Title: [165037] trunk
Revision
165037
Author
commit-qu...@webkit.org
Date
2014-03-03 22:37:43 -0800 (Mon, 03 Mar 2014)

Log Message

:active style is not cleared when its display property is set to none before mouse released.
https://bugs.webkit.org/show_bug.cgi?id=129465

Patch by Sanghyup Lee <sh53....@samsung.com> on 2014-03-03
Reviewed by Antonio Gomes.

Source/WebCore:

We currently clearing the :active style when element has a renderer.
This patch makes elements clear its active style regardless of renderer.

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):

LayoutTests:

* fast/css/active-display-none-expected.txt: Added.
* fast/css/active-display-none.html: Added.

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/css/active-display-none-expected.txt (0 => 165037)


--- trunk/LayoutTests/fast/css/active-display-none-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/active-display-none-expected.txt	2014-03-04 06:37:43 UTC (rev 165037)
@@ -0,0 +1,13 @@
+:active style should be cleared even if display property is set to none before mouse released.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS background is "rgb(255, 0, 0)"
+PASS background is "rgb(255, 0, 0)"
+PASS background is "rgb(0, 0, 0)"
+PASS background is "rgb(0, 0, 0)"
+
+
+
+
+

Added: trunk/LayoutTests/fast/css/active-display-none.html (0 => 165037)


--- trunk/LayoutTests/fast/css/active-display-none.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/active-display-none.html	2014-03-04 06:37:43 UTC (rev 165037)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<style>
+  div { background: rgb(0, 0, 0); }
+  div:active { background: rgb(255, 0, 0); }
+  #parent {
+    width: 200px;
+    height: 200px;
+    border: 2px solid rgb(0, 0, 255);
+  }
+  #child {
+    width: 100px;
+    height: 100px;
+    border: 2px solid rgb(0, 0, 255);
+  }
+</style>
+
+<body>
+  <div id="parent">
+    <div id="child"></div>
+  </div>
+  <pre id="description"></div>
+  <pre id="console"></pre>
+</body>
+
+<script src=""
+<script>
+  function shouldHaveBackground(element, bg) {
+    background = "" null).getPropertyValue("background-color")
+    shouldBeEqualToString('background', bg)
+  }
+
+  if (window.testRunner) {
+    description(":active style should be cleared even if display property is set to none before mouse released.")
+    var child = document.getElementById('child')
+    var parent = document.getElementById('parent')
+    testRunner.dumpAsText();
+
+    // Move and down into the child box.
+    eventSender.mouseMoveTo(50, 50)
+    eventSender.mouseDown()
+    shouldHaveBackground(child, 'rgb(255, 0, 0)')
+    shouldHaveBackground(parent, 'rgb(255, 0, 0)')
+
+    // With the mouse still down, set parent box to display:none.
+    parent.style.display = "none";
+
+    // Mouse up to clear active style.
+    eventSender.mouseUp()
+    parent.style.display = "block";
+    shouldHaveBackground(child, 'rgb(0, 0, 0)')
+    shouldHaveBackground(parent, 'rgb(0, 0, 0)')
+  }
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (165036 => 165037)


--- trunk/Source/WebCore/ChangeLog	2014-03-04 04:21:39 UTC (rev 165036)
+++ trunk/Source/WebCore/ChangeLog	2014-03-04 06:37:43 UTC (rev 165037)
@@ -1,3 +1,24 @@
+2014-03-03  Sanghyup Lee  <sh53....@samsung.com>
+
+        :active style is not cleared when its display property is set to none before mouse released.
+        https://bugs.webkit.org/show_bug.cgi?id=129465
+
+        Reviewed by Antonio Gomes.
+
+        Source/WebCore:
+
+        We currently clearing the :active style when element has a renderer.
+        This patch makes elements clear its active style regardless of renderer. 
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateHoverActiveState):
+
+        LayoutTests:
+
+        * fast/css/active-display-none-expected.txt: Added.
+        * fast/css/active-display-none.html: Added.
+
+
 2014-03-03  Andreas Kling  <akl...@apple.com>
 
         Remove 2 unnecessary includes from JSDOMBinding.h

Modified: trunk/Source/WebCore/dom/Document.cpp (165036 => 165037)


--- trunk/Source/WebCore/dom/Document.cpp	2014-03-04 04:21:39 UTC (rev 165036)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-03-04 06:37:43 UTC (rev 165037)
@@ -5835,12 +5835,9 @@
     Element* oldActiveElement = m_activeElement.get();
     if (oldActiveElement && !request.active()) {
         // We are clearing the :active chain because the mouse has been released.
-        for (RenderElement* curr = oldActiveElement->renderer(); curr; curr = curr->parent()) {
-            Element* element = curr->element();
-            if (!element)
-                continue;
-            element->setActive(false);
-            m_userActionElements.setInActiveChain(element, false);
+        for (Element* curr = oldActiveElement; curr; curr = curr->parentElement()) {
+            curr->setActive(false);
+            m_userActionElements.setInActiveChain(curr, false);
         }
         m_activeElement.clear();
     } else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to