Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1391)

Unified Diff: Source/core/rendering/RenderView.cpp

Issue 275543003: Don't always fully repaint on viewport resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/style/FillLayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderView.cpp
diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp
index d7d3b7b7eec0e004c114ec3893663289d67c91f8..ef34168d5c4cd1d7ea98613e72378c50f26b5f1e 100644
--- a/Source/core/rendering/RenderView.cpp
+++ b/Source/core/rendering/RenderView.cpp
@@ -185,6 +185,30 @@ void RenderView::checkLayoutState()
}
#endif
+bool RenderView::shouldDoFullRepaintForNextLayout() const
+{
+ // 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 (shouldUsePrintingLayout())
+ return true;
+
+ if (!style()->isHorizontalWritingMode() || width() != viewWidth())
+ return true;
+
+ if (height() != viewHeight()) {
+ if (RenderObject* backgroundRenderer = this->backgroundRenderer()) {
+ if (backgroundRenderer->style()->backgroundImageNeedsFullRepaintOnContainerHeightChange())
+ return true;
+ }
+ }
+
+ return false;
+}
+
void RenderView::layout()
{
if (!document().paginated())
@@ -787,12 +811,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();
esprehn 2014/05/20 22:27:09 I'm not sure this is always correct, if the <body>
Xianzhu 2014/05/20 22:49:42 rendererForRootBackground() will return <body>'s r
+ }
+ return 0;
}
LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/style/FillLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698