Changeset 27952 in webkit


Ignore:
Timestamp:
Nov 21, 2007 9:23:20 PM (16 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Eric Seidel.

  • fix <rdar://problem/5607037> REGRESSION (r27351): Departure date does not repaint when changed on Google Maps public transit planner (16034)

Test: fast/repaint/subtree-root-skipped.html

  • page/FrameView.cpp: (WebCore::FrameViewPrivate::FrameViewPrivate): Initialize the layout root to 0. (WebCore::FrameView::layoutRoot): Changed to return a RenderObject instead of a Node. (WebCore::FrameView::layout): Changed for layout root being a renderer rather than a DOM node. Also replaced clearing the repaint rects set with asserting that it is empty if this is the top-level call to layout(). If it is not, the set may contain rects from enclosing layout() and those should not be removed. (WebCore::FrameView::scheduleRelayout): Changed for layout root being a renderer rather than a DOM node. (WebCore::isObjectAncestorContainerOf): Added this helper function that tests whether one object will be marked by calling markContainingBlocksForLayout() on the other. (WebCore::FrameView::scheduleRelayoutOfSubtree): Changed for layout root being a renderer rather than a DOM node. Changed the check if new and current layout roots are on the same path from the root to use the subgraph of the render tree defined by container()hood instead of the DOM tree and parenthood.
  • page/FrameView.h:
  • rendering/RenderBox.cpp: (WebCore::RenderBox::calcWidth): Changed for layout root being a renderer rather than a DOM node.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::~RenderObject): Added an assertion that the object being deleted is not currently the layout root. (WebCore::RenderObject::scheduleRelayout): Changed for layout root being a renderer rather than a DOM node.

LayoutTests:

