Title: [202517] trunk
Revision
202517
Author
[email protected]
Date
2016-06-27 15:20:17 -0700 (Mon, 27 Jun 2016)

Log Message

Fix style invalidation for :active when the activated node has no renderer
https://bugs.webkit.org/show_bug.cgi?id=159125

Reviewed by Antti Koivisto.

Source/WebCore:

Same old bug: a style invalidation path was depending
on the style.

Here we really need both flags. An element can have
childrenAffectedByActive() false and renderStyle->affectedByActive() true
if it was subject to style sharing.

The element state "childrenAffectedByActive" should be renamed
"styleAffectedByActive" since it is not a parent invalidation flag.
That will be done separately.

Tests: fast/css/pseudo-active-on-labeled-control-without-renderer.html
       fast/css/pseudo-active-style-sharing-1.html
       fast/css/pseudo-active-style-sharing-2.html
       fast/css/pseudo-active-style-sharing-3.html
       fast/css/pseudo-active-style-sharing-4.html
       fast/css/pseudo-active-style-sharing-5.html
       fast/css/pseudo-active-style-sharing-6.html

* dom/Element.cpp:
(WebCore::Element::setActive):
* style/StyleRelations.cpp:
(WebCore::Style::commitRelationsToRenderStyle):

LayoutTests:

There was no bug with style sharing but I wanted that covered anyway.
Style sharing depends on 2 flags which is uncommon.
There was no test coverage whatsoever, breaking it did not fail any test.

* fast/css/pseudo-active-on-labeled-control-without-renderer-expected.txt: Added.
* fast/css/pseudo-active-on-labeled-control-without-renderer.html: Added.
* fast/css/pseudo-active-style-sharing-1-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-1.html: Added.
* fast/css/pseudo-active-style-sharing-2-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-2.html: Added.
* fast/css/pseudo-active-style-sharing-3-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-3.html: Added.
* fast/css/pseudo-active-style-sharing-4-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-4.html: Added.
* fast/css/pseudo-active-style-sharing-5-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-5.html: Added.
* fast/css/pseudo-active-style-sharing-6-expected.txt: Added.
* fast/css/pseudo-active-style-sharing-6.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202516 => 202517)


--- trunk/LayoutTests/ChangeLog	2016-06-27 22:13:16 UTC (rev 202516)
+++ trunk/LayoutTests/ChangeLog	2016-06-27 22:20:17 UTC (rev 202517)
@@ -1,3 +1,29 @@
+2016-06-27  Benjamin Poulain  <[email protected]>
+
+        Fix style invalidation for :active when the activated node has no renderer
+        https://bugs.webkit.org/show_bug.cgi?id=159125
+
+        Reviewed by Antti Koivisto.
+
+        There was no bug with style sharing but I wanted that covered anyway.
+        Style sharing depends on 2 flags which is uncommon.
+        There was no test coverage whatsoever, breaking it did not fail any test.
+
+        * fast/css/pseudo-active-on-labeled-control-without-renderer-expected.txt: Added.
+        * fast/css/pseudo-active-on-labeled-control-without-renderer.html: Added.
+        * fast/css/pseudo-active-style-sharing-1-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-1.html: Added.
+        * fast/css/pseudo-active-style-sharing-2-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-2.html: Added.
+        * fast/css/pseudo-active-style-sharing-3-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-3.html: Added.
+        * fast/css/pseudo-active-style-sharing-4-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-4.html: Added.
+        * fast/css/pseudo-active-style-sharing-5-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-5.html: Added.
+        * fast/css/pseudo-active-style-sharing-6-expected.txt: Added.
+        * fast/css/pseudo-active-style-sharing-6.html: Added.
+
 2016-06-27  Joanmarie Diggs  <[email protected]>
 
         AX: REGRESSION (r202063): ARIA role attribute is being ignored for label element

