Title: [142220] trunk/Source/WebKit/blackberry
Revision
142220
Author
[email protected]
Date
2013-02-07 19:01:40 -0800 (Thu, 07 Feb 2013)

Log Message

[BlackBerry] Enable non-video element enter/exit fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=108314

Reviewed by Antonio Gomes.

Webkit support non-video element (like div) to enter/exit
fullscreen. We should pass this capability in blackberry porting.

RIM PR 256370, internally reviewed by Max Feil.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::clearDocumentData):
(BlackBerry::WebKit::WebPagePrivate::setViewportSize):
(BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
(BlackBerry::WebKit::WebPagePrivate::enterFullscreenForNode):
(BlackBerry::WebKit::WebPagePrivate::exitFullscreenForNode):
(WebKit):
(BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::adjustFullScreenElementDimensionsIfNeeded):
* Api/WebPage_p.h:
(WebPagePrivate):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (142219 => 142220)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-02-08 02:41:21 UTC (rev 142219)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-02-08 03:01:40 UTC (rev 142220)
@@ -422,7 +422,7 @@
     , m_suspendRootLayerCommit(false)
 #endif
     , m_pendingOrientation(-1)
-    , m_fullscreenVideoNode(0)
+    , m_fullscreenNode(0)
     , m_hasInRegionScrollableAreas(false)
     , m_updateDelegatedOverlaysDispatched(false)
     , m_enableQnxJavaScriptObject(false)
@@ -2503,7 +2503,7 @@
     if (nodeUnderFatFinger && nodeUnderFatFinger->document() == documentGoingAway)
         m_touchEventHandler->resetLastFatFingersResult();
 
-    // NOTE: m_fullscreenVideoNode, m_fullScreenPluginView and m_pluginViews
+    // NOTE: m_fullscreenNode, m_fullScreenPluginView and m_pluginViews
     // are cleared in other methods already.
 }
 
@@ -3838,7 +3838,7 @@
 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO)
     // When leaving fullscreen mode, restore the scale and scroll position if needed.
     // We also need to make sure the scale and scroll position won't cause over scale or over scroll.
-    if (m_scaleBeforeFullScreen > 0 && !m_fullscreenVideoNode) {
+    if (m_scaleBeforeFullScreen > 0 && !m_fullscreenNode) {
         // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here,
         // as it will multiply the scale rather than set the scale.
         // FIXME: We can refactor this into setCurrentScale(double) if it is useful in the future.
@@ -5157,15 +5157,15 @@
 {
     UNUSED_PARAM(done);
 #if ENABLE(VIDEO)
-    if (d->m_webSettings->fullScreenVideoCapable()) {
-        if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get()))
-            mediaElement->exitFullscreen();
-    } else {
+    Element* element = toElement(d->m_fullscreenNode.get());
+    if (!element)
+        return;
+    if (d->m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag))
+        static_cast<HTMLMediaElement*>(element)->exitFullscreen();
 #if ENABLE(FULLSCREEN_API)
-        if (Element* element = static_cast<Element*>(d->m_fullscreenVideoNode.get()))
-            element->document()->webkitCancelFullScreen();
+    else
+        element->document()->webkitCancelFullScreen();
 #endif
-    }
 #endif
 }
 
@@ -5781,7 +5781,7 @@
         return;
 
     mmrPlayer->setFullscreenWebPageClient(m_client);
-    m_fullscreenVideoNode = node;
+    m_fullscreenNode = node;
     m_client->fullscreenStart(contextName, window, mmrPlayer->getWindowScreenRect());
 #endif
 }
@@ -5789,9 +5789,9 @@
 void WebPagePrivate::exitFullscreenForNode(Node* node)
 {
 #if ENABLE(VIDEO)
-    if (m_fullscreenVideoNode.get()) {
+    if (m_fullscreenNode.get()) {
         m_client->fullscreenStop();
-        m_fullscreenVideoNode = 0;
+        m_fullscreenNode = 0;
     }
 
     if (!node || !node->hasTagName(HTMLNames::videoTag))
@@ -5811,23 +5811,12 @@
 }
 
 #if ENABLE(FULLSCREEN_API)
-// TODO: We should remove this helper class when we decide to support all elements.
-static bool containsVideoTags(Element* element)
-{
-    for (Node* node = element->firstChild(); node; node = NodeTraversal::next(node, element)) {
-        if (node->hasTagName(HTMLNames::videoTag))
-            return true;
-    }
-    return false;
-}
-
 void WebPagePrivate::enterFullScreenForElement(Element* element)
 {
 #if ENABLE(VIDEO)
-    // TODO: We should not check video tag when we decide to support all elements.
-    if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element)))
+    if (!element)
         return;
