OLD | NEW |
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 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 FixedLayoutTestWebViewClient client; | 1748 FixedLayoutTestWebViewClient client; |
1749 client.m_screenInfo.deviceScaleFactor = 1; | 1749 client.m_screenInfo.deviceScaleFactor = 1; |
1750 int viewportWidth = 640; | 1750 int viewportWidth = 640; |
1751 int viewportHeight = 480; | 1751 int viewportHeight = 480; |
1752 | 1752 |
1753 FrameTestHelpers::WebViewHelper webViewHelper; | 1753 FrameTestHelpers::WebViewHelper webViewHelper; |
1754 | 1754 |
1755 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, | 1755 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, |
1756 &client, nullptr, configureAndroid); | 1756 &client, nullptr, configureAndroid); |
1757 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1757 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
| 1758 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 1759 |
1758 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); | 1760 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); |
| 1761 GraphicsLayer* scrollContainer = compositor->containerLayer(); |
| 1762 if (!scrollContainer) |
| 1763 scrollContainer = compositor->rootGraphicsLayer(); |
| 1764 |
1759 EXPECT_EQ(0, webViewHelper.webView() | 1765 EXPECT_EQ(0, webViewHelper.webView() |
1760 ->mainFrameImpl() | 1766 ->mainFrameImpl() |
1761 ->frameView() | 1767 ->frameView() |
1762 ->layoutSize() | 1768 ->layoutSize() |
1763 .width()); | 1769 .width()); |
1764 EXPECT_EQ(0, webViewHelper.webView() | 1770 EXPECT_EQ(0, webViewHelper.webView() |
1765 ->mainFrameImpl() | 1771 ->mainFrameImpl() |
1766 ->frameView() | 1772 ->frameView() |
1767 ->layoutSize() | 1773 ->layoutSize() |
1768 .height()); | 1774 .height()); |
1769 EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); | 1775 EXPECT_EQ(0.0, scrollContainer->size().width()); |
1770 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1776 EXPECT_EQ(0.0, scrollContainer->size().height()); |
1771 | 1777 |
1772 webViewHelper.resize(WebSize(viewportWidth, 0)); | 1778 webViewHelper.resize(WebSize(viewportWidth, 0)); |
1773 EXPECT_EQ(viewportWidth, webViewHelper.webView() | 1779 EXPECT_EQ(viewportWidth, webViewHelper.webView() |
1774 ->mainFrameImpl() | 1780 ->mainFrameImpl() |
1775 ->frameView() | 1781 ->frameView() |
1776 ->layoutSize() | 1782 ->layoutSize() |
1777 .width()); | 1783 .width()); |
1778 EXPECT_EQ(0, webViewHelper.webView() | 1784 EXPECT_EQ(0, webViewHelper.webView() |
1779 ->mainFrameImpl() | 1785 ->mainFrameImpl() |
1780 ->frameView() | 1786 ->frameView() |
1781 ->layoutSize() | 1787 ->layoutSize() |
1782 .height()); | 1788 .height()); |
1783 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); | 1789 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); |
1784 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1790 EXPECT_EQ(0.0, scrollContainer->size().height()); |
1785 | 1791 |
1786 // The flag ForceZeroLayoutHeight will cause the following resize of viewport | 1792 // The flag ForceZeroLayoutHeight will cause the following resize of viewport |
1787 // height to be ignored by the outer viewport (the container layer of | 1793 // height to be ignored by the outer viewport (the container layer of |
1788 // LayerCompositor). The height of the visualViewport, however, is not | 1794 // LayerCompositor). The height of the visualViewport, however, is not |
1789 // affected. | 1795 // affected. |
1790 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1796 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
1791 EXPECT_FALSE( | 1797 EXPECT_FALSE( |
1792 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); | 1798 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); |
1793 EXPECT_EQ(viewportWidth, webViewHelper.webView() | 1799 EXPECT_EQ(viewportWidth, webViewHelper.webView() |
1794 ->mainFrameImpl() | 1800 ->mainFrameImpl() |
1795 ->frameView() | 1801 ->frameView() |
1796 ->layoutSize() | 1802 ->layoutSize() |
1797 .width()); | 1803 .width()); |
1798 EXPECT_EQ(0, webViewHelper.webView() | 1804 EXPECT_EQ(0, webViewHelper.webView() |
1799 ->mainFrameImpl() | 1805 ->mainFrameImpl() |
1800 ->frameView() | 1806 ->frameView() |
1801 ->layoutSize() | 1807 ->layoutSize() |
1802 .height()); | 1808 .height()); |
1803 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); | 1809 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); |
1804 EXPECT_EQ(viewportHeight, compositor->containerLayer()->size().height()); | 1810 EXPECT_EQ(viewportHeight, scrollContainer->size().height()); |
1805 | 1811 |
1806 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); | 1812 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); |
1807 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); | 1813 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); |
1808 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); | 1814 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); |
1809 EXPECT_TRUE( | 1815 EXPECT_TRUE( |
1810 visualViewport.containerLayer()->platformLayer()->masksToBounds()); | 1816 visualViewport.containerLayer()->platformLayer()->masksToBounds()); |
1811 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds()); | 1817 EXPECT_FALSE(scrollContainer->platformLayer()->masksToBounds()); |
1812 } | 1818 } |
1813 | 1819 |
1814 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { | 1820 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { |
1815 registerMockedHttpURLLoad("200-by-300.html"); | 1821 registerMockedHttpURLLoad("200-by-300.html"); |
1816 | 1822 |
1817 FixedLayoutTestWebViewClient client; | 1823 FixedLayoutTestWebViewClient client; |
1818 client.m_screenInfo.deviceScaleFactor = 1; | 1824 client.m_screenInfo.deviceScaleFactor = 1; |
1819 int viewportWidth = 640; | 1825 int viewportWidth = 640; |
1820 int viewportHeight = 480; | 1826 int viewportHeight = 480; |
1821 | 1827 |
(...skipping 9540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11362 FrameTestHelpers::WebViewHelper openerHelper; | 11368 FrameTestHelpers::WebViewHelper openerHelper; |
11363 openerHelper.initialize(false, nullptr, &openerWebViewClient); | 11369 openerHelper.initialize(false, nullptr, &openerWebViewClient); |
11364 FrameTestHelpers::WebViewHelper helper; | 11370 FrameTestHelpers::WebViewHelper helper; |
11365 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); | 11371 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); |
11366 | 11372 |
11367 openerHelper.reset(); | 11373 openerHelper.reset(); |
11368 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); | 11374 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); |
11369 } | 11375 } |
11370 | 11376 |
11371 } // namespace blink | 11377 } // namespace blink |
OLD | NEW |