Added: trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,49 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+After Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+After Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["target", "labelable"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+After Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-on-labeled-control-without-renderer.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html id="html">
+<head>
+<style id="custom-style">
+    * {
+        background-color: white;
+        margin: 0;
+        padding: 0;
+    }
+    /* The order of evalution is important here. The simple selector ":active" must be evaluated last */
+    label:active, input:active {
+        background-color: rgb(50, 100, 150) !important;
+    }
+    #target {
+        display: block;
+        width: 100px;
+        height: 100px;
+        background-color: green;
+    }
+</style>
+</head>
+<script src=""
+<body id="body">
+    <div id="webkit-test">
+        <div id="labelable-ancestor">
+            <div id="labelable-parent">
+                <label for="" id="target">Label</label>
+            </div>
+        </div>
+        <div id="next-group" style="display:none">
+            <div id="sibling1">Sibling1</div>
+            <input id="labelable" value="Labelable Input">
+            <div id="sibling2">Sibling2</div>
+        </div>
+    </div>
+    <div id="console">
+    </div>
+    <script>
+    description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+    window.jsTestIsAsync = true;
+
+    function elementsWithActiveStyle() {
+        let elements = [];
+        for (let element of document.querySelectorAll("*")) {
+            if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(element.id);
+        }
+        return elements;
+    }
+    function elementsMatchingActiveSelector() {
+        let elements = [];
+        for (let element of document.querySelectorAll(":active")) {
+            elements.push(element.id);
+        }
+        return elements;
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 50);
+    } else {
+        debug("");
+        debug("To run Manually, click-hold-release 3 times on the green rect. All the results below should say PASS.")
+        debug("");
+    }
+
+    function sendMouseDown() {
+        if (window.eventSender) {
+            eventSender.mouseDown();
+        }
+    }
+
+    function sendMouseUp() {
+        if (window.eventSender) {
+            eventSender.mouseUp();
+        }
+    }
+
+    function mouseDownHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Down" : "On Mouse Down");
+        shouldBe('elementsWithActiveStyle()', '["target", "labelable"]');
+        shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "target", "labelable"]');
+
+        // The current spec does not defined the order in which elements are activated.
+        // It is reasonable to have the activation after the mouseDown dispatch. That's what Firefox does at this time.
+        // This delayed handler ensure we cover both possibilities. The first handler fails on Firefox but that's not
+        // necessarily wrong, just undefined. The result is fine as long as one of the two handler succeed.
+        if (!delayed) {
+            setTimeout(function() { mouseDownHandler(event, true); }, 0);
+        } else {
+            sendMouseUp();
+        }
+    }
+    var target = document.getElementById('target');
+    target.addEventListener('mousedown', mouseDownHandler);
+
+    let mouseUpCount = 0;
+    function mouseUpHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Up" : "On Mouse Up");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        if (++mouseUpCount === 6) {
+            document.getElementById("webkit-test").style.display = "none";
+            document.getElementById("custom-style").innerText = "";
+            finishJSTest();
+        } else {
+            if (!delayed) {
+                setTimeout(function() { mouseUpHandler(event, true); }, 0);
+            } else {
+                sendMouseDown();
+            }
+        }
+    }
+    target.addEventListener('mouseup', mouseUpHandler);
+
+
+    debug("Initial state");
+    shouldBe('elementsWithActiveStyle()', '[]');
+    shouldBe('elementsMatchingActiveSelector()', '[]');
+
+    sendMouseDown();
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-1.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+<head>
+<style id="custom-style">
+    * {
+        background-color: white;
+        margin: 0;
+        padding: 0;
+    }
+    label:active, input:active {
+        background-color: rgb(50, 100, 150) !important;
+    }
+    label {
+        display: block;
+        width: 100px;
+        height: 100px;
+        background-color: green;
+        border: 2px solid black;
+    }
+</style>
+</head>
+<script src=""
+<body id="body">
+    <div id="webkit-test">
+        <div id="labelable-ancestor">
+            <div id="labelable-parent">
+                <label for=""
+                <label for=""
+                <label for=""
+            </div>
+        </div>
+        <div id="next-group" style="display:none">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+        </div>
+    </div>
+    <div id="console">
+    </div>
+    <script>
+    description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+    window.jsTestIsAsync = true;
+
+    function generateName(element) {
+        if (element.id && element.id != "labelable")
+            return element.id;
+
+        let childPosition = 1;
+        while (element.previousElementSibling) {
+            element = element.previousElementSibling;
+            ++childPosition;
+        }
+        return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+    }
+
+    function elementsWithActiveStyle() {
+        let elements = [];
+        for (let element of document.querySelectorAll("*")) {
+            if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+        }
+        return elements;
+    }
+    function elementsMatchingActiveSelector() {
+        let elements = [];
+        for (let element of document.querySelectorAll(":active")) {
+            elements.push(generateName(element));
+        }
+        return elements;
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 50);
+    } else {
+        debug("");
+        debug("To run Manually, click-hold-release on the first green rect. All the results below should say PASS.")
+        debug("");
+    }
+
+    function sendMouseDown() {
+        if (window.eventSender) {
+            eventSender.mouseDown();
+        }
+    }
+
+    function sendMouseUp() {
+        if (window.eventSender) {
+            eventSender.mouseUp();
+        }
+    }
+
+    function mouseDownHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Down" : "On Mouse Down");
+        shouldBe('elementsWithActiveStyle()', '["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]');
+        shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]');
+
+        if (!delayed) {
+            setTimeout(function() { mouseDownHandler(event, true); }, 0);
+        } else {
+            sendMouseUp();
+        }
+    }
+    var target = document.querySelector('label:nth-child(1)');
+    target.addEventListener('mousedown', mouseDownHandler);
+
+    function mouseUpHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Up" : "On Mouse Up");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        document.getElementById("webkit-test").style.display = "none";
+        document.getElementById("custom-style").innerText = "";
+        finishJSTest();
+    }
+    target.addEventListener('mouseup', mouseUpHandler);
+
+
+    debug("Initial state");
+    shouldBe('elementsWithActiveStyle()', '[]');
+    shouldBe('elementsMatchingActiveSelector()', '[]');
+
+    sendMouseDown();
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-2.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+<head>
+<style id="custom-style">
+    * {
+        background-color: white;
+        margin: 0;
+        padding: 0;
+    }
+    :active {
+        background-color: rgb(50, 100, 150) !important;
+    }
+    label {
+        display: block;
+        width: 100px;
+        height: 100px;
+        background-color: green;
+        border: 2px solid black;
+    }
+</style>
+</head>
+<script src=""
+<body id="body">
+    <div id="webkit-test">
+        <div id="labelable-ancestor">
+            <div id="labelable-parent">
+                <label for=""
+                <label for=""
+                <label for=""
+            </div>
+        </div>
+        <div id="next-group" style="display:none">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+        </div>
+    </div>
+    <div id="console">
+    </div>
+    <script>
+    description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+    window.jsTestIsAsync = true;
+
+    function generateName(element) {
+        if (element.id && element.id != "labelable")
+            return element.id;
+
+        let childPosition = 1;
+        while (element.previousElementSibling) {
+            element = element.previousElementSibling;
+            ++childPosition;
+        }
+        return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+    }
+
+    function elementsWithActiveStyle() {
+        let elements = [];
+        for (let element of document.querySelectorAll("*")) {
+            if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+        }
+        return elements;
+    }
+    function elementsMatchingActiveSelector() {
+        let elements = [];
+        for (let element of document.querySelectorAll(":active")) {
+            elements.push(generateName(element));
+        }
+        return elements;
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 50);
+    } else {
+        debug("");
+        debug("To run Manually, click-hold-release on the first green rect. All the results below should say PASS.")
+        debug("");
+    }
+
+    function sendMouseDown() {
+        if (window.eventSender) {
+            eventSender.mouseDown();
+        }
+    }
+
+    function sendMouseUp() {
+        if (window.eventSender) {
+            eventSender.mouseUp();
+        }
+    }
+
+    function mouseDownHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Down" : "On Mouse Down");
+        shouldBe('elementsWithActiveStyle()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]');
+        shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]');
+
+        if (!delayed) {
+            setTimeout(function() { mouseDownHandler(event, true); }, 0);
+        } else {
+            sendMouseUp();
+        }
+    }
+    var target = document.querySelector('label:nth-child(1)');
+    target.addEventListener('mousedown', mouseDownHandler);
+
+    function mouseUpHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Up" : "On Mouse Up");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        document.getElementById("webkit-test").style.display = "none";
+        document.getElementById("custom-style").innerText = "";
+        finishJSTest();
+    }
+    target.addEventListener('mouseup', mouseUpHandler);
+
+
+    debug("Initial state");
+    shouldBe('elementsWithActiveStyle()', '[]');
+    shouldBe('elementsMatchingActiveSelector()', '[]');
+
+    sendMouseDown();
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+        Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "target1", "#next-group >> input:nth-child(1)"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "target1", "#next-group >> input:nth-child(1)"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-3.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+    <head>
+        <style id="custom-style">
+            * {
+                background-color: white;
+                margin: 0;
+                padding: 0;
+            }
+        label:active, input:active {
+            background-color: rgb(50, 100, 150) !important;
+        }
+        #target1, #target2, #target3 {
+            display: block;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+            border: 2px solid black;
+        }
+        </style>
+    </head>
+    <script src=""
+    <body id="body">
+        <div id="webkit-test">
+            <div id="labelable-ancestor">
+                <div id="labelable-parent">
+                    <label for="" id="target1">Target</div></label>
+                    <label for="" id="target2"></div></label>
+                    <label for="" id="target3"></div></label>
+                </div>
+            </div>
+            <div id="next-group" style="display:none">
+                <input id="labelable" value="Labelable Input">
+                <input id="labelable" value="Labelable Input">
+                <input id="labelable" value="Labelable Input">
+            </div>
+        </div>
+        <div id="console">
+        </div>
+        <script>
+            description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+            window.jsTestIsAsync = true;
+
+            function generateName(element) {
+                if (element.id && element.id !== "labelable")
+                return element.id;
+
+                let childPosition = 1;
+                while (element.previousElementSibling) {
+                    element = element.previousElementSibling;
+                    ++childPosition;
+                }
+                return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+            }
+
+        function elementsWithActiveStyle() {
+            let elements = [];
+            for (let element of document.querySelectorAll("*")) {
+                if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+            }
+            return elements;
+        }
+        function elementsMatchingActiveSelector() {
+            let elements = [];
+            for (let element of document.querySelectorAll(":active")) {
+                elements.push(generateName(element));
+            }
+            return elements;
+        }
+
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(50, 50);
+        } else {
+            debug("");
+            debug("To run Manually, click-hold-release on the first green rect. All the results below should say PASS.")
+            debug("");
+        }
+
+        function sendMouseDown() {
+            if (window.eventSender) {
+                eventSender.mouseDown();
+            }
+        }
+
+        function sendMouseUp() {
+            if (window.eventSender) {
+                eventSender.mouseUp();
+            }
+        }
+
+        function mouseDownHandler(event, delayed = false) {
+            debug(delayed ? "After Mouse Down" : "On Mouse Down");
+            shouldBe('elementsWithActiveStyle()', '["#labelable-parent >> label:nth-child(1)", "#next-group >> input:nth-child(1)"]');
+            shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(1)", "target1", "#next-group >> input:nth-child(1)"]');
+
+            if (!delayed) {
+                setTimeout(function() { mouseDownHandler(event, true); }, 0);
+            } else {
+                sendMouseUp();
+            }
+        }
+        var target = document.querySelector('label:nth-child(1)');
+        target.addEventListener('mousedown', mouseDownHandler);
+
+        function mouseUpHandler(event, delayed = false) {
+            debug(delayed ? "After Mouse Up" : "On Mouse Up");
+            shouldBe('elementsWithActiveStyle()', '[]');
+            shouldBe('elementsMatchingActiveSelector()', '[]');
+            document.getElementById("webkit-test").style.display = "none";
+            document.getElementById("custom-style").innerText = "";
+            finishJSTest();
+        }
+        target.addEventListener('mouseup', mouseUpHandler);
+        
+        
+        debug("Initial state");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        
+        sendMouseDown();
+            </script>
+        <script src=""
+    </body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-4.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+<head>
+<style id="custom-style">
+    * {
+        background-color: white;
+        margin: 0;
+        padding: 0;
+    }
+    label:active, input:active {
+        background-color: rgb(50, 100, 150) !important;
+    }
+    label {
+        display: block;
+        width: 100px;
+        height: 100px;
+        background-color: green;
+        border: 2px solid black;
+    }
+</style>
+</head>
+<script src=""
+<body id="body">
+    <div id="webkit-test">
+        <div id="labelable-ancestor">
+            <div id="labelable-parent">
+                <label for=""
+                <label for=""
+                <label for=""
+            </div>
+        </div>
+        <div id="next-group" style="display:none">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+        </div>
+    </div>
+    <div id="console">
+    </div>
+    <script>
+    description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+    window.jsTestIsAsync = true;
+
+    function generateName(element) {
+        if (element.id && element.id != "labelable")
+            return element.id;
+
+        let childPosition = 1;
+        while (element.previousElementSibling) {
+            element = element.previousElementSibling;
+            ++childPosition;
+        }
+        return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+    }
+
+    function elementsWithActiveStyle() {
+        let elements = [];
+        for (let element of document.querySelectorAll("*")) {
+            if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+        }
+        return elements;
+    }
+    function elementsMatchingActiveSelector() {
+        let elements = [];
+        for (let element of document.querySelectorAll(":active")) {
+            elements.push(generateName(element));
+        }
+        return elements;
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 150);
+    } else {
+        debug("");
+        debug("To run Manually, click-hold-release on the second green rect. All the results below should say PASS.")
+        debug("");
+    }
+
+    function sendMouseDown() {
+        if (window.eventSender) {
+            eventSender.mouseDown();
+        }
+    }
+
+    function sendMouseUp() {
+        if (window.eventSender) {
+            eventSender.mouseUp();
+        }
+    }
+
+    function mouseDownHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Down" : "On Mouse Down");
+        shouldBe('elementsWithActiveStyle()', '["#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]');
+        shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]');
+
+        if (!delayed) {
+            setTimeout(function() { mouseDownHandler(event, true); }, 0);
+        } else {
+            sendMouseUp();
+        }
+    }
+    var target = document.querySelector('label:nth-child(2)');
+    target.addEventListener('mousedown', mouseDownHandler);
+
+    function mouseUpHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Up" : "On Mouse Up");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        document.getElementById("webkit-test").style.display = "none";
+        document.getElementById("custom-style").innerText = "";
+        finishJSTest();
+    }
+    target.addEventListener('mouseup', mouseUpHandler);
+
+
+    debug("Initial state");
+    shouldBe('elementsWithActiveStyle()', '[]');
+    shouldBe('elementsMatchingActiveSelector()', '[]');
+
+    sendMouseDown();
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+    Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-5.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+<head>
+<style id="custom-style">
+    * {
+        background-color: white;
+        margin: 0;
+        padding: 0;
+    }
+    :active {
+        background-color: rgb(50, 100, 150) !important;
+    }
+    label {
+        display: block;
+        width: 100px;
+        height: 100px;
+        background-color: green;
+        border: 2px solid black;
+    }
+</style>
+</head>
+<script src=""
+<body id="body">
+    <div id="webkit-test">
+        <div id="labelable-ancestor">
+            <div id="labelable-parent">
+                <label for=""
+                <label for=""
+                <label for=""
+            </div>
+        </div>
+        <div id="next-group" style="display:none">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+            <input id="labelable" value="Labelable Input">
+        </div>
+    </div>
+    <div id="console">
+    </div>
+    <script>
+    description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+    window.jsTestIsAsync = true;
+
+    function generateName(element) {
+        if (element.id && element.id != "labelable")
+            return element.id;
+
+        let childPosition = 1;
+        while (element.previousElementSibling) {
+            element = element.previousElementSibling;
+            ++childPosition;
+        }
+        return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+    }
+
+    function elementsWithActiveStyle() {
+        let elements = [];
+        for (let element of document.querySelectorAll("*")) {
+            if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+        }
+        return elements;
+    }
+    function elementsMatchingActiveSelector() {
+        let elements = [];
+        for (let element of document.querySelectorAll(":active")) {
+            elements.push(generateName(element));
+        }
+        return elements;
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 150);
+    } else {
+        debug("");
+        debug("To run Manually, click-hold-release on the second green rect. All the results below should say PASS.")
+        debug("");
+    }
+
+    function sendMouseDown() {
+        if (window.eventSender) {
+            eventSender.mouseDown();
+        }
+    }
+
+    function sendMouseUp() {
+        if (window.eventSender) {
+            eventSender.mouseUp();
+        }
+    }
+
+    function mouseDownHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Down" : "On Mouse Down");
+        shouldBe('elementsWithActiveStyle()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]');
+        shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "#next-group >> input:nth-child(1)"]');
+
+        if (!delayed) {
+            setTimeout(function() { mouseDownHandler(event, true); }, 0);
+        } else {
+            sendMouseUp();
+        }
+    }
+    var target = document.querySelector('label:nth-child(2)');
+    target.addEventListener('mousedown', mouseDownHandler);
+
+    function mouseUpHandler(event, delayed = false) {
+        debug(delayed ? "After Mouse Up" : "On Mouse Up");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        document.getElementById("webkit-test").style.display = "none";
+        document.getElementById("custom-style").innerText = "";
+        finishJSTest();
+    }
+    target.addEventListener('mouseup', mouseUpHandler);
+
+
+    debug("Initial state");
+    shouldBe('elementsWithActiveStyle()', '[]');
+    shouldBe('elementsMatchingActiveSelector()', '[]');
+
+    sendMouseDown();
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6-expected.txt (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6-expected.txt	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,22 @@
+Verify that a labeled elemed gets the :active state even if it has no renderer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+        Initial state
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+On Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(2)", "labelable2"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "target2", "labelable2"]
+After Mouse Down
+PASS elementsWithActiveStyle() is ["#labelable-parent >> label:nth-child(2)", "labelable2"]
+PASS elementsMatchingActiveSelector() is ["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "target2", "labelable2"]
+On Mouse Up
+PASS elementsWithActiveStyle() is []
+PASS elementsMatchingActiveSelector() is []
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6.html (0 => 202517)


--- trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-active-style-sharing-6.html	2016-06-27 22:20:17 UTC (rev 202517)
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html id="html">
+    <head>
+        <style id="custom-style">
+            * {
+                background-color: white;
+                margin: 0;
+                padding: 0;
+            }
+        label:active, input:active {
+            background-color: rgb(50, 100, 150) !important;
+        }
+        #target1, #target2, #target3 {
+            display: block;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+            border: 2px solid black;
+        }
+        </style>
+    </head>
+    <script src=""
+    <body id="body">
+        <div id="webkit-test">
+            <div id="labelable-ancestor">
+                <div id="labelable-parent">
+                    <label for="" id="target1"></div></label>
+                    <label for="" id="target2">Target</div></label>
+                    <label for="" id="target3"></div></label>
+                </div>
+            </div>
+            <div id="next-group" style="display:none">
+                <input id="labelable1" value="Labelable Input">
+                <input id="labelable2" value="Labelable Input">
+                <input id="labelable3" value="Labelable Input">
+            </div>
+        </div>
+        <div id="console">
+        </div>
+        <script>
+            description("Verify that a labeled elemed gets the :active state even if it has no renderer.");
+            window.jsTestIsAsync = true;
+
+            function generateName(element) {
+                if (element.id)
+                    return element.id;
+
+                let childPosition = 1;
+                while (element.previousElementSibling) {
+                    element = element.previousElementSibling;
+                    ++childPosition;
+                }
+                return "#" + element.parentElement.id + " >> " + element.tagName.toLowerCase() + ":nth-child(" + childPosition + ")";
+            }
+
+        function elementsWithActiveStyle() {
+            let elements = [];
+            for (let element of document.querySelectorAll("*")) {
+                if (getComputedStyle(element).backgroundColor === "rgb(50, 100, 150)")
+                elements.push(generateName(element));
+            }
+            return elements;
+        }
+        function elementsMatchingActiveSelector() {
+            let elements = [];
+            for (let element of document.querySelectorAll(":active")) {
+                elements.push(generateName(element));
+            }
+            return elements;
+        }
+
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(50, 150);
+        } else {
+            debug("");
+            debug("To run Manually, click-hold-release on the second green rect. All the results below should say PASS.")
+            debug("");
+        }
+
+        function sendMouseDown() {
+            if (window.eventSender) {
+                eventSender.mouseDown();
+            }
+        }
+
+        function sendMouseUp() {
+            if (window.eventSender) {
+                eventSender.mouseUp();
+            }
+        }
+
+        function mouseDownHandler(event, delayed = false) {
+            debug(delayed ? "After Mouse Down" : "On Mouse Down");
+            shouldBe('elementsWithActiveStyle()', '["#labelable-parent >> label:nth-child(2)", "labelable2"]');
+            shouldBe('elementsMatchingActiveSelector()', '["html", "body", "webkit-test", "labelable-ancestor", "labelable-parent", "#labelable-parent >> label:nth-child(2)", "target2", "labelable2"]');
+
+            if (!delayed) {
+                setTimeout(function() { mouseDownHandler(event, true); }, 0);
+            } else {
+                sendMouseUp();
+            }
+        }
+        var target = document.querySelector('label:nth-child(2)');
+        target.addEventListener('mousedown', mouseDownHandler);
+
+        function mouseUpHandler(event, delayed = false) {
+            debug(delayed ? "After Mouse Up" : "On Mouse Up");
+            shouldBe('elementsWithActiveStyle()', '[]');
+            shouldBe('elementsMatchingActiveSelector()', '[]');
+            document.getElementById("webkit-test").style.display = "none";
+            document.getElementById("custom-style").innerText = "";
+            finishJSTest();
+        }
+        target.addEventListener('mouseup', mouseUpHandler);
+        
+        
+        debug("Initial state");
+        shouldBe('elementsWithActiveStyle()', '[]');
+        shouldBe('elementsMatchingActiveSelector()', '[]');
+        
+        sendMouseDown();
+            </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (202516 => 202517)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-06-27 22:13:16 UTC (rev 202516)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-06-27 22:20:17 UTC (rev 202517)
@@ -254,7 +254,14 @@
 fast/scrolling/scroll-animator-select-list-events.html [ Skip ]
 fast/events/prevent-default-prevents-interaction-with-scrollbars.html [ Skip ]
 fast/text/text-disappear-on-deselect.html [ ImageOnlyFailure ]
