| 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 6440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6451 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); | 6451 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); |
| 6452 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6452 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
| 6453 webViewImpl->updateAllLifecyclePhases(); | 6453 webViewImpl->updateAllLifecyclePhases(); |
| 6454 | 6454 |
| 6455 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 6455 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 6456 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6456 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
| 6457 Element* divFullscreen = document->getElementById("div1"); | 6457 Element* divFullscreen = document->getElementById("div1"); |
| 6458 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); | 6458 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); |
| 6459 webViewImpl->didEnterFullscreen(); | 6459 webViewImpl->didEnterFullscreen(); |
| 6460 webViewImpl->updateAllLifecyclePhases(); | 6460 webViewImpl->updateAllLifecyclePhases(); |
| 6461 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); | 6461 EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), divFullscreen
); |
| 6462 | 6462 |
| 6463 // Verify that the element is sized to the viewport. | 6463 // Verify that the element is sized to the viewport. |
| 6464 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS
creenLayoutObject(); | 6464 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS
creenLayoutObject(); |
| 6465 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); | 6465 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); |
| 6466 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); | 6466 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); |
| 6467 | 6467 |
| 6468 // Verify it's updated after a device rotation. | 6468 // Verify it's updated after a device rotation. |
| 6469 client.m_screenInfo.rect.width = viewportHeight; | 6469 client.m_screenInfo.rect.width = viewportHeight; |
| 6470 client.m_screenInfo.rect.height = viewportWidth; | 6470 client.m_screenInfo.rect.height = viewportWidth; |
| 6471 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); | 6471 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6486 webViewImpl->updateAllLifecyclePhases(); | 6486 webViewImpl->updateAllLifecyclePhases(); |
| 6487 | 6487 |
| 6488 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 6488 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 6489 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6489 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
| 6490 Element* divFullscreen = document->getElementById("div1"); | 6490 Element* divFullscreen = document->getElementById("div1"); |
| 6491 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); | 6491 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr
efixedRequest); |
| 6492 webViewImpl->didEnterFullscreen(); | 6492 webViewImpl->didEnterFullscreen(); |
| 6493 webViewImpl->updateAllLifecyclePhases(); | 6493 webViewImpl->updateAllLifecyclePhases(); |
| 6494 | 6494 |
| 6495 // Verify that the viewports are nonscrollable. | 6495 // Verify that the viewports are nonscrollable. |
| 6496 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); | 6496 EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), divFullscreen
); |
| 6497 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView()
; | 6497 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView()
; |
| 6498 WebLayer* layoutViewportScrollLayer = webViewImpl->compositor()->scrollLayer
()->platformLayer(); | 6498 WebLayer* layoutViewportScrollLayer = webViewImpl->compositor()->scrollLayer
()->platformLayer(); |
| 6499 WebLayer* visualViewportScrollLayer = frameView->page()->frameHost().visualV
iewport().scrollLayer()->platformLayer(); | 6499 WebLayer* visualViewportScrollLayer = frameView->page()->frameHost().visualV
iewport().scrollLayer()->platformLayer(); |
| 6500 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); | 6500 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); |
| 6501 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical()); | 6501 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical()); |
| 6502 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal()); | 6502 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal()); |
| 6503 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical()); | 6503 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical()); |
| 6504 | 6504 |
| 6505 // Verify that the viewports are scrollable upon exiting fullscreen. | 6505 // Verify that the viewports are scrollable upon exiting fullscreen. |
| 6506 webViewImpl->didExitFullscreen(); | 6506 webViewImpl->didExitFullscreen(); |
| 6507 webViewImpl->updateAllLifecyclePhases(); | 6507 webViewImpl->updateAllLifecyclePhases(); |
| 6508 ASSERT_FALSE(Fullscreen::isFullScreen(*document)); | 6508 EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), nullptr); |
| 6509 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal()); | 6509 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal()); |
| 6510 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical()); | 6510 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical()); |
| 6511 ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal()); | 6511 ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal()); |
| 6512 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical()); | 6512 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical()); |
| 6513 } | 6513 } |
| 6514 | 6514 |
| 6515 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) | 6515 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) |
| 6516 { | 6516 { |
| 6517 FakeCompositingWebViewClient client; | 6517 FakeCompositingWebViewClient client; |
| 6518 registerMockedHttpURLLoad("fullscreen_div.html"); | 6518 registerMockedHttpURLLoad("fullscreen_div.html"); |
| 6519 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6519 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6520 int viewportWidth = 640; | 6520 int viewportWidth = 640; |
| 6521 int viewportHeight = 480; | 6521 int viewportHeight = 480; |
| 6522 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); | 6522 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full
screen_div.html", true, nullptr, &client, nullptr, configureAndroid); |
| 6523 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 6523 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
| 6524 webViewImpl->updateAllLifecyclePhases(); | 6524 webViewImpl->updateAllLifecyclePhases(); |
| 6525 | 6525 |
| 6526 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 6526 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 6527 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6527 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
| 6528 Fullscreen::from(*document).requestFullscreen(*document->documentElement(),
Fullscreen::PrefixedRequest); | 6528 Fullscreen::from(*document).requestFullscreen(*document->documentElement(),
Fullscreen::PrefixedRequest); |
| 6529 webViewImpl->didEnterFullscreen(); | 6529 webViewImpl->didEnterFullscreen(); |
| 6530 webViewImpl->updateAllLifecyclePhases(); | 6530 webViewImpl->updateAllLifecyclePhases(); |
| 6531 | 6531 |
| 6532 // Verify that the main frame is still scrollable. | 6532 // Verify that the main frame is still scrollable. |
| 6533 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); | 6533 EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), document->doc
umentElement()); |
| 6534 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor
mLayer(); | 6534 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor
mLayer(); |
| 6535 ASSERT_TRUE(webScrollLayer->scrollable()); | 6535 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 6536 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 6536 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 6537 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 6537 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
| 6538 | 6538 |
| 6539 // Verify the main frame still behaves correctly after a resize. | 6539 // Verify the main frame still behaves correctly after a resize. |
| 6540 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); | 6540 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); |
| 6541 ASSERT_TRUE(webScrollLayer->scrollable()); | 6541 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 6542 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); | 6542 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); |
| 6543 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); | 6543 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8838 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); | 8838 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); |
| 8839 helper.webView()->mainFrameImpl()->loadRequest(request); | 8839 helper.webView()->mainFrameImpl()->loadRequest(request); |
| 8840 | 8840 |
| 8841 // Normally, the result of the JS url replaces the existing contents on the | 8841 // Normally, the result of the JS url replaces the existing contents on the |
| 8842 // Document. However, if the JS triggers a navigation, the contents should | 8842 // Document. However, if the JS triggers a navigation, the contents should |
| 8843 // not be replaced. | 8843 // not be replaced. |
| 8844 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document(
)->documentElement()->innerText()); | 8844 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document(
)->documentElement()->innerText()); |
| 8845 } | 8845 } |
| 8846 | 8846 |
| 8847 } // namespace blink | 8847 } // namespace blink |
| OLD | NEW |