- Revision
- 117148
- Author
- [email protected]
- Date
- 2012-05-15 13:55:12 -0700 (Tue, 15 May 2012)
Log Message
[BlackBerry] Enable the Fullscreen API
https://bugs.webkit.org/show_bug.cgi?id=86129
Patch by Max Feil <[email protected]> on 2012-05-15
Reviewed by Antonio Gomes.
This patch enables the new document-based Fullscreen API.
The ENABLE(FULLSCREEN_API) is already enabled in the
BlackBerry WebKit build. My patch turns fullscreen on
in the page settings by default and implements the missing
ChromeClientBlackBerry::{supports,enter,exit}FullScreenForElement()
member functions. I am also plumbing through the existing
"fullScreenVideoCapable" that QNXStageWebView has always been
sending to allow the presence of a native fullscreen video player
to be checked.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
* Api/WebSettings.cpp:
(WebKit):
(BlackBerry::WebKit::WebSettings::standardSettings):
(BlackBerry::WebKit::WebSettings::fullScreenVideoCapable):
(BlackBerry::WebKit::WebSettings::setFullScreenVideoCapable):
* Api/WebSettings.h:
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore):
(WebCore::ChromeClientBlackBerry::supportsFullScreenForElement):
(WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
(WebCore::ChromeClientBlackBerry::exitFullScreenForElement):
* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (117147 => 117148)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-05-15 20:55:12 UTC (rev 117148)
@@ -123,7 +123,6 @@
#include "runtime_root.h"
#if ENABLE(VIDEO)
-#include "HTMLMediaElement.h"
#include "MediaPlayer.h"
#include "MediaPlayerPrivateBlackBerry.h"
#endif
@@ -6019,6 +6018,11 @@
WebSocket::setIsAvailable(webSettings->areWebSocketsEnabled());
#endif
+#if ENABLE(FULLSCREEN_API)
+ // This allows _javascript_ to call webkitRequestFullScreen() on an element.
+ coreSettings->setFullScreenEnabled(true);
+#endif
+
#if ENABLE(VIEWPORT_REFLOW)
coreSettings->setTextReflowEnabled(webSettings->textReflowMode() == WebSettings::TextReflowEnabled);
#endif
Modified: trunk/Source/WebKit/blackberry/Api/WebSettings.cpp (117147 => 117148)
--- trunk/Source/WebKit/blackberry/Api/WebSettings.cpp 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/Api/WebSettings.cpp 2012-05-15 20:55:12 UTC (rev 117148)
@@ -54,6 +54,7 @@
DEFINE_STATIC_LOCAL(String, BlackBerryUserScalableEnabled, ("BlackBerryUserScalableEnabled"));
DEFINE_STATIC_LOCAL(String, BlackBerryViewportWidth, ("BlackBerryViewportWidth"));
DEFINE_STATIC_LOCAL(String, BlackBerryZoomToFitOnLoadEnabled, ("BlackBerryZoomToFitOnLoadEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryFullScreenVideoCapable, ("BlackBerryFullScreenVideoCapable"));
DEFINE_STATIC_LOCAL(String, SpatialNavigationEnabled, ("SpatialNavigationEnabled"));
DEFINE_STATIC_LOCAL(String, WebKitDatabasePath, ("WebKitDatabasePath"));
DEFINE_STATIC_LOCAL(String, WebKitDatabasesEnabled, ("WebKitDatabasesEnabled"));
@@ -162,6 +163,7 @@
settings->m_private->setBoolean(BlackBerryUseWebKitCache, true);
settings->m_private->setBoolean(BlackBerryUserScalableEnabled, true);
settings->m_private->setBoolean(BlackBerryZoomToFitOnLoadEnabled, true);
+ settings->m_private->setBoolean(BlackBerryFullScreenVideoCapable, false);
settings->m_private->setInteger(WebKitDefaultFontSize, 16);
settings->m_private->setInteger(WebKitDefaultFixedFontSize, 13);
@@ -753,5 +755,15 @@
m_private->setBoolean(SpatialNavigationEnabled, enable);
}
+bool WebSettings::fullScreenVideoCapable() const
+{
+ return m_private->getBoolean(BlackBerryFullScreenVideoCapable);
+}
+
+void WebSettings::setFullScreenVideoCapable(bool enable)
+{
+ m_private->setBoolean(BlackBerryFullScreenVideoCapable, enable);
+}
+
} // namespace WebKit
} // namespace BlackBerry
Modified: trunk/Source/WebKit/blackberry/Api/WebSettings.h (117147 => 117148)
--- trunk/Source/WebKit/blackberry/Api/WebSettings.h 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/Api/WebSettings.h 2012-05-15 20:55:12 UTC (rev 117148)
@@ -220,6 +220,9 @@
bool isSpatialNavigationEnabled() const;
void setSpatialNavigationEnabled(bool);
+ bool fullScreenVideoCapable() const;
+ void setFullScreenVideoCapable(bool);
+
private:
WebSettingsPrivate* m_private;
WebSettings();
Modified: trunk/Source/WebKit/blackberry/ChangeLog (117147 => 117148)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-05-15 20:55:12 UTC (rev 117148)
@@ -1,3 +1,36 @@
+2012-05-15 Max Feil <[email protected]>
+
+ [BlackBerry] Enable the Fullscreen API
+ https://bugs.webkit.org/show_bug.cgi?id=86129
+
+ Reviewed by Antonio Gomes.
+
+ This patch enables the new document-based Fullscreen API.
+ The ENABLE(FULLSCREEN_API) is already enabled in the
+ BlackBerry WebKit build. My patch turns fullscreen on
+ in the page settings by default and implements the missing
+ ChromeClientBlackBerry::{supports,enter,exit}FullScreenForElement()
+ member functions. I am also plumbing through the existing
+ "fullScreenVideoCapable" that QNXStageWebView has always been
+ sending to allow the presence of a native fullscreen video player
+ to be checked.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
+ * Api/WebSettings.cpp:
+ (WebKit):
+ (BlackBerry::WebKit::WebSettings::standardSettings):
+ (BlackBerry::WebKit::WebSettings::fullScreenVideoCapable):
+ (BlackBerry::WebKit::WebSettings::setFullScreenVideoCapable):
+ * Api/WebSettings.h:
+ * WebCoreSupport/ChromeClientBlackBerry.cpp:
+ (WebCore):
+ (WebCore::ChromeClientBlackBerry::supportsFullScreenForElement):
+ (WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
+ (WebCore::ChromeClientBlackBerry::exitFullScreenForElement):
+ * WebCoreSupport/ChromeClientBlackBerry.h:
+ (ChromeClientBlackBerry):
+
2012-05-15 Hanna Ma <[email protected]>
[BlackBerry] adding a functionality for web inspector to inspect current selected element
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp (117147 => 117148)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp 2012-05-15 20:55:12 UTC (rev 117148)
@@ -717,6 +717,45 @@
m_webPagePrivate->exitFullscreenForNode(node);
}
+#if ENABLE(FULLSCREEN_API)
+bool ChromeClientBlackBerry::supportsFullScreenForElement(const WebCore::Element* element, bool withKeyboard)
+{
+ return !withKeyboard;
+}
+
+void ChromeClientBlackBerry::enterFullScreenForElement(WebCore::Element* element)
+{
+ element->document()->webkitWillEnterFullScreenForElement(element);
+ if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) {
+ // The Browser chrome has its own fullscreen video widget it wants to
+ // use, and this is a video element. The only reason that
+ // webkitWillEnterFullScreenForElement() and
+ // webkitDidEnterFullScreenForElement() are still called in this case
+ // is so that exitFullScreenForElement() gets called later.
+ enterFullscreenForNode(element);
+ } else {
+ // No fullscreen video widget has been made available by the Browser
+ // chrome, or this is not a video element. The webkitRequestFullScreen
+ // _javascript_ call is often made on a div element.
+ // This is where we would hide the browser's chrome if we wanted to.
+ }
+ element->document()->webkitDidEnterFullScreenForElement(element);
+}
+
+void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element* element)
+{
+ element->document()->webkitWillExitFullScreenForElement(element);
+ if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) {
+ // The Browser chrome has its own fullscreen video widget.
+ exitFullscreenForNode(element);
+ } else {
+ // This is where we would restore the browser's chrome
+ // if hidden above.
+ }
+ element->document()->webkitDidExitFullScreenForElement(element);
+}
+#endif
+
#if ENABLE(WEBGL)
void ChromeClientBlackBerry::requestWebGLPermission(Frame* frame)
{
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h (117147 => 117148)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h 2012-05-15 20:54:18 UTC (rev 117147)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h 2012-05-15 20:55:12 UTC (rev 117148)
@@ -126,6 +126,11 @@
virtual bool supportsFullscreenForNode(const Node*);
virtual void enterFullscreenForNode(Node*);
virtual void exitFullscreenForNode(Node*);
+#if ENABLE(FULLSCREEN_API)
+ virtual bool supportsFullScreenForElement(const Element*, bool withKeyboard);
+ virtual void enterFullScreenForElement(Element*);
+ virtual void exitFullScreenForElement(Element*);
+#endif
#if ENABLE(WEBGL)
virtual void requestWebGLPermission(Frame*);
#endif