Changeset 50623 in webkit


Ignore:
Timestamp:
Nov 8, 2009 9:32:07 AM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/7363434> Crash inside RenderObject::localToAbsolute
below FrameView::layout
https://bugs.webkit.org/show_bug.cgi?id=31093

Reviewed by Simon Fraser.

WebCore:

Test: fast/block/positioning/relative-positioned-inline-container.html

In <http://trac.webkit.org/changeset/19148>, setStaticY() was changed
to mark the object for layout, doing so without marking its ancestors.
However, RenderBlock::skipLeadingWhitespace and
RenderBlock::skipTrailingWhitespace() call setStaticY() on a relative-
positioned inline container, causing it to be marked for layout without
ever going back to give it layout, and thus layout could end with a
dirty object still in the tree, leading to all sorts of badness.

The fix is to revert setStaticY() to not marking the object dirty, and
instead do it in the call sites that require it, which are in
RenderBlock and RenderFlexibleBox.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::adjustPositionedBlock):

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::layoutHorizontalBox):
(WebCore::RenderFlexibleBox::layoutVerticalBox):

  • rendering/RenderLayer.cpp:
  • rendering/RenderLayer.h:

(WebCore::RenderLayer::setStaticY):

LayoutTests:

  • fast/block/positioning/relative-positioned-inline-container-expected.checksum: Added.
  • fast/block/positioning/relative-positioned-inline-container-expected.png: Added.
  • fast/block/positioning/relative-positioned-inline-container-expected.txt: Added.
  • fast/block/positioning/relative-positioned-inline-container.html: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r50617 r50623  
     12009-11-08  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7363434> Crash inside RenderObject::localToAbsolute
     6        below FrameView::layout
     7        https://bugs.webkit.org/show_bug.cgi?id=31093
     8
     9        * fast/block/positioning/relative-positioned-inline-container-expected.checksum: Added.
     10        * fast/block/positioning/relative-positioned-inline-container-expected.png: Added.
     11        * fast/block/positioning/relative-positioned-inline-container-expected.txt: Added.
     12        * fast/block/positioning/relative-positioned-inline-container.html: Added.
     13
    1142009-11-07  Dirk Pranke  <dpranke@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r50618 r50623  
     12009-11-08  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7363434> Crash inside RenderObject::localToAbsolute
     6        below FrameView::layout
     7        https://bugs.webkit.org/show_bug.cgi?id=31093
     8
     9        Test: fast/block/positioning/relative-positioned-inline-container.html
     10
     11        In <http://trac.webkit.org/changeset/19148>, setStaticY() was changed
     12        to mark the object for layout, doing so without marking its ancestors.
     13        However, RenderBlock::skipLeadingWhitespace and
     14        RenderBlock::skipTrailingWhitespace() call setStaticY() on a relative-
     15        positioned inline container, causing it to be marked for layout without
     16        ever going back to give it layout, and thus layout could end with a
     17        dirty object still in the tree, leading to all sorts of badness.
     18
     19        The fix is to revert setStaticY() to not marking the object dirty, and
     20        instead do it in the call sites that require it, which are in
     21        RenderBlock and RenderFlexibleBox.
     22
     23        * rendering/RenderBlock.cpp:
     24        (WebCore::RenderBlock::adjustPositionedBlock):
     25        * rendering/RenderFlexibleBox.cpp:
     26        (WebCore::RenderFlexibleBox::layoutHorizontalBox):
     27        (WebCore::RenderFlexibleBox::layoutVerticalBox):
     28        * rendering/RenderLayer.cpp:
     29        * rendering/RenderLayer.h:
     30        (WebCore::RenderLayer::setStaticY):
     31
    1322009-11-07  Daniel Bates  <dbates@webkit.org>
    233
  • trunk/WebCore/rendering/RenderBlock.cpp

    r50466 r50623  
    868868            y += (collapsedTopPos - collapsedTopNeg) - marginTop;
    869869        }
    870         child->layer()->setStaticY(y);
     870        RenderLayer* childLayer = child->layer();
     871        if (childLayer->staticY() != y) {
     872            child->layer()->setStaticY(y);
     873            child->setChildNeedsLayout(true, false);
     874        }
    871875    }
    872876}
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r47440 r50623  
    411411                    else child->layer()->setStaticX(width() - xPos);
    412412                }
    413                 if (child->style()->hasStaticY())
    414                     child->layer()->setStaticY(yPos);
     413                if (child->style()->hasStaticY()) {
     414                    RenderLayer* childLayer = child->layer();
     415                    if (childLayer->staticY() != yPos) {
     416                        child->layer()->setStaticY(yPos);
     417                        child->setChildNeedsLayout(true, false);
     418                    }
     419                }
    415420                child = iterator.next();
    416421                continue;
     
    770775                        child->layer()->setStaticX(borderRight()+paddingRight());
    771776                }
    772                 if (child->style()->hasStaticY())
    773                     child->layer()->setStaticY(height());
     777                if (child->style()->hasStaticY()) {
     778                    RenderLayer* childLayer = child->layer();
     779                    if (childLayer->staticY() != height()) {
     780                        child->layer()->setStaticY(height());
     781                        child->setChildNeedsLayout(true, false);
     782                    }
     783                }
    774784                child = iterator.next();
    775785                continue;
  • trunk/WebCore/rendering/RenderLayer.cpp

    r49753 r50623  
    244244}
    245245
    246 void RenderLayer::setStaticY(int staticY)
    247 {
    248     if (m_staticY == staticY)
    249         return;
    250     m_staticY = staticY;
    251     renderer()->setChildNeedsLayout(true, false);
    252 }
    253 
    254246void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags)
    255247{
  • trunk/WebCore/rendering/RenderLayer.h

    r49753 r50623  
    391391    int staticY() const { return m_staticY; }
    392392    void setStaticX(int staticX) { m_staticX = staticX; }
    393     void setStaticY(int staticY);
     393    void setStaticY(int staticY) { m_staticY = staticY; }
    394394
    395395    bool hasTransform() const { return renderer()->hasTransform(); }
Note: See TracChangeset for help on using the changeset viewer.