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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp

Issue 2825343003: Clean compositing inputs for location APIs for sticky-affected elements. (Closed)
Patch Set: Created 3 years, 8 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintLayerScrollableArea.h" 5 #include "core/paint/PaintLayerScrollableArea.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/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 11 matching lines...) Expand all
22 class MockChromeClient : public EmptyChromeClient { 22 class MockChromeClient : public EmptyChromeClient {
23 public: 23 public:
24 MOCK_METHOD3(MockSetToolTip, void(LocalFrame*, const String&, TextDirection)); 24 MOCK_METHOD3(MockSetToolTip, void(LocalFrame*, const String&, TextDirection));
25 void SetToolTip(LocalFrame& frame, 25 void SetToolTip(LocalFrame& frame,
26 const String& tooltip_text, 26 const String& tooltip_text,
27 TextDirection dir) override { 27 TextDirection dir) override {
28 MockSetToolTip(&frame, tooltip_text, dir); 28 MockSetToolTip(&frame, tooltip_text, dir);
29 } 29 }
30 }; 30 };
31 31
32 } // namespace { 32 } // namespace
33 33
34 class PaintLayerScrollableAreaTest : public RenderingTest { 34 class PaintLayerScrollableAreaTest : public RenderingTest {
35 public: 35 public:
36 PaintLayerScrollableAreaTest() 36 PaintLayerScrollableAreaTest()
37 : RenderingTest(EmptyLocalFrameClient::Create()), 37 : RenderingTest(EmptyLocalFrameClient::Create()),
38 chrome_client_(new MockChromeClient) {} 38 chrome_client_(new MockChromeClient) {}
39 39
40 ~PaintLayerScrollableAreaTest() { 40 ~PaintLayerScrollableAreaTest() {
41 testing::Mock::VerifyAndClearExpectations(&GetChromeClient()); 41 testing::Mock::VerifyAndClearExpectations(&GetChromeClient());
42 } 42 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 " </div>" 621 " </div>"
622 "</div>"); 622 "</div>");
623 GetDocument().View()->UpdateAllLifecyclePhases(); 623 GetDocument().View()->UpdateAllLifecyclePhases();
624 Element* container = GetDocument().GetElementById("container"); 624 Element* container = GetDocument().GetElementById("container");
625 ASSERT_TRUE(container); 625 ASSERT_TRUE(container);
626 PaintLayerScrollableArea* scrollable_area = 626 PaintLayerScrollableArea* scrollable_area =
627 ToLayoutBoxModelObject(container->GetLayoutObject())->GetScrollableArea(); 627 ToLayoutBoxModelObject(container->GetLayoutObject())->GetScrollableArea();
628 ASSERT_TRUE(scrollable_area); 628 ASSERT_TRUE(scrollable_area);
629 EXPECT_FALSE(scrollable_area->HasHorizontalScrollbar()); 629 EXPECT_FALSE(scrollable_area->HasHorizontalScrollbar());
630 } 630 }
631
632 TEST_F(PaintLayerScrollableAreaTest,
633 StickyPositionConstraintsInvalidatedByLayout) {
634 SetBodyInnerHTML(
635 "<style>#scroller { overflow-y: scroll; height: 100px; }"
636 "#sticky { height: 25px; position: sticky; top: 0; }"
637 "#padding { height: 500px; }</style>"
638 "<div id='scroller'><div id='sticky'></div><div id='padding'></div>"
639 "</div>");
640
641 LayoutBoxModelObject* scroller =
642 ToLayoutBoxModelObject(GetLayoutObjectByElementId("scroller"));
643 LayoutBoxModelObject* sticky =
644 ToLayoutBoxModelObject(GetLayoutObjectByElementId("sticky"));
645
646 EXPECT_FALSE(sticky->Layer()->NeedsCompositingInputsUpdate());
647
648 PaintLayerScrollableArea* scrollable_area = scroller->GetScrollableArea();
649 ASSERT_TRUE(scrollable_area);
650
651 // Fake layout.
652 scrollable_area->UpdateAfterLayout();
653
654 EXPECT_TRUE(sticky->Layer()->NeedsCompositingInputsUpdate());
655 EXPECT_EQ(0u, scrollable_area->GetStickyConstraintsMap().size());
631 } 656 }
657 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698