Title: [172619] trunk
Revision
172619
Author
[email protected]
Date
2014-08-14 21:06:27 -0700 (Thu, 14 Aug 2014)

Log Message

CSS JIT: compile the :empty pseudo class
https://bugs.webkit.org/show_bug.cgi?id=135958

Reviewed by Andreas Kling.

Source/WebCore:

Compile :empty, nothing fancy.

Tests: fast/selectors/empty-basics.html
       fast/selectors/empty-long-adjacent-backtracking.html
       fast/selectors/empty-adjacent-style-update.html
       fast/selectors/empty-style-update.html

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
(WebCore::SelectorCompiler::setElementStyleIsAffectedByEmpty):
(WebCore::SelectorCompiler::setElementStyleFromContextIsAffectedByEmptyAndUpdateRenderStyleIfNecessary):
(WebCore::SelectorCompiler::setElementStyleIsAffectedByEmptyAndUpdateRenderStyleIfNecessary):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsEmpty):
* dom/CharacterData.h:
(WebCore::CharacterData::dataMemoryOffset):
* dom/ContainerNode.h:
(WebCore::ContainerNode::firstChildMemoryOffset):
* dom/Node.h:
(WebCore::Node::flagIsText):

Source/WTF:

* wtf/text/StringImpl.h:
(WTF::StringImpl::lengthMemoryOffset):

LayoutTests:

Add some test coverage, :empty had very little testing.

The test empty-adjacent-style-update expose some problems with style update,
I will look into them separately.

* fast/selectors/empty-adjacent-style-update-expected.txt: Added.
* fast/selectors/empty-adjacent-style-update.html: Added.
* fast/selectors/empty-basics-expected.txt: Added.
* fast/selectors/empty-basics.html: Added.
* fast/selectors/empty-long-adjacent-backtracking-expected.txt: Added.
* fast/selectors/empty-long-adjacent-backtracking.html: Added.
* fast/selectors/empty-style-update-expected.txt: Added.
* fast/selectors/empty-style-update.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172618 => 172619)


--- trunk/LayoutTests/ChangeLog	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/LayoutTests/ChangeLog	2014-08-15 04:06:27 UTC (rev 172619)
@@ -1,3 +1,24 @@
+2014-08-14  Benjamin Poulain  <[email protected]>
+
+        CSS JIT: compile the :empty pseudo class
+        https://bugs.webkit.org/show_bug.cgi?id=135958
+
+        Reviewed by Andreas Kling.
+
+        Add some test coverage, :empty had very little testing.
+
+        The test empty-adjacent-style-update expose some problems with style update,
+        I will look into them separately.
+
+        * fast/selectors/empty-adjacent-style-update-expected.txt: Added.
+        * fast/selectors/empty-adjacent-style-update.html: Added.
+        * fast/selectors/empty-basics-expected.txt: Added.
+        * fast/selectors/empty-basics.html: Added.
+        * fast/selectors/empty-long-adjacent-backtracking-expected.txt: Added.
+        * fast/selectors/empty-long-adjacent-backtracking.html: Added.
+        * fast/selectors/empty-style-update-expected.txt: Added.
+        * fast/selectors/empty-style-update.html: Added.
+
 2014-08-14  Martin Hock  <[email protected]>
 
         IndexedDB should respect SchemeRegistry's database access setting.

