| 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 FixedLayoutTestWebViewClient client; | 1749 FixedLayoutTestWebViewClient client; |
| 1750 client.m_screenInfo.deviceScaleFactor = 1; | 1750 client.m_screenInfo.deviceScaleFactor = 1; |
| 1751 int viewportWidth = 640; | 1751 int viewportWidth = 640; |
| 1752 int viewportHeight = 480; | 1752 int viewportHeight = 480; |
| 1753 | 1753 |
| 1754 FrameTestHelpers::WebViewHelper webViewHelper; | 1754 FrameTestHelpers::WebViewHelper webViewHelper; |
| 1755 | 1755 |
| 1756 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, | 1756 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, |
| 1757 &client, nullptr, configureAndroid); | 1757 &client, nullptr, configureAndroid); |
| 1758 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | 1758 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); |
| 1759 webViewHelper.webView()->updateAllLifecyclePhases(); |
| 1760 |
| 1759 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); | 1761 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); |
| 1762 GraphicsLayer* scrollContainer = compositor->containerLayer(); |
| 1763 if (!scrollContainer) |
| 1764 scrollContainer = compositor->rootGraphicsLayer(); |
| 1765 |
| 1760 EXPECT_EQ(0, webViewHelper.webView() | 1766 EXPECT_EQ(0, webViewHelper.webView() |
| 1761 ->mainFrameImpl() | 1767 ->mainFrameImpl() |
| 1762 ->frameView() | 1768 ->frameView() |
| 1763 ->layoutSize() | 1769 ->layoutSize() |
| 1764 .width()); | 1770 .width()); |
| 1765 EXPECT_EQ(0, webViewHelper.webView() | 1771 EXPECT_EQ(0, webViewHelper.webView() |
| 1766 ->mainFrameImpl() | 1772 ->mainFrameImpl() |
| 1767 ->frameView() | 1773 ->frameView() |
| 1768 ->layoutSize() | 1774 ->layoutSize() |
| 1769 .height()); | 1775 .height()); |
| 1770 EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); | 1776 EXPECT_EQ(0.0, scrollContainer->size().width()); |
| 1771 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1777 EXPECT_EQ(0.0, scrollContainer->size().height()); |
| 1772 | 1778 |
| 1773 webViewHelper.resize(WebSize(viewportWidth, 0)); | 1779 webViewHelper.resize(WebSize(viewportWidth, 0)); |
| 1774 EXPECT_EQ(viewportWidth, webViewHelper.webView() | 1780 EXPECT_EQ(viewportWidth, webViewHelper.webView() |
| 1775 ->mainFrameImpl() | 1781 ->mainFrameImpl() |
| 1776 ->frameView() | 1782 ->frameView() |
| 1777 ->layoutSize() | 1783 ->layoutSize() |
| 1778 .width()); | 1784 .width()); |
| 1779 EXPECT_EQ(0, webViewHelper.webView() | 1785 EXPECT_EQ(0, webViewHelper.webView() |
| 1780 ->mainFrameImpl() | 1786 ->mainFrameImpl() |
| 1781 ->frameView() | 1787 ->frameView() |
| 1782 ->layoutSize() | 1788 ->layoutSize() |
| 1783 .height()); | 1789 .height()); |
| 1784 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); | 1790 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); |
| 1785 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); | 1791 EXPECT_EQ(0.0, scrollContainer->size().height()); |
| 1786 | 1792 |
| 1787 // The flag ForceZeroLayoutHeight will cause the following resize of viewport | 1793 // The flag ForceZeroLayoutHeight will cause the following resize of viewport |
| 1788 // height to be ignored by the outer viewport (the container layer of | 1794 // height to be ignored by the outer viewport (the container layer of |
| 1789 // LayerCompositor). The height of the visualViewport, however, is not | 1795 // LayerCompositor). The height of the visualViewport, however, is not |
| 1790 // affected. | 1796 // affected. |
| 1791 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 1797 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
| 1792 EXPECT_FALSE( | 1798 EXPECT_FALSE( |
| 1793 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); | 1799 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); |
| 1794 EXPECT_EQ(viewportWidth, webViewHelper.webView() | 1800 EXPECT_EQ(viewportWidth, webViewHelper.webView() |
| 1795 ->mainFrameImpl() | 1801 ->mainFrameImpl() |
| 1796 ->frameView() | 1802 ->frameView() |
| 1797 ->layoutSize() | 1803 ->layoutSize() |
| 1798 .width()); | 1804 .width()); |
| 1799 EXPECT_EQ(0, webViewHelper.webView() | 1805 EXPECT_EQ(0, webViewHelper.webView() |
| 1800 ->mainFrameImpl() | 1806 ->mainFrameImpl() |
| 1801 ->frameView() | 1807 ->frameView() |
| 1802 ->layoutSize() | 1808 ->layoutSize() |
| 1803 .height()); | 1809 .height()); |
| 1804 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); | 1810 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); |
| 1805 EXPECT_EQ(viewportHeight, compositor->containerLayer()->size().height()); | 1811 EXPECT_EQ(viewportHeight, scrollContainer->size().height()); |
| 1806 | 1812 |
| 1807 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); | 1813 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 1808 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); | 1814 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); |
| 1809 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); | 1815 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); |
| 1810 EXPECT_TRUE( | 1816 EXPECT_TRUE( |
| 1811 visualViewport.containerLayer()->platformLayer()->masksToBounds()); | 1817 visualViewport.containerLayer()->platformLayer()->masksToBounds()); |
| 1812 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds()); | 1818 EXPECT_FALSE(scrollContainer->platformLayer()->masksToBounds()); |
| 1813 } | 1819 } |
| 1814 | 1820 |
| 1815 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { | 1821 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { |
| 1816 registerMockedHttpURLLoad("200-by-300.html"); | 1822 registerMockedHttpURLLoad("200-by-300.html"); |
| 1817 | 1823 |
| 1818 FixedLayoutTestWebViewClient client; | 1824 FixedLayoutTestWebViewClient client; |
| 1819 client.m_screenInfo.deviceScaleFactor = 1; | 1825 client.m_screenInfo.deviceScaleFactor = 1; |
| 1820 int viewportWidth = 640; | 1826 int viewportWidth = 640; |
| 1821 int viewportHeight = 480; | 1827 int viewportHeight = 480; |
| 1822 | 1828 |
| (...skipping 9618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11441 "document.querySelector('input').focus();")); | 11447 "document.querySelector('input').focus();")); |
| 11442 | 11448 |
| 11443 // Verify that the right WebWidgetClient has been notified. | 11449 // Verify that the right WebWidgetClient has been notified. |
| 11444 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); | 11450 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); |
| 11445 | 11451 |
| 11446 remoteFrame->close(); | 11452 remoteFrame->close(); |
| 11447 webViewHelper.reset(); | 11453 webViewHelper.reset(); |
| 11448 } | 11454 } |
| 11449 | 11455 |
| 11450 } // namespace blink | 11456 } // namespace blink |
| OLD | NEW |