Changeset 151237 in webkit


Ignore:
Timestamp:
Jun 5, 2013 2:25:27 PM (11 years ago)
Author:
betravis@adobe.com
Message:

[css exclusions] Clean up ExclusionShapeInsideInfo dynamic removal code
https://bugs.webkit.org/show_bug.cgi?id=116236

Reviewed by David Hyatt.

Instead of keeping the ExclusionShapeInsideInfo around after it has
become stale, we can immediately remove it and just mark descendants
for relayout. This patch removes most of the code added by
https://bugs.webkit.org/show_bug.cgi?id=111029
in favor of this simpler approach.

This patch does not introduce new functionality.

  • rendering/ExclusionShapeInsideInfo.h:

(WebCore::ExclusionShapeInsideInfo::ExclusionShapeInsideInfo):
(ExclusionShapeInsideInfo): Remove needsRemoval code.

  • rendering/LayoutState.cpp:

(WebCore::LayoutState::LayoutState): Ditto.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Remove
needsRemoval code and mark descendants for layout.
(WebCore):
(WebCore::RenderBlock::markShapeInsideDescendantsForLayout): Method to mark
descendants of a shape inside with inline content for layout.
(WebCore::exclusionInfoRequiresRelayout): Remove needsRemoval code.
(WebCore::RenderBlock::updateRegionsAndExclusionsAfterChildLayout): Ditto.

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
(RenderBlock):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::layoutExclusionShapeInsideInfo): Ditto.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151236 r151237  
     12013-06-05  Bear Travis  <betravis@adobe.com>
     2
     3        [css exclusions] Clean up ExclusionShapeInsideInfo dynamic removal code
     4        https://bugs.webkit.org/show_bug.cgi?id=116236
     5
     6        Reviewed by David Hyatt.
     7
     8        Instead of keeping the ExclusionShapeInsideInfo around after it has
     9        become stale, we can immediately remove it and just mark descendants
     10        for relayout. This patch removes most of the code added by
     11        https://bugs.webkit.org/show_bug.cgi?id=111029
     12        in favor of this simpler approach.
     13
     14        This patch does not introduce new functionality.
     15
     16        * rendering/ExclusionShapeInsideInfo.h:
     17        (WebCore::ExclusionShapeInsideInfo::ExclusionShapeInsideInfo):
     18        (ExclusionShapeInsideInfo): Remove needsRemoval code.
     19        * rendering/LayoutState.cpp:
     20        (WebCore::LayoutState::LayoutState): Ditto.
     21        * rendering/RenderBlock.cpp:
     22        (WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Remove
     23        needsRemoval code and mark descendants for layout.
     24        (WebCore):
     25        (WebCore::RenderBlock::markShapeInsideDescendantsForLayout): Method to mark
     26        descendants of a shape inside with inline content for layout.
     27        (WebCore::exclusionInfoRequiresRelayout): Remove needsRemoval code.
     28        (WebCore::RenderBlock::updateRegionsAndExclusionsAfterChildLayout): Ditto.
     29        * rendering/RenderBlock.h:
     30        (WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
     31        (RenderBlock):
     32        * rendering/RenderBlockLineLayout.cpp:
     33        (WebCore::RenderBlock::layoutExclusionShapeInsideInfo): Ditto.
     34
    1352013-06-05  Arunprasad Rajkumar  <arurajku@cisco.com>
    236
  • trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h

    r149226 r151237  
    7171    virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE
    7272    {
    73         ASSERT(!needsRemoval());
    7473        m_segmentRanges.clear();
    7574        return ExclusionShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &ExclusionShape::getIncludedIntervals>::computeSegmentsForLine(lineTop, lineHeight);
     
    9998    bool needsLayout() { return m_needsLayout; }
    10099
    101     void setNeedsRemoval(bool value) { m_needsRemoval = value; }
    102     bool needsRemoval() { return m_needsRemoval; }
    103 
    104100protected:
    105101    virtual LayoutRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape()->shapePaddingLogicalBoundingBox(); }
     
    109105    : ExclusionShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &ExclusionShape::getIncludedIntervals> (renderer)
    110106    , m_needsLayout(false)
    111     , m_needsRemoval(false)
    112107    { }
    113108
    114109    SegmentRangeList m_segmentRanges;
    115110    bool m_needsLayout:1;
    116     bool m_needsRemoval:1;
    117111};
    118112
  • trunk/Source/WebCore/rendering/LayoutState.cpp

    r147758 r151237  
    114114    if (renderer->isRenderBlock()) {
    115115        const RenderBlock* renderBlock = toRenderBlock(renderer);
    116         m_exclusionShapeInsideInfo = renderBlock->exclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
    117         if (m_next->m_exclusionShapeInsideInfo && renderBlock->allowsExclusionShapeInsideInfoSharing()) {
    118             if (!m_exclusionShapeInsideInfo)
    119                 m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
    120             else if (m_exclusionShapeInsideInfo->needsRemoval()) {
    121                 m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
    122                 m_exclusionShapeInsideInfo->setNeedsLayout(true);
    123             }
    124         }
     116        m_exclusionShapeInsideInfo = renderBlock->exclusionShapeInsideInfo();
     117        if (!m_exclusionShapeInsideInfo && m_next->m_exclusionShapeInsideInfo && renderBlock->allowsExclusionShapeInsideInfoSharing())
     118            m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
    125119    }
    126120#endif
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r151178 r151237  
    14471447        return;
    14481448
    1449     ExclusionShapeInsideInfo* exclusionShapeInsideInfo;
    14501449    if (shapeInside) {
    1451         exclusionShapeInsideInfo = ensureExclusionShapeInsideInfo();
     1450        ExclusionShapeInsideInfo* exclusionShapeInsideInfo = ensureExclusionShapeInsideInfo();
    14521451        exclusionShapeInsideInfo->dirtyShapeSize();
    1453         exclusionShapeInsideInfo->setNeedsRemoval(false);
    1454     } else if ((exclusionShapeInsideInfo = this->exclusionShapeInsideInfo(ShapePresentOrRemoved)))
    1455         exclusionShapeInsideInfo->setNeedsRemoval(true);
     1452    } else {
     1453        setExclusionShapeInsideInfo(nullptr);
     1454        markShapeInsideDescendantsForLayout();
     1455    }
     1456}
     1457
     1458void RenderBlock::markShapeInsideDescendantsForLayout()
     1459{
     1460    if (!everHadLayout())
     1461        return;
     1462    if (childrenInline()) {
     1463        setNeedsLayout(true);
     1464        return;
     1465    }
     1466    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     1467        if (!child->isRenderBlock())
     1468            continue;
     1469        RenderBlock* childBlock = toRenderBlock(child);
     1470        childBlock->markShapeInsideDescendantsForLayout();
     1471    }
    14561472}
    14571473#endif
     
    14621478    return false;
    14631479#else
    1464     ExclusionShapeInsideInfo* info = block->exclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
     1480    ExclusionShapeInsideInfo* info = block->exclusionShapeInsideInfo();
    14651481    if (info)
    1466         info->setNeedsLayout(info->shapeSizeDirty() || info->needsRemoval());
     1482        info->setNeedsLayout(info->shapeSizeDirty());
    14671483    else
    1468         info = block->layoutExclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
     1484        info = block->layoutExclusionShapeInsideInfo();
    14691485    return info && info->needsLayout();
    14701486#endif
     
    15161532{
    15171533#if ENABLE(CSS_EXCLUSIONS)
    1518     ExclusionShapeInsideInfo* exclusionShapeInsideInfo = this->exclusionShapeInsideInfo(ShapePresentOrRemoved);
    1519     if (exclusionShapeInsideInfo && exclusionShapeInsideInfo->needsRemoval())
    1520         setExclusionShapeInsideInfo(nullptr);
    1521 
    15221534    // A previous sibling has changed dimension, so we need to relayout the shape with the content
    15231535    ExclusionShapeInsideInfo* shapeInsideInfo = layoutExclusionShapeInsideInfo();
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r151178 r151237  
    454454    }
    455455
    456     enum ExclusionShapeStatus { ShapePresent, ShapePresentOrRemoved };
    457     ExclusionShapeInsideInfo* exclusionShapeInsideInfo(ExclusionShapeStatus exclusionShapeStatus = ShapePresent) const
     456    ExclusionShapeInsideInfo* exclusionShapeInsideInfo() const
    458457    {
    459458        if (!m_rareData || !m_rareData->m_shapeInsideInfo)
    460459            return 0;
    461         return ExclusionShapeInsideInfo::isEnabledFor(this) || (exclusionShapeStatus == ShapePresentOrRemoved) ? m_rareData->m_shapeInsideInfo.get() : 0;
     460        return ExclusionShapeInsideInfo::isEnabledFor(this) ? m_rareData->m_shapeInsideInfo.get() : 0;
    462461    }
    463462    void setExclusionShapeInsideInfo(PassOwnPtr<ExclusionShapeInsideInfo> value)
     
    467466        m_rareData->m_shapeInsideInfo = value;
    468467    }
    469     ExclusionShapeInsideInfo* layoutExclusionShapeInsideInfo(ExclusionShapeStatus = ShapePresent) const;
     468    void markShapeInsideDescendantsForLayout();
     469    ExclusionShapeInsideInfo* layoutExclusionShapeInsideInfo() const;
    470470    bool allowsExclusionShapeInsideInfoSharing() const { return !isInline() && !isFloating(); }
    471471#endif
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r150642 r151237  
    7878
    7979#if ENABLE(CSS_EXCLUSIONS)
    80 ExclusionShapeInsideInfo* RenderBlock::layoutExclusionShapeInsideInfo(ExclusionShapeStatus exclusionShapeStatus) const
     80ExclusionShapeInsideInfo* RenderBlock::layoutExclusionShapeInsideInfo() const
    8181{
    8282    ExclusionShapeInsideInfo* shapeInsideInfo = view()->layoutState()->exclusionShapeInsideInfo();
    83     if (shapeInsideInfo && shapeInsideInfo->needsRemoval() && exclusionShapeStatus == ShapePresent)
    84         shapeInsideInfo = 0;
    8583
    8684    if (!shapeInsideInfo && flowThreadContainingBlock() && allowsExclusionShapeInsideInfoSharing()) {
     
    9088        if (region)
    9189            shapeInsideInfo = region->exclusionShapeInsideInfo();
    92         return shapeInsideInfo && shapeInsideInfo->needsRemoval() && exclusionShapeStatus == ShapePresent ? 0 : shapeInsideInfo;
    9390    }
    9491
Note: See TracChangeset for help on using the changeset viewer.