Changeset 40238 in webkit


Ignore:
Timestamp:
Jan 25, 2009 7:38:55 PM (15 years ago)
Author:
hyatt@apple.com
Message:

WebCore:

2009-01-25 David Hyatt <hyatt@apple.com>

Fix for https://bugs.webkit.org/show_bug.cgi?id=23524, lots of missing content in table sections.

The new table code created a bug involving markAllDescendantsWithFloatsForLayout, namely that it could
end up marking ancestors of a block as needing layout when that block was still in the process of
doing a layout.

The fix is to add a parameter to markAllDescendantsWithFloatsForLayout that says whether or not
we are "mid-layout." If this flag is set, then the method will make sure to do only local dirtying
of objects to avoid accidentally marking a clean ancestor as needing layout again.

Ultimately the second parameter to setNeedsLayout and setChildNeedsLayout should just be removed,
with a check of whether or not we are mid-layout being done by those methods instead.

Reviewed by Oliver Hunt

Added fast/repaint/dynamic-table-vertical-alignment-change.html

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::collapseMargins): (WebCore::RenderBlock::clearFloatsIfNeeded): (WebCore::RenderBlock::layoutBlockChildren): (WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout):
  • rendering/RenderBlock.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromObjectLists):
  • rendering/RenderObject.h:
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::layoutRows):

LayoutTests:

2009-01-25 David Hyatt <hyatt@apple.com>

Add layout test for https://bugs.webkit.org/show_bug.cgi?id=23524.

