Title: [217238] trunk/Source/WebCore
Revision
217238
Author
[email protected]
Date
2017-05-22 12:43:39 -0700 (Mon, 22 May 2017)

Log Message

Don't unconditionally reset TextIterator::m_handledChildren for display: contents nodes.
https://bugs.webkit.org/show_bug.cgi?id=172443

This avoids an infinite hang when enabling display: contents in bug 171984.

Patch by Emilio Cobos Álvarez <[email protected]> on 2017-05-22
Reviewed by Antti Koivisto.

No new tests. Relanding bug 171984 will add test coverage for this.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217237 => 217238)


--- trunk/Source/WebCore/ChangeLog	2017-05-22 19:27:43 UTC (rev 217237)
+++ trunk/Source/WebCore/ChangeLog	2017-05-22 19:43:39 UTC (rev 217238)
@@ -1,3 +1,19 @@
+2017-05-22  Emilio Cobos Álvarez  <[email protected]>
+
+        Don't unconditionally reset TextIterator::m_handledChildren for display: contents nodes.
+        https://bugs.webkit.org/show_bug.cgi?id=172443
+
+        This avoids an infinite hang when enabling display: contents in bug 171984.
+
+        Reviewed by Antti Koivisto.
+
+        No new tests. Relanding bug 171984 will add test coverage for this.
+
+        * editing/TextIterator.cpp:
+        (WebCore::hasDisplayContents):
+        (WebCore::fullyClipsContents):
+        (WebCore::TextIterator::advance):
+
 2017-05-22  Sam Weinig  <[email protected]>
 
         [WebIDL] Support callbacks with arbitrary return types

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (217237 => 217238)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2017-05-22 19:27:43 UTC (rev 217237)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2017-05-22 19:43:39 UTC (rev 217238)
@@ -444,6 +444,11 @@
     return node.parentOrShadowHostNode();
 }
 
+static inline bool hasDisplayContents(Node& node)
+{
+    return is<Element>(node) && downcast<Element>(node).hasDisplayContents();
+}
+
 void TextIterator::advance()
 {
     ASSERT(!atEnd());
@@ -491,12 +496,12 @@
         }
         
         auto* renderer = m_node->renderer();
-        if (!renderer) {
-            m_handledNode = true;
-            m_handledChildren = !(is<Element>(*m_node) && downcast<Element>(*m_node).hasDisplayContents());
-        } else {
-            // handle current node according to its type
-            if (!m_handledNode) {
+        if (!m_handledNode) {
+            if (!renderer) {
+                m_handledNode = true;
+                m_handledChildren = !hasDisplayContents(*m_node);
+            } else {
+                // handle current node according to its type
                 if (renderer->isText() && m_node->isTextNode())
                     m_handledNode = handleTextNode();
                 else if (isRendererReplacedElement(renderer))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to