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

Unified Diff: Source/core/paint/BackgroundImageGeometry.cpp

Issue 1332643002: Fix fixed-background offset issue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/paint/BackgroundImageGeometry.h ('k') | Source/core/paint/BlockPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/BackgroundImageGeometry.cpp
diff --git a/Source/core/paint/BackgroundImageGeometry.cpp b/Source/core/paint/BackgroundImageGeometry.cpp
index d4a3bedff08bf0af15358b19fe13c291f3f5f1f4..aa1151313dcfd83af950c2162dc3eb2171556dd6 100644
--- a/Source/core/paint/BackgroundImageGeometry.cpp
+++ b/Source/core/paint/BackgroundImageGeometry.cpp
@@ -156,7 +156,7 @@ void BackgroundImageGeometry::clip(const IntRect& clipRect)
void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const LayoutBoxModelObject* paintContainer,
const GlobalPaintFlags globalPaintFlags, const FillLayer& fillLayer, const LayoutRect& paintRect,
- LayoutObject* backgroundObject)
+ const IntPoint& accumulatedScrollOffsetSincePaintContainer, LayoutObject* backgroundObject)
{
LayoutUnit left = 0;
LayoutUnit top = 0;
@@ -223,10 +223,13 @@ void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L
setHasNonLocalGeometry();
IntRect viewportRect = pixelSnappedIntRect(obj.viewRect());
- if (fixedBackgroundPaintsInLocalCoordinates(obj, globalPaintFlags))
+ if (fixedBackgroundPaintsInLocalCoordinates(obj, globalPaintFlags)) {
viewportRect.setLocation(IntPoint());
- else if (FrameView* frameView = obj.view()->frameView())
- viewportRect.setLocation(frameView->scrollPosition());
+ } else {
+ if (FrameView* frameView = obj.view()->frameView()) {
+ viewportRect.setLocation(frameView->scrollPosition());
+ viewportRect.moveBy(accumulatedScrollOffsetSincePaintContainer);
+ }
if (paintContainer) {
IntPoint absoluteContainerOffset = roundedIntPoint(paintContainer->localToAbsolute(FloatPoint()));
chrishtr 2015/09/09 17:05:41 localToAbsolute includes scroll offsets...why isn'
Xianzhu 2015/09/09 17:09:09 It includes scroll offsets from root to the paint
chrishtr 2015/09/09 17:29:16 Oh right. How about replacing your code with mapL
Xianzhu 2015/09/09 20:40:03 This seems not to work because we only need to com
chrishtr 2015/09/09 20:48:15 Maybe just make a one-off method that accumulates
Xianzhu 2015/09/09 22:04:06 Good idea! Done.
« no previous file with comments | « Source/core/paint/BackgroundImageGeometry.h ('k') | Source/core/paint/BlockPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698