Changeset 141517 in webkit


Ignore:
Timestamp:
Jan 31, 2013 5:48:20 PM (11 years ago)
Author:
ojan@chromium.org
Message:

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

Reviewed by Tony Chang.

computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
This is take 2 after this was rolled out because it was missing the guards
in RenderCounter/RenderQuote.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::minPreferredLogicalWidth):
(WebCore::RenderBox::maxPreferredLogicalWidth):

  • rendering/RenderCounter.cpp:

(WebCore::RenderCounter::computePreferredLogicalWidths):

  • rendering/RenderQuote.cpp:

(WebCore::RenderQuote::computePreferredLogicalWidths):

  • 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:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141516 r141517  
     12013-01-31  Ojan Vafai  <ojan@chromium.org>
     2
     3        Assert that computePreferredLogicalWidths never calls setNeedsLayout
     4        https://bugs.webkit.org/show_bug.cgi?id=108539
     5
     6        Reviewed by Tony Chang.
     7
     8        computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
     9        and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
     10        This is take 2 after this was rolled out because it was missing the guards
     11        in RenderCounter/RenderQuote.
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::minPreferredLogicalWidth):
     15        (WebCore::RenderBox::maxPreferredLogicalWidth):
     16        * rendering/RenderCounter.cpp:
     17        (WebCore::RenderCounter::computePreferredLogicalWidths):
     18        * rendering/RenderQuote.cpp:
     19        (WebCore::RenderQuote::computePreferredLogicalWidths):
     20        * rendering/mathml/RenderMathMLOperator.cpp:
     21        (WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
     22        * rendering/mathml/RenderMathMLRoot.cpp:
     23        (WebCore::RenderMathMLRoot::computePreferredLogicalWidths):
     24        * rendering/mathml/RenderMathMLRow.cpp:
     25        (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
     26
    1272013-01-31  Abhishek Arya  <inferno@chromium.org>
    228
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r141492 r141517  
    859859LayoutUnit RenderBox::minPreferredLogicalWidth() const
    860860{
    861     if (preferredLogicalWidthsDirty())
     861    if (preferredLogicalWidthsDirty()) {
     862#ifndef NDEBUG
     863        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
     864#endif
    862865        const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
     866    }
    863867       
    864868    return m_minPreferredLogicalWidth;
     
    867871LayoutUnit RenderBox::maxPreferredLogicalWidth() const
    868872{
    869     if (preferredLogicalWidthsDirty())
     873    if (preferredLogicalWidthsDirty()) {
     874#ifndef NDEBUG
     875        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
     876#endif
    870877        const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
     878    }
    871879       
    872880    return m_maxPreferredLogicalWidth;
  • trunk/Source/WebCore/rendering/RenderCounter.cpp

    r138909 r141517  
    520520void RenderCounter::computePreferredLogicalWidths(float lead)
    521521{
     522#ifndef NDEBUG
     523    // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths.
     524    // Instead, we should properly hook the appropriate changes in the DOM and modify
     525    // the render tree then. When that's done, we also won't need to override
     526    // computePreferredLogicalWidths at all.
     527    // https://bugs.webkit.org/show_bug.cgi?id=104829
     528    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
     529    setNeedsLayoutIsForbidden(false);
     530#endif
     531
    522532    setTextInternal(originalText());
     533
     534#ifndef NDEBUG
     535    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
     536#endif
     537
    523538    RenderText::computePreferredLogicalWidths(lead);
    524539}
  • trunk/Source/WebCore/rendering/RenderQuote.cpp

    r127381 r141517  
    251251void RenderQuote::computePreferredLogicalWidths(float lead)
    252252{
     253#ifndef NDEBUG
     254    // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths.
     255    // Instead, we should properly hook the appropriate changes in the DOM and modify
     256    // the render tree then. When that's done, we also won't need to override
     257    // computePreferredLogicalWidths at all.
     258    // https://bugs.webkit.org/show_bug.cgi?id=104829
     259    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
     260    setNeedsLayoutIsForbidden(false);
     261#endif
     262
    253263    if (!m_attached)
    254264        attachQuote();
    255265    setTextInternal(originalText());
     266
     267#ifndef NDEBUG
     268    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
     269#endif
     270
    256271    RenderText::computePreferredLogicalWidths(lead);
    257272}
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r140950 r141517  
    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

    r140950 r141517  
    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

    r140950 r141517  
    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.