Title: [216966] trunk
Revision
216966
Author
za...@apple.com
Date
2017-05-16 19:33:28 -0700 (Tue, 16 May 2017)

Log Message

Do not skip <slot> children when collecting content for innerText.
https://bugs.webkit.org/show_bug.cgi?id=172113
<rdar://problem/30362324>

Reviewed by Ryosuke Niwa and Brent Fulgham.

Source/WebCore:

"display: contents" elements do not generate renderers but their children might.
This patch ensure that we don't skip them while collecting text content.

Test: fast/text/inner-text-should-include-slot-subtree.html

* editing/TextIterator.cpp:
(WebCore::TextIterator::advance):

LayoutTests:

* fast/text/inner-text-should-include-slot-subtree-expected.txt: Added.
* fast/text/inner-text-should-include-slot-subtree.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216965 => 216966)


--- trunk/LayoutTests/ChangeLog	2017-05-17 02:11:43 UTC (rev 216965)
+++ trunk/LayoutTests/ChangeLog	2017-05-17 02:33:28 UTC (rev 216966)
@@ -1,3 +1,14 @@
+2017-05-16  Zalan Bujtas  <za...@apple.com>
+
+        Do not skip <slot> children when collecting content for innerText.
+        https://bugs.webkit.org/show_bug.cgi?id=172113
+        <rdar://problem/30362324>
+
+        Reviewed by Ryosuke Niwa and Brent Fulgham.
+
+        * fast/text/inner-text-should-include-slot-subtree-expected.txt: Added.
+        * fast/text/inner-text-should-include-slot-subtree.html: Added.
+
 2017-05-16  Jiewen Tan  <jiewen_...@apple.com>
 
         Unreviewed, fix LayoutTests/plugins/navigator-plugin-crash.html

Modified: trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree-expected.txt (216965 => 216966)


--- trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree-expected.txt	2017-05-17 02:11:43 UTC (rev 216965)
+++ trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree-expected.txt	2017-05-17 02:33:28 UTC (rev 216966)
@@ -77,6 +77,7 @@
 PASS internals.countFindMatches('in-', []) is 4
 PASS internals.countFindMatches('in-shadow in-document', ['DoNotTraverseFlatTree']) is 0
 PASS internals.countFindMatches('in-shadow in-document', []) is 0
+PASS rangeText(internals.rangeOfString('inside-display-none', null, [])) is null
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree.html (216965 => 216966)


--- trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree.html	2017-05-17 02:11:43 UTC (rev 216965)
+++ trunk/LayoutTests/editing/text-iterator/find-string-on-flat-tree.html	2017-05-17 02:33:28 UTC (rev 216966)
@@ -2,6 +2,7 @@
 <html>
 <body>
 <div id="test-content">in-document <span id="host">unslotted <b id="slotted-element" slot="named-slot">slotted</b> unslotted</span> in-document<span id="user-agent-host"></span></div>
+<div id="display-none-content" style="display: none">inside-display-none</div>
 <script src=""
 <script>
 
@@ -161,6 +162,8 @@
     shouldBe("internals.countFindMatches('in-shadow in-document', ['DoNotTraverseFlatTree'])", "0");
     shouldBe("internals.countFindMatches('in-shadow in-document', [])", "0");
 
+    shouldBe("rangeText(internals.rangeOfString('inside-display-none', null, []))", "null");
+
     document.getElementById('console').style.display = null;
 }
 

Added: trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree-expected.txt (0 => 216966)


--- trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree-expected.txt	2017-05-17 02:33:28 UTC (rev 216966)
@@ -0,0 +1 @@
+Passif no crash orassert

Added: trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree.html (0 => 216966)


--- trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/inner-text-should-include-slot-subtree.html	2017-05-17 02:33:28 UTC (rev 216966)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that slot subtree is included in innerText</title>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<div id=container><slot id=sslot>if no crash or</slot></div>
+<script>
+container.insertBefore(document.createTextNode("Pass"), sslot);
+container.appendChild(document.createTextNode("assert"));
+document.body.offsetHeight;
+document.body.innerText;
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (216965 => 216966)


--- trunk/Source/WebCore/ChangeLog	2017-05-17 02:11:43 UTC (rev 216965)
+++ trunk/Source/WebCore/ChangeLog	2017-05-17 02:33:28 UTC (rev 216966)
@@ -1,3 +1,19 @@
+2017-05-16  Zalan Bujtas  <za...@apple.com>
+
+        Do not skip <slot> children when collecting content for innerText.
+        https://bugs.webkit.org/show_bug.cgi?id=172113
+        <rdar://problem/30362324>
+
+        Reviewed by Ryosuke Niwa and Brent Fulgham.
+
+        "display: contents" elements do not generate renderers but their children might.
+        This patch ensure that we don't skip them while collecting text content.  
+
+        Test: fast/text/inner-text-should-include-slot-subtree.html
+
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::advance):
+
 2017-05-16  Filip Pizlo  <fpi...@apple.com>
 
         GCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (216965 => 216966)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2017-05-17 02:11:43 UTC (rev 216965)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2017-05-17 02:33:28 UTC (rev 216966)
@@ -493,7 +493,7 @@
         auto* renderer = m_node->renderer();
         if (!renderer) {
             m_handledNode = true;
-            m_handledChildren = !((m_behavior & TextIteratorTraversesFlatTree) && is<Element>(*m_node) && downcast<Element>(*m_node).hasDisplayContents());
+            m_handledChildren = !(is<Element>(*m_node) && downcast<Element>(*m_node).hasDisplayContents());
         } else {
             // handle current node according to its type
             if (!m_handledNode) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to