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

Unified Diff: content/renderer/render_widget.cc

Issue 8366032: Fix fullscreen API event delivery to be delayed until the state change has (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
===================================================================
--- content/renderer/render_widget.cc (revision 106466)
+++ content/renderer/render_widget.cc (working copy)
@@ -272,34 +272,41 @@
// Remember the rect where the resize corner will be drawn.
resizer_rect_ = resizer_rect;
- if (size_ == new_size)
- return;
+ // NOTE: We may have entered fullscreen mode without changing our size.
+ bool fullscreen_change = is_fullscreen_ != is_fullscreen;
+ if (fullscreen_change)
+ WillToggleFullscreen();
+ is_fullscreen_ = is_fullscreen;
- // TODO(darin): We should not need to reset this here.
- SetHidden(false);
- needs_repainting_on_restore_ = false;
+ if (size_ != new_size) {
+ // TODO(darin): We should not need to reset this here.
+ SetHidden(false);
+ needs_repainting_on_restore_ = false;
- size_ = new_size;
- is_fullscreen_ = is_fullscreen;
+ size_ = new_size;
- // We should not be sent a Resize message if we have not ACK'd the previous
- DCHECK(!next_paint_is_resize_ack());
+ // We should not be sent a Resize message if we have not ACK'd the previous
+ DCHECK(!next_paint_is_resize_ack());
- paint_aggregator_.ClearPendingUpdate();
+ paint_aggregator_.ClearPendingUpdate();
- // When resizing, we want to wait to paint before ACK'ing the resize. This
- // ensures that we only resize as fast as we can paint. We only need to send
- // an ACK if we are resized to a non-empty rect.
- webwidget_->resize(new_size);
- if (!new_size.IsEmpty()) {
- if (!is_accelerated_compositing_active_) {
- // Resize should have caused an invalidation of the entire view.
- DCHECK(paint_aggregator_.HasPendingUpdate());
+ // When resizing, we want to wait to paint before ACK'ing the resize. This
+ // ensures that we only resize as fast as we can paint. We only need to
+ // send an ACK if we are resized to a non-empty rect.
+ webwidget_->resize(new_size);
+ if (!new_size.IsEmpty()) {
+ if (!is_accelerated_compositing_active_) {
+ // Resize should have caused an invalidation of the entire view.
+ DCHECK(paint_aggregator_.HasPendingUpdate());
+ }
+
+ // We will send the Resize_ACK flag once we paint again.
+ set_next_paint_is_resize_ack();
}
+ }
- // We will send the Resize_ACK flag once we paint again.
- set_next_paint_is_resize_ack();
- }
+ if (fullscreen_change)
+ DidToggleFullscreen();
}
void RenderWidget::OnWasHidden() {
@@ -1269,6 +1276,32 @@
RenderThread::Get()->WidgetRestored();
}
+void RenderWidget::WillToggleFullscreen() {
+#ifdef WEBKIT_HAS_NEW_FULLSCREEN_API
+ if (!webwidget_)
+ return;
+
+ if (is_fullscreen_) {
+ webwidget_->willExitFullScreen();
+ } else {
+ webwidget_->willEnterFullScreen();
+ }
+#endif
+}
+
+void RenderWidget::DidToggleFullscreen() {
+#ifdef WEBKIT_HAS_NEW_FULLSCREEN_API
+ if (!webwidget_)
+ return;
+
+ if (is_fullscreen_) {
+ webwidget_->didEnterFullScreen();
+ } else {
+ webwidget_->didExitFullScreen();
+ }
+#endif
+}
+
void RenderWidget::SetBackground(const SkBitmap& background) {
background_ = background;
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698