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

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: Merge with master and use EXPECT_EQ for non-fatal checks. 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cba284bf8e7baf44acbaf1e8678f4c726857bcee..3c99a4f3c5eb3da5913a534299fbc9bd5576aa89 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -779,12 +779,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
@@ -812,13 +821,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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698