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

Side by Side Diff: third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp

Issue 1854543002: Oilpan: Remove WillBe types (part 7) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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/frame/RootFrameViewport.h" 5 #include "core/frame/RootFrameViewport.h"
6 6
7 #include "core/layout/ScrollAlignment.h" 7 #include "core/layout/ScrollAlignment.h"
8 #include "platform/geometry/DoubleRect.h" 8 #include "platform/geometry/DoubleRect.h"
9 #include "platform/geometry/LayoutRect.h" 9 #include "platform/geometry/LayoutRect.h"
10 #include "platform/scroll/ScrollableArea.h" 10 #include "platform/scroll/ScrollableArea.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #define EXPECT_POINT_EQ(expected, actual) \ 13 #define EXPECT_POINT_EQ(expected, actual) \
14 do { \ 14 do { \
15 EXPECT_EQ((expected).x(), (actual).x()); \ 15 EXPECT_EQ((expected).x(), (actual).x()); \
16 EXPECT_EQ((expected).y(), (actual).y()); \ 16 EXPECT_EQ((expected).y(), (actual).y()); \
17 } while (false) 17 } while (false)
18 #define EXPECT_SIZE_EQ(expected, actual) \ 18 #define EXPECT_SIZE_EQ(expected, actual) \
19 do { \ 19 do { \
20 EXPECT_EQ((expected).width(), (actual).width()); \ 20 EXPECT_EQ((expected).width(), (actual).width()); \
21 EXPECT_EQ((expected).height(), (actual).height()); \ 21 EXPECT_EQ((expected).height(), (actual).height()); \
22 } while (false) 22 } while (false)
23 23
24 namespace blink { 24 namespace blink {
25 25
26 class ScrollableAreaStub : public NoBaseWillBeGarbageCollectedFinalized<Scrollab leAreaStub>, public ScrollableArea { 26 class ScrollableAreaStub : public GarbageCollectedFinalized<ScrollableAreaStub>, public ScrollableArea {
27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScrollableAreaStub); 27 USING_GARBAGE_COLLECTED_MIXIN(ScrollableAreaStub);
28 public: 28 public:
29 static PassOwnPtrWillBeRawPtr<ScrollableAreaStub> create(const IntSize& view portSize, const IntSize& contentsSize) 29 static RawPtr<ScrollableAreaStub> create(const IntSize& viewportSize, const IntSize& contentsSize)
30 { 30 {
31 return adoptPtrWillBeNoop(new ScrollableAreaStub(viewportSize, contentsS ize)); 31 return new ScrollableAreaStub(viewportSize, contentsSize);
32 } 32 }
33 33
34 void setViewportSize(const IntSize& viewportSize) 34 void setViewportSize(const IntSize& viewportSize)
35 { 35 {
36 m_viewportSize = viewportSize; 36 m_viewportSize = viewportSize;
37 } 37 }
38 38
39 IntSize viewportSize() const { return m_viewportSize; } 39 IntSize viewportSize() const { return m_viewportSize; }
40 40
41 // ScrollableArea Impl 41 // ScrollableArea Impl
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 bool m_userInputScrollableX; 107 bool m_userInputScrollableX;
108 bool m_userInputScrollableY; 108 bool m_userInputScrollableY;
109 DoublePoint m_scrollPosition; 109 DoublePoint m_scrollPosition;
110 IntSize m_viewportSize; 110 IntSize m_viewportSize;
111 IntSize m_contentsSize; 111 IntSize m_contentsSize;
112 }; 112 };
113 113
114 class RootFrameViewStub : public ScrollableAreaStub { 114 class RootFrameViewStub : public ScrollableAreaStub {
115 public: 115 public:
116 static PassOwnPtrWillBeRawPtr<RootFrameViewStub> create(const IntSize& viewp ortSize, const IntSize& contentsSize) 116 static RawPtr<RootFrameViewStub> create(const IntSize& viewportSize, const I ntSize& contentsSize)
117 { 117 {
118 return adoptPtrWillBeNoop(new RootFrameViewStub(viewportSize, contentsSi ze)); 118 return new RootFrameViewStub(viewportSize, contentsSize);
119 } 119 }
120 120
121 DoublePoint maximumScrollPositionDouble() const override 121 DoublePoint maximumScrollPositionDouble() const override
122 { 122 {
123 return IntPoint(contentsSize() - viewportSize()); 123 return IntPoint(contentsSize() - viewportSize());
124 } 124 }
125 125
126 private: 126 private:
127 RootFrameViewStub(const IntSize& viewportSize, const IntSize& contentsSize) 127 RootFrameViewStub(const IntSize& viewportSize, const IntSize& contentsSize)
128 : ScrollableAreaStub(viewportSize, contentsSize) 128 : ScrollableAreaStub(viewportSize, contentsSize)
129 { 129 {
130 } 130 }
131 131
132 int visibleWidth() const override { return m_viewportSize.width(); } 132 int visibleWidth() const override { return m_viewportSize.width(); }
133 int visibleHeight() const override { return m_viewportSize.height(); } 133 int visibleHeight() const override { return m_viewportSize.height(); }
134 }; 134 };
135 135
136 class VisualViewportStub : public ScrollableAreaStub { 136 class VisualViewportStub : public ScrollableAreaStub {
137 public: 137 public:
138 static PassOwnPtrWillBeRawPtr<VisualViewportStub> create(const IntSize& view portSize, const IntSize& contentsSize) 138 static RawPtr<VisualViewportStub> create(const IntSize& viewportSize, const IntSize& contentsSize)
139 { 139 {
140 return adoptPtrWillBeNoop(new VisualViewportStub(viewportSize, contentsS ize)); 140 return new VisualViewportStub(viewportSize, contentsSize);
141 } 141 }
142 142
143 DoublePoint maximumScrollPositionDouble() const override 143 DoublePoint maximumScrollPositionDouble() const override
144 { 144 {
145 DoubleSize visibleViewport = viewportSize(); 145 DoubleSize visibleViewport = viewportSize();
146 visibleViewport.scale(1 / m_scale); 146 visibleViewport.scale(1 / m_scale);
147 147
148 DoubleSize maxPosition = DoubleSize(contentsSize()) - visibleViewport; 148 DoubleSize maxPosition = DoubleSize(contentsSize()) - visibleViewport;
149 return DoublePoint(maxPosition); 149 return DoublePoint(maxPosition);
150 } 150 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 { 182 {
183 } 183 }
184 }; 184 };
185 185
186 // Tests that scrolling the viewport when the layout viewport is 186 // Tests that scrolling the viewport when the layout viewport is
187 // !userInputScrollable (as happens when overflow:hidden is set) works 187 // !userInputScrollable (as happens when overflow:hidden is set) works
188 // correctly, that is, the visual viewport can scroll, but not the layout. 188 // correctly, that is, the visual viewport can scroll, but not the layout.
189 TEST_F(RootFrameViewportTest, UserInputScrollable) 189 TEST_F(RootFrameViewportTest, UserInputScrollable)
190 { 190 {
191 IntSize viewportSize(100, 150); 191 IntSize viewportSize(100, 150);
192 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(200, 300)); 192 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(200, 300));
193 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 193 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
194 194
195 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::cr eate(*visualViewport.get(), *layoutViewport.get()); 195 RawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visual Viewport.get(), *layoutViewport.get());
196 196
197 visualViewport->setScale(2); 197 visualViewport->setScale(2);
198 198
199 // Disable just the layout viewport's horizontal scrolling, the 199 // Disable just the layout viewport's horizontal scrolling, the
200 // RootFrameViewport should remain scrollable overall. 200 // RootFrameViewport should remain scrollable overall.
201 layoutViewport->setUserInputScrollable(false, true); 201 layoutViewport->setUserInputScrollable(false, true);
202 visualViewport->setUserInputScrollable(true, true); 202 visualViewport->setUserInputScrollable(true, true);
203 203
204 EXPECT_TRUE(rootFrameViewport->userInputScrollable(HorizontalScrollbar)); 204 EXPECT_TRUE(rootFrameViewport->userInputScrollable(HorizontalScrollbar));
205 EXPECT_TRUE(rootFrameViewport->userInputScrollable(VerticalScrollbar)); 205 EXPECT_TRUE(rootFrameViewport->userInputScrollable(VerticalScrollbar));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport->scrollPositionDouble()) ; 243 EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport->scrollPositionDouble()) ;
244 EXPECT_POINT_EQ(DoublePoint(150, 75), rootFrameViewport->scrollPositionDoubl e()); 244 EXPECT_POINT_EQ(DoublePoint(150, 75), rootFrameViewport->scrollPositionDoubl e());
245 } 245 }
246 246
247 // Make sure scrolls using the scroll animator (scroll(), setScrollPosition()) 247 // Make sure scrolls using the scroll animator (scroll(), setScrollPosition())
248 // work correctly when one of the subviewports is explicitly scrolled without us ing the 248 // work correctly when one of the subviewports is explicitly scrolled without us ing the
249 // RootFrameViewport interface. 249 // RootFrameViewport interface.
250 TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll) 250 TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
251 { 251 {
252 IntSize viewportSize(100, 150); 252 IntSize viewportSize(100, 150);
253 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(200, 300)); 253 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(200, 300));
254 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 254 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
255 255
256 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::cr eate(*visualViewport.get(), *layoutViewport.get()); 256 RawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visual Viewport.get(), *layoutViewport.get());
257 257
258 visualViewport->setScale(2); 258 visualViewport->setScale(2);
259 259
260 visualViewport->setScrollPosition(DoublePoint(50, 75), ProgrammaticScroll); 260 visualViewport->setScrollPosition(DoublePoint(50, 75), ProgrammaticScroll);
261 EXPECT_POINT_EQ(DoublePoint(50, 75), rootFrameViewport->scrollPositionDouble ()); 261 EXPECT_POINT_EQ(DoublePoint(50, 75), rootFrameViewport->scrollPositionDouble ());
262 262
263 // If the scroll animator doesn't update, it will still think it's at (0, 0) and so it 263 // If the scroll animator doesn't update, it will still think it's at (0, 0) and so it
264 // may early exit. 264 // may early exit.
265 rootFrameViewport->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll); 265 rootFrameViewport->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll);
266 EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble() ); 266 EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble() );
(...skipping 15 matching lines...) Expand all
282 rootFrameViewport->userScroll(ScrollByPixel, FloatSize(-100, 0)); 282 rootFrameViewport->userScroll(ScrollByPixel, FloatSize(-100, 0));
283 EXPECT_POINT_EQ(DoublePoint(0, 150), rootFrameViewport->scrollPositionDouble ()); 283 EXPECT_POINT_EQ(DoublePoint(0, 150), rootFrameViewport->scrollPositionDouble ());
284 EXPECT_POINT_EQ(DoublePoint(0, 150), layoutViewport->scrollPositionDouble()) ; 284 EXPECT_POINT_EQ(DoublePoint(0, 150), layoutViewport->scrollPositionDouble()) ;
285 } 285 }
286 286
287 // Test that the scrollIntoView correctly scrolls the main frame 287 // Test that the scrollIntoView correctly scrolls the main frame
288 // and visual viewport such that the given rect is centered in the viewport. 288 // and visual viewport such that the given rect is centered in the viewport.
289 TEST_F(RootFrameViewportTest, ScrollIntoView) 289 TEST_F(RootFrameViewportTest, ScrollIntoView)
290 { 290 {
291 IntSize viewportSize(100, 150); 291 IntSize viewportSize(100, 150);
292 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(200, 300)); 292 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(200, 300));
293 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 293 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
294 294
295 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::cr eate(*visualViewport.get(), *layoutViewport.get()); 295 RawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visual Viewport.get(), *layoutViewport.get());
296 296
297 // Test that the visual viewport is scrolled if the viewport has been 297 // Test that the visual viewport is scrolled if the viewport has been
298 // resized (as is the case when the ChromeOS keyboard comes up) but not 298 // resized (as is the case when the ChromeOS keyboard comes up) but not
299 // scaled. 299 // scaled.
300 visualViewport->setViewportSize(IntSize(100, 100)); 300 visualViewport->setViewportSize(IntSize(100, 100));
301 rootFrameViewport->scrollIntoView( 301 rootFrameViewport->scrollIntoView(
302 LayoutRect(100, 250, 50, 50), 302 LayoutRect(100, 250, 50, 50),
303 ScrollAlignment::alignToEdgeIfNeeded, 303 ScrollAlignment::alignToEdgeIfNeeded,
304 ScrollAlignment::alignToEdgeIfNeeded); 304 ScrollAlignment::alignToEdgeIfNeeded);
305 EXPECT_POINT_EQ(DoublePoint(50, 150), layoutViewport->scrollPositionDouble() ); 305 EXPECT_POINT_EQ(DoublePoint(50, 150), layoutViewport->scrollPositionDouble() );
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 ScrollAlignment::alignTopAlways, 357 ScrollAlignment::alignTopAlways,
358 ScrollAlignment::alignTopAlways); 358 ScrollAlignment::alignTopAlways);
359 EXPECT_POINT_EQ(DoublePoint(50, 50), layoutViewport->scrollPositionDouble()) ; 359 EXPECT_POINT_EQ(DoublePoint(50, 50), layoutViewport->scrollPositionDouble()) ;
360 EXPECT_POINT_EQ(DoublePoint(0, 10), visualViewport->scrollPositionDouble()); 360 EXPECT_POINT_EQ(DoublePoint(0, 10), visualViewport->scrollPositionDouble());
361 } 361 }
362 362
363 // Tests that the setScrollPosition method works correctly with both viewports. 363 // Tests that the setScrollPosition method works correctly with both viewports.
364 TEST_F(RootFrameViewportTest, SetScrollPosition) 364 TEST_F(RootFrameViewportTest, SetScrollPosition)
365 { 365 {
366 IntSize viewportSize(500, 500); 366 IntSize viewportSize(500, 500);
367 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(1000, 2000)); 367 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(1000, 2000));
368 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 368 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
369 369
370 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::cr eate(*visualViewport.get(), *layoutViewport.get()); 370 RawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visual Viewport.get(), *layoutViewport.get());
371 371
372 visualViewport->setScale(2); 372 visualViewport->setScale(2);
373 373
374 // Ensure that the visual viewport scrolls first. 374 // Ensure that the visual viewport scrolls first.
375 rootFrameViewport->setScrollPosition(DoublePoint(100, 100), ProgrammaticScro ll); 375 rootFrameViewport->setScrollPosition(DoublePoint(100, 100), ProgrammaticScro ll);
376 EXPECT_POINT_EQ(DoublePoint(100, 100), visualViewport->scrollPositionDouble( )); 376 EXPECT_POINT_EQ(DoublePoint(100, 100), visualViewport->scrollPositionDouble( ));
377 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble()); 377 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
378 378
379 // Scroll to the visual viewport's extent, the layout viewport should scroll the 379 // Scroll to the visual viewport's extent, the layout viewport should scroll the
380 // remainder. 380 // remainder.
(...skipping 11 matching lines...) Expand all
392 rootFrameViewport->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll); 392 rootFrameViewport->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll);
393 EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble()); 393 EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
394 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble()); 394 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
395 } 395 }
396 396
397 // Tests that the visible rect (i.e. visual viewport rect) is correctly 397 // Tests that the visible rect (i.e. visual viewport rect) is correctly
398 // calculated, taking into account both viewports and page scale. 398 // calculated, taking into account both viewports and page scale.
399 TEST_F(RootFrameViewportTest, VisibleContentRect) 399 TEST_F(RootFrameViewportTest, VisibleContentRect)
400 { 400 {
401 IntSize viewportSize(500, 401); 401 IntSize viewportSize(500, 401);
402 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(1000, 2000)); 402 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(1000, 2000));
403 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 403 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
404 404
405 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::cr eate(*visualViewport.get(), *layoutViewport.get()); 405 RawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visual Viewport.get(), *layoutViewport.get());
406 406
407 rootFrameViewport->setScrollPosition(DoublePoint(100, 75), ProgrammaticScrol l); 407 rootFrameViewport->setScrollPosition(DoublePoint(100, 75), ProgrammaticScrol l);
408 408
409 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRect( ).location()); 409 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRect( ).location());
410 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRectD ouble().location()); 410 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRectD ouble().location());
411 EXPECT_SIZE_EQ(DoubleSize(500, 401), rootFrameViewport->visibleContentRect() .size()); 411 EXPECT_SIZE_EQ(DoubleSize(500, 401), rootFrameViewport->visibleContentRect() .size());
412 EXPECT_SIZE_EQ(DoubleSize(500, 401), rootFrameViewport->visibleContentRectDo uble().size()); 412 EXPECT_SIZE_EQ(DoubleSize(500, 401), rootFrameViewport->visibleContentRectDo uble().size());
413 413
414 visualViewport->setScale(2); 414 visualViewport->setScale(2);
415 415
416 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRect( ).location()); 416 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRect( ).location());
417 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRectD ouble().location()); 417 EXPECT_POINT_EQ(DoublePoint(100, 75), rootFrameViewport->visibleContentRectD ouble().location());
418 EXPECT_SIZE_EQ(DoubleSize(250, 201), rootFrameViewport->visibleContentRect() .size()); 418 EXPECT_SIZE_EQ(DoubleSize(250, 201), rootFrameViewport->visibleContentRect() .size());
419 EXPECT_SIZE_EQ(DoubleSize(250, 200.5), rootFrameViewport->visibleContentRect Double().size()); 419 EXPECT_SIZE_EQ(DoubleSize(250, 200.5), rootFrameViewport->visibleContentRect Double().size());
420 } 420 }
421 421
422 // Tests that scrolls on the root frame scroll the visual viewport before 422 // Tests that scrolls on the root frame scroll the visual viewport before
423 // trying to scroll the layout viewport. 423 // trying to scroll the layout viewport.
424 TEST_F(RootFrameViewportTest, ViewportScrollOrder) 424 TEST_F(RootFrameViewportTest, ViewportScrollOrder)
425 { 425 {
426 IntSize viewportSize(100, 100); 426 IntSize viewportSize(100, 100);
427 OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::cr eate(viewportSize, IntSize(200, 300)); 427 RawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewpor tSize, IntSize(200, 300));
428 OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub:: create(viewportSize, viewportSize); 428 RawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewp ortSize, viewportSize);
429 429
430 OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = 430 RawPtr<ScrollableArea> rootFrameViewport =
431 RootFrameViewport::create(*visualViewport.get(), *layoutViewport.get()); 431 RootFrameViewport::create(*visualViewport.get(), *layoutViewport.get());
432 432
433 visualViewport->setScale(2); 433 visualViewport->setScale(2);
434 434
435 rootFrameViewport->setScrollPosition(DoublePoint(40, 40), UserScroll); 435 rootFrameViewport->setScrollPosition(DoublePoint(40, 40), UserScroll);
436 EXPECT_POINT_EQ(DoublePoint(40, 40), visualViewport->scrollPositionDouble()) ; 436 EXPECT_POINT_EQ(DoublePoint(40, 40), visualViewport->scrollPositionDouble()) ;
437 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble()); 437 EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
438 438
439 rootFrameViewport->setScrollPosition(DoublePoint(60, 60), ProgrammaticScroll ); 439 rootFrameViewport->setScrollPosition(DoublePoint(60, 60), ProgrammaticScroll );
440 EXPECT_POINT_EQ(DoublePoint(50, 50), visualViewport->scrollPositionDouble()) ; 440 EXPECT_POINT_EQ(DoublePoint(50, 50), visualViewport->scrollPositionDouble()) ;
441 EXPECT_POINT_EQ(DoublePoint(10, 10), layoutViewport->scrollPositionDouble()) ; 441 EXPECT_POINT_EQ(DoublePoint(10, 10), layoutViewport->scrollPositionDouble()) ;
442 } 442 }
443 443
444 } // namespace blink 444 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/RootFrameViewport.h ('k') | third_party/WebKit/Source/core/frame/SmartClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698