Added: trunk/LayoutTests/fast/selectors/empty-adjacent-style-update-expected.txt (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-adjacent-style-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-adjacent-style-update-expected.txt	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,30 @@
+Test the style with a :empty pseudo class used for a sibling of the styled element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Initial state is emtpy.
+PASS getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Adding a comment does not change the :empty state.
+PASS getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Add an element as child make updates :empty.
+FAIL getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+FAIL getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+Adding an empty text node, this is still not empty because of the element.
+FAIL getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+FAIL getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+Removing the elements previously added should restore the :empty state.
+PASS getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Adding a non empty text node makes the state non empty.
+FAIL getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+FAIL getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor should be rgb(255, 255, 255). Was rgb(1, 2, 3).
+Removing the last text child, back to being empty.
+PASS getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/selectors/empty-adjacent-style-update.html (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-adjacent-style-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-adjacent-style-update.html	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,73 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<style>
+target {
+    background-color: white;
+}
+testcase:empty+target {
+    background-color: rgb(1, 2, 3);
+}
+</style>
+</head>
+<body>
+    <div>
+        <testcase id="with-renderer"></testcase>
+        <target id="target-with-renderer"></target>
+    </div>
+    <div style="display:none;">
+        <testcase id="without-renderer"></testcase>
+        <target id="target-without-renderer"></target>
+    </div>
+</body>
+<script>
+description('Test the style with a :empty pseudo class used for a sibling of the styled element.');
+
+var testCaseWithRender = document.getElementById("with-renderer");
+var testCaseWithoutRenderer = document.getElementById("without-renderer");
+
+debug("Initial state is emtpy.");
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Adding a comment does not change the :empty state.");
+testCaseWithRender.appendChild(document.createComment("WebKit!"));
+testCaseWithoutRenderer.appendChild(document.createComment("WebKit!"));
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Add an element as child make updates :empty.");
+var elementForCaseWithRenderer = document.createElement('div');
+var elementForCaseWithoutRenderer = document.createElement('div');
+testCaseWithRender.appendChild(elementForCaseWithRenderer);
+testCaseWithoutRenderer.appendChild(elementForCaseWithoutRenderer);
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Adding an empty text node, this is still not empty because of the element.");
+testCaseWithRender.appendChild(document.createTextNode(''));
+testCaseWithoutRenderer.appendChild(document.createTextNode(''));
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Removing the elements previously added should restore the :empty state.");
+testCaseWithRender.removeChild(elementForCaseWithRenderer);
+testCaseWithoutRenderer.removeChild(elementForCaseWithoutRenderer);
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Adding a non empty text node makes the state non empty.");
+testCaseWithRender.appendChild(document.createTextNode('WebKit!'));
+testCaseWithoutRenderer.appendChild(document.createTextNode('WebKit!'));
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Removing the last text child, back to being empty.");
+testCaseWithRender.removeChild(testCaseWithRender.lastChild);
+testCaseWithoutRenderer.removeChild(testCaseWithoutRenderer.lastChild);
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("target-without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+</script>
+<script src=""
+</html>

Added: trunk/LayoutTests/fast/selectors/empty-basics-expected.txt (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-basics-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-basics-expected.txt	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,20 @@
+Check the basic features of the ":empty" pseudo class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll("testcase:empty").length is 4
+PASS document.querySelectorAll("testcase:empty")[0] is document.getElementById("no-content")
+PASS document.querySelectorAll("testcase:empty")[1] is document.getElementById("comment")
+PASS document.querySelectorAll("testcase:empty")[2] is document.getElementById("empty-textnodes")
+PASS document.querySelectorAll("testcase:empty")[3] is document.getElementById("comments-and-empty-textnodes")
+PASS getComputedStyle(document.getElementById("no-content")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("comment")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("empty-textnodes")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("comments-and-empty-textnodes")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("space-character")).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.getElementById("element")).backgroundColor is "rgb(255, 255, 255)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/selectors/empty-basics.html (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-basics.html	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-basics.html	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<style>
+testcase {
+    background-color: white;
+}
+testcase:empty {
+    background-color: rgb(1, 2, 3);
+}
+</style>
+</head>
+<body>
+    <div style="display:none">
+        <!-- Success: No content -->
+        <testcase id="no-content"></testcase>
+
+        <!-- Success: Comments are not elment -->
+        <testcase id="comment"><!-- empty --></testcase>
+
+        <!-- Success: Empty text node are okay. -->
+        <testcase id="empty-textnodes"></testcase>
+
+        <!-- Success: The two above. -->
+        <testcase id="comments-and-empty-textnodes"></testcase>
+
+        <!-- Failure: Non empty text node, there is a space character. -->
+        <testcase id="space-character"> </testcase>
+
+        <!-- Failure: the <span> element inside makes the node non-empty. -->
+        <testcase id="element"><span></span></testcase>
+    </div>
+</body>
+<script>
+description('Check the basic features of the ":empty" pseudo class.');
+
+var emptyTextnodes = document.getElementById("empty-textnodes");
+for (var i = 0; i < 10; ++i)
+    emptyTextnodes.appendChild(document.createTextNode(""));
+
+var commentsAndEmptyTextnodes = document.getElementById("comments-and-empty-textnodes");
+for (var i = 0; i < 10; ++i) {
+    commentsAndEmptyTextnodes.appendChild(document.createTextNode(""));
+    commentsAndEmptyTextnodes.appendChild(document.createComment("WebKit!"));
+}
+
+shouldBe('document.querySelectorAll("testcase:empty").length', '4');
+shouldBe('document.querySelectorAll("testcase:empty")[0]', 'document.getElementById("no-content")');
+shouldBe('document.querySelectorAll("testcase:empty")[1]', 'document.getElementById("comment")');
+shouldBe('document.querySelectorAll("testcase:empty")[2]', 'document.getElementById("empty-textnodes")');
+shouldBe('document.querySelectorAll("testcase:empty")[3]', 'document.getElementById("comments-and-empty-textnodes")');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById("no-content")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("comment")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("empty-textnodes")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("comments-and-empty-textnodes")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("space-character")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("element")).backgroundColor', 'rgb(255, 255, 255)');
+
+</script>
+<script src=""
+</html>

Added: trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking-expected.txt (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking-expected.txt	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,77 @@
+Test backtracking of a long chain of :empty siblings to catch any issue with register allocation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)").length is 3
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[0] is document.getElementById("target1")
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[1] is document.getElementById("target2")
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[2] is document.getElementById("target3")
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)>target-child").length is 1
+PASS document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)>target-child")[0] is document.getElementById("target4")
+PASS document.querySelectorAll("testcase").length is 61
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[20]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[21]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[22]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[23]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[24]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[25]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[26]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[27]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[28]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[29]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[30]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[31]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[32]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[33]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[34]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[35]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[36]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[37]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[38]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[39]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[40]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[41]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[42]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[43]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[44]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[45]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[46]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[47]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[48]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[49]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[50]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[51]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[52]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[53]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[54]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[55]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[56]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[57]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[58]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[59]).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[60]).backgroundColor is "rgb(1, 2, 3)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking.html (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking.html	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-long-adjacent-backtracking.html	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,109 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<style>
+testcase {
+    background-color: white;
+}
+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty) {
+    background-color: rgb(1, 2, 3);
+}
+</style>
+</head>
+<body>
+    <div style="display:none">
+        <!-- 20 empty -->
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+
+        <testcase id=target1><foobar></foobar></testcase>
+
+        <!-- 19 empty -->
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+
+        <testcase id=target2>Not Empty!</testcase>
+
+        <!-- 19 empty -->
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+        <testcase class=empty></testcase>
+
+        <testcase id="target3">
+            <target-child id="target4"></target-child>
+        </testcase>
+    </div>
+</body>
+<script>
+description('Test backtracking of a long chain of :empty siblings to catch any issue with register allocation.');
+
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)").length', '3');
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[0]', 'document.getElementById("target1")');
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[1]', 'document.getElementById("target2")');
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)")[2]', 'document.getElementById("target3")');
+
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)>target-child").length', '1');
+shouldBe('document.querySelectorAll(":empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty+:empty~:not(:empty)>target-child")[0]', 'document.getElementById("target4")');
+
+shouldBe('document.querySelectorAll("testcase").length', '61')
+
+var allTestCases = document.querySelectorAll("testcase");
+for (var i = 0; i < 61; ++i)
+    shouldBeEqualToString('getComputedStyle(document.querySelectorAll("testcase")[' + i + ']).backgroundColor', allTestCases[i].classList.contains('empty') ? 'rgb(255, 255, 255)' : 'rgb(1, 2, 3)');
+
+
+</script>
+<script src=""
+</html>

