Title: [245361] trunk
Revision
245361
Author
[email protected]
Date
2019-05-15 15:34:09 -0700 (Wed, 15 May 2019)

Log Message

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: trunk/LayoutTests/ChangeLog (245360 => 245361)


--- trunk/LayoutTests/ChangeLog	2019-05-15 22:27:09 UTC (rev 245360)
+++ trunk/LayoutTests/ChangeLog	2019-05-15 22:34:09 UTC (rev 245361)
@@ -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-15  Shawn Roberts  <[email protected]>
 
         Layout tests http/wpt/webauthn/public-key-credential-create-success-hid.https.html

Added: trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt (0 => 245361)


--- trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash-expected.txt	2019-05-15 22:34:09 UTC (rev 245361)
@@ -0,0 +1 @@
+PASS if no crash or ASSERT 

Added: trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash.html (0 => 245361)


--- trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-with-shape-outside-crash.html	2019-05-15 22:34:09 UTC (rev 245361)
@@ -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: trunk/Source/WebCore/ChangeLog (245360 => 245361)


--- trunk/Source/WebCore/ChangeLog	2019-05-15 22:27:09 UTC (rev 245360)
+++ trunk/Source/WebCore/ChangeLog	2019-05-15 22:34:09 UTC (rev 245361)
@@ -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-15  Youenn Fablet  <[email protected]>
 
         Mark beacon and ping loads as low priority

Modified: trunk/Source/WebCore/rendering/FloatingObjects.cpp (245360 => 245361)


--- trunk/Source/WebCore/rendering/FloatingObjects.cpp	2019-05-15 22:27:09 UTC (rev 245360)
+++ trunk/Source/WebCore/rendering/FloatingObjects.cpp	2019-05-15 22:34:09 UTC (rev 245361)
@@ -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: trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp (245360 => 245361)


--- trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2019-05-15 22:27:09 UTC (rev 245360)
+++ trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2019-05-15 22:34:09 UTC (rev 245361)
@@ -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