[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-develop
Subject:    [HtmlUnit] SVN: [12729] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit
From:       asashour () users ! sourceforge ! net
Date:       2016-05-26 11:02:53
Message-ID: E1b5t45-0006Yf-1V () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 12729
          http://sourceforge.net/p/htmlunit/code/12729
Author:   asashour
Date:     2016-05-26 11:02:53 +0000 (Thu, 26 May 2016)
Log Message:
-----------
CSS: support :hover selector

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java


Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
 ===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java	2016-05-26 \
                10:15:28 UTC (rev 12728)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java	2016-05-26 \
11:02:53 UTC (rev 12729) @@ -81,6 +81,11 @@
     private Map<String, String> namespaces_ = new HashMap<>();
 
     /**
+     * Whether the is Mouse currently over this element or now.
+     */
+    private boolean mouseOver_;
+
+    /**
      * Creates an instance of a DOM element that can have a namespace.
      *
      * @param namespaceURI the URI that identifies an XML namespace
@@ -1133,6 +1138,7 @@
         else {
             currentPage = scriptResult.getNewPage();
         }
+        mouseOver_ = !MouseEvent.TYPE_MOUSE_OUT.equals(eventType);
         return currentPage;
     }
 
@@ -1229,6 +1235,13 @@
         return false;
     }
 
+    /**
+     * Returns whether the Mouse is currently over this element or not.
+     * @return whether the Mouse is currently over this element or not
+     */
+    public boolean isMouseOver() {
+        return mouseOver_;
+    }
 }
 
 /**

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java
 ===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java	2016-05-26 \
                10:15:28 UTC (rev 12728)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java	2016-05-26 \
11:02:53 UTC (rev 12729) @@ -781,6 +781,9 @@
                 final String ref = element.getPage().getUrl().getRef();
                 return StringUtils.isNotBlank(ref) && ref.equals(element.getId());
 
+            case "hover":
+                return element.isMouseOver();
+
             default:
                 if (value.startsWith("nth-child(")) {
                     final String nth = value.substring(value.indexOf('(') + 1, \
value.length() - 1);


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic