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

Side by Side Diff: third_party/WebKit/Source/web/FullscreenController.cpp

Issue 2810813004: Hide fullscreen rotation jank (Closed)
Patch Set: Refactor jank logic. Make RWHVA a WebContentsObserver to observe fullscreen state Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (state_ != State::kEnteringFullscreen) 71 if (state_ != State::kEnteringFullscreen)
72 return; 72 return;
73 73
74 UpdatePageScaleConstraints(false); 74 UpdatePageScaleConstraints(false);
75 web_view_base_->SetPageScaleFactor(1.0f); 75 web_view_base_->SetPageScaleFactor(1.0f);
76 if (web_view_base_->MainFrame()->IsWebLocalFrame()) 76 if (web_view_base_->MainFrame()->IsWebLocalFrame())
77 web_view_base_->MainFrame()->SetScrollOffset(WebSize()); 77 web_view_base_->MainFrame()->SetScrollOffset(WebSize());
78 web_view_base_->SetVisualViewportOffset(FloatPoint()); 78 web_view_base_->SetVisualViewportOffset(FloatPoint());
79 79
80 state_ = State::kFullscreen; 80 state_ = State::kFullscreen;
81 web_view_base_->LayerTreeView()->SetIsFullscreen(true);
81 82
82 // Notify all local frames that we have entered fullscreen. 83 // Notify all local frames that we have entered fullscreen.
83 for (Frame* frame = web_view_base_->GetPage()->MainFrame(); frame; 84 for (Frame* frame = web_view_base_->GetPage()->MainFrame(); frame;
84 frame = frame->Tree().TraverseNext()) { 85 frame = frame->Tree().TraverseNext()) {
85 if (!frame->IsLocalFrame()) 86 if (!frame->IsLocalFrame())
86 continue; 87 continue;
87 if (Document* document = ToLocalFrame(frame)->GetDocument()) { 88 if (Document* document = ToLocalFrame(frame)->GetDocument()) {
88 if (Fullscreen* fullscreen = Fullscreen::FromIfExists(*document)) 89 if (Fullscreen* fullscreen = Fullscreen::FromIfExists(*document))
89 fullscreen->DidEnterFullscreen(); 90 fullscreen->DidEnterFullscreen();
90 } 91 }
(...skipping 30 matching lines...) Expand all
121 if (Document* document = ToLocalFrame(frame)->GetDocument()) { 122 if (Document* document = ToLocalFrame(frame)->GetDocument()) {
122 if (Fullscreen* fullscreen = Fullscreen::FromIfExists(*document)) 123 if (Fullscreen* fullscreen = Fullscreen::FromIfExists(*document))
123 fullscreen->DidExitFullscreen(); 124 fullscreen->DidExitFullscreen();
124 } 125 }
125 } 126 }
126 127
127 // We need to wait until style and layout are updated in order to properly 128 // We need to wait until style and layout are updated in order to properly
128 // restore scroll offsets since content may not be overflowing in the same way 129 // restore scroll offsets since content may not be overflowing in the same way
129 // until they are. 130 // until they are.
130 state_ = State::kNeedsScrollAndScaleRestore; 131 state_ = State::kNeedsScrollAndScaleRestore;
132 web_view_base_->LayerTreeView()->SetIsFullscreen(false);
131 } 133 }
132 134
133 void FullscreenController::EnterFullscreen(LocalFrame& frame) { 135 void FullscreenController::EnterFullscreen(LocalFrame& frame) {
134 // If already fullscreen or exiting fullscreen, synchronously call 136 // If already fullscreen or exiting fullscreen, synchronously call
135 // |didEnterFullscreen()|. When exiting, the coming |didExitFullscren()| call 137 // |didEnterFullscreen()|. When exiting, the coming |didExitFullscren()| call
136 // will again notify all frames. 138 // will again notify all frames.
137 if (state_ == State::kFullscreen || state_ == State::kExitingFullscreen) { 139 if (state_ == State::kFullscreen || state_ == State::kExitingFullscreen) {
138 State old_state = state_; 140 State old_state = state_;
139 state_ = State::kEnteringFullscreen; 141 state_ = State::kEnteringFullscreen;
140 DidEnterFullscreen(); 142 DidEnterFullscreen();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // again to ensure the final constraints pick up the latest contents size. 288 // again to ensure the final constraints pick up the latest contents size.
287 web_view_base_->DidChangeContentsSize(); 289 web_view_base_->DidChangeContentsSize();
288 if (web_view_base_->MainFrameImpl() && 290 if (web_view_base_->MainFrameImpl() &&
289 web_view_base_->MainFrameImpl()->GetFrameView()) 291 web_view_base_->MainFrameImpl()->GetFrameView())
290 web_view_base_->MainFrameImpl()->GetFrameView()->SetNeedsLayout(); 292 web_view_base_->MainFrameImpl()->GetFrameView()->SetNeedsLayout();
291 293
292 web_view_base_->UpdateMainFrameLayoutSize(); 294 web_view_base_->UpdateMainFrameLayoutSize();
293 } 295 }
294 296
295 } // namespace blink 297 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698