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

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

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: Set WebViewImpl transparency for fullscreen. Created 3 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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 webFrameClient(frame).exitFullscreen(); 176 webFrameClient(frame).exitFullscreen();
177 177
178 m_state = State::ExitingFullscreen; 178 m_state = State::ExitingFullscreen;
179 } 179 }
180 180
181 void FullscreenController::fullscreenElementChanged(Element* fromElement, 181 void FullscreenController::fullscreenElementChanged(Element* fromElement,
182 Element* toElement) { 182 Element* toElement) {
183 DCHECK_NE(fromElement, toElement); 183 DCHECK_NE(fromElement, toElement);
184 184
185 // Restore transparency if old fullscreen element changed it.
186 if (m_needsTransparencyRestore)
187 m_webViewImpl->setIsTransparent(m_initialTransparency);
188
185 if (toElement) { 189 if (toElement) {
186 DCHECK(Fullscreen::isCurrentFullScreenElement(*toElement)); 190 DCHECK(Fullscreen::isCurrentFullScreenElement(*toElement));
187 191
188 if (isHTMLVideoElement(*toElement)) { 192 if (isHTMLVideoElement(*toElement)) {
189 HTMLVideoElement& videoElement = toHTMLVideoElement(*toElement); 193 HTMLVideoElement& videoElement = toHTMLVideoElement(*toElement);
190 videoElement.didEnterFullscreen(); 194 videoElement.didEnterFullscreen();
191 195
192 // If the video uses overlay fullscreen mode, make the background 196 // If the video uses overlay fullscreen mode, make the background
193 // transparent. 197 // transparent.
194 if (videoElement.usesOverlayFullscreenVideo() && 198 if (videoElement.usesOverlayFullscreenVideo()) {
195 m_webViewImpl->layerTreeView()) { 199 m_initialTransparency = m_webViewImpl->isTransparent();
chrishtr 2017/03/01 16:16:53 For m_initialPageScaleFactor, it is "reset" in Ful
Eric Seckler 2017/03/07 18:00:46 This stuff changed a bit now, but I still restore
196 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); 200 m_needsTransparencyRestore = true;
201 m_webViewImpl->setIsTransparent(true);
197 } 202 }
198 } 203 }
199 } 204 }
200 205
201 if (fromElement) { 206 if (fromElement) {
202 DCHECK(!Fullscreen::isCurrentFullScreenElement(*fromElement)); 207 DCHECK(!Fullscreen::isCurrentFullScreenElement(*fromElement));
203 208
204 if (isHTMLVideoElement(*fromElement)) { 209 if (isHTMLVideoElement(*fromElement)) {
205 // If the video used overlay fullscreen mode, restore the transparency.
206 if (m_webViewImpl->layerTreeView()) {
207 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
208 m_webViewImpl->isTransparent());
209 }
210
211 HTMLVideoElement& videoElement = toHTMLVideoElement(*fromElement); 210 HTMLVideoElement& videoElement = toHTMLVideoElement(*fromElement);
212 videoElement.didExitFullscreen(); 211 videoElement.didExitFullscreen();
213 } 212 }
214 } 213 }
215 } 214 }
216 215
217 void FullscreenController::updateSize() { 216 void FullscreenController::updateSize() {
218 DCHECK(m_webViewImpl->page()); 217 DCHECK(m_webViewImpl->page());
219 218
220 if (m_state != State::Fullscreen && m_state != State::ExitingFullscreen) 219 if (m_state != State::Fullscreen && m_state != State::ExitingFullscreen)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // again to ensure the final constraints pick up the latest contents size. 266 // again to ensure the final constraints pick up the latest contents size.
268 m_webViewImpl->didChangeContentsSize(); 267 m_webViewImpl->didChangeContentsSize();
269 if (m_webViewImpl->mainFrameImpl() && 268 if (m_webViewImpl->mainFrameImpl() &&
270 m_webViewImpl->mainFrameImpl()->frameView()) 269 m_webViewImpl->mainFrameImpl()->frameView())
271 m_webViewImpl->mainFrameImpl()->frameView()->setNeedsLayout(); 270 m_webViewImpl->mainFrameImpl()->frameView()->setNeedsLayout();
272 271
273 m_webViewImpl->updateMainFrameLayoutSize(); 272 m_webViewImpl->updateMainFrameLayoutSize();
274 } 273 }
275 274
276 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698