Chromium Code Reviews| Index: Source/core/rendering/RenderView.cpp |
| diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp |
| index c60e736890f3b9ac64c750e667cf6b9e62b1ed6f..c8c4c793544158a3cfaeab3230cb6fee37b20ea1 100644 |
| --- a/Source/core/rendering/RenderView.cpp |
| +++ b/Source/core/rendering/RenderView.cpp |
| @@ -200,8 +200,17 @@ void RenderView::layout() |
| // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. |
| bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); |
| if (relayoutChildren) { |
| - // FIXME: Should not always fully repaint on resize. |
| - setShouldDoFullRepaintAfterLayout(true); |
| + // It's hard to predict here which of full repaint or per-descendant repaint costs less. |
| + // For vertical writing mode or width change it's more likely that per-descendant repaint |
| + // eventually turns out to be full repaint but with the cost to handle more layout states |
| + // and discrete repaint rects, so marking full repaint here is more likely to cost less. |
| + // Otherwise, per-descendant repaint is more likely to avoid unnecessary full repaints. |
| + if (!style()->isHorizontalWritingMode() || width() != viewWidth()) { |
| + setShouldDoFullRepaintAfterLayout(true); |
| + } else if (RenderObject* backgroundRenderer = this->backgroundRenderer()) { |
| + if (backgroundRenderer->style()->backgroundImageNeedsFullRepaintOnContainerHeightChange()) |
| + setShouldDoFullRepaintAfterLayout(true); |
| + } |
|
esprehn
2014/05/08 20:42:03
Does this work if repaint-after-layout is turned o
Xianzhu
2014/05/08 22:31:08
Yes. This is also based on https://codereview.chro
|
| layoutScope.setChildNeedsLayout(this); |
| for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { |
| @@ -792,12 +801,18 @@ IntRect RenderView::unscaledDocumentRect() const |
| bool RenderView::rootBackgroundIsEntirelyFixed() const |
| { |
| - RenderObject* rootObject = document().documentElement() ? document().documentElement()->renderer() : 0; |
| - if (!rootObject) |
| - return false; |
| + if (RenderObject* backgroundRenderer = this->backgroundRenderer()) |
| + return backgroundRenderer->hasEntirelyFixedBackground(); |
| + return false; |
| +} |
| - RenderObject* rootRenderer = rootObject->rendererForRootBackground(); |
| - return rootRenderer->hasEntirelyFixedBackground(); |
| +RenderObject* RenderView::backgroundRenderer() const |
| +{ |
| + if (Element* documentElement = document().documentElement()) { |
| + if (RenderObject* rootObject = documentElement->renderer()) |
| + return rootObject->rendererForRootBackground(); |
| + } |
| + return 0; |
| } |
| LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const |