Index: Source/core/paint/BackgroundImageGeometry.cpp |
diff --git a/Source/core/paint/BackgroundImageGeometry.cpp b/Source/core/paint/BackgroundImageGeometry.cpp |
index d4a3bedff08bf0af15358b19fe13c291f3f5f1f4..281988d135096cd04f8cc2e789beed5959571014 100644 |
--- a/Source/core/paint/BackgroundImageGeometry.cpp |
+++ b/Source/core/paint/BackgroundImageGeometry.cpp |
@@ -127,6 +127,20 @@ IntSize calculateFillTileSize(const LayoutBoxModelObject& obj, const FillLayer& |
return IntSize(); |
} |
+IntPoint accumulatedScrollOffset(const LayoutBoxModelObject& object, const LayoutBoxModelObject* container) |
+{ |
+ const LayoutBlock* block = object.isLayoutBlock() ? toLayoutBlock(&object) : object.containingBlock(); |
+ IntPoint result; |
+ while (block) { |
+ if (block->hasOverflowClip()) |
+ result += block->scrolledContentOffset(); |
+ if (block == container) |
+ break; |
+ block = block->containingBlock(); |
+ } |
+ return result; |
+} |
+ |
} // anonymous namespace |
void BackgroundImageGeometry::setNoRepeatX(int xOffset) |
@@ -223,10 +237,15 @@ 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()); |
+ // Compensate the translations created by ScrollRecorders. |
+ // TODO(trchen): Fix this for SP phase 2. crbug.com/528226. |
chrishtr
2015/09/09 22:46:33
Wrong bug? I was thinking a tracking bug for this
Xianzhu
2015/09/09 23:39:56
Wanted to reuse the bug for phase 2.
Filed crbug.
|
+ viewportRect.moveBy(accumulatedScrollOffset(obj, paintContainer)); |
+ } |
if (paintContainer) { |
IntPoint absoluteContainerOffset = roundedIntPoint(paintContainer->localToAbsolute(FloatPoint())); |