+fast/css/pseudo-active-on-labeled-control-without-renderer.html [ Skip ]
 fast/css/pseudo-active-on-labeled-element-not-canceled-by-focus.html [ Skip ]
+fast/css/pseudo-active-style-sharing-1.html [ Skip ]
+fast/css/pseudo-active-style-sharing-2.html [ Skip ]
+fast/css/pseudo-active-style-sharing-3.html [ Skip ]
+fast/css/pseudo-active-style-sharing-4.html [ Skip ]
+fast/css/pseudo-active-style-sharing-5.html [ Skip ]
+fast/css/pseudo-active-style-sharing-6.html [ Skip ]
 fast/css/pseudo-active-with-programmatic-focus.html [ Skip ]
 
 webkit.org/b/148695 fast/shadow-dom [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (202516 => 202517)


--- trunk/Source/WebCore/ChangeLog	2016-06-27 22:13:16 UTC (rev 202516)
+++ trunk/Source/WebCore/ChangeLog	2016-06-27 22:20:17 UTC (rev 202517)
@@ -1,3 +1,34 @@
+2016-06-27  Benjamin Poulain  <[email protected]>
+
+        Fix style invalidation for :active when the activated node has no renderer
+        https://bugs.webkit.org/show_bug.cgi?id=159125
+
+        Reviewed by Antti Koivisto.
+
+        Same old bug: a style invalidation path was depending
+        on the style.
+
+        Here we really need both flags. An element can have
+        childrenAffectedByActive() false and renderStyle->affectedByActive() true
+        if it was subject to style sharing.
+
+        The element state "childrenAffectedByActive" should be renamed
+        "styleAffectedByActive" since it is not a parent invalidation flag.
+        That will be done separately.
+
+        Tests: fast/css/pseudo-active-on-labeled-control-without-renderer.html
+               fast/css/pseudo-active-style-sharing-1.html
+               fast/css/pseudo-active-style-sharing-2.html
+               fast/css/pseudo-active-style-sharing-3.html
+               fast/css/pseudo-active-style-sharing-4.html
+               fast/css/pseudo-active-style-sharing-5.html
+               fast/css/pseudo-active-style-sharing-6.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::setActive):
+        * style/StyleRelations.cpp:
+        (WebCore::Style::commitRelationsToRenderStyle):
+
 2016-06-27  Joanmarie Diggs  <[email protected]>
 
         AX: REGRESSION (r202063): ARIA role attribute is being ignored for label element

