| 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 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 EXPECT_TRUE( | 1160 EXPECT_TRUE( |
| 1161 setTextAutosizingMultiplier(toLocalFrame(frame)->document(), 2)); | 1161 setTextAutosizingMultiplier(toLocalFrame(frame)->document(), 2)); |
| 1162 for (LayoutItem layoutItem = | 1162 for (LayoutItem layoutItem = |
| 1163 toLocalFrame(frame)->document()->layoutViewItem(); | 1163 toLocalFrame(frame)->document()->layoutViewItem(); |
| 1164 !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { | 1164 !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { |
| 1165 if (layoutItem.isText()) | 1165 if (layoutItem.isText()) |
| 1166 EXPECT_FALSE(layoutItem.needsLayout()); | 1166 EXPECT_FALSE(layoutItem.needsLayout()); |
| 1167 } | 1167 } |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 frameView->page()->frameHost().visualViewport().setSize(IntSize(200, 200)); | 1170 frameView->page()->visualViewport().setSize(IntSize(200, 200)); |
| 1171 | 1171 |
| 1172 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext()) { | 1172 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext()) { |
| 1173 if (!frame->isLocalFrame()) | 1173 if (!frame->isLocalFrame()) |
| 1174 continue; | 1174 continue; |
| 1175 for (LayoutItem layoutItem = | 1175 for (LayoutItem layoutItem = |
| 1176 toLocalFrame(frame)->document()->layoutViewItem(); | 1176 toLocalFrame(frame)->document()->layoutViewItem(); |
| 1177 !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { | 1177 !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { |
| 1178 if (layoutItem.isText()) | 1178 if (layoutItem.isText()) |
| 1179 EXPECT_TRUE(layoutItem.needsLayout()); | 1179 EXPECT_TRUE(layoutItem.needsLayout()); |
| 1180 } | 1180 } |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 .width()); | 1804 .width()); |
| 1805 EXPECT_EQ(0, webViewHelper.webView() | 1805 EXPECT_EQ(0, webViewHelper.webView() |
| 1806 ->mainFrameImpl() | 1806 ->mainFrameImpl() |
| 1807 ->frameView() | 1807 ->frameView() |
| 1808 ->layoutSize() | 1808 ->layoutSize() |
| 1809 .height()); | 1809 .height()); |
| 1810 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); | 1810 EXPECT_EQ(viewportWidth, scrollContainer->size().width()); |
| 1811 EXPECT_EQ(viewportHeight, scrollContainer->size().height()); | 1811 EXPECT_EQ(viewportHeight, scrollContainer->size().height()); |
| 1812 | 1812 |
| 1813 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); | 1813 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 1814 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); | 1814 VisualViewport& visualViewport = frame->page()->visualViewport(); |
| 1815 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); | 1815 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); |
| 1816 EXPECT_TRUE( | 1816 EXPECT_TRUE( |
| 1817 visualViewport.containerLayer()->platformLayer()->masksToBounds()); | 1817 visualViewport.containerLayer()->platformLayer()->masksToBounds()); |
| 1818 EXPECT_FALSE(scrollContainer->platformLayer()->masksToBounds()); | 1818 EXPECT_FALSE(scrollContainer->platformLayer()->masksToBounds()); |
| 1819 } | 1819 } |
| 1820 | 1820 |
| 1821 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { | 1821 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { |
| 1822 registerMockedHttpURLLoad("200-by-300.html"); | 1822 registerMockedHttpURLLoad("200-by-300.html"); |
| 1823 | 1823 |
| 1824 FixedLayoutTestWebViewClient client; | 1824 FixedLayoutTestWebViewClient client; |
| (...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6039 | 6039 |
| 6040 webViewHelper.resize(WebSize(100, 200)); | 6040 webViewHelper.resize(WebSize(100, 200)); |
| 6041 | 6041 |
| 6042 // Scroll main frame to the bottom of the document | 6042 // Scroll main frame to the bottom of the document |
| 6043 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); | 6043 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); |
| 6044 EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->view()->getScrollOffset()); | 6044 EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->view()->getScrollOffset()); |
| 6045 | 6045 |
| 6046 webViewImpl->setPageScaleFactor(2.0); | 6046 webViewImpl->setPageScaleFactor(2.0); |
| 6047 | 6047 |
| 6048 // Scroll visual viewport to the top of the main frame. | 6048 // Scroll visual viewport to the top of the main frame. |
| 6049 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); | 6049 VisualViewport& visualViewport = frame->page()->visualViewport(); |
| 6050 visualViewport.setLocation(FloatPoint(0, 0)); | 6050 visualViewport.setLocation(FloatPoint(0, 0)); |
| 6051 EXPECT_SIZE_EQ(ScrollOffset(0, 0), visualViewport.getScrollOffset()); | 6051 EXPECT_SIZE_EQ(ScrollOffset(0, 0), visualViewport.getScrollOffset()); |
| 6052 | 6052 |
| 6053 // Tap at the top: there is nothing there. | 6053 // Tap at the top: there is nothing there. |
| 6054 client.resetTriggered(); | 6054 client.resetTriggered(); |
| 6055 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); | 6055 webViewHelper.webView()->handleInputEvent(fatTap(10, 60)); |
| 6056 EXPECT_FALSE(client.triggered()); | 6056 EXPECT_FALSE(client.triggered()); |
| 6057 | 6057 |
| 6058 // Scroll visual viewport to the bottom of the main frame. | 6058 // Scroll visual viewport to the bottom of the main frame. |
| 6059 visualViewport.setLocation(FloatPoint(0, 200)); | 6059 visualViewport.setLocation(FloatPoint(0, 200)); |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7721 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); | 7721 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); |
| 7722 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); | 7722 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); |
| 7723 webViewImpl->updateAllLifecyclePhases(); | 7723 webViewImpl->updateAllLifecyclePhases(); |
| 7724 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); | 7724 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); |
| 7725 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); | 7725 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); |
| 7726 | 7726 |
| 7727 // Verify that the viewports are nonscrollable. | 7727 // Verify that the viewports are nonscrollable. |
| 7728 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); | 7728 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); |
| 7729 WebLayer* layoutViewportScrollLayer = | 7729 WebLayer* layoutViewportScrollLayer = |
| 7730 webViewImpl->compositor()->scrollLayer()->platformLayer(); | 7730 webViewImpl->compositor()->scrollLayer()->platformLayer(); |
| 7731 WebLayer* visualViewportScrollLayer = frameView->page() | 7731 WebLayer* visualViewportScrollLayer = |
| 7732 ->frameHost() | 7732 frameView->page()->visualViewport().scrollLayer()->platformLayer(); |
| 7733 .visualViewport() | |
| 7734 .scrollLayer() | |
| 7735 ->platformLayer(); | |
| 7736 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); | 7733 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); |
| 7737 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical()); | 7734 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical()); |
| 7738 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal()); | 7735 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal()); |
| 7739 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical()); | 7736 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical()); |
| 7740 | 7737 |
| 7741 // Verify that the viewports are scrollable upon exiting fullscreen. | 7738 // Verify that the viewports are scrollable upon exiting fullscreen. |
| 7742 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); | 7739 EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document)); |
| 7743 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); | 7740 EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document)); |
| 7744 webViewImpl->didExitFullscreen(); | 7741 webViewImpl->didExitFullscreen(); |
| 7745 EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document)); | 7742 EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document)); |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8530 | 8527 |
| 8531 remoteFrame->view()->resize(size); | 8528 remoteFrame->view()->resize(size); |
| 8532 | 8529 |
| 8533 FrameTestHelpers::TestWebFrameClient client; | 8530 FrameTestHelpers::TestWebFrameClient client; |
| 8534 WebLocalFrame* localFrame = WebLocalFrame::createProvisional( | 8531 WebLocalFrame* localFrame = WebLocalFrame::createProvisional( |
| 8535 &client, nullptr, nullptr, remoteFrame, WebSandboxFlags::None); | 8532 &client, nullptr, nullptr, remoteFrame, WebSandboxFlags::None); |
| 8536 remoteFrame->swap(localFrame); | 8533 remoteFrame->swap(localFrame); |
| 8537 | 8534 |
| 8538 // Verify that the size that was set with a remote main frame is correct | 8535 // Verify that the size that was set with a remote main frame is correct |
| 8539 // after swapping to a local frame. | 8536 // after swapping to a local frame. |
| 8540 FrameHost* host = | 8537 Page* page = toWebViewImpl(localFrame->view())->page()->mainFrame()->page(); |
| 8541 toWebViewImpl(localFrame->view())->page()->mainFrame()->host(); | 8538 EXPECT_EQ(size.width, page->visualViewport().size().width()); |
| 8542 EXPECT_EQ(size.width, host->visualViewport().size().width()); | 8539 EXPECT_EQ(size.height, page->visualViewport().size().height()); |
| 8543 EXPECT_EQ(size.height, host->visualViewport().size().height()); | |
| 8544 | 8540 |
| 8545 // Manually reset to break WebViewHelper's dependency on the stack allocated | 8541 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 8546 // TestWebFrameClient. | 8542 // TestWebFrameClient. |
| 8547 reset(); | 8543 reset(); |
| 8548 remoteFrame->close(); | 8544 remoteFrame->close(); |
| 8549 } | 8545 } |
| 8550 | 8546 |
| 8551 namespace { | 8547 namespace { |
| 8552 | 8548 |
| 8553 class SwapMainFrameWhenTitleChangesWebFrameClient | 8549 class SwapMainFrameWhenTitleChangesWebFrameClient |
| (...skipping 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11446 "document.querySelector('input').focus();")); | 11442 "document.querySelector('input').focus();")); |
| 11447 | 11443 |
| 11448 // Verify that the right WebWidgetClient has been notified. | 11444 // Verify that the right WebWidgetClient has been notified. |
| 11449 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); | 11445 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); |
| 11450 | 11446 |
| 11451 remoteFrame->close(); | 11447 remoteFrame->close(); |
| 11452 webViewHelper.reset(); | 11448 webViewHelper.reset(); |
| 11453 } | 11449 } |
| 11454 | 11450 |
| 11455 } // namespace blink | 11451 } // namespace blink |
| OLD | NEW |