Title: [245454] releases/WebKitGTK/webkit-2.24
Revision
245454
Author
[email protected]
Date
2019-05-17 04:25:20 -0700 (Fri, 17 May 2019)

Log Message

Merge r245361 - Do not create a shape object outside of the layout context
https://bugs.webkit.org/show_bug.cgi?id=197926
<rdar://problem/50627858>

Reviewed by Simon Fraser.

Source/WebCore:

ShapeOutside objects are used to compute line constrains during layout (in a strict sense, they are part of the layout context and should only be mutated during layout).
If we don't create one during layout, we probably don't need to know its geometry during paint (or any other non-layout activity) either.

Test: fast/block/float/float-with-shape-outside-crash.html

* rendering/FloatingObjects.cpp:
(WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
(WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):

LayoutTests:

* fast/block/float/float-with-shape-outside-crash-expected.txt: Added.
* fast/block/float/float-with-shape-outside-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog (245453 => 245454)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog	2019-05-17 11:25:14 UTC (rev 245453)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog	2019-05-17 11:25:20 UTC (rev 245454)
@@ -1,3 +1,14 @@
+2019-05-15  Zalan Bujtas  <[email protected]>
+
+        Do not create a shape object outside of the layout context
+        https://bugs.webkit.org/show_bug.cgi?id=197926
+        <rdar://problem/50627858>
+
+        Reviewed by Simon Fraser.
+
+        * fast/block/float/float-with-shape-outside-crash-expected.txt: Added.
+        * fast/block/float/float-with-shape-outside-crash.html: Added.
+
 2019-05-14  Zalan Bujtas  <[email protected]>
 
         Do not try to issue repaint while the render tree is being destroyed.

Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt (0 => 245454)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt	2019-05-17 11:25:20 UTC (rev 245454)
@@ -0,0 +1 @@
+PASS if no crash or ASSERT 

Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash.html (0 => 245454)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/block/float/float-with-shape-outside-crash.html	2019-05-17 11:25:20 UTC (rev 245454)
@@ -0,0 +1,17 @@
+<style>
+q { 
+    float: left;
+}
+
+div { 
+    float: left;
+    width: 1400px;
+    height: 100px;
+    -webkit-shape-outside: filter(url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4MCAxMjUiIHN0cm9rZT0iI2QzNiI+CiAgPHBhdGggZD0iTTQwLDczdjUwIiBzdHJva2Utd2lkdGg9IjExIi8+CiAgPHBhdGggZD0iTTE3LDk4bDQ3LDAiIHN0cm9rZS13aWR0aD0iOCIvPgogIDxjaXJjbGUgcj0iMzMiIGN4PSI0MCIgY3k9IjQwIiBmaWxsPSJub25lIiBzdHJva2Utd2lkdGg9IjEyIi8+Cjwvc3ZnPgo=), hue-rotate()); 
+}
+</style><span>PASS if no crash or ASSERT</span><q>
+<div></div></q><script>
+document.getSelection().selectAllChildren(document.body);
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (245453 => 245454)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-05-17 11:25:14 UTC (rev 245453)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-05-17 11:25:20 UTC (rev 245454)
@@ -1,3 +1,22 @@
+2019-05-15  Zalan Bujtas  <[email protected]>
+
+        Do not create a shape object outside of the layout context
+        https://bugs.webkit.org/show_bug.cgi?id=197926
+        <rdar://problem/50627858>
+
+        Reviewed by Simon Fraser.
+
+        ShapeOutside objects are used to compute line constrains during layout (in a strict sense, they are part of the layout context and should only be mutated during layout).
+        If we don't create one during layout, we probably don't need to know its geometry during paint (or any other non-layout activity) either.
+
+        Test: fast/block/float/float-with-shape-outside-crash.html
+
+        * rendering/FloatingObjects.cpp:
+        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
+        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):
+
 2019-05-14  Zalan Bujtas  <[email protected]>
 
         Do not try to issue repaint while the render tree is being destroyed.

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/FloatingObjects.cpp (245453 => 245454)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/FloatingObjects.cpp	2019-05-17 11:25:14 UTC (rev 245453)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/FloatingObjects.cpp	2019-05-17 11:25:20 UTC (rev 245454)
@@ -479,7 +479,7 @@
     LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject);
     if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
         ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop);
-        if (!shapeDeltas.lineOverlapsShape())
+        if (!shapeDeltas.isValid() || !shapeDeltas.lineOverlapsShape())
             return false;
 
         logicalRight += shapeDeltas.rightMarginBoxDelta();
@@ -498,7 +498,7 @@
     LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject);
     if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
         ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop);
-        if (!shapeDeltas.lineOverlapsShape())
+        if (!shapeDeltas.isValid() || !shapeDeltas.lineOverlapsShape())
             return false;
 
         logicalLeft += shapeDeltas.leftMarginBoxDelta();

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp (245453 => 245454)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2019-05-17 11:25:14 UTC (rev 245453)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2019-05-17 11:25:20 UTC (rev 245454)
@@ -38,6 +38,7 @@
 #include "RenderBox.h"
 #include "RenderFragmentContainer.h"
 #include "RenderImage.h"
+#include "RenderView.h"
 
 namespace WebCore {
 
@@ -320,6 +321,10 @@
 
 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const RenderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, LayoutUnit lineHeight)
 {
+    // If we never constructed this shape during layout, we propably don't need to know about it outside of layout in the context of "containing block line".
+    if (!m_shape && !containingBlock.view().frameView().layoutContext().isInLayout())
+        return { };
+
     ASSERT(lineHeight >= 0);
     LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(floatingObject) + containingBlock.marginBeforeForChild(m_renderer);
     LayoutUnit borderBoxLineTop = lineTop - borderBoxTop;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to