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

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

Issue 2698843004: Correct for enclosing layers scroll position in sticky_data->main_thread_offset (Closed)
Patch Set: Remove check for containingLayer and make unittest more nested 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/compositing/CompositedLayerMapping.h" 5 #include "core/layout/compositing/CompositedLayerMapping.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/layout/api/LayoutViewItem.h" 10 #include "core/layout/api/LayoutViewItem.h"
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 ASSERT_TRUE(sticky); 1681 ASSERT_TRUE(sticky);
1682 WebLayerStickyPositionConstraint constraint = 1682 WebLayerStickyPositionConstraint constraint =
1683 sticky->mainGraphicsLayer() 1683 sticky->mainGraphicsLayer()
1684 ->contentLayer() 1684 ->contentLayer()
1685 ->layer() 1685 ->layer()
1686 ->stickyPositionConstraint(); 1686 ->stickyPositionConstraint();
1687 EXPECT_EQ(IntPoint(0, 50), 1687 EXPECT_EQ(IntPoint(0, 50),
1688 IntPoint(constraint.parentRelativeStickyBoxOffset)); 1688 IntPoint(constraint.parentRelativeStickyBoxOffset));
1689 } 1689 }
1690 1690
1691 TEST_P(CompositedLayerMappingTest,
1692 StickyPositionIntermediateContainerContentOffset) {
1693 setBodyInnerHTML(
1694 "<style>.composited { will-change: transform; }"
1695 "#scroller { overflow: auto; height: 200px; width: 200px; }"
1696 ".container { height: 500px; }"
1697 ".innerPadding { height: 10px; }"
1698 "#sticky { position: sticky; top: 25px; height: 50px; }</style>"
1699 "<div id='scroller' class='composited'>"
1700 "<div class='composited container'>"
1701 " <div class='composited container'>"
1702 " <div class='innerPadding'></div>"
1703 " <div id='sticky' class='composited'></div>"
1704 " </div></div></div>");
1705
1706 CompositedLayerMapping* sticky =
1707 toLayoutBlock(getLayoutObjectByElementId("sticky"))
1708 ->layer()
1709 ->compositedLayerMapping();
1710 ASSERT_TRUE(sticky);
1711
1712 WebLayerStickyPositionConstraint constraint =
1713 sticky->mainGraphicsLayer()
1714 ->contentLayer()
1715 ->layer()
1716 ->stickyPositionConstraint();
1717 EXPECT_EQ(IntPoint(0, 10),
1718 IntPoint(constraint.parentRelativeStickyBoxOffset));
1719
1720 // Now scroll the page - this should not affect the parent-relative offset.
1721 LayoutBoxModelObject* scroller =
1722 toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
1723 PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
1724 scrollableArea->scrollToAbsolutePosition(
1725 FloatPoint(scrollableArea->scrollPosition().x(), 100));
1726 ASSERT_EQ(100.0, scrollableArea->scrollPosition().y());
1727
1728 document().view()->updateLifecycleToCompositingCleanPlusScrolling();
flackr 2017/02/22 16:14:49 Does this actually call updateStickyConstraints? W
smcgruer 2017/02/22 18:39:04 It appears to be: [133571:133571:0222/133838.6476
1729
1730 constraint = sticky->mainGraphicsLayer()
1731 ->contentLayer()
1732 ->layer()
1733 ->stickyPositionConstraint();
1734 EXPECT_EQ(IntPoint(0, 10),
1735 IntPoint(constraint.parentRelativeStickyBoxOffset));
1736 }
1737
1691 } // namespace blink 1738 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698