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

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

Issue 1630693003: Fix offset issue of background-attachment:fixed on scroller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/LayoutTests/paint/overflow/fixed-background-on-scroller-scroll-expected.html ('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/BackgroundImageGeometry.cpp
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
index 36909481eece9b1be6fc6e18a92d3d97a909a894..c10a2d255469345531b8a9000d61f34faad35e6f 100644
--- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
+++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
@@ -119,16 +119,16 @@ LayoutSize calculateFillTileSize(const LayoutBoxModelObject& obj, const FillLaye
return LayoutSize();
}
-IntPoint accumulatedScrollOffset(const LayoutBoxModelObject& object, const LayoutBoxModelObject* container)
+IntPoint accumulatedScrollOffsetForFixedBackground(const LayoutBoxModelObject& object, const LayoutBoxModelObject* container)
{
- const LayoutBlock* block = object.isLayoutBlock() ? toLayoutBlock(&object) : object.containingBlock();
IntPoint result;
- while (block) {
+ if (&object == container)
+ return result;
+ for (const LayoutBlock* block = object.containingBlock(); block; block = block->containingBlock()) {
if (block->hasOverflowClip())
result += block->scrolledContentOffset();
if (block == container)
break;
- block = block->containingBlock();
}
return result;
}
@@ -257,7 +257,7 @@ void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L
viewportRect.setLocation(frameView->scrollPosition());
// Compensate the translations created by ScrollRecorders.
// TODO(trchen): Fix this for SP phase 2. crbug.com/529963.
- viewportRect.moveBy(accumulatedScrollOffset(obj, paintContainer));
+ viewportRect.moveBy(accumulatedScrollOffsetForFixedBackground(obj, paintContainer));
}
if (paintContainer)
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/overflow/fixed-background-on-scroller-scroll-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698