Reviewed by Oliver Hunt

  • fast/repaint/dynamic-table-vertical-alignment-change.html: Added.
  • platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.checksum: Added.
  • platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.png: Added.
  • platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.txt: Added.
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r40236 r40238  
     12009-01-25  David Hyatt  <hyatt@apple.com>
     2
     3        Add layout test for https://bugs.webkit.org/show_bug.cgi?id=23524.
     4
     5        Reviewed by Oliver Hunt
     6
     7        * fast/repaint/dynamic-table-vertical-alignment-change.html: Added.
     8        * platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.checksum: Added.
     9        * platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.png: Added.
     10        * platform/mac/fast/repaint/dynamic-table-vertical-alignment-change-expected.txt: Added.
     11
    1122009-01-25  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r40237 r40238  
     12009-01-25  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for https://bugs.webkit.org/show_bug.cgi?id=23524, lots of missing content in table sections.
     4
     5        The new table code created a bug involving  markAllDescendantsWithFloatsForLayout, namely that it could
     6        end up marking ancestors of a block as needing layout when that block was still in the process of
     7        doing a layout.
     8
     9        The fix is to add a parameter to markAllDescendantsWithFloatsForLayout that says whether or not
     10        we are "mid-layout."  If this flag is set, then the method will make sure to do only local dirtying
     11        of objects to avoid accidentally marking a clean ancestor as needing layout again.
     12
     13        Ultimately the second parameter to setNeedsLayout and setChildNeedsLayout should just be removed,
     14        with a check of whether or not we are mid-layout being done by those methods instead.
     15
     16        Reviewed by Oliver Hunt
     17
     18        Added fast/repaint/dynamic-table-vertical-alignment-change.html
     19
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::collapseMargins):
     22        (WebCore::RenderBlock::clearFloatsIfNeeded):
     23        (WebCore::RenderBlock::layoutBlockChildren):
     24        (WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout):
     25        * rendering/RenderBlock.h:
     26        * rendering/RenderObject.cpp:
     27        (WebCore::RenderObject::removeFromObjectLists):
     28        * rendering/RenderObject.h:
     29        * rendering/RenderTableSection.cpp:
     30        (WebCore::RenderTableSection::layoutRows):
     31
    1322009-01-25  Darin Adler  <darin@apple.com>
    233
  • trunk/WebCore/rendering/RenderBlock.cpp

    r40231 r40238  
    10671067
    10681068        if (!child->avoidsFloats() && child->containsFloats())
    1069             child->markAllDescendantsWithFloatsForLayout();
     1069            static_cast<RenderBlock*>(child)->markAllDescendantsWithFloatsForLayout();
    10701070
    10711071        // Our guess was wrong. Make the child lay itself out again.
     
    11221122        child->setChildNeedsLayout(true, false);
    11231123    if (!child->avoidsFloats() && child->containsFloats())
    1124         child->markAllDescendantsWithFloatsForLayout();
     1124        static_cast<RenderBlock*>(child)->markAllDescendantsWithFloatsForLayout();
    11251125    child->layoutIfNeeded();
    11261126}
     
    13431343
    13441344        if (markDescendantsWithFloats)
    1345             child->markAllDescendantsWithFloatsForLayout();
     1345            static_cast<RenderBlock*>(child)->markAllDescendantsWithFloatsForLayout();
    13461346
    13471347        if (child->isRenderBlock())
     
    30533053}
    30543054
    3055 void RenderBlock::markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove)
    3056 {
    3057     setChildNeedsLayout(true);
     3055void RenderBlock::markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove, bool inLayout)
     3056{
     3057    setChildNeedsLayout(true, !inLayout);
    30583058
    30593059    if (floatToRemove)
     
    30653065            if (isBlockFlow() && !child->isFloatingOrPositioned() &&
    30663066                ((floatToRemove ? child->containsFloat(floatToRemove) : child->containsFloats()) || child->shrinkToAvoidFloats()))
    3067                 child->markAllDescendantsWithFloatsForLayout(floatToRemove);
     3067                static_cast<RenderBlock*>(child)->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout);
    30683068        }
    30693069    }
  • trunk/WebCore/rendering/RenderBlock.h

    r40180 r40238  
    178178    void clearFloats();
    179179    int getClearDelta(RenderBox* child);
    180     virtual void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0);
     180    void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0, bool inLayout = true);
    181181    void markPositionedObjectsForLayout();
    182182
  • trunk/WebCore/rendering/RenderObject.cpp

    r40235 r40238  
    507507{
    508508    return (style()->top().isAuto() && style()->bottom().isAuto()) || style()->top().isStatic();
    509 }
    510 
    511 void RenderObject::markAllDescendantsWithFloatsForLayout(RenderBox*)
    512 {
    513509}
    514510
     
    22722268
    22732269        if (outermostBlock)
    2274             outermostBlock->markAllDescendantsWithFloatsForLayout(toRenderBox(this));
     2270            outermostBlock->markAllDescendantsWithFloatsForLayout(toRenderBox(this), false);
    22752271    }
    22762272
  • trunk/WebCore/rendering/RenderObject.h

    r40235 r40238  
    363363    RenderObject* hoverAncestor() const;
    364364
    365     virtual void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0);
    366365    void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);
    367366    void setNeedsLayout(bool b, bool markParents = true);
  • trunk/WebCore/rendering/RenderSVGRoot.cpp

    r40143 r40238  
    108108    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    109109        if (selfNeedsLayout()) // either bounds or transform changed, force kids to relayout
    110             child->setNeedsLayout(true);
     110            child->setNeedsLayout(true, false);
    111111       
    112112        child->layoutIfNeeded();
  • trunk/WebCore/rendering/RenderTable.cpp

    r40143 r40238  
    296296    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    297297        // FIXME: What about a form that has a display value that makes it a table section?
    298         if (child->needsLayout() && !(child->element() && child->element()->hasTagName(formTag)))
     298        if (child->needsLayout() && !(child->element() && child->element()->hasTagName(formTag) && !child->isTableSection()))
    299299            child->layout();
    300300        if (child->isTableSection()) {
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r40192 r40238  
    588588    }
    589589
     590    ASSERT(!needsLayout());
     591
    590592    statePusher.pop();
    591593
Note: See TracChangeset for help on using the changeset viewer.