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

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

Issue 2168373002: Revert of Reland "Implement FullScreen using top layer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve WebFrameTest.cpp conflict and appease presubmit Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/web/FullscreenController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/frame/RemoteFrame.h" 57 #include "core/frame/RemoteFrame.h"
58 #include "core/frame/Settings.h" 58 #include "core/frame/Settings.h"
59 #include "core/frame/VisualViewport.h" 59 #include "core/frame/VisualViewport.h"
60 #include "core/html/HTMLBodyElement.h" 60 #include "core/html/HTMLBodyElement.h"
61 #include "core/html/HTMLDocument.h" 61 #include "core/html/HTMLDocument.h"
62 #include "core/html/HTMLFormElement.h" 62 #include "core/html/HTMLFormElement.h"
63 #include "core/html/HTMLMediaElement.h" 63 #include "core/html/HTMLMediaElement.h"
64 #include "core/html/ImageDocument.h" 64 #include "core/html/ImageDocument.h"
65 #include "core/input/EventHandler.h" 65 #include "core/input/EventHandler.h"
66 #include "core/layout/HitTestResult.h" 66 #include "core/layout/HitTestResult.h"
67 #include "core/layout/LayoutFullScreen.h"
68 #include "core/layout/api/LayoutViewItem.h"
67 #include "core/layout/compositing/PaintLayerCompositor.h" 69 #include "core/layout/compositing/PaintLayerCompositor.h"
68 #include "core/loader/DocumentLoader.h" 70 #include "core/loader/DocumentLoader.h"
69 #include "core/loader/DocumentThreadableLoader.h" 71 #include "core/loader/DocumentThreadableLoader.h"
70 #include "core/loader/DocumentThreadableLoaderClient.h" 72 #include "core/loader/DocumentThreadableLoaderClient.h"
71 #include "core/loader/FrameLoadRequest.h" 73 #include "core/loader/FrameLoadRequest.h"
72 #include "core/loader/ThreadableLoader.h" 74 #include "core/loader/ThreadableLoader.h"
73 #include "core/page/Page.h" 75 #include "core/page/Page.h"
74 #include "core/page/ScopedPageLoadDeferrer.h" 76 #include "core/page/ScopedPageLoadDeferrer.h"
75 #include "core/paint/PaintLayer.h" 77 #include "core/paint/PaintLayer.h"
76 #include "core/testing/NullExecutionContext.h" 78 #include "core/testing/NullExecutionContext.h"
(...skipping 6350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 6429 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
6428 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); 6430 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true);
6429 webViewHelper.webView()->settings()->setUseWideViewport(true); 6431 webViewHelper.webView()->settings()->setUseWideViewport(true);
6430 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6432 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6431 webViewHelper.webView()->updateAllLifecyclePhases(); 6433 webViewHelper.webView()->updateAllLifecyclePhases();
6432 6434
6433 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView() ; 6435 FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView() ;
6434 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); 6436 EXPECT_LT(frameView->maximumScrollPosition().x(), 0);
6435 } 6437 }
6436 6438
6437 TEST_F(WebFrameTest, FullscreenCleanTopLayerAndFullscreenStack)
6438 {
6439 FakeCompositingWebViewClient client;
6440 registerMockedHttpURLLoad("fullscreen_div.html");
6441 FrameTestHelpers::WebViewHelper webViewHelper;
6442 int viewportWidth = 640;
6443 int viewportHeight = 480;
6444 client.m_screenInfo.rect.width = viewportWidth;
6445 client.m_screenInfo.rect.height = viewportHeight;
6446 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
6447 m_baseURL + "fullscreen_div.html", true, 0, &client, nullptr, configureA ndroid);
6448 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6449 webViewImpl->updateAllLifecyclePhases();
6450
6451 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6452 Document* document = webViewImpl->mainFrameImpl()->frame()->document();
6453 Fullscreen& fullscreen = Fullscreen::from(*document);
6454
6455 Element* divFullscreen = document->getElementById("div1");
6456 fullscreen.requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
6457 webViewImpl->didEnterFullscreen();
6458 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6459
6460 // Sanity check. We should have both in our stack.
6461 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 1UL);
6462 ASSERT_EQ(document->topLayerElements().size(), 2UL);
6463
6464 fullscreen.exitFullscreen();
6465 webViewImpl->didExitFullscreen();
6466
6467 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 0UL);
6468 ASSERT_EQ(document->topLayerElements().size(), 0UL);
6469 }
6470
6471 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) 6439 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize)
6472 { 6440 {
6473 FakeCompositingWebViewClient client; 6441 FakeCompositingWebViewClient client;
6474 registerMockedHttpURLLoad("fullscreen_div.html"); 6442 registerMockedHttpURLLoad("fullscreen_div.html");
6475 FrameTestHelpers::WebViewHelper webViewHelper(this); 6443 FrameTestHelpers::WebViewHelper webViewHelper(this);
6476 int viewportWidth = 640; 6444 int viewportWidth = 640;
6477 int viewportHeight = 480; 6445 int viewportHeight = 480;
6478 client.m_screenInfo.rect.width = viewportWidth; 6446 client.m_screenInfo.rect.width = viewportWidth;
6479 client.m_screenInfo.rect.height = viewportHeight; 6447 client.m_screenInfo.rect.height = viewportHeight;
6480 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid); 6448 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid);
6481 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6449 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6482 webViewImpl->updateAllLifecyclePhases(); 6450 webViewImpl->updateAllLifecyclePhases();
6483 6451
6484 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); 6452 Document* document = webViewImpl->mainFrameImpl()->frame()->document();
6485 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6453 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6486 Element* divFullscreen = document->getElementById("div1"); 6454 Element* divFullscreen = document->getElementById("div1");
6487 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6455 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6488 webViewImpl->didEnterFullscreen(); 6456 webViewImpl->didEnterFullscreen();
6489 webViewImpl->updateAllLifecyclePhases(); 6457 webViewImpl->updateAllLifecyclePhases();
6490 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6458 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6491 6459
6492 // Verify that the element is sized to the viewport. 6460 // Verify that the element is sized to the viewport.
6493 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); 6461 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6494 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6495 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6462 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6496 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6463 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6497 6464
6498 // Verify it's updated after a device rotation. 6465 // Verify it's updated after a device rotation.
6499 client.m_screenInfo.rect.width = viewportHeight; 6466 client.m_screenInfo.rect.width = viewportHeight;
6500 client.m_screenInfo.rect.height = viewportWidth; 6467 client.m_screenInfo.rect.height = viewportWidth;
6501 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); 6468 webViewHelper.resize(WebSize(viewportHeight, viewportWidth));
6502 webViewImpl->updateAllLifecyclePhases(); 6469 webViewImpl->updateAllLifecyclePhases();
6503 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6470 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6504 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6471 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6588 webViewImpl->updateAllLifecyclePhases(); 6555 webViewImpl->updateAllLifecyclePhases();
6589 6556
6590 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document(); 6557 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document();
6591 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6558 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6592 Element* divFullscreen = document->getElementById("div1"); 6559 Element* divFullscreen = document->getElementById("div1");
6593 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6560 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6594 webViewImpl->didEnterFullscreen(); 6561 webViewImpl->didEnterFullscreen();
6595 webViewImpl->updateAllLifecyclePhases(); 6562 webViewImpl->updateAllLifecyclePhases();
6596 6563
6597 // Verify that the element is sized to the viewport. 6564 // Verify that the element is sized to the viewport.
6598 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); 6565 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6599 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6600 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6566 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6601 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6567 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6602 6568
6603 // Verify it's updated after a device rotation. 6569 // Verify it's updated after a device rotation.
6604 client.m_screenInfo.rect.width = viewportHeight; 6570 client.m_screenInfo.rect.width = viewportHeight;
6605 client.m_screenInfo.rect.height = viewportWidth; 6571 client.m_screenInfo.rect.height = viewportWidth;
6606 webViewHelper.resize(WebSize(viewportHeight, viewportWidth)); 6572 webViewHelper.resize(WebSize(viewportHeight, viewportWidth));
6607 webViewImpl->updateAllLifecyclePhases(); 6573 webViewImpl->updateAllLifecyclePhases();
6608 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6574 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6609 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6575 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
8869 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 8835 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
8870 helper.webView()->mainFrameImpl()->loadRequest(request); 8836 helper.webView()->mainFrameImpl()->loadRequest(request);
8871 8837
8872 // Normally, the result of the JS url replaces the existing contents on the 8838 // Normally, the result of the JS url replaces the existing contents on the
8873 // Document. However, if the JS triggers a navigation, the contents should 8839 // Document. However, if the JS triggers a navigation, the contents should
8874 // not be replaced. 8840 // not be replaced.
8875 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document( )->documentElement()->innerText()); 8841 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document( )->documentElement()->innerText());
8876 } 8842 }
8877 8843
8878 } // namespace blink 8844 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/FullscreenController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698