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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return event; 111 return event;
112 } 112 }
113 113
114 void verticalScroll(float deltaY) 114 void verticalScroll(float deltaY)
115 { 115 {
116 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llBegin)); 116 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llBegin));
117 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llUpdate, 0, deltaY)); 117 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llUpdate, 0, deltaY));
118 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llEnd)); 118 webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScro llEnd));
119 } 119 }
120 120
121 PassRefPtrWillBeRawPtr<Element> getElementById(const WebString& id) 121 RawPtr<Element> getElementById(const WebString& id)
122 { 122 {
123 return static_cast<PassRefPtrWillBeRawPtr<Element>>( 123 return static_cast<RawPtr<Element>>(
124 webViewImpl()->mainFrame()->document().getElementById(id)); 124 webViewImpl()->mainFrame()->document().getElementById(id));
125 } 125 }
126 126
127 127
128 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } 128 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); }
129 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()-> frame(); } 129 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()-> frame(); }
130 VisualViewport& visualViewport() const { return m_helper.webViewImpl()->page ()->frameHost().visualViewport(); } 130 VisualViewport& visualViewport() const { return m_helper.webViewImpl()->page ()->frameHost().visualViewport(); }
131 131
132 private: 132 private:
133 std::string m_baseURL; 133 std::string m_baseURL;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 WebTopControlsBoth, WebTopControlsShown, false); 568 WebTopControlsBoth, WebTopControlsShown, false);
569 webView->topControls().setShownRatio(1); 569 webView->topControls().setShownRatio(1);
570 webView->resize(WebSize(400, 300)); 570 webView->resize(WebSize(400, 300));
571 webView->updateAllLifecyclePhases(); 571 webView->updateAllLifecyclePhases();
572 572
573 ASSERT_EQ(100.f, webView->topControls().contentOffset()); 573 ASSERT_EQ(100.f, webView->topControls().contentOffset());
574 574
575 // When the top controls are showing, there's 300px for the layout height so 575 // When the top controls are showing, there's 300px for the layout height so
576 // 50% should result in both the position:fixed and position: absolute divs 576 // 50% should result in both the position:fixed and position: absolute divs
577 // having 150px of height. 577 // having 150px of height.
578 RefPtrWillBeRawPtr<Element> absPos = 578 RawPtr<Element> absPos =
579 getElementById(WebString::fromUTF8("abs")); 579 getElementById(WebString::fromUTF8("abs"));
580 RefPtrWillBeRawPtr<Element> fixedPos = 580 RawPtr<Element> fixedPos =
581 getElementById(WebString::fromUTF8("fixed")); 581 getElementById(WebString::fromUTF8("fixed"));
582 EXPECT_FLOAT_EQ(150.f, absPos->getBoundingClientRect()->height()); 582 EXPECT_FLOAT_EQ(150.f, absPos->getBoundingClientRect()->height());
583 EXPECT_FLOAT_EQ(150.f, fixedPos->getBoundingClientRect()->height()); 583 EXPECT_FLOAT_EQ(150.f, fixedPos->getBoundingClientRect()->height());
584 584
585 // The layout size on the FrameView should not include the top controls. 585 // The layout size on the FrameView should not include the top controls.
586 EXPECT_EQ(300, frame()->view()->layoutSize(IncludeScrollbars).height()); 586 EXPECT_EQ(300, frame()->view()->layoutSize(IncludeScrollbars).height());
587 587
588 // Hide the top controls. 588 // Hide the top controls.
589 verticalScroll(-100.f); 589 verticalScroll(-100.f);
590 webView->setTopControlsHeight(100.f, false); 590 webView->setTopControlsHeight(100.f, false);
(...skipping 21 matching lines...) Expand all
612 webView->updateTopControlsState( 612 webView->updateTopControlsState(
613 WebTopControlsBoth, WebTopControlsShown, false); 613 WebTopControlsBoth, WebTopControlsShown, false);
614 webView->topControls().setShownRatio(1); 614 webView->topControls().setShownRatio(1);
615 webView->resize(WebSize(400, 300)); 615 webView->resize(WebSize(400, 300));
616 webView->updateAllLifecyclePhases(); 616 webView->updateAllLifecyclePhases();
617 617
618 ASSERT_EQ(100.f, webView->topControls().contentOffset()); 618 ASSERT_EQ(100.f, webView->topControls().contentOffset());
619 619
620 // 'vh' units should be based on the viewport when the top controls are 620 // 'vh' units should be based on the viewport when the top controls are
621 // hidden. 621 // hidden.
622 RefPtrWillBeRawPtr<Element> absPos = 622 RawPtr<Element> absPos =
623 getElementById(WebString::fromUTF8("abs")); 623 getElementById(WebString::fromUTF8("abs"));
624 RefPtrWillBeRawPtr<Element> fixedPos = 624 RawPtr<Element> fixedPos =
625 getElementById(WebString::fromUTF8("fixed")); 625 getElementById(WebString::fromUTF8("fixed"));
626 EXPECT_FLOAT_EQ(200.f, absPos->getBoundingClientRect()->height()); 626 EXPECT_FLOAT_EQ(200.f, absPos->getBoundingClientRect()->height());
627 EXPECT_FLOAT_EQ(200.f, fixedPos->getBoundingClientRect()->height()); 627 EXPECT_FLOAT_EQ(200.f, fixedPos->getBoundingClientRect()->height());
628 628
629 // The size used for viewport units should not be reduced by the top 629 // The size used for viewport units should not be reduced by the top
630 // controls. 630 // controls.
631 EXPECT_EQ(400, frame()->view()->viewportSizeForViewportUnits().height()); 631 EXPECT_EQ(400, frame()->view()->viewportSizeForViewportUnits().height());
632 632
633 // Hide the top controls. 633 // Hide the top controls.
634 verticalScroll(-100.f); 634 verticalScroll(-100.f);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 // Device viewport is 400px but the page is width=800 so minimum-scale 667 // Device viewport is 400px but the page is width=800 so minimum-scale
668 // should be 0.5. This is also the scale at which the viewport fills the 668 // should be 0.5. This is also the scale at which the viewport fills the
669 // layout width. 669 // layout width.
670 ASSERT_EQ(0.5f, webView->minimumPageScaleFactor()); 670 ASSERT_EQ(0.5f, webView->minimumPageScaleFactor());
671 671
672 // We should size vh units so that 100vh fills the viewport at min-scale so 672 // We should size vh units so that 100vh fills the viewport at min-scale so
673 // we have to account for the minimum page scale factor. Since both boxes 673 // we have to account for the minimum page scale factor. Since both boxes
674 // are 50vh, and layout scale = 0.5, we have a vh viewport of 400 / 0.5 = 80 0 674 // are 50vh, and layout scale = 0.5, we have a vh viewport of 400 / 0.5 = 80 0
675 // so we expect 50vh to be 400px. 675 // so we expect 50vh to be 400px.
676 RefPtrWillBeRawPtr<Element> absPos = 676 RawPtr<Element> absPos =
677 getElementById(WebString::fromUTF8("abs")); 677 getElementById(WebString::fromUTF8("abs"));
678 RefPtrWillBeRawPtr<Element> fixedPos = 678 RawPtr<Element> fixedPos =
679 getElementById(WebString::fromUTF8("fixed")); 679 getElementById(WebString::fromUTF8("fixed"));
680 EXPECT_FLOAT_EQ(400.f, absPos->getBoundingClientRect()->height()); 680 EXPECT_FLOAT_EQ(400.f, absPos->getBoundingClientRect()->height());
681 EXPECT_FLOAT_EQ(400.f, fixedPos->getBoundingClientRect()->height()); 681 EXPECT_FLOAT_EQ(400.f, fixedPos->getBoundingClientRect()->height());
682 682
683 // The size used for viewport units should not be reduced by the top 683 // The size used for viewport units should not be reduced by the top
684 // controls. 684 // controls.
685 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height()); 685 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height());
686 686
687 // Hide the top controls. 687 // Hide the top controls.
688 verticalScroll(-100.f); 688 verticalScroll(-100.f);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 // that's 1600px wide so the minimum scale is 0.25 to encompass that. 723 // that's 1600px wide so the minimum scale is 0.25 to encompass that.
724 ASSERT_EQ(0.25f, webView->minimumPageScaleFactor()); 724 ASSERT_EQ(0.25f, webView->minimumPageScaleFactor());
725 725
726 // The viewport will match the layout width at scale=0.5 so the height used 726 // The viewport will match the layout width at scale=0.5 so the height used
727 // for vh should be (300 / 0.5) for the layout height + (100 / 0.5) for top 727 // for vh should be (300 / 0.5) for the layout height + (100 / 0.5) for top
728 // controls = 800. 728 // controls = 800.
729 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height()); 729 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height());
730 } 730 }
731 731
732 } // namespace blink 732 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698