Added: trunk/LayoutTests/fast/selectors/empty-style-update-expected.txt (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-style-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-style-update-expected.txt	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,30 @@
+Test the style update with the :empty pseudo class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Initial state is emtpy.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Adding a comment does not change the :empty state.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Add an element as child make updates :empty.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(255, 255, 255)"
+Adding an empty text node, this is still not empty because of the element.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(255, 255, 255)"
+Removing the elements previously added should restore the :empty state.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+Adding a non empty text node makes the state non empty.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(255, 255, 255)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(255, 255, 255)"
+Removing the last text child, back to being empty.
+PASS getComputedStyle(document.getElementById("with-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.getElementById("without-renderer")).backgroundColor is "rgb(1, 2, 3)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/selectors/empty-style-update.html (0 => 172619)


--- trunk/LayoutTests/fast/selectors/empty-style-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/empty-style-update.html	2014-08-15 04:06:27 UTC (rev 172619)
@@ -0,0 +1,71 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<style>
+testcase {
+    background-color: white;
+}
+testcase:empty {
+    background-color: rgb(1, 2, 3);
+}
+</style>
+</head>
+<body>
+    <div>
+        <testcase id="with-renderer"></testcase>
+    </div>
+    <div style="display:none;">
+        <testcase id="without-renderer"></testcase>
+    </div>
+</body>
+<script>
+description('Test the style update with the :empty pseudo class.');
+
+var testCaseWithRender = document.getElementById("with-renderer");
+var testCaseWithoutRenderer = document.getElementById("without-renderer");
+
+debug("Initial state is emtpy.");
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Adding a comment does not change the :empty state.");
+testCaseWithRender.appendChild(document.createComment("WebKit!"));
+testCaseWithoutRenderer.appendChild(document.createComment("WebKit!"));
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Add an element as child make updates :empty.");
+var elementForCaseWithRenderer = document.createElement('div');
+var elementForCaseWithoutRenderer = document.createElement('div');
+testCaseWithRender.appendChild(elementForCaseWithRenderer);
+testCaseWithoutRenderer.appendChild(elementForCaseWithoutRenderer);
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Adding an empty text node, this is still not empty because of the element.");
+testCaseWithRender.appendChild(document.createTextNode(''));
+testCaseWithoutRenderer.appendChild(document.createTextNode(''));
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Removing the elements previously added should restore the :empty state.");
+testCaseWithRender.removeChild(elementForCaseWithRenderer);
+testCaseWithoutRenderer.removeChild(elementForCaseWithoutRenderer);
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+
+debug("Adding a non empty text node makes the state non empty.");
+testCaseWithRender.appendChild(document.createTextNode('WebKit!'));
+testCaseWithoutRenderer.appendChild(document.createTextNode('WebKit!'));
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(255, 255, 255)');
+
+debug("Removing the last text child, back to being empty.");
+testCaseWithRender.removeChild(testCaseWithRender.lastChild);
+testCaseWithoutRenderer.removeChild(testCaseWithoutRenderer.lastChild);
+shouldBeEqualToString('getComputedStyle(document.getElementById("with-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById("without-renderer")).backgroundColor', 'rgb(1, 2, 3)');
+</script>
+<script src=""
+</html>

Modified: trunk/Source/WTF/ChangeLog (172618 => 172619)


--- trunk/Source/WTF/ChangeLog	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WTF/ChangeLog	2014-08-15 04:06:27 UTC (rev 172619)
@@ -1,3 +1,13 @@
+2014-08-14  Benjamin Poulain  <[email protected]>
+
+        CSS JIT: compile the :empty pseudo class
+        https://bugs.webkit.org/show_bug.cgi?id=135958
+
+        Reviewed by Andreas Kling.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::lengthMemoryOffset):
+
 2014-08-12  Myles C. Maxfield  <[email protected]>
 
         Elements whose contents start with an astral Unicode symbol disappear when CSS `::first-letter` is applied to them

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (172618 => 172619)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2014-08-15 04:06:27 UTC (rev 172619)
@@ -412,6 +412,7 @@
     WTF_EXPORT_STRING_API static PassRef<StringImpl> adopt(StringBuffer<LChar>&);
 
     unsigned length() const { return m_length; }
+    static ptrdiff_t lengthMemoryOffset() { return OBJECT_OFFSETOF(StringImpl, m_length); }
     bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; }
 
     ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return m_data8; }

