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

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

Issue 200943002: Fix an issue that fullscreen layer is scrollable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits Created 6 years, 9 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 | Annotate | Revision Log
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "WebSecurityOrigin.h" 53 #include "WebSecurityOrigin.h"
54 #include "WebSecurityPolicy.h" 54 #include "WebSecurityPolicy.h"
55 #include "WebSettings.h" 55 #include "WebSettings.h"
56 #include "WebSpellCheckClient.h" 56 #include "WebSpellCheckClient.h"
57 #include "WebTextCheckingCompletion.h" 57 #include "WebTextCheckingCompletion.h"
58 #include "WebTextCheckingResult.h" 58 #include "WebTextCheckingResult.h"
59 #include "WebViewClient.h" 59 #include "WebViewClient.h"
60 #include "WebViewImpl.h" 60 #include "WebViewImpl.h"
61 #include "core/clipboard/Clipboard.h" 61 #include "core/clipboard/Clipboard.h"
62 #include "core/dom/DocumentMarkerController.h" 62 #include "core/dom/DocumentMarkerController.h"
63 #include "core/dom/FullscreenElementStack.h"
63 #include "core/dom/Range.h" 64 #include "core/dom/Range.h"
64 #include "core/editing/Editor.h" 65 #include "core/editing/Editor.h"
65 #include "core/editing/FrameSelection.h" 66 #include "core/editing/FrameSelection.h"
66 #include "core/editing/SpellChecker.h" 67 #include "core/editing/SpellChecker.h"
67 #include "core/editing/VisiblePosition.h" 68 #include "core/editing/VisiblePosition.h"
68 #include "core/events/MouseEvent.h" 69 #include "core/events/MouseEvent.h"
69 #include "core/frame/FrameView.h" 70 #include "core/frame/FrameView.h"
70 #include "core/frame/LocalFrame.h" 71 #include "core/frame/LocalFrame.h"
71 #include "core/frame/Settings.h" 72 #include "core/frame/Settings.h"
72 #include "core/html/HTMLFormElement.h" 73 #include "core/html/HTMLFormElement.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 { 121 {
121 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest)); 122 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
122 ASSERT(m_layerTreeView); 123 ASSERT(m_layerTreeView);
123 } 124 }
124 125
125 virtual WebLayerTreeView* layerTreeView() OVERRIDE 126 virtual WebLayerTreeView* layerTreeView() OVERRIDE
126 { 127 {
127 return m_layerTreeView.get(); 128 return m_layerTreeView.get();
128 } 129 }
129 130
131 virtual bool enterFullScreen() OVERRIDE { return true; }
132
130 private: 133 private:
131 OwnPtr<WebLayerTreeView> m_layerTreeView; 134 OwnPtr<WebLayerTreeView> m_layerTreeView;
132 }; 135 };
133 136
134 class WebFrameTest : public testing::Test { 137 class WebFrameTest : public testing::Test {
135 protected: 138 protected:
136 WebFrameTest() 139 WebFrameTest()
137 : m_baseURL("http://www.test.com/") 140 : m_baseURL("http://www.test.com/")
138 , m_chromeURL("chrome://") 141 , m_chromeURL("chrome://")
139 { 142 {
(...skipping 5096 matching lines...) Expand 10 before | Expand all | Expand 10 after
5236 FrameTestHelpers::WebViewHelper webViewHelper; 5239 FrameTestHelpers::WebViewHelper webViewHelper;
5237 webViewHelper.initializeAndLoad("about:blank"); 5240 webViewHelper.initializeAndLoad("about:blank");
5238 5241
5239 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView(); 5242 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView();
5240 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200)); 5243 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200));
5241 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect()); 5244 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect());
5242 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200)); 5245 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200));
5243 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ; 5246 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ;
5244 } 5247 }
5245 5248
5249 TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
5250 {
5251 FakeCompositingWebViewClient client;
5252 registerMockedHttpURLLoad("fullscreen_div.html");
5253 FrameTestHelpers::WebViewHelper webViewHelper;
5254 int viewportWidth = 640;
5255 int viewportHeight = 480;
5256 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, &configueCompositingWebView);
5257 webViewImpl->settings()->setFullScreenEnabled(true);
5258 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
5259 webViewImpl->layout();
5260
5261 Document* document = toWebFrameImpl(webViewImpl->mainFrame())->frame()->docu ment();
5262 WebCore::UserGestureIndicator gesture(WebCore::DefinitelyProcessingUserGestu re);
5263 Element* divFullscreen = document->getElementById("div1");
5264 divFullscreen->webkitRequestFullscreen();
5265 webViewImpl->willEnterFullScreen();
5266 webViewImpl->didEnterFullScreen();
5267 webViewImpl->layout();
5268
5269 // Verify that the main frame is not scrollable.
5270 ASSERT_TRUE(WebCore::FullscreenElementStack::isFullScreen(*document));
5271 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor mLayer();
5272 ASSERT_FALSE(webScrollLayer->scrollable());
5273
5274 // Verify that the main frame is scrollable upon exiting fullscreen.
5275 webViewImpl->willExitFullScreen();
5276 webViewImpl->didExitFullScreen();
5277 webViewImpl->layout();
5278 ASSERT_FALSE(WebCore::FullscreenElementStack::isFullScreen(*document));
5279 webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
5280 ASSERT_TRUE(webScrollLayer->scrollable());
5281 }
5282
5246 } // namespace 5283 } // namespace
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | Source/web/tests/data/fullscreen_div.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698