Changeset 140554 in webkit


Ignore:
Timestamp:
Jan 23, 2013 10:54:56 AM (11 years ago)
Author:
ojan@chromium.org
Message:

Assert that computePreferredLogicalWidths never calls setNeedsLayout
https://bugs.webkit.org/show_bug.cgi?id=107613

Reviewed by Eric Seidel.

computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
The mathml bits can be removed once https://bugs.webkit.org/show_bug.cgi?id=107353
is resolved.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::minPreferredLogicalWidth):

  • rendering/mathml/RenderMathMLOperator.cpp:

(WebCore::RenderMathMLOperator::computePreferredLogicalWidths):

  • rendering/mathml/RenderMathMLRoot.cpp:

(WebCore::RenderMathMLRoot::computePreferredLogicalWidths):

  • rendering/mathml/RenderMathMLRow.cpp:

(WebCore::RenderMathMLRow::computePreferredLogicalWidths):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140547 r140554  
     12013-01-23  Ojan Vafai  <ojan@chromium.org>
     2
     3        Assert that computePreferredLogicalWidths never calls setNeedsLayout
     4        https://bugs.webkit.org/show_bug.cgi?id=107613
     5
     6        Reviewed by Eric Seidel.
     7
     8        computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
     9        and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
     10        The mathml bits can be removed once https://bugs.webkit.org/show_bug.cgi?id=107353
     11        is resolved.
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::minPreferredLogicalWidth):
     15        * rendering/mathml/RenderMathMLOperator.cpp:
     16        (WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
     17        * rendering/mathml/RenderMathMLRoot.cpp:
     18        (WebCore::RenderMathMLRoot::computePreferredLogicalWidths):
     19        * rendering/mathml/RenderMathMLRow.cpp:
     20        (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
     21
    1222013-01-23  Noam Rosenthal  <noam@webkit.org>
    223
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r140439 r140554  
    850850LayoutUnit RenderBox::minPreferredLogicalWidth() const
    851851{
    852     if (preferredLogicalWidthsDirty())
     852    if (preferredLogicalWidthsDirty()) {
     853#ifndef NDEBUG
     854        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
     855#endif
    853856        const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
     857    }
    854858       
    855859    return m_minPreferredLogicalWidth;
     
    858862LayoutUnit RenderBox::maxPreferredLogicalWidth() const
    859863{
    860     if (preferredLogicalWidthsDirty())
     864    if (preferredLogicalWidthsDirty()) {
     865#ifndef NDEBUG
     866        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
     867#endif
    861868        const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
     869    }
    862870       
    863871    return m_maxPreferredLogicalWidth;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r140244 r140554  
    8484{
    8585    ASSERT(preferredLogicalWidthsDirty());
     86
     87#ifndef NDEBUG
     88    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
     89    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
     90    setNeedsLayoutIsForbidden(false);
     91#endif
    8692   
    8793    // Check for an uninitialized operator.
    8894    if (!firstChild())
    8995        updateFromElement();
    90    
     96
     97#ifndef NDEBUG
     98    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
     99#endif
     100
    91101    RenderMathMLBlock::computePreferredLogicalWidths();
    92102}
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

    r140032 r140554  
    188188    ASSERT(preferredLogicalWidthsDirty() && needsLayout());
    189189   
     190#ifndef NDEBUG
     191    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
     192    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
     193    setNeedsLayoutIsForbidden(false);
     194#endif
     195   
    190196    computeChildrenPreferredLogicalHeights();
    191197   
     
    220226    } else
    221227        m_intrinsicPaddingStart = frontWidth;
    222    
     228
     229#ifndef NDEBUG
     230    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
     231#endif
     232
    223233    RenderMathMLBlock::computePreferredLogicalWidths();
    224234   
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp

    r140244 r140554  
    5555{
    5656    ASSERT(preferredLogicalWidthsDirty() && needsLayout());
    57    
     57
     58#ifndef NDEBUG
     59    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
     60    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
     61    setNeedsLayoutIsForbidden(false);
     62#endif
     63
    5864    computeChildrenPreferredLogicalHeights();
    5965    int stretchLogicalHeight = 0;
     
    7884        }
    7985    }
    80    
     86
     87#ifndef NDEBUG
     88    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
     89#endif
     90
    8191    RenderMathMLBlock::computePreferredLogicalWidths();
    8292   
Note: See TracChangeset for help on using the changeset viewer.