-    if (m_webSettings->fullScreenVideoCapable()) {
+    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
         // 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
@@ -5859,7 +5848,7 @@
         // _javascript_ call is often made on a div element.
         // This is where we would hide the browser's chrome if we wanted to.
         client()->fullscreenStart();
-        m_fullscreenVideoNode = element;
+        m_fullscreenNode = element;
     }
 #endif
 }
@@ -5867,17 +5856,16 @@
 void WebPagePrivate::exitFullScreenForElement(Element* element)
 {
 #if ENABLE(VIDEO)
-    // TODO: We should not check video tag when we decide to support all elements.
-    if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element)))
+    if (!element)
         return;
-    if (m_webSettings->fullScreenVideoCapable()) {
+    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
         // 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.
         client()->fullscreenStop();
-        m_fullscreenVideoNode = 0;
+        m_fullscreenNode = 0;
     }
 #endif
 }
@@ -5887,14 +5875,14 @@
 {
     // If we are in fullscreen video mode, and we change the FrameView::viewportRect,
     // we need to adjust the media container to the new size.
-    if (!m_fullscreenVideoNode || !m_fullscreenVideoNode->renderer()
-        || !m_fullscreenVideoNode->document() || !m_fullscreenVideoNode->document()->fullScreenRenderer())
+    if (!m_fullscreenNode || !m_fullscreenNode->renderer()
+        || !m_fullscreenNode->document() || !m_fullscreenNode->document()->fullScreenRenderer())
         return;
 
-    ASSERT(m_fullscreenVideoNode->isElementNode());
-    ASSERT(static_cast<Element*>(m_fullscreenVideoNode.get())->isMediaElement());
+    ASSERT(m_fullscreenNode->isElementNode());
+    ASSERT(static_cast<Element*>(m_fullscreenNode.get())->isMediaElement());
 
-    Document* document = m_fullscreenVideoNode->document();
+    Document* document = m_fullscreenNode->document();
     RenderStyle* fullScreenStyle = document->fullScreenRenderer()->style();
     ASSERT(fullScreenStyle);
 

Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (142219 => 142220)


--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2013-02-08 02:41:21 UTC (rev 142219)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2013-02-08 03:01:40 UTC (rev 142220)
@@ -582,7 +582,7 @@
 
     int m_pendingOrientation;
 
-    RefPtr<WebCore::Node> m_fullscreenVideoNode;
+    RefPtr<WebCore::Node> m_fullscreenNode;
     RefPtr<WebCore::PluginView> m_fullScreenPluginView;
 
     typedef HashMap<const WebCore::Frame*, BackingStoreClient*> BackingStoreClientForFrameMap;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (142219 => 142220)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-02-08 02:41:21 UTC (rev 142219)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-02-08 03:01:40 UTC (rev 142220)
@@ -1,3 +1,29 @@
+2013-02-07  Mary Wu  <[email protected]>
+
+        [BlackBerry] Enable non-video element enter/exit fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=108314
+
+        Reviewed by Antonio Gomes.
+
+        Webkit support non-video element (like div) to enter/exit
+        fullscreen. We should pass this capability in blackberry porting.
+
+        RIM PR 256370, internally reviewed by Max Feil.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+        (BlackBerry::WebKit::WebPagePrivate::clearDocumentData):
+        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
+        (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
+        (BlackBerry::WebKit::WebPagePrivate::enterFullscreenForNode):
+        (BlackBerry::WebKit::WebPagePrivate::exitFullscreenForNode):
+        (WebKit):
+        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
+        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
+        (BlackBerry::WebKit::WebPagePrivate::adjustFullScreenElementDimensionsIfNeeded):
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+
 2013-02-07  Jakob Petsovits  <[email protected]>
 
         [BlackBerry] Fix all flicker caused by empty/incomplete geometries.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to