| 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 a3fa2e373dcb74a684f18143ffbb4954ba3a4590..3798a1fa098fc22ec9b0a7b9627ad1e92aea22e0 100644
|
| --- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
|
| @@ -56,7 +56,11 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo)
|
| if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutView, DisplayItem::BoxDecorationBackground, LayoutPoint()))
|
| return;
|
|
|
| - IntRect documentRect = m_layoutView.documentRect();
|
| + // When the view uses composited scrolling, the main GraphicsLayer (where the background is painted)
|
| + // is sized to the layout viewport. Otherwise, it's the size of the document.
|
| + IntRect backgroundRect = m_layoutView.layer()->needsCompositedScrolling() ?
|
| + pixelSnappedIntRect(m_layoutView.viewRect()) : m_layoutView.documentRect();
|
| +
|
| const Document& document = m_layoutView.document();
|
| const FrameView& frameView = *m_layoutView.frameView();
|
| bool isMainFrame = !document.ownerElement();
|
| @@ -66,14 +70,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;
|
| }
|
|
|
| @@ -85,7 +89,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()) {
|
| @@ -99,16 +103,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;
|
| }
|
|
|
| @@ -127,15 +131,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);
|
|
|