Modified: trunk/Source/WebCore/ChangeLog (172618 => 172619)


--- trunk/Source/WebCore/ChangeLog	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WebCore/ChangeLog	2014-08-15 04:06:27 UTC (rev 172619)
@@ -1,3 +1,32 @@
+2014-08-14  Benjamin Poulain  <[email protected]>
+
+        CSS JIT: compile the :empty pseudo class
+        https://bugs.webkit.org/show_bug.cgi?id=135958
+
+        Reviewed by Andreas Kling.
+
+        Compile :empty, nothing fancy.
+
+        Tests: fast/selectors/empty-basics.html
+               fast/selectors/empty-long-adjacent-backtracking.html
+               fast/selectors/empty-adjacent-style-update.html
+               fast/selectors/empty-style-update.html
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::addPseudoClassType):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
+        (WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
+        (WebCore::SelectorCompiler::setElementStyleIsAffectedByEmpty):
+        (WebCore::SelectorCompiler::setElementStyleFromContextIsAffectedByEmptyAndUpdateRenderStyleIfNecessary):
+        (WebCore::SelectorCompiler::setElementStyleIsAffectedByEmptyAndUpdateRenderStyleIfNecessary):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsEmpty):
+        * dom/CharacterData.h:
+        (WebCore::CharacterData::dataMemoryOffset):
+        * dom/ContainerNode.h:
+        (WebCore::ContainerNode::firstChildMemoryOffset):
+        * dom/Node.h:
+        (WebCore::Node::flagIsText):
+
 2014-08-14  Wenson Hsieh  <[email protected]>
 
         Implement scroll snapping animations on Mac

Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (172618 => 172619)


