Commit 354b1a42 authored by hyatt's avatar hyatt

Fix for livepage.apple.com slowness. Ensure that

	clipped regions only paint their own rectangles
	when they or any children inside of them need to
	be reflowed.

	This fix is intended as an interim band-aid for a much
	larger problem (that all of layout doesn't just auto-invalidate
	the regions it needs to, and that DHTML doesn't have
	specialized behavior to avoid async repainting or even
	relayout when only a repaint is required).

        * khtml/khtmlview.cpp:
        (KHTMLView::timerEvent):
        * khtml/rendering/render_container.cpp:
        (RenderContainer::removeChildNode):
        (RenderContainer::appendChildNode):
        (RenderContainer::insertChildNode):
        (RenderContainer::layout):
        * khtml/rendering/render_object.cpp:
        (RenderObject::setLayouted):
        (RenderObject::scheduleRelayout):
        * khtml/rendering/render_root.cpp:
        (RenderRoot::repaintRectangle):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d20075d4
2002-11-15 David Hyatt <hyatt@apple.com>
Fix for livepage.apple.com slowness. Ensure that
clipped regions only paint their own rectangles
when they or any children inside of them need to
be reflowed.
This fix is intended as an interim band-aid for a much
larger problem (that all of layout doesn't just auto-invalidate
the regions it needs to, and that DHTML doesn't have
specialized behavior to avoid async repainting or even
relayout when only a repaint is required).
* khtml/khtmlview.cpp:
(KHTMLView::timerEvent):
* khtml/rendering/render_container.cpp:
(RenderContainer::removeChildNode):
(RenderContainer::appendChildNode):
(RenderContainer::insertChildNode):
(RenderContainer::layout):
* khtml/rendering/render_object.cpp:
(RenderObject::setLayouted):
(RenderObject::scheduleRelayout):
* khtml/rendering/render_root.cpp:
(RenderRoot::repaintRectangle):
2002-11-15 David Hyatt <hyatt@apple.com>
Fix the problem where the last lines of paragrpahs were getting
......
2002-11-15 David Hyatt <hyatt@apple.com>
Fix for livepage.apple.com slowness. Ensure that
clipped regions only paint their own rectangles
when they or any children inside of them need to
be reflowed.
This fix is intended as an interim band-aid for a much
larger problem (that all of layout doesn't just auto-invalidate
the regions it needs to, and that DHTML doesn't have
specialized behavior to avoid async repainting or even
relayout when only a repaint is required).
* khtml/khtmlview.cpp:
(KHTMLView::timerEvent):
* khtml/rendering/render_container.cpp:
(RenderContainer::removeChildNode):
(RenderContainer::appendChildNode):
(RenderContainer::insertChildNode):
(RenderContainer::layout):
* khtml/rendering/render_object.cpp:
(RenderObject::setLayouted):
(RenderObject::scheduleRelayout):
* khtml/rendering/render_root.cpp:
(RenderRoot::repaintRectangle):
2002-11-15 David Hyatt <hyatt@apple.com>
Fix the problem where the last lines of paragrpahs were getting
......
2002-11-15 David Hyatt <hyatt@apple.com>
Fix for livepage.apple.com slowness. Ensure that
clipped regions only paint their own rectangles
when they or any children inside of them need to
be reflowed.
This fix is intended as an interim band-aid for a much
larger problem (that all of layout doesn't just auto-invalidate
the regions it needs to, and that DHTML doesn't have
specialized behavior to avoid async repainting or even
relayout when only a repaint is required).
* khtml/khtmlview.cpp:
(KHTMLView::timerEvent):
* khtml/rendering/render_container.cpp:
(RenderContainer::removeChildNode):
(RenderContainer::appendChildNode):
(RenderContainer::insertChildNode):
(RenderContainer::layout):
* khtml/rendering/render_object.cpp:
(RenderObject::setLayouted):
(RenderObject::scheduleRelayout):
* khtml/rendering/render_root.cpp:
(RenderRoot::repaintRectangle):
2002-11-15 David Hyatt <hyatt@apple.com>
Fix the problem where the last lines of paragrpahs were getting
......
......@@ -1460,7 +1460,7 @@ void KHTMLView::timerEvent ( QTimerEvent *e )
d->timerId = 0;
//scheduleRepaint(contentsX(),contentsY(),visibleWidth(),visibleHeight());
d->updateRect = QRect(contentsX(),contentsY(),visibleWidth(),visibleHeight());
d->updateRect = QRect(contentsX(),contentsY(),visibleWidth(),visibleHeight());
}
if( m_part->xmlDocImpl() ) {
......
......@@ -183,10 +183,9 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
oldChild->setNextSibling(0);
oldChild->setParent(0);
setLayouted( false );
setMinMaxKnown( false );
setLayouted( false );
return oldChild;
}
......@@ -252,12 +251,13 @@ void RenderContainer::appendChildNode(RenderObject* newChild)
setFirstChild(newChild);
setLastChild(newChild);
newChild->setLayouted( false );
newChild->setMinMaxKnown( false );
// Keep our layer hierarchy updated.
if (newChild->layer())
enclosingLayer()->addChild(newChild->layer());
newChild->setMinMaxKnown( false );
newChild->setLayouted( false );
}
void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeChild)
......@@ -282,14 +282,15 @@ void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeC
child->setPreviousSibling(prev);
child->setParent(this);
child->setLayouted( false );
child->setMinMaxKnown( false );
// Keep our layer hierarchy updated.
// XXX Need this to do an insertion and really find the right place to
// put the new layer. -dwh
if (child->layer())
enclosingLayer()->addChild(child->layer());
child->setMinMaxKnown( false );
child->setLayouted( false );
}
......@@ -300,9 +301,9 @@ void RenderContainer::layout()
RenderObject *child = firstChild();
while( child ) {
if( !child->layouted() )
child->layout();
child = child->nextSibling();
if( !child->layouted() )
child->layout();
child = child->nextSibling();
}
setLayouted();
}
......
......@@ -220,6 +220,13 @@ RenderObject* RenderObject::offsetParent() const
return curr;
}
// This function now contains a rather unsavory hack. If an attempt is made to
// setLayout(false) an object inside a clipped (overflow:hidden) object, we just
// lay that object out immediately and then repaint only the clipped rectangle.
// scheduleRelayout always causes a full repaint, so we have to avoid it. This
// is gross, and we want to fix scheduleRelayout not to always do a full repaint
// in the future. -dwh
static RenderObject* gClipObject = 0;
void RenderObject::setLayouted(bool b)
{
m_layouted = b;
......@@ -234,12 +241,28 @@ void RenderObject::setLayouted(bool b)
else {
RenderObject *o = m_parent;
RenderObject *root = this;
RenderObject* clippedObj = (style()->overflow() == OHIDDEN) ? this : 0;
while( o ) {
o->m_layouted = false;
if (o->style()->overflow() == OHIDDEN && !clippedObj)
clippedObj = o;
root = o;
o = o->m_parent;
}
root->scheduleRelayout();
if (!gClipObject) {
if (clippedObj) {
gClipObject = clippedObj;
root->layout();
clippedObj->repaintRectangle(0,0,clippedObj->contentWidth(),clippedObj->contentHeight());
gClipObject = 0;
}
else
root->scheduleRelayout();
}
}
}
......@@ -1148,7 +1171,7 @@ void RenderObject::scheduleRelayout()
if (!isRoot()) return;
KHTMLView *view = static_cast<RenderRoot *>(this)->view();
if ( view )
view->scheduleRelayout();
view->scheduleRelayout();
}
......
......@@ -245,7 +245,9 @@ void RenderRoot::repaintRectangle(int x, int y, int w, int h, bool f)
QRect ur(x, y, w, h);
if (ur.intersects(vr))
if (m_view) m_view->scheduleRepaint(x, y, w, h);
if (m_view)
//m_view->updateContents(ur);
m_view->scheduleRepaint(x, y, w, h);
}
void RenderRoot::repaint()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment