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

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: Address reviewer comments Created 3 years, 9 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, StickyPositionEnclosingLayersContentOffset) {
1692 setBodyInnerHTML(
1693 "<style>.composited { will-change: transform; }"
1694 "#scroller { overflow: auto; height: 200px; width: 200px; }"
1695 ".container { height: 500px; }"
1696 ".innerPadding { height: 10px; }"
1697 "#sticky { position: sticky; top: 25px; height: 50px; }</style>"
1698 "<div id='scroller' class='composited'>"
1699 "<div class='composited container'>"
1700 " <div class='composited container'>"
1701 " <div class='innerPadding'></div>"
1702 " <div id='sticky' class='composited'></div>"
1703 " </div></div></div>");
1704
1705 PaintLayer* stickyLayer =
1706 toLayoutBox(getLayoutObjectByElementId("sticky"))->layer();
1707 CompositedLayerMapping* stickyMapping = stickyLayer->compositedLayerMapping();
1708 ASSERT_TRUE(stickyMapping);
1709
1710 WebLayerStickyPositionConstraint constraint =
1711 stickyMapping->mainGraphicsLayer()
1712 ->contentLayer()
1713 ->layer()
1714 ->stickyPositionConstraint();
1715 EXPECT_EQ(IntPoint(0, 10),
1716 IntPoint(constraint.parentRelativeStickyBoxOffset));
1717
1718 // Now scroll the page - this should not affect the parent-relative offset.
1719 LayoutBoxModelObject* scroller =
1720 toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
1721 PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
1722 scrollableArea->scrollToAbsolutePosition(
1723 FloatPoint(scrollableArea->scrollPosition().x(), 100));
1724 ASSERT_EQ(100.0, scrollableArea->scrollPosition().y());
1725
1726 stickyLayer->setNeedsCompositingInputsUpdate();
1727 EXPECT_TRUE(stickyLayer->needsCompositingInputsUpdate());
1728 document().view()->updateLifecycleToCompositingCleanPlusScrolling();
1729 EXPECT_FALSE(stickyLayer->needsCompositingInputsUpdate());
1730
1731 constraint = stickyMapping->mainGraphicsLayer()
1732 ->contentLayer()
1733 ->layer()
1734 ->stickyPositionConstraint();
1735 EXPECT_EQ(IntPoint(0, 10),
1736 IntPoint(constraint.parentRelativeStickyBoxOffset));
1737 }
1738
1691 } // namespace blink 1739 } // 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