Changeset 142982 in webkit


Ignore:
Timestamp:
Feb 15, 2013 4:28:19 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Regions][Mac] fast/regions/full-screen-video-from-region.html hits an assertion in RenderFlowThread::removeRenderBoxRegionInfo
https://bugs.webkit.org/show_bug.cgi?id=106075

Patch by Andrei Bucur <abucur@adobe.com> on 2013-02-15
Reviewed by Tony Chang.

Source/WebCore:

The crash is caused by two issues.

The first problem is how a block inside a flow thread determines if the children needs relayout or not.
When the region chain is invalidated, the information is lost so we need to return true, even for the
enclosing RenderFlowThread. Because the video renderer is the first child of the flow thread this doesn't
happen.

The patch implements this behaviour by inspecting both if the region chain has changed and
if the block has no range computed yet.

The second problem is RenderMedia not inheriting from RenderBlock. The logic of child relayout doesn't apply
to it. In the test case, when the full screen button is pressed, the region changes width to fill the viewport,
the chain is invalidated and the box info hash map is cleared. When the video is laid out again (after fixing
the first issue) it has the same size so the controls don't do a layout. They remain without box info inside
the flow thread, thus causing the assertion.

The patch forces the controls to relayout if the region chain was invalidated. We can't use the
logicalWidthChangedInRegions method because it is block specific. This will be fixed in a later patch.

Tests: No new tests. fast/regions/full-screen-video-from-region.html no longer crashes.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::checkForPaginationLogicalHeightChange):

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::RenderFlowThread):
(WebCore::RenderFlowThread::layout):
(WebCore::RenderFlowThread::logicalWidthChangedInRegions):

  • rendering/RenderFlowThread.h: Renamed pageLogicalHeightChanged to pageLogicalSizeChanged.
  • rendering/RenderMedia.cpp:

(WebCore::RenderMedia::layout):

LayoutTests:

Removed the crash/fail expectation for fast/regions/full-screen-video-from-region.html.

  • platform/mac/TestExpectations:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142981 r142982  
     12013-02-15  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions][Mac] fast/regions/full-screen-video-from-region.html hits an assertion in RenderFlowThread::removeRenderBoxRegionInfo
     4        https://bugs.webkit.org/show_bug.cgi?id=106075
     5
     6        Reviewed by Tony Chang.
     7
     8        Removed the crash/fail expectation for fast/regions/full-screen-video-from-region.html.
     9
     10        * platform/mac/TestExpectations:
     11
    1122013-02-15  Andrew Wilson  <atwilson@chromium.org>
    213
  • trunk/LayoutTests/platform/mac/TestExpectations

    r142979 r142982  
    13511351webkit.org/b/105999 [ Lion ] fast/canvas/canvas-composite-image.html [ Failure ]
    13521352
    1353 webkit.org/b/106075 [ Debug ] fast/regions/full-screen-video-from-region.html [ Crash ]
    1354 
    13551353webkit.org/b/106151 [ Lion ] http/tests/misc/link-rel-icon-beforeload.html [ Pass Failure ]
    13561354
  • trunk/Source/WebCore/ChangeLog

    r142979 r142982  
     12013-02-15  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions][Mac] fast/regions/full-screen-video-from-region.html hits an assertion in RenderFlowThread::removeRenderBoxRegionInfo
     4        https://bugs.webkit.org/show_bug.cgi?id=106075
     5
     6        Reviewed by Tony Chang.
     7
     8        The crash is caused by two issues.
     9
     10        The first problem is how a block inside a flow thread determines if the children needs relayout or not.
     11        When the region chain is invalidated, the information is lost so we need to return true, even for the
     12        enclosing RenderFlowThread. Because the video renderer is the first child of the flow thread this doesn't
     13        happen.
     14
     15        The patch implements this behaviour by inspecting both if the region chain has changed and
     16        if the block has no range computed yet.
     17
     18        The second problem is RenderMedia not inheriting from RenderBlock. The logic of child relayout doesn't apply
     19        to it. In the test case, when the full screen button is pressed, the region changes width to fill the viewport,
     20        the chain is invalidated and the box info hash map is cleared. When the video is laid out again (after fixing
     21        the first issue) it has the same size so the controls don't do a layout. They remain without box info inside
     22        the flow thread, thus causing the assertion.
     23
     24        The patch forces the controls to relayout if the region chain was invalidated. We can't use the
     25        logicalWidthChangedInRegions method because it is block specific. This will be fixed in a later patch.
     26
     27        Tests: No new tests. fast/regions/full-screen-video-from-region.html no longer crashes.
     28
     29        * rendering/RenderBlock.cpp:
     30        (WebCore::RenderBlock::checkForPaginationLogicalHeightChange):
     31        * rendering/RenderFlowThread.cpp:
     32        (WebCore::RenderFlowThread::RenderFlowThread):
     33        (WebCore::RenderFlowThread::layout):
     34        (WebCore::RenderFlowThread::logicalWidthChangedInRegions):
     35        * rendering/RenderFlowThread.h: Renamed pageLogicalHeightChanged to pageLogicalSizeChanged.
     36        * rendering/RenderMedia.cpp:
     37        (WebCore::RenderMedia::layout):
     38
    1392013-02-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    240
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r142974 r142982  
    14741474    } else if (isRenderFlowThread()) {
    14751475        pageLogicalHeight = 1; // This is just a hack to always make sure we have a page logical height.
    1476         pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalHeightChanged();
     1476        pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalSizeChanged();
    14771477    }
    14781478}
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r140948 r142982  
    5757    , m_hasRegionsWithStyling(false)
    5858    , m_dispatchRegionLayoutUpdateEvent(false)
    59     , m_pageLogicalHeightChanged(false)
     59    , m_pageLogicalSizeChanged(false)
    6060{
    6161    ASSERT(document->cssRegionsEnabled());
     
    137137    StackStats::LayoutCheckPoint layoutCheckPoint;
    138138
    139     m_pageLogicalHeightChanged = m_regionsInvalidated && everHadLayout();
     139    m_pageLogicalSizeChanged = m_regionsInvalidated && everHadLayout();
    140140    if (m_regionsInvalidated) {
    141141        m_regionsInvalidated = false;
     
    188188    RenderBlock::layout();
    189189
    190     m_pageLogicalHeightChanged = false;
     190    m_pageLogicalSizeChanged = false;
    191191
    192192    if (lastRegion())
     
    461461bool RenderFlowThread::logicalWidthChangedInRegions(const RenderBlock* block, LayoutUnit offsetFromLogicalTopOfFirstPage)
    462462{
    463     if (!hasRegions() || block == this) // Not necessary, since if any region changes, we do a full pagination relayout anyway.
     463    if (!hasRegions())
    464464        return false;
    465465
     
    468468    getRegionRangeForBox(block, startRegion, endRegion);
    469469
    470     // If the block doesn't have a startRegion (and implicitly a region range) it's safe to assume the width in regions has changed (e.g. the region chain was invalidated).
    471     if (!startRegion)
     470    // When the region chain is invalidated the box information is discarded so we must assume the width has changed.
     471    if (m_pageLogicalSizeChanged && !startRegion)
    472472        return true;
     473
     474    // Not necessary for the flow thread, since we already computed the correct info for it.
     475    if (block == this)
     476        return false;
    473477
    474478    for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r140948 r142982  
    134134    bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0);
    135135
    136     bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
     136    bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; }
    137137
    138138    bool hasAutoLogicalHeightRegions() const { ASSERT(isAutoLogicalHeightRegionsCountConsistent()); return m_autoLogicalHeightRegionsCount; }
     
    205205    bool m_hasRegionsWithStyling : 1;
    206206    bool m_dispatchRegionLayoutUpdateEvent : 1;
    207     bool m_pageLogicalHeightChanged : 1;
     207    bool m_pageLogicalSizeChanged : 1;
    208208};
    209209
  • trunk/Source/WebCore/rendering/RenderMedia.cpp

    r131938 r142982  
    3030
    3131#include "HTMLMediaElement.h"
     32#include "RenderFlowThread.h"
    3233#include "RenderView.h"
    3334
     
    6768        return;
    6869
     70    bool controlsNeedLayout = controlsRenderer->needsLayout();
     71    // If the region chain has changed we also need to relayout the controls to update the region box info.
     72    // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
     73    if (inRenderFlowThread() && !controlsNeedLayout) {
     74        const RenderFlowThread* flowThread = enclosingRenderFlowThread();
     75        ASSERT(flowThread);
     76        if (flowThread->pageLogicalSizeChanged())
     77            controlsNeedLayout = true;
     78    }
     79
    6980    LayoutSize newSize = contentBoxRect().size();
    70     if (newSize == oldSize && !controlsRenderer->needsLayout())
     81    if (newSize == oldSize && !controlsNeedLayout)
    7182        return;
    7283
Note: See TracChangeset for help on using the changeset viewer.