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

Unified Diff: third_party/WebKit/Source/core/paint/ViewPainter.cpp

Issue 1472083006: Root layer scrolling: set correct size for document's main GraphicsLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@garden
Patch Set: reuse boundingBoxForCompositing in ViewPainter Created 5 years 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 | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/ViewPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/ViewPainter.cpp b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
index 5a4f838c15ec73ac74e8056b2c90e4835ffff57c..c1eb6d11529ee9619f6329a228d0ce3c33e23c8d 100644
--- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
@@ -55,7 +55,8 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutView, DisplayItem::BoxDecorationBackground, LayoutPoint()))
return;
- IntRect documentRect = m_layoutView.documentRect();
+ // The background fill rect is the size of the LayoutView's main GraphicsLayer.
+ IntRect backgroundRect = pixelSnappedIntRect(m_layoutView.layer()->boundingBoxForCompositing());
const Document& document = m_layoutView.document();
const FrameView& frameView = *m_layoutView.frameView();
bool isMainFrame = !document.ownerElement();
@@ -65,14 +66,14 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
Color rootBackgroundColor = m_layoutView.style()->visitedDependentColor(CSSPropertyBackgroundColor);
const LayoutObject* rootObject = document.documentElement() ? document.documentElement()->layoutObject() : nullptr;
- LayoutObjectDrawingRecorder recorder(context, m_layoutView, DisplayItem::BoxDecorationBackground, documentRect, LayoutPoint());
+ LayoutObjectDrawingRecorder recorder(context, m_layoutView, DisplayItem::BoxDecorationBackground, backgroundRect, LayoutPoint());
// Special handling for print economy mode.
bool forceBackgroundToWhite = BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(m_layoutView.styleRef(), document);
if (forceBackgroundToWhite) {
// If for any reason the view background is not transparent, paint white instead, otherwise keep transparent as is.
if (paintsBaseBackground || rootBackgroundColor.alpha() || m_layoutView.style()->backgroundLayers().image())
- context.fillRect(documentRect, Color::white, SkXfermode::kSrc_Mode);
+ context.fillRect(backgroundRect, Color::white, SkXfermode::kSrc_Mode);
return;
}
@@ -84,7 +85,7 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
// we need to apply inverse transform on the document rect to get to the root element space.
bool backgroundRenderable = true;
TransformationMatrix transform;
- IntRect paintRect = documentRect;
+ IntRect paintRect = backgroundRect;
if (!rootObject || !rootObject->isBox()) {
backgroundRenderable = false;
} else if (rootObject->hasLayer()) {
@@ -98,16 +99,16 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
backgroundRenderable = false;
} else {
bool isClamped;
- paintRect = transform.inverse().projectQuad(FloatQuad(documentRect), &isClamped).enclosingBoundingBox();
+ paintRect = transform.inverse().projectQuad(FloatQuad(backgroundRect), &isClamped).enclosingBoundingBox();
backgroundRenderable = !isClamped;
}
}
if (!backgroundRenderable) {
if (baseBackgroundColor.alpha())
- context.fillRect(documentRect, baseBackgroundColor, shouldClearCanvas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
+ context.fillRect(backgroundRect, baseBackgroundColor, shouldClearCanvas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
else if (shouldClearCanvas)
- context.fillRect(documentRect, Color(), SkXfermode::kClear_Mode);
+ context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode);
return;
}
@@ -126,15 +127,15 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
if (shouldDrawBackgroundInSeparateBuffer) {
if (baseBackgroundColor.alpha())
- context.fillRect(documentRect, baseBackgroundColor, shouldClearCanvas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
+ context.fillRect(backgroundRect, baseBackgroundColor, shouldClearCanvas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
context.beginLayer();
}
Color combinedBackgroundColor = shouldDrawBackgroundInSeparateBuffer ? rootBackgroundColor : baseBackgroundColor.blend(rootBackgroundColor);
if (combinedBackgroundColor.alpha())
- context.fillRect(documentRect, combinedBackgroundColor, (shouldDrawBackgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
+ context.fillRect(backgroundRect, combinedBackgroundColor, (shouldDrawBackgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode);
else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer)
- context.fillRect(documentRect, Color(), SkXfermode::kClear_Mode);
+ context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode);
for (auto it = reversedPaintList.rbegin(); it != reversedPaintList.rend(); ++it) {
ASSERT((*it)->clip() == BorderFillBox);
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698