Modified: trunk/Source/WebCore/dom/Element.cpp (202516 => 202517)


--- trunk/Source/WebCore/dom/Element.cpp	2016-06-27 22:13:16 UTC (rev 202516)
+++ trunk/Source/WebCore/dom/Element.cpp	2016-06-27 22:20:17 UTC (rev 202517)
@@ -553,13 +553,14 @@
 
     document().userActionElements().setActive(this, flag);
 
+    const RenderStyle* renderStyle = this->renderStyle();
+    bool reactsToPress = (renderStyle && renderStyle->affectedByActive()) || childrenAffectedByActive();
+    if (reactsToPress)
+        setNeedsStyleRecalc();
+
     if (!renderer())
         return;
 
-    bool reactsToPress = renderStyle()->affectedByActive() || childrenAffectedByActive();
-    if (reactsToPress)
-        setNeedsStyleRecalc();
-
     if (renderer()->style().hasAppearance() && renderer()->theme().stateChanged(*renderer(), ControlStates::PressedState))
         reactsToPress = true;
 

Modified: trunk/Source/WebCore/style/StyleRelations.cpp (202516 => 202517)


--- trunk/Source/WebCore/style/StyleRelations.cpp	2016-06-27 22:13:16 UTC (rev 202516)
+++ trunk/Source/WebCore/style/StyleRelations.cpp	2016-06-27 22:20:17 UTC (rev 202517)
@@ -52,6 +52,7 @@
         switch (relation.type) {
         case Relation::AffectedByActive:
             style.setAffectedByActive();
+            appendStyleRelation(relation);
             break;
         case Relation::AffectedByDrag:
             style.setAffectedByDrag();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to