Changeset 19848 in webkit


Ignore:
Timestamp:
Feb 25, 2007 5:29:46 PM (17 years ago)
Author:
hyatt
Message:

Fix for regression caused by changing the containing block of positioned elements with no positioned ancestor
to be the initial containing block (represented in our tree by the RenderView). Rework RenderView's layout
to have very few special cases. Now it will just relayout its children when the width/height of the
view actually changes. Positioned elements no longer get a special additional layout, since width/height
adjustments are caught by the base class already anyway.

Reviewed by mjs, darin

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::layoutBlock):
  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock): (WebCore::RenderFlexibleBox::layoutVerticalBox):
  • rendering/RenderView.cpp: (WebCore::RenderView::RenderView): (WebCore::RenderView::layout):
  • rendering/RenderView.h:
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19847 r19848  
     12007-02-25  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for regression caused by changing the containing block of positioned elements with no positioned ancestor
     4        to be the initial containing block (represented in our tree by the RenderView).  Rework RenderView's layout
     5        to have very few special cases.   Now it will just relayout its children when the width/height of the
     6        view actually changes.  Positioned elements no longer get a special additional layout, since width/height
     7        adjustments are caught by the base class already anyway.
     8
     9        Reviewed by mjs, darin
     10
     11        * rendering/RenderBlock.cpp:
     12        (WebCore::RenderBlock::layoutBlock):
     13        * rendering/RenderFlexibleBox.cpp:
     14        (WebCore::RenderFlexibleBox::layoutBlock):
     15        (WebCore::RenderFlexibleBox::layoutVerticalBox):
     16        * rendering/RenderView.cpp:
     17        (WebCore::RenderView::RenderView):
     18        (WebCore::RenderView::layout):
     19        * rendering/RenderView.h:
     20
    1212007-02-25  Maciej Stachowiak  <mjs@apple.com>
    222
  • trunk/WebCore/rendering/RenderBlock.cpp

    r19785 r19848  
    575575    // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
    576576    // we overflow or not.
    577     RenderObject* flexbox = view()->flexBoxInFirstLayout();
    578     if (hasOverflowClip() && !(flexbox && flexbox != this && isDescendantOf(flexbox)))
     577    if (hasOverflowClip())
    579578        m_layer->updateScrollInfoAfterLayout();
    580579
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r19784 r19848  
    325325    // Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if
    326326    // we overflow or not.
    327     RenderObject* flexbox = view()->flexBoxInFirstLayout();
    328     if (hasOverflowClip() && !(flexbox && flexbox != this && isDescendantOf(flexbox)))
     327    if (hasOverflowClip())
    329328        m_layer->updateScrollInfoAfterLayout();
    330329
     
    806805    // out within the box.
    807806    do {
    808    
    809         if (view()->flexBoxInFirstLayout() == this)
    810             view()->setFlexBoxInFirstLayout(0);
    811         else if (!view()->flexBoxInFirstLayout())
    812             view()->setFlexBoxInFirstLayout(this);
    813            
    814807        m_height = borderTop() + paddingTop();
    815808        int minHeight = m_height + toAdd;
  • trunk/WebCore/rendering/RenderView.cpp

    r19828 r19848  
    4141    , m_printImages(true)
    4242    , m_maximalOutlineSize(0)
    43     , m_flexBoxInFirstLayout(0)
    4443{
    4544    // Clear our anonymous bit, set because RenderObject assumes
     
    9695        m_minWidth = m_width;
    9796
    98     // FIXME: This is all just a terrible workaround for bugs in layout when the view height changes.
    99     // Find a better way to detect view height changes.  We're guessing that if we don't need layout that the reason
    100     // we were called is because of a FrameView bounds change.
    101     if (!needsLayout()) {
     97    bool relayoutChildren = !printing() && (!m_frameView || m_width != m_frameView->visibleWidth() || m_height != m_frameView->visibleHeight());
     98    if (relayoutChildren)
    10299        setChildNeedsLayout(true, false);
    103         setMinMaxKnown(false);
    104         for (RenderObject* c = firstChild(); c; c = c->nextSibling())
    105             c->setChildNeedsLayout(true, false);
    106     }
    107100
    108101    if (recalcMinMax())
    109102        recalcMinMaxWidths();
    110 
    111     RenderBlock::layout();
    112 
    113     int docw = docWidth();
    114     int doch = docHeight();
    115 
    116     if (!printing()) {
    117         setWidth(m_frameView->visibleWidth());
    118         setHeight(m_frameView->visibleHeight());
    119     }
    120 
    121     // FIXME: we could maybe do the call below better and only pass true if the docsize changed.
    122     layoutPositionedObjects(true);
    123 
    124     layer()->setHeight(max(doch, m_height));
    125     layer()->setWidth(max(docw, m_width));
     103   
     104    if (needsLayout())
     105        RenderBlock::layout();
     106
     107    setOverflowWidth(max(docWidth(), m_width));
     108    setOverflowHeight(max(docHeight(), m_height));
    126109
    127110    setNeedsLayout(false);
  • trunk/WebCore/rendering/RenderView.h

    r19492 r19848  
    9191    void removeWidget(RenderObject*);
    9292
    93     void setFlexBoxInFirstLayout(RenderObject* r) { m_flexBoxInFirstLayout = r; }
    94     RenderObject* flexBoxInFirstLayout() { return m_flexBoxInFirstLayout; }
    95 
    9693    const IntSize& layoutDelta() const { return m_layoutDelta; }
    9794    void addLayoutDelta(const IntSize& delta) { m_layoutDelta += delta; }
     
    116113    RenderObjectSet m_widgets;
    117114
    118     RenderObject* m_flexBoxInFirstLayout;
    119 
    120115private:
    121116    int m_bestTruncatedAt;
Note: See TracChangeset for help on using the changeset viewer.