Title: [229849] trunk
Revision
229849
Author
[email protected]
Date
2018-03-22 07:54:12 -0700 (Thu, 22 Mar 2018)

Log Message

SVG root is skipped while marking percentage height descendants dirty.
https://bugs.webkit.org/show_bug.cgi?id=183877

Reviewed by Antti Koivisto.

Source/WebCore:

Calling continingBlock() to get to the correct container works as long as the ancestor inline element
renderers are wrapped in anonymous blocks (continuation for example).

While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
so containingBlock() will elegantly skip it and return an SVG root ancestor.
dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers
(note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).

Covered by existing tests.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229848 => 229849)


--- trunk/LayoutTests/ChangeLog	2018-03-22 13:48:34 UTC (rev 229848)
+++ trunk/LayoutTests/ChangeLog	2018-03-22 14:54:12 UTC (rev 229849)
@@ -1,3 +1,12 @@
+2018-03-22  Zalan Bujtas  <[email protected]>
+
+        SVG root is skipped while marking percentage height descendants dirty.
+        https://bugs.webkit.org/show_bug.cgi?id=183877
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations:
+
 2018-03-22  Frederic Wang  <[email protected]>
 
         [MathML] Import WPT test to replace mathml/opentype/large-operators-italic-correction.html

Modified: trunk/LayoutTests/TestExpectations (229848 => 229849)


--- trunk/LayoutTests/TestExpectations	2018-03-22 13:48:34 UTC (rev 229848)
+++ trunk/LayoutTests/TestExpectations	2018-03-22 14:54:12 UTC (rev 229849)
@@ -1781,5 +1781,3 @@
 webkit.org/b/182928 http/tests/cache-storage/cache-representation.https.html [ Pass Failure ]
 
 webkit.org/b/183572 imported/blink/svg/css/path-layout-crash.html [ Skip ]
-webkit.org/b/183572 imported/mozilla/svg/foreignObject-ancestor-style-change-01.svg [ Skip ]
-webkit.org/b/183572 imported/mozilla/svg/mask-transformed-01.svg [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (229848 => 229849)


--- trunk/Source/WebCore/ChangeLog	2018-03-22 13:48:34 UTC (rev 229848)
+++ trunk/Source/WebCore/ChangeLog	2018-03-22 14:54:12 UTC (rev 229849)
@@ -1,3 +1,25 @@
+2018-03-22  Zalan Bujtas  <[email protected]>
+
+        SVG root is skipped while marking percentage height descendants dirty.
+        https://bugs.webkit.org/show_bug.cgi?id=183877
+
+        Reviewed by Antti Koivisto.
+
+        Calling continingBlock() to get to the correct container works as long as the ancestor inline element
+        renderers are wrapped in anonymous blocks (continuation for example).
+
+        While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
+        so containingBlock() will elegantly skip it and return an SVG root ancestor.
+        dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
+        on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
+        This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
+        (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
+
+        Covered by existing tests.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
+
 2018-03-22  Adrian Perez de Castro  <[email protected]>
 
         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (229848 => 229849)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2018-03-22 13:48:34 UTC (rev 229848)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2018-03-22 14:54:12 UTC (rev 229849)
@@ -58,6 +58,7 @@
 #include "RenderListMarker.h"
 #include "RenderMenuList.h"
 #include "RenderSVGResourceClipper.h"
+#include "RenderSVGRoot.h"
 #include "RenderTableCell.h"
 #include "RenderTextFragment.h"
 #include "RenderTheme.h"
@@ -64,6 +65,7 @@
 #include "RenderTreeBuilder.h"
 #include "RenderTreePosition.h"
 #include "RenderView.h"
+#include "SVGSVGElement.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
 #include "ShapeOutsideInfo.h"
@@ -819,7 +821,7 @@
         return;
 
     for (auto it = descendants->begin(), end = descendants->end(); it != end; ++it) {
-        RenderBox* box = *it;
+        auto* box = *it;
         while (box != this) {
             if (box->normalChildNeedsLayout())
                 break;
@@ -830,8 +832,20 @@
             // (A horizontal flexbox that contains an inline image wrapped in an anonymous block for example.)
             if (box->hasAspectRatio()) 
                 box->setPreferredLogicalWidthsDirty(true);
-            
-            box = box->containingBlock();
+            auto* containingBlock = box->containingBlock();
+            // Mark the svg ancestor chain dirty as we walk to the containing block. containingBlock() just skips them. See webkit.org/b/183874.
+            if (is<SVGElement>(box->element()) && containingBlock != box->parent()) {
+                auto* ancestor = box->parent();
+                ASSERT(ancestor->isDescendantOf(containingBlock));
+                while (ancestor != containingBlock) {
+                    ancestor->setChildNeedsLayout(MarkOnlyThis);
+                    // This is the topmost SVG root, no need to go any further.
+                    if (is<SVGSVGElement>(ancestor->element()) && !downcast<SVGSVGElement>(*ancestor->element()).ownerSVGElement())
+                        break;
+                    ancestor = ancestor->parent();
+                }
+            }
+            box = containingBlock;
             ASSERT(box);
             if (!box)
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to