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

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

Issue 1410833004: Revert "Implement FullScreen using top layer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/LocalFrame.h" 57 #include "core/frame/LocalFrame.h"
58 #include "core/frame/RemoteFrame.h" 58 #include "core/frame/RemoteFrame.h"
59 #include "core/frame/Settings.h" 59 #include "core/frame/Settings.h"
60 #include "core/frame/VisualViewport.h" 60 #include "core/frame/VisualViewport.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"
67 #include "core/layout/LayoutView.h" 68 #include "core/layout/LayoutView.h"
68 #include "core/layout/compositing/PaintLayerCompositor.h" 69 #include "core/layout/compositing/PaintLayerCompositor.h"
69 #include "core/loader/DocumentLoader.h" 70 #include "core/loader/DocumentLoader.h"
70 #include "core/loader/DocumentThreadableLoader.h" 71 #include "core/loader/DocumentThreadableLoader.h"
71 #include "core/loader/DocumentThreadableLoaderClient.h" 72 #include "core/loader/DocumentThreadableLoaderClient.h"
72 #include "core/loader/FrameLoadRequest.h" 73 #include "core/loader/FrameLoadRequest.h"
73 #include "core/loader/ThreadableLoader.h" 74 #include "core/loader/ThreadableLoader.h"
74 #include "core/page/Page.h" 75 #include "core/page/Page.h"
75 #include "core/paint/PaintLayer.h" 76 #include "core/paint/PaintLayer.h"
76 #include "core/testing/NullExecutionContext.h" 77 #include "core/testing/NullExecutionContext.h"
(...skipping 6393 matching lines...) Expand 10 before | Expand all | Expand 10 after
6470 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 6471 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
6471 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); 6472 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true);
6472 webViewHelper.webView()->settings()->setUseWideViewport(true); 6473 webViewHelper.webView()->settings()->setUseWideViewport(true);
6473 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); 6474 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
6474 webViewHelper.webView()->layout(); 6475 webViewHelper.webView()->layout();
6475 6476
6476 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew(); 6477 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew();
6477 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); 6478 EXPECT_LT(frameView->maximumScrollPosition().x(), 0);
6478 } 6479 }
6479 6480
6480 TEST_F(WebFrameTest, FullscreenCleanTopLayerAndFullscreenStack)
6481 {
6482 FakeCompositingWebViewClient client;
6483 registerMockedHttpURLLoad("fullscreen_div.html");
6484 FrameTestHelpers::WebViewHelper webViewHelper;
6485 int viewportWidth = 640;
6486 int viewportHeight = 480;
6487 client.m_screenInfo.rect.width = viewportWidth;
6488 client.m_screenInfo.rect.height = viewportHeight;
6489 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
6490 m_baseURL + "fullscreen_div.html", true, 0, &client, configureAndroid);
6491 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6492 webViewImpl->layout();
6493
6494 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6495 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6496 Fullscreen& fullscreen = Fullscreen::from(*document);
6497
6498 Element* divFullscreen = document->getElementById("div1");
6499 fullscreen.requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
6500 webViewImpl->didEnterFullScreen();
6501 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6502
6503 // Sanity check. We should have both in our stack.
6504 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 1UL);
6505 ASSERT_EQ(document->topLayerElements().size(), 2UL);
6506
6507 fullscreen.exitFullscreen();
6508 webViewImpl->didExitFullScreen();
6509
6510 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 0UL);
6511 ASSERT_EQ(document->topLayerElements().size(), 0UL);
6512 }
6513
6514 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) 6481 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize)
6515 { 6482 {
6516 FakeCompositingWebViewClient client; 6483 FakeCompositingWebViewClient client;
6517 registerMockedHttpURLLoad("fullscreen_div.html"); 6484 registerMockedHttpURLLoad("fullscreen_div.html");
6518 FrameTestHelpers::WebViewHelper webViewHelper(this); 6485 FrameTestHelpers::WebViewHelper webViewHelper(this);
6519 int viewportWidth = 640; 6486 int viewportWidth = 640;
6520 int viewportHeight = 480; 6487 int viewportHeight = 480;
6521 client.m_screenInfo.rect.width = viewportWidth; 6488 client.m_screenInfo.rect.width = viewportWidth;
6522 client.m_screenInfo.rect.height = viewportHeight; 6489 client.m_screenInfo.rect.height = viewportHeight;
6523 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configureAndroid); 6490 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configureAndroid);
6524 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 6491 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6525 webViewImpl->layout(); 6492 webViewImpl->layout();
6526 6493
6527 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6494 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6528 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6495 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6529 Element* divFullscreen = document->getElementById("div1"); 6496 Element* divFullscreen = document->getElementById("div1");
6530 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6497 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6531 webViewImpl->didEnterFullScreen(); 6498 webViewImpl->didEnterFullScreen();
6532 webViewImpl->layout(); 6499 webViewImpl->layout();
6533 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6500 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6534 6501
6535 // Verify that the element is sized to the viewport. 6502 // Verify that the element is sized to the viewport.
6536 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); 6503 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6537 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6538 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6504 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6539 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6505 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6540 6506
6541 // Verify it's updated after a device rotation. 6507 // Verify it's updated after a device rotation.
6542 client.m_screenInfo.rect.width = viewportHeight; 6508 client.m_screenInfo.rect.width = viewportHeight;
6543 client.m_screenInfo.rect.height = viewportWidth; 6509 client.m_screenInfo.rect.height = viewportWidth;
6544 webViewImpl->resize(WebSize(viewportHeight, viewportWidth)); 6510 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6545 webViewImpl->layout(); 6511 webViewImpl->layout();
6546 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6512 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6547 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6513 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6631 webViewImpl->layout(); 6597 webViewImpl->layout();
6632 6598
6633 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document(); 6599 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document();
6634 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6600 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6635 Element* divFullscreen = document->getElementById("div1"); 6601 Element* divFullscreen = document->getElementById("div1");
6636 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6602 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6637 webViewImpl->didEnterFullScreen(); 6603 webViewImpl->didEnterFullScreen();
6638 webViewImpl->layout(); 6604 webViewImpl->layout();
6639 6605
6640 // Verify that the element is sized to the viewport. 6606 // Verify that the element is sized to the viewport.
6641 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent); 6607 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6642 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6643 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6608 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6644 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6609 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6645 6610
6646 // Verify it's updated after a device rotation. 6611 // Verify it's updated after a device rotation.
6647 client.m_screenInfo.rect.width = viewportHeight; 6612 client.m_screenInfo.rect.width = viewportHeight;
6648 client.m_screenInfo.rect.height = viewportWidth; 6613 client.m_screenInfo.rect.height = viewportWidth;
6649 webViewImpl->resize(WebSize(viewportHeight, viewportWidth)); 6614 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6650 webViewImpl->layout(); 6615 webViewImpl->layout();
6651 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6616 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6652 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6617 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
8310 EXPECT_TRUE(resource); 8275 EXPECT_TRUE(resource);
8311 EXPECT_NE(0, resource->loadFinishTime()); 8276 EXPECT_NE(0, resource->loadFinishTime());
8312 8277
8313 DocumentLoader* loader = document->loader(); 8278 DocumentLoader* loader = document->loader();
8314 8279
8315 EXPECT_TRUE(loader); 8280 EXPECT_TRUE(loader);
8316 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); 8281 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime());
8317 } 8282 }
8318 8283
8319 } // namespace blink 8284 } // 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