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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2436283002: Fix LayoutObject::mapLocalToAncestor() for fixed under absolute (Closed)
Patch Set: - Created 4 years, 2 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
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 0ae7cb6b3efb9b4e07af42ed1c3f3672c0230d8b..e00f014f85e61c347631412ea6360a99c66d6f7b 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -2093,6 +2093,14 @@ void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor,
transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform
: TransformState::FlattenTransform);
+ // If the ancestor is fixed, then the rect is already in its coordinates so
+ // doesn't need viewport-adjusting.
+ if (ancestor->style()->position() != FixedPosition && o->isLayoutView() &&
+ styleRef().position() == FixedPosition) {
+ LayoutRect rect;
+ toLayoutView(o)->adjustOffsetForFixedPosition(rect);
+ transformState.move(rect.x(), rect.y());
+ }
return;
}
@@ -2164,6 +2172,14 @@ void LayoutObject::mapAncestorToLocal(const LayoutBoxModelObject* ancestor,
if (ancestorSkipped) {
containerOffset = ancestor->offsetFromAncestorContainer(o);
transformState.move(-containerOffset.width(), -containerOffset.height());
+ // If the ancestor is fixed, then the rect is already in its coordinates so
+ // doesn't need viewport-adjusting.
+ if (ancestor->style()->position() != FixedPosition && o->isLayoutView() &&
+ styleRef().position() == FixedPosition) {
+ LayoutRect rect;
+ toLayoutView(o)->adjustOffsetForFixedPosition(rect);
+ transformState.move(rect.x(), rect.y());
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698