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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2812523003: Update layer position on scroll origin change (Closed)
Patch Set: Add Test 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 11593 matching lines...) Expand 10 before | Expand all | Expand 10 after
11604 Document* iframe_doc = frame_owner_element->contentDocument(); 11604 Document* iframe_doc = frame_owner_element->contentDocument();
11605 EXPECT_TRUE(iframe_doc->documentElement()->GetLayoutObject()); 11605 EXPECT_TRUE(iframe_doc->documentElement()->GetLayoutObject());
11606 11606
11607 // Changing the display from 'block' -> 'none' should cause layout objects to 11607 // Changing the display from 'block' -> 'none' should cause layout objects to
11608 // disappear. 11608 // disappear.
11609 element->SetInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); 11609 element->SetInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
11610 Compositor().BeginFrame(); 11610 Compositor().BeginFrame();
11611 EXPECT_FALSE(iframe_doc->documentElement()->GetLayoutObject()); 11611 EXPECT_FALSE(iframe_doc->documentElement()->GetLayoutObject());
11612 } 11612 }
11613 11613
11614 TEST_F(WebFrameSimTest, ScrollOriginChangeUpdatesLayerPositions) {
11615 WebView().Resize(WebSize(800, 600));
11616 SimRequest main_resource("https://example.com/test.html", "text/html");
11617
11618 LoadURL("https://example.com/test.html");
11619 main_resource.Complete(
11620 "<!DOCTYPE html>"
11621 "<body dir='rtl'>"
11622 " <div style='width:1px; height:1px; position:absolute; left:-10000px'>"
11623 " </div>"
11624 "</body>");
11625
11626 Compositor().BeginFrame();
11627 ScrollableArea* area = GetDocument().View()->LayoutViewportScrollableArea();
11628 ASSERT_EQ(10000, area->ScrollOrigin().X());
11629 ASSERT_EQ(10000, area->LayerForScrolling()->GetPosition().X());
11630
11631 // Removing the overflowing element removes all overflow so the scroll origin
11632 // implicitly is reset to (0, 0).
11633 GetDocument().QuerySelector("div")->remove();
11634 Compositor().BeginFrame();
11635
11636 EXPECT_EQ(0, area->ScrollOrigin().X());
11637 EXPECT_EQ(0, area->LayerForScrolling()->GetPosition().X());
11638 }
11639
11614 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { 11640 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) {
11615 class LoadingObserverFrameClient 11641 class LoadingObserverFrameClient
11616 : public FrameTestHelpers::TestWebFrameClient { 11642 : public FrameTestHelpers::TestWebFrameClient {
11617 public: 11643 public:
11618 void FrameDetached(WebLocalFrame*, DetachType) override { 11644 void FrameDetached(WebLocalFrame*, DetachType) override {
11619 did_call_frame_detached_ = true; 11645 did_call_frame_detached_ = true;
11620 } 11646 }
11621 11647
11622 void DidStopLoading() override { 11648 void DidStopLoading() override {
11623 // TODO(dcheng): Investigate not calling this as well during frame detach. 11649 // TODO(dcheng): Investigate not calling this as well during frame detach.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
11853 FrameTestHelpers::LoadFrame(local_frame, "data:text/html,some page"); 11879 FrameTestHelpers::LoadFrame(local_frame, "data:text/html,some page");
11854 11880
11855 // Local frame with remote parent should have transparent baseBackgroundColor. 11881 // Local frame with remote parent should have transparent baseBackgroundColor.
11856 Color color = local_frame->GetFrameView()->BaseBackgroundColor(); 11882 Color color = local_frame->GetFrameView()->BaseBackgroundColor();
11857 EXPECT_EQ(Color::kTransparent, color); 11883 EXPECT_EQ(Color::kTransparent, color);
11858 11884
11859 view->Close(); 11885 view->Close();
11860 } 11886 }
11861 11887
11862 } // namespace blink 11888 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698