Title: [210035] trunk
Revision
210035
Author
za...@apple.com
Date
2016-12-20 13:47:31 -0800 (Tue, 20 Dec 2016)

Log Message

SVG elements should inherit the root's flow thread state.
https://bugs.webkit.org/show_bug.cgi?id=166173
rdar://problem/29704862

Reviewed by Simon Fraser.

Source/WebCore:

When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either.

Test: fast/multicol/svg-inside-multicolumn.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::computedFlowThreadState):
* rendering/RenderObject.h:
(WebCore::RenderObject::isProgress):
(WebCore::RenderObject::isRenderSVGBlock):
* rendering/svg/RenderSVGBlock.h:

LayoutTests:

* fast/multicol/svg-inside-multicolumn-expected.txt: Added.
* fast/multicol/svg-inside-multicolumn.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210034 => 210035)


--- trunk/LayoutTests/ChangeLog	2016-12-20 21:41:14 UTC (rev 210034)
+++ trunk/LayoutTests/ChangeLog	2016-12-20 21:47:31 UTC (rev 210035)
@@ -1,3 +1,14 @@
+2016-12-20  Zalan Bujtas  <za...@apple.com>
+
+        SVG elements should inherit the root's flow thread state.
+        https://bugs.webkit.org/show_bug.cgi?id=166173
+        rdar://problem/29704862
+
+        Reviewed by Simon Fraser.
+
+        * fast/multicol/svg-inside-multicolumn-expected.txt: Added.
+        * fast/multicol/svg-inside-multicolumn.html: Added.
+
 2016-12-20  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Console could be made useful for very simple await expressions

Added: trunk/LayoutTests/fast/multicol/svg-inside-multicolumn-expected.txt (0 => 210035)


--- trunk/LayoutTests/fast/multicol/svg-inside-multicolumn-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/svg-inside-multicolumn-expected.txt	2016-12-20 21:47:31 UTC (rev 210035)
@@ -0,0 +1,2 @@
+Pass if no crash or assert.
+

Added: trunk/LayoutTests/fast/multicol/svg-inside-multicolumn.html (0 => 210035)


--- trunk/LayoutTests/fast/multicol/svg-inside-multicolumn.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/svg-inside-multicolumn.html	2016-12-20 21:47:31 UTC (rev 210035)
@@ -0,0 +1,50 @@
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!--======================================================================-->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="svgroot" width="100%" height="100%" viewBox="0 0 480 360">
+	<text fill="black">Pass if no crash or assert.</text>
+<style>
+svg {
+  position: absolute;
+}
+  
+body {
+  animation-name: name0;
+  animation-duration: 100s;
+}
+
+@-webkit-keyframes name0 {
+  from {
+    column-width: auto;
+  }
+  to {
+    column-width: 1;
+  }
+}
+
+body:last-child {
+  animation-name: foobar;
+}
+</style>
+
+<script type="text/_javascript_">
+// <![CDATA[
+if (window.testRunner)
+  testRunner.dumpAsText();
+document.getElementById("svgroot").offsetHeight;
+document.getElementById("svgroot").insertBefore(document.createElementNS("http://www.w3.org/2000/svg", "text"), null);
+// ]]>
+</script>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (210034 => 210035)


--- trunk/Source/WebCore/ChangeLog	2016-12-20 21:41:14 UTC (rev 210034)
+++ trunk/Source/WebCore/ChangeLog	2016-12-20 21:47:31 UTC (rev 210035)
@@ -1,3 +1,22 @@
+2016-12-20  Zalan Bujtas  <za...@apple.com>
+
+        SVG elements should inherit the root's flow thread state.
+        https://bugs.webkit.org/show_bug.cgi?id=166173
+        rdar://problem/29704862
+
+        Reviewed by Simon Fraser.
+
+        When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either.
+
+        Test: fast/multicol/svg-inside-multicolumn.html
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::computedFlowThreadState):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isProgress):
+        (WebCore::RenderObject::isRenderSVGBlock):
+        * rendering/svg/RenderSVGBlock.h:
+
 2016-12-20  Alex Christensen  <achristen...@webkit.org>
 
         Fix yet another app that uses initEvent with fewer than 3 parameters

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (210034 => 210035)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2016-12-20 21:41:14 UTC (rev 210034)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2016-12-20 21:47:31 UTC (rev 210035)
@@ -57,7 +57,11 @@
 #include "RenderNamedFlowFragment.h"
 #include "RenderNamedFlowThread.h" 
 #include "RenderRuby.h"
+#include "RenderSVGBlock.h"
+#include "RenderSVGInline.h"
+#include "RenderSVGModelObject.h"
 #include "RenderSVGResourceContainer.h"
+#include "RenderSVGRoot.h"
 #include "RenderScrollbarPart.h"
 #include "RenderTableRow.h"
 #include "RenderTheme.h"
@@ -185,7 +189,11 @@
     auto inheritedFlowState = RenderObject::NotInsideFlowThread;
     if (is<RenderText>(renderer))
         inheritedFlowState = renderer.parent()->flowThreadState();
-    else if (auto* containingBlock = renderer.containingBlock())
+    else if (is<RenderSVGBlock>(renderer) || is<RenderSVGInline>(renderer) || is<RenderSVGModelObject>(renderer)) {
+        // containingBlock() skips svg boundary (SVG root is a RenderReplaced).
+        if (auto* svgRoot = SVGRenderSupport::findTreeRootObject(downcast<RenderElement>(renderer)))
+            inheritedFlowState = svgRoot->flowThreadState();
+    } else if (auto* containingBlock = renderer.containingBlock())
         inheritedFlowState = containingBlock->flowThreadState();
     else {
         // Splitting lines or doing continuation, so just keep the current state.

Modified: trunk/Source/WebCore/rendering/RenderObject.h (210034 => 210035)


--- trunk/Source/WebCore/rendering/RenderObject.h	2016-12-20 21:41:14 UTC (rev 210034)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2016-12-20 21:47:31 UTC (rev 210035)
@@ -243,7 +243,6 @@
 #endif
     virtual bool isSnapshottedPlugIn() const { return false; }
     virtual bool isProgress() const { return false; }
-    virtual bool isRenderSVGBlock() const { return false; };
     virtual bool isRenderButton() const { return false; }
     virtual bool isRenderIFrame() const { return false; }
     virtual bool isRenderImage() const { return false; }
@@ -349,6 +348,7 @@
     // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
     // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
     virtual bool isRenderSVGModelObject() const { return false; }
+    virtual bool isRenderSVGBlock() const { return false; };
     virtual bool isSVGRoot() const { return false; }
     virtual bool isSVGContainer() const { return false; }
     virtual bool isSVGTransformableContainer() const { return false; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h (210034 => 210035)


--- trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h	2016-12-20 21:41:14 UTC (rev 210034)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h	2016-12-20 21:47:31 UTC (rev 210035)
@@ -50,3 +50,5 @@
 };
 
 } // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGBlock, isRenderSVGBlock())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to