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

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

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adress Dmitry's comments + sync. Created 4 years, 2 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 { 96 {
97 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil l-change: transform'></div>"); 97 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil l-change: transform'></div>");
98 98
99 document().settings()->setMainFrameClipsContent(false); 99 document().settings()->setMainFrameClipsContent(false);
100 100
101 document().view()->updateAllLifecyclePhases(); 101 document().view()->updateAllLifecyclePhases();
102 Element* element = document().getElementById("target"); 102 Element* element = document().getElementById("target");
103 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la yer(); 103 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la yer();
104 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); 104 ASSERT_TRUE(paintLayer->graphicsLayerBacking());
105 ASSERT_TRUE(paintLayer->compositedLayerMapping()); 105 ASSERT_TRUE(paintLayer->compositedLayerMapping());
106 // recomputeInterestRect computes the interest rect; computeInterestRect app lies the extra setting to paint everything. 106 // Clipping is disabled in recomputeInterestRect.
107 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), recomputeInterestRect(paintLayer->g raphicsLayerBacking())); 107 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), recomputeInterestRect(paintLayer-> graphicsLayerBacking()));
108 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); 108 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect()));
109 } 109 }
110 110
111 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) 111 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument)
112 { 112 {
113 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;' ></div>"); 113 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;' ></div>");
114 114
115 document().settings()->setMainFrameClipsContent(false);
116
117 document().view()->updateAllLifecyclePhases(); 115 document().view()->updateAllLifecyclePhases();
118 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro ll); 116 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro ll);
119 document().view()->updateAllLifecyclePhases(); 117 document().view()->updateAllLifecyclePhases();
120 118
121 PaintLayer* paintLayer = document().layoutViewItem().layer(); 119 PaintLayer* paintLayer = document().layoutViewItem().layer();
122 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); 120 ASSERT_TRUE(paintLayer->graphicsLayerBacking());
123 ASSERT_TRUE(paintLayer->compositedLayerMapping()); 121 ASSERT_TRUE(paintLayer->compositedLayerMapping());
124 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px = 4200px in non-RTL mode. Expanding 122 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px = 4200px in non-RTL mode. Expanding
125 // the resulting rect by 4000px in each direction yields this result. 123 // the resulting rect by 4000px in each direction yields this result.
126 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer- >graphicsLayerBacking())); 124 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer- >graphicsLayerBacking()));
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 document().setRootScroller(nullptr, nonThrow); 786 document().setRootScroller(nullptr, nonThrow);
789 document().view()->updateAllLifecyclePhases(); 787 document().view()->updateAllLifecyclePhases();
790 ASSERT_EQ(document().documentElement(), rootScrollerController.globalRoo tScroller()); 788 ASSERT_EQ(document().documentElement(), rootScrollerController.globalRoo tScroller());
791 789
792 EXPECT_TRUE(mapping3->clippingLayer()); 790 EXPECT_TRUE(mapping3->clippingLayer());
793 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds()) ; 791 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds()) ;
794 } 792 }
795 } 793 }
796 794
797 } // namespace blink 795 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698