OLD | NEW |
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 Loading... |
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 Loading... |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // again to ensure the final constraints pick up the latest contents size. | 289 // again to ensure the final constraints pick up the latest contents size. |
288 web_view_base_->DidChangeContentsSize(); | 290 web_view_base_->DidChangeContentsSize(); |
289 if (web_view_base_->MainFrameImpl() && | 291 if (web_view_base_->MainFrameImpl() && |
290 web_view_base_->MainFrameImpl()->GetFrameView()) | 292 web_view_base_->MainFrameImpl()->GetFrameView()) |
291 web_view_base_->MainFrameImpl()->GetFrameView()->SetNeedsLayout(); | 293 web_view_base_->MainFrameImpl()->GetFrameView()->SetNeedsLayout(); |
292 | 294 |
293 web_view_base_->UpdateMainFrameLayoutSize(); | 295 web_view_base_->UpdateMainFrameLayoutSize(); |
294 } | 296 } |
295 | 297 |
296 } // namespace blink | 298 } // namespace blink |
OLD | NEW |