Commit d9462a52 authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Darin Adler.

        - fix https://bugs.webkit.org/show_bug.cgi?id=15129
          <rdar://problem/4644824> adding a new line with DOM does unnecessary additional repaint

        Covered by fast/repaint/4776765.html

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlock): Avoid repainting this object if it
        did not have layout in the beginning.
        (WebCore::RenderBlock::layoutBlockChildren): If a child did not have
        layout in the beginning, repaint it in its new position, to compensate
        for the above (regardless of whether it "moved").
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::checkForRepaintDuringLayout): Added a comment
        about generalizing this fix in the future.

LayoutTests:

        Reviewed by Darin Adler.

        - updated results for https://bugs.webkit.org/show_bug.cgi?id=15129
          <rdar://problem/4644824> adding a new line with DOM does unnecessary additional repaint

        * platform/mac/fast/repaint/4776765-expected.checksum:
        * platform/mac/fast/repaint/4776765-expected.png:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ce5a0b3a
2008-09-16 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- updated results for https://bugs.webkit.org/show_bug.cgi?id=15129
<rdar://problem/4644824> adding a new line with DOM does unnecessary additional repaint
* platform/mac/fast/repaint/4776765-expected.checksum:
* platform/mac/fast/repaint/4776765-expected.png:
2008-09-16 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
......
a5f367ab983b2114cc7626bdf53d1393
\ No newline at end of file
345ad944b1ea8f26f2863d18eb7c9048
\ No newline at end of file
2008-09-16 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix https://bugs.webkit.org/show_bug.cgi?id=15129
<rdar://problem/4644824> adding a new line with DOM does unnecessary additional repaint
Covered by fast/repaint/4776765.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock): Avoid repainting this object if it
did not have layout in the beginning.
(WebCore::RenderBlock::layoutBlockChildren): If a child did not have
layout in the beginning, repaint it in its new position, to compensate
for the above (regardless of whether it "moved").
* rendering/RenderObject.cpp:
(WebCore::RenderObject::checkForRepaintDuringLayout): Added a comment
about generalizing this fix in the future.
2008-09-16 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
......
......@@ -582,7 +582,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
IntRect oldBounds;
IntRect oldOutlineBox;
bool checkForRepaint = checkForRepaintDuringLayout();
bool checkForRepaint = m_everHadLayout && checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
......@@ -1279,7 +1279,10 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
// run-ins. When we encounter these four types of objects, we don't actually lay them out as normal flow blocks.
bool handled = false;
RenderObject* next = handleSpecialChild(child, marginInfo, compactInfo, handled);
if (handled) { child = next; continue; }
if (handled) {
child = next;
continue;
}
// The child is a normal flow object. Compute its vertical margins now.
child->calcVerticalMargins();
......@@ -1319,6 +1322,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
if (child->isRenderBlock())
previousFloatBottom = max(previousFloatBottom, oldRect.y() + static_cast<RenderBlock*>(child)->floatBottom());
bool childHadLayout = child->m_everHadLayout;
bool childNeededLayout = child->needsLayout();
if (childNeededLayout)
child->layout();
......@@ -1364,10 +1368,13 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
// If the child moved, we have to repaint it as well as any floating/positioned
// descendants. An exception is if we need a layout. In this case, we know we're going to
// repaint ourselves (and the child) anyway.
if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
if (childHadLayout && !selfNeedsLayout() && child->checkForRepaintDuringLayout())
child->repaintDuringLayoutIfMoved(oldRect);
}
if (!childHadLayout && child->checkForRepaintDuringLayout())
child->repaint();
child = child->nextSibling();
}
......
......@@ -1960,6 +1960,9 @@ void RenderObject::repaintOverhangingFloats(bool paintAllDescendants)
bool RenderObject::checkForRepaintDuringLayout() const
{
// FIXME: <https://bugs.webkit.org/show_bug.cgi?id=20885> It is probably safe to also require
// m_everHadLayout. Currently, only RenderBlock::layoutBlock() adds this condition. See also
// <https://bugs.webkit.org/show_bug.cgi?id=15129>.
return !document()->view()->needsFullRepaint() && !hasLayer();
}
......
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