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

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

Issue 22454003: Support subtitles for native fullscreen video (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 if (Document* doc = m_fullScreenFrame->document()) { 77 if (Document* doc = m_fullScreenFrame->document()) {
78 if (FullscreenElementStack::isFullScreen(doc)) { 78 if (FullscreenElementStack::isFullScreen(doc)) {
79 if (!m_exitFullscreenPageScaleFactor) { 79 if (!m_exitFullscreenPageScaleFactor) {
80 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor (); 80 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor ();
81 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset(); 81 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset();
82 m_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f); 82 m_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f);
83 } 83 }
84 84
85 FullscreenElementStack::from(doc)->webkitDidEnterFullScreenForElemen t(0); 85 FullscreenElementStack::from(doc)->webkitDidEnterFullScreenForElemen t(0);
86 #if USE(NATIVE_FULLSCREEN_VIDEO)
87 if (Element* element = FullscreenElementStack::currentFullScreenElem entFrom(doc)) {
88 if (element->isMediaElement() && m_webViewImpl->layerTreeView())
89 m_webViewImpl->layerTreeView()->setHasTransparentBackground( true);
90 }
91 #endif
86 } 92 }
87 } 93 }
88 } 94 }
89 95
90 void FullscreenController::willExitFullScreen() 96 void FullscreenController::willExitFullScreen()
91 { 97 {
92 if (!m_fullScreenFrame) 98 if (!m_fullScreenFrame)
93 return; 99 return;
94 100
95 if (Document* doc = m_fullScreenFrame->document()) { 101 if (Document* doc = m_fullScreenFrame->document()) {
96 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist s(doc); 102 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist s(doc);
97 if (!fullscreen) 103 if (!fullscreen)
98 return; 104 return;
99 if (fullscreen->isFullScreen(doc)) { 105 if (fullscreen->isFullScreen(doc)) {
100 // When the client exits from full screen we have to call webkitCanc elFullScreen to 106 // When the client exits from full screen we have to call webkitCanc elFullScreen to
101 // notify the document. While doing that, suppress notifications bac k to the client. 107 // notify the document. While doing that, suppress notifications bac k to the client.
102 m_isCancelingFullScreen = true; 108 m_isCancelingFullScreen = true;
103 fullscreen->webkitCancelFullScreen(); 109 fullscreen->webkitCancelFullScreen();
104 m_isCancelingFullScreen = false; 110 m_isCancelingFullScreen = false;
105 fullscreen->webkitWillExitFullScreenForElement(0); 111 fullscreen->webkitWillExitFullScreenForElement(0);
112 #if USE(NATIVE_FULLSCREEN_VIDEO)
113 if (m_webViewImpl->layerTreeView())
114 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we bViewImpl->isTransparent());
115 #endif
106 } 116 }
107 } 117 }
108 } 118 }
109 119
110 void FullscreenController::didExitFullScreen() 120 void FullscreenController::didExitFullScreen()
111 { 121 {
112 if (!m_fullScreenFrame) 122 if (!m_fullScreenFrame)
113 return; 123 return;
114 124
115 if (Document* doc = m_fullScreenFrame->document()) { 125 if (Document* doc = m_fullScreenFrame->document()) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 mediaElement->player()->exitFullscreen(); 186 mediaElement->player()->exitFullscreen();
177 return; 187 return;
178 } 188 }
179 #endif 189 #endif
180 if (WebViewClient* client = m_webViewImpl->client()) 190 if (WebViewClient* client = m_webViewImpl->client())
181 client->exitFullScreen(); 191 client->exitFullScreen();
182 } 192 }
183 193
184 } 194 }
185 195
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698