--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2014-08-15 04:06:27 UTC (rev 172619)
@@ -238,6 +238,7 @@
     void generateElementFunctionCallTest(Assembler::JumpList& failureCases, JSC::FunctionPtr);
     void generateContextFunctionCallTest(Assembler::JumpList& failureCases, JSC::FunctionPtr);
     void generateElementIsActive(Assembler::JumpList& failureCases, const SelectorFragment&);
+    void generateElementIsEmpty(Assembler::JumpList& failureCases, const SelectorFragment&);
     void generateElementIsFirstChild(Assembler::JumpList& failureCases, const SelectorFragment&);
     void generateElementIsHovered(Assembler::JumpList& failureCases, const SelectorFragment&);
     void generateElementIsInLanguage(Assembler::JumpList& failureCases, const AtomicString&);
@@ -497,7 +498,6 @@
         return FunctionType::CannotMatchAnything;
 
     // FIXME: Compile these pseudoclasses, too!
-    case CSSSelector::PseudoClassEmpty:
     case CSSSelector::PseudoClassFirstOfType:
     case CSSSelector::PseudoClassLastOfType:
     case CSSSelector::PseudoClassOnlyOfType:
@@ -529,6 +529,7 @@
         return FunctionType::SelectorCheckerWithCheckingContext;
 
     case CSSSelector::PseudoClassActive:
