Title: [219800] releases/WebKitGTK/webkit-2.16/Source/WebCore
Revision
219800
Author
[email protected]
Date
2017-07-24 02:40:51 -0700 (Mon, 24 Jul 2017)

Log Message

Merge r216825 - AccessibilityRenderObject::textUnderElement needs to assert on unclean tree.
https://bugs.webkit.org/show_bug.cgi?id=172065

Reviewed by Simon Fraser.

r192103 changed the assert logic incorrectly. If the tree is dirty, regardless of the renderer's type,
TextIterator will end up forcing style update/layout on the render tree.
The original assert would have hit with bug 171546 prior to r216726.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (219799 => 219800)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-07-24 09:40:39 UTC (rev 219799)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-07-24 09:40:51 UTC (rev 219800)
@@ -1,3 +1,17 @@
+2017-05-13  Zalan Bujtas  <[email protected]>
+
+        AccessibilityRenderObject::textUnderElement needs to assert on unclean tree.
+        https://bugs.webkit.org/show_bug.cgi?id=172065
+
+        Reviewed by Simon Fraser.
+
+        r192103 changed the assert logic incorrectly. If the tree is dirty, regardless of the renderer's type,
+        TextIterator will end up forcing style update/layout on the render tree.
+        The original assert would have hit with bug 171546 prior to r216726.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::textUnderElement):
+
 2017-05-11  Zalan Bujtas  <[email protected]>
 
         AX: Defer text changes until after the tree is clean if needed.

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (219799 => 219800)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-07-24 09:40:39 UTC (rev 219799)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-07-24 09:40:51 UTC (rev 219800)
@@ -627,15 +627,12 @@
     if (m_renderer->isBR())
         return ASCIILiteral("\n");
 
-    bool isRenderText = is<RenderText>(*m_renderer);
-
     if (shouldGetTextFromNode(mode))
         return AccessibilityNodeObject::textUnderElement(mode);
 
     // We use a text iterator for text objects AND for those cases where we are
     // explicitly asking for the full text under a given element.
-    bool shouldIncludeAllChildren = mode.childrenInclusion == AccessibilityTextUnderElementMode::TextUnderElementModeIncludeAllChildren;
-    if (isRenderText || shouldIncludeAllChildren) {
+    if (is<RenderText>(*m_renderer) || mode.childrenInclusion == AccessibilityTextUnderElementMode::TextUnderElementModeIncludeAllChildren) {
         // If possible, use a text iterator to get the text, so that whitespace
         // is handled consistently.
         Document* nodeDocument = nullptr;
@@ -669,11 +666,10 @@
                 if (frame->document() != nodeDocument)
                     return String();
 
-                // The tree should be stable before looking through the children of a non-Render Text object.
-                // Otherwise, further uses of TextIterator will force a layout update, potentially altering
-                // the accessibility tree and causing crashes in the loop that computes the result text.
-                ASSERT((isRenderText || !shouldIncludeAllChildren) || (!nodeDocument->renderView()->layoutState() && !nodeDocument->childNeedsStyleRecalc()));
-
+                // Renders referenced by accessibility objects could get destroyed, if TextIterator ends up triggering
+                // style update/layout here. See also AXObjectCache::deferTextChangedIfNeeded().
+                ASSERT_WITH_SECURITY_IMPLICATION(!nodeDocument->childNeedsStyleRecalc());
+                ASSERT_WITH_SECURITY_IMPLICATION(!nodeDocument->view()->isInRenderTreeLayout());
                 return plainText(textRange.get(), textIteratorBehaviorForTextRange());
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to