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

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

Issue 2688973002: Fix background-attachment:local with --root-layer-scrolls (Closed)
Patch Set: none Created 3 years, 10 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 | « 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 6920030de3bfc23d20e8b7f48a05f4e21c501277..96f0115588219f01920f9872cc7d2ae64ef5624c 100644
--- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
@@ -8,11 +8,13 @@
#include "core/frame/Settings.h"
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
#include "core/paint/BlockPainter.h"
#include "core/paint/BoxPainter.h"
#include "core/paint/LayoutObjectDrawingRecorder.h"
#include "core/paint/PaintInfo.h"
#include "core/paint/PaintLayer.h"
+#include "core/paint/ScrollRecorder.h"
#include "platform/RuntimeEnabledFeatures.h"
namespace blink {
@@ -54,21 +56,34 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo) {
// possible.
GraphicsContext& context = paintInfo.context;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- context, m_layoutView, DisplayItem::kDocumentBackground))
- return;
// The background rect always includes at least the visible content size.
IntRect backgroundRect(IntRect(m_layoutView.viewRect()));
- if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() ||
- BoxPainter::
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
+ backgroundRect.unite(m_layoutView.documentRect());
+
+ const DisplayItemClient* displayItemClient = &m_layoutView;
+
+ Optional<ScrollRecorder> scrollRecorder;
+ if (BoxPainter::
isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer(
&m_layoutView, paintInfo)) {
// Layout overflow, combined with the visible content size.
backgroundRect.unite(m_layoutView.documentRect());
+ displayItemClient =
+ static_cast<const DisplayItemClient*>(m_layoutView.layer()
+ ->compositedLayerMapping()
+ ->scrollingContentsLayer());
+
+ scrollRecorder.emplace(paintInfo.context, m_layoutView, paintInfo.phase,
+ m_layoutView.scrolledContentOffset());
}
+ if (DrawingRecorder::useCachedDrawingIfPossible(
+ context, *displayItemClient, DisplayItem::kDocumentBackground))
+ return;
+
const Document& document = m_layoutView.document();
const FrameView& frameView = *m_layoutView.frameView();
bool isMainFrame = document.isInMainFrame();
@@ -85,8 +100,8 @@ void ViewPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo) {
document.documentElement() ? document.documentElement()->layoutObject()
: nullptr;
- LayoutObjectDrawingRecorder recorder(
- context, m_layoutView, DisplayItem::kDocumentBackground, backgroundRect);
+ DrawingRecorder recorder(context, *displayItemClient,
+ DisplayItem::kDocumentBackground, backgroundRect);
// Special handling for print economy mode.
bool forceBackgroundToWhite =
« 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