Reviewed by Eric Seidel.

  • repaint test for <rdar://problem/5607037> REGRESSION (r27351): Departure date does not repaint when changed on Google Maps public transit planner (16034)
  • fast/repaint/subtree-root-skipped.html: Added.
  • platform/mac-leopard/fast/repaint/subtree-root-skipped-expected.checksum: Added.
  • platform/mac-leopard/fast/repaint/subtree-root-skipped-expected.png: Added.
  • platform/mac/fast/repaint/subtree-root-skipped-expected.txt: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r27939 r27952  
     12007-11-21  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        - repaint test for <rdar://problem/5607037> REGRESSION (r27351): Departure date does not repaint when changed on Google Maps public transit planner (16034)
     6
     7        * fast/repaint/subtree-root-skipped.html: Added.
     8        * platform/mac-leopard/fast/repaint/subtree-root-skipped-expected.checksum: Added.
     9        * platform/mac-leopard/fast/repaint/subtree-root-skipped-expected.png: Added.
     10        * platform/mac/fast/repaint/subtree-root-skipped-expected.txt: Added.
     11
    1122007-11-21  Alexey Proskuryakov  <ap@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r27951 r27952  
     12007-11-21  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        - fix <rdar://problem/5607037> REGRESSION (r27351): Departure date does not repaint when changed on Google Maps public transit planner (16034)
     6
     7        Test: fast/repaint/subtree-root-skipped.html
     8
     9        * page/FrameView.cpp:
     10        (WebCore::FrameViewPrivate::FrameViewPrivate): Initialize the layout
     11        root to 0.
     12        (WebCore::FrameView::layoutRoot): Changed to return a RenderObject
     13        instead of a Node.
     14        (WebCore::FrameView::layout): Changed for layout root being a renderer
     15        rather than a DOM node. Also replaced clearing the repaint rects
     16        set with asserting that it is empty if this is the top-level call to
     17        layout(). If it is not, the set may contain rects from enclosing
     18        layout() and those should not be removed.
     19        (WebCore::FrameView::scheduleRelayout): Changed for layout root being
     20        a renderer rather than a DOM node.
     21        (WebCore::isObjectAncestorContainerOf): Added this helper function that
     22        tests whether one object will be marked by calling
     23        markContainingBlocksForLayout() on the other.
     24        (WebCore::FrameView::scheduleRelayoutOfSubtree): Changed for layout
     25        root being a renderer rather than a DOM node. Changed the check if new
     26        and current layout roots are on the same path from the root to use
     27        the subgraph of the render tree defined by container()hood instead of
     28        the DOM tree and parenthood.
     29        * page/FrameView.h:
     30        * rendering/RenderBox.cpp:
     31        (WebCore::RenderBox::calcWidth): Changed for layout root being a
     32        renderer rather than a DOM node.
     33        * rendering/RenderObject.cpp:
     34        (WebCore::RenderObject::~RenderObject): Added an assertion that the
     35        object being deleted is not currently the layout root.
     36        (WebCore::RenderObject::scheduleRelayout): Changed for layout root being
     37        a renderer rather than a DOM node.
     38
    1392007-11-21  Mark Rowe  <mrowe@apple.com>
    240
  • trunk/WebCore/page/FrameView.cpp

    r27351 r27952  
    5858        : m_slowRepaintObjectCount(0)
    5959        , layoutTimer(view, &FrameView::layoutTimerFired)
     60        , layoutRoot(0)
    6061        , m_mediaType("screen")
    6162        , m_enqueueEvents(0)
     
    100101    Timer<FrameView> layoutTimer;
    101102    bool delayedLayout;
    102     RefPtr<Node> layoutRoot;
     103    RenderObject* layoutRoot;
    103104   
    104105    bool layoutSchedulingEnabled;
     
    284285}
    285286
    286 Node* FrameView::layoutRoot() const
    287 {
    288     return layoutPending() ? 0 : d->layoutRoot.get();
     287RenderObject* FrameView::layoutRoot() const
     288{
     289    return layoutPending() ? 0 : d->layoutRoot;
    289290}
    290291
     
    313314
    314315    if (!allowSubtree && d->layoutRoot) {
    315         if (d->layoutRoot->renderer())
    316             d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
     316        d->layoutRoot->markContainingBlocksForLayout(false);
    317317        d->layoutRoot = 0;
    318318    }
     
    336336   
    337337    bool subtree = d->layoutRoot;
    338     Node* rootNode = subtree ? d->layoutRoot.get() : document;
    339338
    340339    // If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
     
    343342        return;
    344343
    345     RenderObject* root = rootNode->renderer();
     344    RenderObject* root = subtree ? d->layoutRoot : document->renderer();
    346345    if (!root) {
    347346        // FIXME: Do we need to set m_size here?
     
    356355   
    357356    if (!subtree) {
    358         Document* document = static_cast<Document*>(rootNode);
    359357        RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0;
    360358        if (document->isHTMLDocument()) {
     
    385383
    386384    d->doFullRepaint = !subtree && (d->firstLayout || static_cast<RenderView*>(root)->printing());
    387     d->repaintRects.clear();
     385    ASSERT(d->nestedLayoutCount > 1 || d->repaintRects.isEmpty());
    388386
    389387    bool didFirstLayout = false;
     
    690688
    691689    if (d->layoutRoot) {
    692         if (d->layoutRoot->renderer())
    693             d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
     690        d->layoutRoot->markContainingBlocksForLayout(false);
    694691        d->layoutRoot = 0;
    695692    }
     
    716713}
    717714
    718 void FrameView::scheduleRelayoutOfSubtree(Node* n)
     715static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant)
     716{
     717    for (RenderObject* r = descendant; r; r = r->container()) {
     718        if (r == ancestor)
     719            return true;
     720    }
     721    return false;
     722}
     723
     724void FrameView::scheduleRelayoutOfSubtree(RenderObject* o)
    719725{
    720726    ASSERT(m_frame->view() == this);
     
    723729            && m_frame->document()->renderer()
    724730            && m_frame->document()->renderer()->needsLayout())) {
    725         if (n->renderer())
    726             n->renderer()->markContainingBlocksForLayout(false);
     731        if (o)
     732            o->markContainingBlocksForLayout(false);
    727733        return;
    728734    }
    729735
    730736    if (layoutPending()) {
    731         if (d->layoutRoot != n) {
    732             if (n->isDescendantOf(d->layoutRoot.get())) {
     737        if (d->layoutRoot != o) {
     738            if (isObjectAncestorContainerOf(d->layoutRoot, o)) {
    733739                // Keep the current root
    734                 if (n->renderer())
    735                     n->renderer()->markContainingBlocksForLayout(false);
    736             } else if (d->layoutRoot && d->layoutRoot->isDescendantOf(n)) {
    737                 // Re-root at n
    738                 if (d->layoutRoot->renderer())
    739                     d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
    740                 d->layoutRoot = n;
     740                o->markContainingBlocksForLayout(false);
     741            } else if (d->layoutRoot && isObjectAncestorContainerOf(o, d->layoutRoot)) {
     742                // Re-root at o
     743                d->layoutRoot->markContainingBlocksForLayout(false);
     744                d->layoutRoot = o;
    741745            } else {
    742746                // Just do a full relayout
    743                 if (d->layoutRoot && d->layoutRoot->renderer())
    744                     d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
     747                if (d->layoutRoot)
     748                    d->layoutRoot->markContainingBlocksForLayout(false);
    745749                d->layoutRoot = 0;
    746                 if (n->renderer())
    747                     n->renderer()->markContainingBlocksForLayout(false);
     750                o->markContainingBlocksForLayout(false);
    748751            }
    749752        }
    750753    } else {
    751754        int delay = m_frame->document()->minimumLayoutDelay();
    752         d->layoutRoot = n;
     755        d->layoutRoot = o;
    753756        d->delayedLayout = delay != 0;
    754757        d->layoutTimer.startOneShot(delay * 0.001);
  • trunk/WebCore/page/FrameView.h

    r27598 r27952  
    7373    void layoutTimerFired(Timer<FrameView>*);
    7474    void scheduleRelayout();
    75     void scheduleRelayoutOfSubtree(Node*);
     75    void scheduleRelayoutOfSubtree(RenderObject*);
    7676    void unscheduleRelayout();
    7777    bool layoutPending() const;
    7878
    79     Node* layoutRoot() const;
     79    RenderObject* layoutRoot() const;
    8080    int layoutCount() const;
    8181
  • trunk/WebCore/rendering/RenderBox.cpp

    r27743 r27952  
    10821082
    10831083    // If layout is limited to a subtree, the subtree root's width does not change.
    1084     if (node() && view()->frameView() && view()->frameView()->layoutRoot() == node())
     1084    if (node() && view()->frameView() && view()->frameView()->layoutRoot() == this)
    10851085        return;
    10861086
  • trunk/WebCore/rendering/RenderObject.cpp

    r27611 r27952  
    202202RenderObject::~RenderObject()
    203203{
     204    ASSERT(!node() || !document()->frame()->view() || document()->frame()->view()->layoutRoot() != this);
    204205#ifndef NDEBUG
    205206    --RenderObjectCounter::count;
     
    27342735        FrameView* v = view() ? view()->frameView() : 0;
    27352736        if (v)
    2736             v->scheduleRelayoutOfSubtree(node());
     2737            v->scheduleRelayoutOfSubtree(this);
    27372738    }
    27382739}
Note: See TracChangeset for help on using the changeset viewer.