+    case CSSSelector::PseudoClassEmpty:
     case CSSSelector::PseudoClassFirstChild:
     case CSSSelector::PseudoClassHover:
     case CSSSelector::PseudoClassLastChild:
@@ -1963,6 +1964,8 @@
 
     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassActive))
         generateElementIsActive(matchingPostTagNameFailureCases, fragment);
+    if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassEmpty))
+        generateElementIsEmpty(matchingPostTagNameFailureCases, fragment);
     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassHover))
         generateElementIsHovered(matchingPostTagNameFailureCases, fragment);
     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassOnlyChild))
@@ -2459,6 +2462,97 @@
     }
 }
 
+static void jumpIfElementIsNotEmpty(Assembler& assembler, RegisterAllocator& registerAllocator, Assembler::JumpList& notEmptyCases, Assembler::RegisterID element)
+{
+    LocalRegister currentChild(registerAllocator);
+    assembler.loadPtr(Assembler::Address(element, ContainerNode::firstChildMemoryOffset()), currentChild);
+
+    Assembler::Label loopStart(assembler.label());
+    Assembler::Jump noMoreChildren = assembler.branchTestPtr(Assembler::Zero, currentChild);
+
+    notEmptyCases.append(testIsElementFlagOnNode(Assembler::NonZero, assembler, currentChild));
+
+    {
+        Assembler::Jump skipTextNodeCheck = assembler.branchTest32(Assembler::Zero, Assembler::Address(currentChild, Node::nodeFlagsMemoryOffset()), Assembler::TrustedImm32(Node::flagIsText()));
+
+        LocalRegister textStringImpl(registerAllocator);
+        assembler.loadPtr(Assembler::Address(currentChild, CharacterData::dataMemoryOffset()), textStringImpl);
+        notEmptyCases.append(assembler.branchTest32(Assembler::NonZero, Assembler::Address(textStringImpl, StringImpl::lengthMemoryOffset())));
+
+        skipTextNodeCheck.link(&assembler);
+    }
+
+    assembler.loadPtr(Assembler::Address(currentChild, Node::nextSiblingMemoryOffset()), currentChild);
+    assembler.jump().linkTo(loopStart, &assembler);
+
+    noMoreChildren.link(&assembler);
+}
+
+static void setElementStyleIsAffectedByEmpty(Element* element)
+{
+    element->setStyleAffectedByEmpty();
+}
+
+static void setElementStyleFromContextIsAffectedByEmptyAndUpdateRenderStyleIfNecessary(CheckingContext* context, bool isEmpty)
+{
+    ASSERT(context->elementStyle);
+    context->elementStyle->setEmptyState(isEmpty);
+}
+
+static void setElementStyleIsAffectedByEmptyAndUpdateRenderStyleIfNecessary(Element* element, bool isEmpty)
+{
+    element->setStyleAffectedByEmpty();
+
+    if (element->renderStyle() && (element->document().styleSheetCollection().usesSiblingRules() || element->renderStyle()->unique()))
+        element->renderStyle()->setEmptyState(isEmpty);
+}
+
+void SelectorCodeGenerator::generateElementIsEmpty(Assembler::JumpList& failureCases, const SelectorFragment& fragment)
+{
+    if (m_selectorContext == SelectorContext::QuerySelector) {
+        jumpIfElementIsNotEmpty(m_assembler, m_registerAllocator, failureCases, elementAddressRegister);
+        return;
+    }
+
+    LocalRegisterWithPreference isEmptyResults(m_registerAllocator, JSC::GPRInfo::argumentGPR1);
+    m_assembler.move(Assembler::TrustedImm32(0), isEmptyResults);
+
+    Assembler::JumpList notEmpty;
+    jumpIfElementIsNotEmpty(m_assembler, m_registerAllocator, notEmpty, elementAddressRegister);
+    m_assembler.move(Assembler::TrustedImm32(1), isEmptyResults);
+    notEmpty.link(&m_assembler);
+
+    Assembler::Jump skipMarking;
+    if (shouldUseRenderStyleFromCheckingContext(m_selectorContext, fragment)) {
+        {
+            LocalRegister checkingContext(m_registerAllocator);
+            skipMarking = jumpIfNotResolvingStyle(checkingContext);
+
+            FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+            functionCall.setFunctionAddress(setElementStyleFromContextIsAffectedByEmptyAndUpdateRenderStyleIfNecessary);
+            functionCall.setTwoArguments(checkingContext, isEmptyResults);
+            functionCall.call();
+        }
+
+        FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+        functionCall.setFunctionAddress(setElementStyleIsAffectedByEmpty);
+        functionCall.setOneArgument(elementAddressRegister);
+        functionCall.call();
+    } else {
+        {
+            LocalRegister checkingContext(m_registerAllocator);
+            skipMarking = jumpIfNotResolvingStyle(checkingContext);
+        }
+        FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+        functionCall.setFunctionAddress(setElementStyleIsAffectedByEmptyAndUpdateRenderStyleIfNecessary);
+        functionCall.setTwoArguments(elementAddressRegister, isEmptyResults);
+        functionCall.call();
+    }
+    skipMarking.link(&m_assembler);
+
+    failureCases.append(m_assembler.branchTest32(Assembler::Zero, isEmptyResults));
+}
+
 void SelectorCodeGenerator::generateElementIsFirstChild(Assembler::JumpList& failureCases, const SelectorFragment& fragment)
 {
     if (m_selectorContext == SelectorContext::QuerySelector) {

Modified: trunk/Source/WebCore/dom/CharacterData.h (172618 => 172619)


--- trunk/Source/WebCore/dom/CharacterData.h	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WebCore/dom/CharacterData.h	2014-08-15 04:06:27 UTC (rev 172619)
@@ -31,6 +31,8 @@
 class CharacterData : public Node {
 public:
     String data() const { return m_data; }
+    static ptrdiff_t dataMemoryOffset() { return OBJECT_OFFSETOF(CharacterData, m_data); }
+
     void setData(const String&, ExceptionCode&);
     unsigned length() const { return m_data.length(); }
     String substringData(unsigned offset, unsigned count, ExceptionCode&);

Modified: trunk/Source/WebCore/dom/ContainerNode.h (172618 => 172619)


--- trunk/Source/WebCore/dom/ContainerNode.h	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2014-08-15 04:06:27 UTC (rev 172619)
@@ -84,6 +84,7 @@
     virtual ~ContainerNode();
 
     Node* firstChild() const { return m_firstChild; }
+    static ptrdiff_t firstChildMemoryOffset() { return OBJECT_OFFSETOF(ContainerNode, m_firstChild); }
     Node* lastChild() const { return m_lastChild; }
     bool hasChildNodes() const { return m_firstChild; }
 

Modified: trunk/Source/WebCore/dom/Node.h (172618 => 172619)


--- trunk/Source/WebCore/dom/Node.h	2014-08-15 03:22:01 UTC (rev 172618)
+++ trunk/Source/WebCore/dom/Node.h	2014-08-15 04:06:27 UTC (rev 172619)
@@ -572,6 +572,7 @@
 #if ENABLE(CSS_SELECTOR_JIT)
     static ptrdiff_t nodeFlagsMemoryOffset() { return OBJECT_OFFSETOF(Node, m_nodeFlags); }
     static ptrdiff_t rareDataMemoryOffset() { return OBJECT_OFFSETOF(Node, m_data.m_rareData); }
+    static int32_t flagIsText() { return IsTextFlag; }
     static int32_t flagIsElement() { return IsElementFlag; }
     static int32_t flagIsHTML() { return IsHTMLFlag; }
     static int32_t flagIsLink() { return IsLinkFlag; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to