summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-03 20:07:10 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-03 20:07:10 +0000
commit6e6a0f5f3d7e4ffa39bf8a2d3057bbaf56f7f6aa (patch)
tree1e88a62ee8953be2124c2cc95b07880044b81d6a
parent4d0df263a2891507742c8e3cec2929ae5f511200 (diff)
downloadchromium_src-6e6a0f5f3d7e4ffa39bf8a2d3057bbaf56f7f6aa.zip
chromium_src-6e6a0f5f3d7e4ffa39bf8a2d3057bbaf56f7f6aa.tar.gz
chromium_src-6e6a0f5f3d7e4ffa39bf8a2d3057bbaf56f7f6aa.tar.bz2
PPAPI SetFullscreen: Explicitely disallow state changes when the opposite
one is already pending. It is not clear what one should expect. Should the 2nd request override the 1st one? Should it be queued up and processed as if it was placed after the 1st one finished? Should it be ignored? In reality, the 2nd transitions does not occur while still messing up the state of 1st one (e.g. the window goes into fullscreen, but fullscreen DidChangeView never fires). Even with the JS interface, the behavior appears to be broken: http://www/~polina/fullscreen.html. Since the feature is not particularly useful, it is cleanest to just deny it in Pepper. BUG=41780 TEST=in CL Review URL: http://codereview.chromium.org/8093013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103767 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc7
-rw-r--r--ppapi/tests/test_fullscreen.cc10
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc8
3 files changed, 20 insertions, 5 deletions
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc b/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
index 959b7bb..4a87752 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
@@ -120,8 +120,9 @@ void TestSetFullscreenFalse() {
// The transition is asynchronous and ends at the next DidChangeView().
EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_TRUE);
g_normal_pending = true;
- // Transition is pending, so repeated requests fail.
+ // Transition is pending, so additional requests fail.
EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_FALSE);
+ EXPECT(ppb->SetFullscreen(pp_instance(), PP_TRUE) == PP_FALSE);
EXPECT(ppb->IsFullscreen(pp_instance()) == PP_TRUE);
// No 2D or 3D device can be bound during transition.
EXPECT(PPBGraphics2D()->IsGraphics2D(g_graphics2d) == PP_TRUE);
@@ -182,8 +183,10 @@ PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource event) {
EXPECT(CreateGraphics2D(&g_graphics2d));
EXPECT(PPBFullscreenDev()->SetFullscreen(pp_instance(), PP_TRUE) == PP_TRUE);
g_fullscreen_pending = true;
- // Transition is pending, so repeated requests fail.
+ // Transition is pending, so additional requests fail.
EXPECT(PPBFullscreenDev()->SetFullscreen(pp_instance(), PP_TRUE) == PP_FALSE);
+ EXPECT(PPBFullscreenDev()->SetFullscreen(pp_instance(), PP_FALSE) ==
+ PP_FALSE);
EXPECT(PPBFullscreenDev()->IsFullscreen(pp_instance()) == PP_FALSE);
// No 2D or 3D device can be bound during transition.
EXPECT(PPBGraphics2D()->IsGraphics2D(g_graphics2d) == PP_TRUE);
diff --git a/ppapi/tests/test_fullscreen.cc b/ppapi/tests/test_fullscreen.cc
index 226d03d..95a0dd7 100644
--- a/ppapi/tests/test_fullscreen.cc
+++ b/ppapi/tests/test_fullscreen.cc
@@ -109,9 +109,11 @@ std::string TestFullscreen::TestNormalToFullscreenToNormal() {
normal_pending_ = true;
if (!screen_mode_.SetFullscreen(false))
return ReportError("SetFullscreen(false) in fullscreen", false);
- // Normal is now pending, so repeated requests should fail.
+ // Normal is now pending, so additional requests should fail.
if (screen_mode_.SetFullscreen(false))
return ReportError("SetFullscreen(false) in normal pending", true);
+ if (screen_mode_.SetFullscreen(true))
+ return ReportError("SetFullscreen(true) in normal pending", true);
if (instance_->BindGraphics(graphics2d_normal_))
return ReportError("BindGraphics() in normal transition", true);
if (!screen_mode_.IsFullscreen())
@@ -154,12 +156,16 @@ bool TestFullscreen::HandleInputEvent(const pp::InputEvent& event) {
FailFullscreenTest(ReportError("SetFullscreen(true) in normal", false));
return false;
}
- // Fullscreen is now pending, so repeated requests should fail.
+ // Fullscreen is now pending, so additional requests should fail.
if (screen_mode_.SetFullscreen(true)) {
FailFullscreenTest(
ReportError("SetFullscreen(true) in fullscreen pending", true));
return false;
}
+ if (screen_mode_.SetFullscreen(false)) {
+ FailFullscreenTest(
+ ReportError("SetFullscreen(false) in fullscreen pending", true));
+ }
// No graphics devices can be bound while in transition.
if (instance_->BindGraphics(graphics2d_fullscreen_)) {
FailFullscreenTest(
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index d7d245f..f41c7dc 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -936,12 +936,18 @@ bool PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) {
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PluginInstance> ref(this);
- // We check whether we are trying to switch to the state we're already going
+ // Check whether we are trying to switch to the state we're already going
// to (i.e. if we're already switching to fullscreen but the fullscreen
// container isn't ready yet, don't do anything more).
if (fullscreen == IsFullscreenOrPending())
return false;
+ // Check whether we are trying to switch while the state is in transition.
+ // The 2nd request gets dropped while messing up the internal state, so
+ // disallow this.
+ if (fullscreen_ != desired_fullscreen_state_)
+ return false;
+
// The browser will allow us to go into fullscreen mode only when processing
// a user gesture. This is guaranteed to work with in-process plugins and
// out-of-process syncronous proxies, but might be an issue with Flash when