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

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

Issue 2646133002: Add offset contributed to sticky position box rect by location containers (Closed)
Patch Set: Add localToAncestorQuadInternal. Created 3 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
Index: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index 486a11a43eb50a95648e8c40706d57d7d6d7f796..883758e27529c6b0d09f787ffbd90dbf53bc27f5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -774,12 +774,21 @@ void LayoutBoxModelObject::updateStickyPositionConstraints() const {
StickyPositionScrollingConstraints constraints;
FloatSize skippedContainersOffset;
LayoutBlock* containingBlock = this->containingBlock();
+ // The location container for boxes is not always the containing block.
+ LayoutBox* locationContainer = isLayoutInline()
+ ? containingBlock
+ : toLayoutBox(this)->locationContainer();
// Skip anonymous containing blocks.
while (containingBlock->isAnonymous()) {
- skippedContainersOffset +=
- toFloatSize(FloatPoint(containingBlock->frameRect().location()));
containingBlock = containingBlock->containingBlock();
}
+ MapCoordinatesFlags flags = 0;
+ skippedContainersOffset =
+ toFloatSize(locationContainer
+ ->localToAncestorQuadWithoutTransforms(
+ FloatQuad(), containingBlock, flags)
+ .boundingBox()
+ .location());
LayoutBox* scrollAncestor =
layer()->ancestorOverflowLayer()->isRootLayer()
? nullptr
@@ -807,13 +816,11 @@ void LayoutBoxModelObject::updateStickyPositionConstraints() const {
}
if (containingBlock != scrollAncestor) {
FloatQuad localQuad(FloatRect(containingBlock->paddingBoxRect()));
- TransformState transformState(TransformState::ApplyTransformDirection,
- localQuad.boundingBox().center(), localQuad);
- containingBlock->mapLocalToAncestor(scrollAncestor, transformState,
- ApplyContainerFlip);
- transformState.flatten();
scrollContainerRelativePaddingBoxRect =
- transformState.lastPlanarQuad().boundingBox();
+ containingBlock
+ ->localToAncestorQuadWithoutTransforms(localQuad, scrollAncestor,
+ flags)
+ .boundingBox();
// The sticky position constraint rects should be independent of the current
// scroll position, so after mapping we add in the scroll position to get

Powered by Google App Engine
This is Rietveld 408576698