Changeset 143322 in webkit


Ignore:
Timestamp:
Feb 19, 2013 5:44:42 AM (11 years ago)
Author:
abucur@adobe.com
Message:

[CSS Regions] Assertion in RenderFlowThread::removeRenderBoxRegionInfo
https://bugs.webkit.org/show_bug.cgi?id=109914

Reviewed by David Hyatt.

Source/WebCore:

This patch moves a part of the invalidation operations inside the RenderFlowThread::invalidateRegions call. The maps
are cleared anyway at layout time but doing this earlier makes sure the flow thread is in a more consistent state
(the RenderFlowThread object has both the region chain invalidated and the regions information cleared).

RenderFlowThread::removeRenderBoxRegionInfo will check if the region chain is invalidated. If true, it means the
flow thread has a layout scheduled and the regions information is not yet reliable. In this case we just return from the
function and wait for the layout to cleanup the box information.

Test: fast/regions/remove-box-info-assert.html

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::removeRegionFromThread):
(WebCore::RenderFlowThread::invalidateRegions):
(WebCore):
(WebCore::RenderFlowThread::layout):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):

  • rendering/RenderFlowThread.h:
  • rendering/RenderNamedFlowThread.cpp:

(WebCore::RenderNamedFlowThread::removeRegionFromThread):

LayoutTests:

The test creates a flow thread with two regions and a content node. We remove the region and the node from the flow thread
at the same time. When the style is updated, the region is first removed from the chain and range information for boxes
is cleared from the flow thread. When the node is removed from the flow thread it tries to delete its region box information.
The range information on the flow thread is gone so the range for the node's box is zero - nothing gets deleted. Afterwards,
an ASSERT is triggered because there's leftover box information inside the region chain.

  • fast/regions/remove-box-info-assert-expected.txt: Added.
  • fast/regions/remove-box-info-assert.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143321 r143322  
     12013-02-19  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Assertion in RenderFlowThread::removeRenderBoxRegionInfo
     4        https://bugs.webkit.org/show_bug.cgi?id=109914
     5
     6        Reviewed by David Hyatt.
     7
     8        The test creates a flow thread with two regions and a content node. We remove the region and the node from the flow thread
     9        at the same time. When the style is updated, the region is first removed from the chain and range information for boxes
     10        is cleared from the flow thread. When the node is removed from the flow thread it tries to delete its region box information.
     11        The range information on the flow thread is gone so the range for the node's box is zero - nothing gets deleted. Afterwards,
     12        an ASSERT is triggered because there's leftover box information inside the region chain.
     13
     14        * fast/regions/remove-box-info-assert-expected.txt: Added.
     15        * fast/regions/remove-box-info-assert.html: Added.
     16
    1172013-02-19  Stephen White  <senorblanco@chromium.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r143320 r143322  
     12013-02-19  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Assertion in RenderFlowThread::removeRenderBoxRegionInfo
     4        https://bugs.webkit.org/show_bug.cgi?id=109914
     5
     6        Reviewed by David Hyatt.
     7
     8        This patch moves a part of the invalidation operations inside the RenderFlowThread::invalidateRegions call. The maps
     9        are cleared anyway at layout time but doing this earlier makes sure the flow thread is in a more consistent state
     10        (the RenderFlowThread object has both the region chain invalidated and the regions information cleared).
     11
     12        RenderFlowThread::removeRenderBoxRegionInfo will check if the region chain is invalidated. If true, it means the
     13        flow thread has a layout scheduled and the regions information is not yet reliable. In this case we just return from the
     14        function and wait for the layout to cleanup the box information.
     15
     16        Test: fast/regions/remove-box-info-assert.html
     17
     18        * rendering/RenderFlowThread.cpp:
     19        (WebCore::RenderFlowThread::removeRegionFromThread):
     20        (WebCore::RenderFlowThread::invalidateRegions):
     21        (WebCore):
     22        (WebCore::RenderFlowThread::layout):
     23        (WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
     24        * rendering/RenderFlowThread.h:
     25        * rendering/RenderNamedFlowThread.cpp:
     26        (WebCore::RenderNamedFlowThread::removeRegionFromThread):
     27
    1282013-02-19  Alberto Garcia  <agarcia@igalia.com>
    229
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r142982 r143322  
    106106{
    107107    ASSERT(renderRegion);
    108     m_regionRangeMap.clear();
    109108    m_regionList.remove(renderRegion);
    110109    invalidateRegions();
    111110    checkRegionsWithStyling();
     111}
     112
     113void RenderFlowThread::invalidateRegions()
     114{
     115    if (m_regionsInvalidated) {
     116        ASSERT(selfNeedsLayout());
     117        return;
     118    }
     119
     120    m_regionRangeMap.clear();
     121    m_breakBeforeToRegionMap.clear();
     122    m_breakAfterToRegionMap.clear();
     123    setNeedsLayout(true);
     124
     125    m_regionsInvalidated = true;
    112126}
    113127
     
    142156        m_regionsHaveUniformLogicalWidth = true;
    143157        m_regionsHaveUniformLogicalHeight = true;
    144         m_regionRangeMap.clear();
    145         m_breakBeforeToRegionMap.clear();
    146         m_breakAfterToRegionMap.clear();
    147158
    148159        LayoutUnit previousRegionLogicalWidth = 0;
     
    153164                RenderRegion* region = *iter;
    154165                ASSERT(!region->needsLayout());
    155                
     166
    156167                region->deleteAllRenderBoxRegionInfo();
    157168
     
    436447    if (!hasRegions())
    437448        return;
     449
     450    // If the region chain was invalidated the next layout will clear the box information from all the regions.
     451    if (m_regionsInvalidated) {
     452        ASSERT(selfNeedsLayout());
     453        return;
     454    }
    438455
    439456    RenderRegion* startRegion;
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r142982 r143322  
    8585    void checkRegionsWithStyling();
    8686
    87     void invalidateRegions() { m_regionsInvalidated = true; setNeedsLayout(true); }
     87    void invalidateRegions();
    8888    bool hasValidRegionInfo() const { return !m_regionsInvalidated && !m_regionList.isEmpty(); }
    8989
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r142271 r143322  
    251251{
    252252    ASSERT(renderRegion);
    253     m_regionRangeMap.clear();
    254253
    255254    if (renderRegion->parentNamedFlowThread()) {
Note: See TracChangeset for help on using the changeset viewer.