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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: Ignore position:sticky offsets when computing localToAncestorQuad offsets Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 if (container->style()->isFlippedBlocksWritingMode()) { 2065 if (container->style()->isFlippedBlocksWritingMode()) {
2066 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); 2066 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
2067 transformState.move(toLayoutBox(container)->flipForWritingMode( 2067 transformState.move(toLayoutBox(container)->flipForWritingMode(
2068 LayoutPoint(centerPoint)) - 2068 LayoutPoint(centerPoint)) -
2069 centerPoint); 2069 centerPoint);
2070 } 2070 }
2071 mode &= ~ApplyContainerFlip; 2071 mode &= ~ApplyContainerFlip;
2072 } 2072 }
2073 } 2073 }
2074 2074
2075 LayoutSize containerOffset = offsetFromContainer(container); 2075 LayoutSize containerOffset =
2076 offsetFromContainer(container, mode & IgnoreSticky);
flackr 2017/01/31 00:20:33 I think this might be cleaner if we add staticOffs
smcgruer 2017/01/31 16:07:06 I've gone for the direct removal for now. It's not
2076 if (isLayoutFlowThread()) { 2077 if (isLayoutFlowThread()) {
2077 // So far the point has been in flow thread coordinates (i.e. as if 2078 // So far the point has been in flow thread coordinates (i.e. as if
2078 // everything in the fragmentation context lived in one tall single column). 2079 // everything in the fragmentation context lived in one tall single column).
2079 // Convert it to a visual point now, since we're about to escape the flow 2080 // Convert it to a visual point now, since we're about to escape the flow
2080 // thread. 2081 // thread.
2081 containerOffset += columnOffset(LayoutPoint(transformState.mappedPoint())); 2082 containerOffset += columnOffset(LayoutPoint(transformState.mappedPoint()));
2082 } 2083 }
2083 2084
2084 // Text objects just copy their parent's computed style, so we need to ignore 2085 // Text objects just copy their parent's computed style, so we need to ignore
2085 // them. 2086 // them.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2300
2300 TransformationMatrix LayoutObject::localToAncestorTransform( 2301 TransformationMatrix LayoutObject::localToAncestorTransform(
2301 const LayoutBoxModelObject* ancestor, 2302 const LayoutBoxModelObject* ancestor,
2302 MapCoordinatesFlags mode) const { 2303 MapCoordinatesFlags mode) const {
2303 TransformState transformState(TransformState::ApplyTransformDirection); 2304 TransformState transformState(TransformState::ApplyTransformDirection);
2304 mapLocalToAncestor(ancestor, transformState, 2305 mapLocalToAncestor(ancestor, transformState,
2305 mode | ApplyContainerFlip | UseTransforms); 2306 mode | ApplyContainerFlip | UseTransforms);
2306 return transformState.accumulatedTransform(); 2307 return transformState.accumulatedTransform();
2307 } 2308 }
2308 2309
2309 LayoutSize LayoutObject::offsetFromContainer(const LayoutObject* o) const { 2310 LayoutSize LayoutObject::offsetFromContainer(const LayoutObject* o,
2311 bool ignoreSticky) const {
2310 ASSERT(o == container()); 2312 ASSERT(o == container());
2311 return o->hasOverflowClip() 2313 return o->hasOverflowClip()
2312 ? LayoutSize(-toLayoutBox(o)->scrolledContentOffset()) 2314 ? LayoutSize(-toLayoutBox(o)->scrolledContentOffset())
2313 : LayoutSize(); 2315 : LayoutSize();
2314 } 2316 }
2315 2317
2316 LayoutSize LayoutObject::offsetFromAncestorContainer( 2318 LayoutSize LayoutObject::offsetFromAncestorContainer(
2317 const LayoutObject* ancestorContainer) const { 2319 const LayoutObject* ancestorContainer) const {
2318 if (ancestorContainer == this) 2320 if (ancestorContainer == this)
2319 return LayoutSize(); 2321 return LayoutSize();
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 const blink::LayoutObject* root = object1; 3494 const blink::LayoutObject* root = object1;
3493 while (root->parent()) 3495 while (root->parent())
3494 root = root->parent(); 3496 root = root->parent();
3495 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3497 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3496 } else { 3498 } else {
3497 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3499 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3498 } 3500 }
3499 } 3501 }
3500 3502
3501 #endif 3503 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698