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

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

Issue 1363023005: Implement FullScreen using top layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/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"
68 #include "core/layout/LayoutView.h" 67 #include "core/layout/LayoutView.h"
69 #include "core/layout/compositing/PaintLayerCompositor.h" 68 #include "core/layout/compositing/PaintLayerCompositor.h"
70 #include "core/loader/DocumentLoader.h" 69 #include "core/loader/DocumentLoader.h"
71 #include "core/loader/DocumentThreadableLoader.h" 70 #include "core/loader/DocumentThreadableLoader.h"
72 #include "core/loader/DocumentThreadableLoaderClient.h" 71 #include "core/loader/DocumentThreadableLoaderClient.h"
73 #include "core/loader/FrameLoadRequest.h" 72 #include "core/loader/FrameLoadRequest.h"
74 #include "core/loader/ThreadableLoader.h" 73 #include "core/loader/ThreadableLoader.h"
75 #include "core/page/Page.h" 74 #include "core/page/Page.h"
76 #include "core/paint/PaintLayer.h" 75 #include "core/paint/PaintLayer.h"
77 #include "core/testing/NullExecutionContext.h" 76 #include "core/testing/NullExecutionContext.h"
(...skipping 6383 matching lines...) Expand 10 before | Expand all | Expand 10 after
6461 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 6460 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
6462 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true); 6461 webViewHelper.webView()->settings()->setLoadWithOverviewMode(true);
6463 webViewHelper.webView()->settings()->setUseWideViewport(true); 6462 webViewHelper.webView()->settings()->setUseWideViewport(true);
6464 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); 6463 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
6465 webViewHelper.webView()->layout(); 6464 webViewHelper.webView()->layout();
6466 6465
6467 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew(); 6466 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew();
6468 EXPECT_LT(frameView->maximumScrollPosition().x(), 0); 6467 EXPECT_LT(frameView->maximumScrollPosition().x(), 0);
6469 } 6468 }
6470 6469
6470 TEST_F(WebFrameTest, FullscreenCleanTopLayerAndFullscreenStack)
6471 {
6472 FakeCompositingWebViewClient client;
6473 registerMockedHttpURLLoad("fullscreen_div.html");
6474 FrameTestHelpers::WebViewHelper webViewHelper;
6475 int viewportWidth = 640;
6476 int viewportHeight = 480;
6477 client.m_screenInfo.rect.width = viewportWidth;
6478 client.m_screenInfo.rect.height = viewportHeight;
6479 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
6480 m_baseURL + "fullscreen_div.html", true, 0, &client, configureAndroid);
6481 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6482 webViewImpl->layout();
6483
6484 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6485 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6486 Fullscreen& fullscreen = Fullscreen::from(*document);
6487
6488 Element* divFullscreen = document->getElementById("div1");
6489 fullscreen.requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
6490 webViewImpl->didEnterFullScreen();
6491 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6492
6493 // Sanity check. We should have both in our stack.
6494 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 1UL);
6495 ASSERT_EQ(document->topLayerElements().size(), 2UL);
6496
6497 fullscreen.exitFullscreen();
6498 webViewImpl->didExitFullScreen();
6499
6500 ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 0UL);
6501 ASSERT_EQ(document->topLayerElements().size(), 0UL);
6502 }
6503
6471 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) 6504 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize)
6472 { 6505 {
6473 FakeCompositingWebViewClient client; 6506 FakeCompositingWebViewClient client;
6474 registerMockedHttpURLLoad("fullscreen_div.html"); 6507 registerMockedHttpURLLoad("fullscreen_div.html");
6475 FrameTestHelpers::WebViewHelper webViewHelper(this); 6508 FrameTestHelpers::WebViewHelper webViewHelper(this);
6476 int viewportWidth = 640; 6509 int viewportWidth = 640;
6477 int viewportHeight = 480; 6510 int viewportHeight = 480;
6478 client.m_screenInfo.rect.width = viewportWidth; 6511 client.m_screenInfo.rect.width = viewportWidth;
6479 client.m_screenInfo.rect.height = viewportHeight; 6512 client.m_screenInfo.rect.height = viewportHeight;
6480 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configureAndroid); 6513 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configureAndroid);
6481 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 6514 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6482 webViewImpl->layout(); 6515 webViewImpl->layout();
6483 6516
6484 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6517 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6485 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6518 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6486 Element* divFullscreen = document->getElementById("div1"); 6519 Element* divFullscreen = document->getElementById("div1");
6487 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6520 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6488 webViewImpl->didEnterFullScreen(); 6521 webViewImpl->didEnterFullScreen();
6489 webViewImpl->layout(); 6522 webViewImpl->layout();
6490 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6523 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6491 6524
6492 // Verify that the element is sized to the viewport. 6525 // Verify that the element is sized to the viewport.
6493 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject(); 6526 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent);
6527 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6494 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6528 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6495 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6529 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6496 6530
6497 // Verify it's updated after a device rotation. 6531 // Verify it's updated after a device rotation.
6498 client.m_screenInfo.rect.width = viewportHeight; 6532 client.m_screenInfo.rect.width = viewportHeight;
6499 client.m_screenInfo.rect.height = viewportWidth; 6533 client.m_screenInfo.rect.height = viewportWidth;
6500 webViewImpl->resize(WebSize(viewportHeight, viewportWidth)); 6534 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6501 webViewImpl->layout(); 6535 webViewImpl->layout();
6502 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6536 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6503 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6537 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6587 webViewImpl->layout(); 6621 webViewImpl->layout();
6588 6622
6589 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document(); 6623 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document();
6590 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6624 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6591 Element* divFullscreen = document->getElementById("div1"); 6625 Element* divFullscreen = document->getElementById("div1");
6592 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6626 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6593 webViewImpl->didEnterFullScreen(); 6627 webViewImpl->didEnterFullScreen();
6594 webViewImpl->layout(); 6628 webViewImpl->layout();
6595 6629
6596 // Verify that the element is sized to the viewport. 6630 // Verify that the element is sized to the viewport.
6597 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject(); 6631 Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*docum ent);
6632 LayoutBox* fullscreenLayoutObject = toLayoutBox(fullscreenElement->layoutObj ect());
6598 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6633 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6599 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6634 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6600 6635
6601 // Verify it's updated after a device rotation. 6636 // Verify it's updated after a device rotation.
6602 client.m_screenInfo.rect.width = viewportHeight; 6637 client.m_screenInfo.rect.width = viewportHeight;
6603 client.m_screenInfo.rect.height = viewportWidth; 6638 client.m_screenInfo.rect.height = viewportWidth;
6604 webViewImpl->resize(WebSize(viewportHeight, viewportWidth)); 6639 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6605 webViewImpl->layout(); 6640 webViewImpl->layout();
6606 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt()); 6641 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalWidth().toInt());
6607 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt()); 6642 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalHeight().toInt());
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
8250 EXPECT_TRUE(resource); 8285 EXPECT_TRUE(resource);
8251 EXPECT_NE(0, resource->loadFinishTime()); 8286 EXPECT_NE(0, resource->loadFinishTime());
8252 8287
8253 DocumentLoader* loader = document->loader(); 8288 DocumentLoader* loader = document->loader();
8254 8289
8255 EXPECT_TRUE(loader); 8290 EXPECT_TRUE(loader);
8256 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); 8291 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime());
8257 } 8292 }
8258 8293
8259 } // namespace blink 8294 } // 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