Changeset 136908 in webkit


Ignore:
Timestamp:
Dec 6, 2012 4:33:56 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Regions] Remove the sanitize mechanism from LineFragmentationData
https://bugs.webkit.org/show_bug.cgi?id=104234

Patch by Andrei Bucur <abucur@adobe.com> on 2012-12-06
Reviewed by David Hyatt.

Remove previous work that ensured an invalid region is never returned by the containingRegion getter. After r136793 the blocks always
relayout children if the region chain changes. This means the sanitize() method is only necessary when all the regions are removed.
This case is treated separately in layoutInlineChildren.

Tests: no new functionality, no bug fixed.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::lineWidthForPaginatedLineChanged):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::layoutInlineChildren):

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::containingRegion):
(WebCore):
(WebCore::RootInlineBox::setContainingRegion):

  • rendering/RootInlineBox.h:

(RootInlineBox):
(WebCore::RootInlineBox::LineFragmentationData::LineFragmentationData):
(LineFragmentationData):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r136907 r136908  
     12012-12-06  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Remove the sanitize mechanism from LineFragmentationData
     4        https://bugs.webkit.org/show_bug.cgi?id=104234
     5
     6        Reviewed by David Hyatt.
     7
     8        Remove previous work that ensured an invalid region is never returned by the containingRegion getter. After r136793 the blocks always
     9        relayout children if the region chain changes. This means the sanitize() method is only necessary when all the regions are removed.
     10        This case is treated separately in layoutInlineChildren.
     11
     12        Tests: no new functionality, no bug fixed.
     13
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::RenderBlock::lineWidthForPaginatedLineChanged):
     16        * rendering/RenderBlockLineLayout.cpp:
     17        (WebCore::RenderBlock::layoutInlineChildren):
     18        * rendering/RootInlineBox.cpp:
     19        (WebCore::RootInlineBox::containingRegion):
     20        (WebCore):
     21        (WebCore::RootInlineBox::setContainingRegion):
     22        * rendering/RootInlineBox.h:
     23        (RootInlineBox):
     24        (WebCore::RootInlineBox::LineFragmentationData::LineFragmentationData):
     25        (LineFragmentationData):
     26
    1272012-12-06  Kenneth Russell  <kbr@google.com>
    228
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r136744 r136908  
    72527252
    72537253    RenderRegion* currentRegion = regionAtBlockOffset(rootBox->lineTopWithLeading() + lineDelta);
    7254     // Just bail if we still don't have a region.
    7255     if (!rootBox->hasContainingRegion() && !currentRegion)
    7256         return false;
    72577254    // Just bail if the region didn't change.
    7258     if (rootBox->hasContainingRegion() && rootBox->containingRegion() == currentRegion)
     7255    if (rootBox->containingRegion() == currentRegion)
    72597256        return false;
    72607257    return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(currentRegion, offsetFromLogicalTopOfFirstPage());
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r136857 r136908  
    17451745        layoutLineGridBox();
    17461746
     1747    bool clearLinesForPagination = firstLineBox() && inRenderFlowThread() && !enclosingRenderFlowThread()->hasRegions();
     1748
    17471749    // Figure out if we should clear out our line boxes.
    17481750    // FIXME: Handle resize eventually!
    1749     bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren;
     1751    bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
    17501752    LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalBottom);
    17511753
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r135750 r136908  
    251251}
    252252
     253RenderRegion* RootInlineBox::containingRegion() const
     254{
     255    RenderRegion* region = m_fragmentationData ? m_fragmentationData->m_containingRegion : 0;
     256
     257#ifndef NDEBUG
     258    if (region) {
     259        RenderFlowThread* flowThread = block()->enclosingRenderFlowThread();
     260        const RenderRegionList& regionList = flowThread->renderRegionList();
     261        ASSERT(regionList.contains(region));
     262    }
     263#endif
     264
     265    return region;
     266}
     267
    253268void RootInlineBox::setContainingRegion(RenderRegion* region)
    254269{
     
    257272    LineFragmentationData* fragmentationData  = ensureLineFragmentationData();
    258273    fragmentationData->m_containingRegion = region;
    259     fragmentationData->m_hasContainingRegion = !!region;
    260 }
    261 
    262 RootInlineBox::LineFragmentationData* RootInlineBox::LineFragmentationData::sanitize(const RenderBlock* block)
    263 {
    264     ASSERT(block->inRenderFlowThread());
    265     if (!m_containingRegion)
    266         return this;
    267 
    268     RenderFlowThread* flowThread = block->enclosingRenderFlowThread();
    269     const RenderRegionList& regionList = flowThread->renderRegionList();
    270     // For pointer types the hash function is |safeToCompareToEmptyOrDeleted|. There shouldn't be any problems if m_containingRegion was deleted.
    271     if (!regionList.contains(m_containingRegion))
    272         m_containingRegion = 0;
    273 
    274     return this;
    275274}
    276275
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r135750 r136908  
    6464    void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
    6565
    66     RenderRegion* containingRegion() const { return m_fragmentationData ? m_fragmentationData->sanitize(block())->m_containingRegion : 0; }
    67     bool hasContainingRegion() const { return m_fragmentationData ? m_fragmentationData->m_hasContainingRegion : false; }
     66    RenderRegion* containingRegion() const;
    6867    void setContainingRegion(RenderRegion*);
    6968
     
    230229            , m_paginatedLineWidth(0)
    231230            , m_isFirstAfterPageBreak(false)
    232             , m_hasContainingRegion(false)
    233231        {
    234232
    235233        }
    236234
    237         LineFragmentationData* sanitize(const RenderBlock*);
    238 
    239235        // It should not be assumed the |containingRegion| is always valid.
    240         // It can also be 0 if the flow has no region chain or an invalid pointer if the region is no longer in the chain.
    241         // Use |sanitize| to filter an invalid region.
     236        // It can also be 0 if the flow has no region chain.
    242237        RenderRegion* m_containingRegion;
    243238        LayoutUnit m_paginationStrut;
    244239        LayoutUnit m_paginatedLineWidth;
    245         unsigned m_isFirstAfterPageBreak : 1;
    246         unsigned m_hasContainingRegion : 1; // We need to keep this to differentiate between the case of a void region and an invalid region.
     240        bool m_isFirstAfterPageBreak;
    247241    };
    248242
Note: See TracChangeset for help on using the changeset viewer.