⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245361 in webkit


Ignore:
Timestamp:
May 15, 2019, 3:34:09 PM (7 years ago)
Author:
Alan Bujtas
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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245340 r245361  
     12019-05-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not create a shape object outside of the layout context
     4        https://bugs.webkit.org/show_bug.cgi?id=197926
     5        <rdar://problem/50627858>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/block/float/float-with-shape-outside-crash-expected.txt: Added.
     10        * fast/block/float/float-with-shape-outside-crash.html: Added.
     11
    1122019-05-15  Shawn Roberts  <sroberts@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r245344 r245361  
     12019-05-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not create a shape object outside of the layout context
     4        https://bugs.webkit.org/show_bug.cgi?id=197926
     5        <rdar://problem/50627858>
     6
     7        Reviewed by Simon Fraser.
     8
     9        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).
     10        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.
     11
     12        Test: fast/block/float/float-with-shape-outside-crash.html
     13
     14        * rendering/FloatingObjects.cpp:
     15        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
     16        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
     17        * rendering/shapes/ShapeOutsideInfo.cpp:
     18        (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):
     19
    1202019-05-15  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/rendering/FloatingObjects.cpp

    r241751 r245361  
    480480    if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
    481481        ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop);
    482         if (!shapeDeltas.lineOverlapsShape())
     482        if (!shapeDeltas.isValid() || !shapeDeltas.lineOverlapsShape())
    483483            return false;
    484484
     
    499499    if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
    500500        ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop);
    501         if (!shapeDeltas.lineOverlapsShape())
     501        if (!shapeDeltas.isValid() || !shapeDeltas.lineOverlapsShape())
    502502            return false;
    503503
  • trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

    r238463 r245361  
    3939#include "RenderFragmentContainer.h"
    4040#include "RenderImage.h"
     41#include "RenderView.h"
    4142
    4243namespace WebCore {
     
    321322ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const RenderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, LayoutUnit lineHeight)
    322323{
     324    // 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".
     325    if (!m_shape && !containingBlock.view().frameView().layoutContext().isInLayout())
     326        return { };
     327
    323328    ASSERT(lineHeight >= 0);
    324329    LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(floatingObject) + containingBlock.marginBeforeForChild(m_renderer);
Note: See TracChangeset for help on using the changeset viewer.