Changeset 119119 in webkit


Ignore:
Timestamp:
May 31, 2012 10:33:39 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Blackberry] WebKit's fullscreen mode needs to notify page client.
https://bugs.webkit.org/show_bug.cgi?id=87337

Patch by Chris Guan <chris.guan@torchmobile.com.cn> on 2012-05-31
Reviewed by Antonio Gomes.

Move "fullScreenVideoCapable" into webpagePrivate to make code
clean for "fullScreenForElement/Node" of cromeClientBlackberry,
All Video checks and code path selections are in webpagePrivate now.
For some UX and secure reasons, we could not apply fullscreen capacity
for all elements, So we use client's fullscreenStart/Stop only for
those video elements and those elements containing video tags.

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::webContext):
(BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
(WebKit):
(BlackBerry::WebKit::containsVideoTags):
(BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):

  • Api/WebPageClient.h:
  • Api/WebPage_p.h:

(WebCore):
(WebPagePrivate):

  • WebCoreSupport/ChromeClientBlackBerry.cpp:

(WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
(WebCore::ChromeClientBlackBerry::exitFullScreenForElement):

Location:
trunk/Source/WebKit/blackberry
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r119105 r119119  
    161161
    162162#if ENABLE(ACCELERATED_2D_CANVAS)
     163#include "GrContext.h"
    163164#include "SharedGraphicsContext3D.h"
    164 #include "GrContext.h"
    165165#endif
    166166
     
    22612261
    22622262    if (node->isTextNode()) {
    2263         Text* curText = static_cast<Text*>(node.get());
     2263        Text* curText = toText(node.get());
    22642264        if (!curText->wholeText().isEmpty())
    22652265            context.setText(curText->wholeText().utf8().data());
     
    54835483    UNUSED_PARAM(done);
    54845484#if ENABLE(VIDEO)
    5485     if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get()))
    5486         mediaElement->exitFullscreen();
     5485    if (d->m_webSettings->fullScreenVideoCapable()) {
     5486        if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get()))
     5487            mediaElement->exitFullscreen();
     5488    } else {
     5489#if ENABLE(FULLSCREEN_API)
     5490        if (Element* element = static_cast<Element*>(d->m_fullscreenVideoNode.get()))
     5491            element->document()->webkitCancelFullScreen();
     5492#endif
     5493    }
    54875494#endif
    54885495}
     
    60376044#endif
    60386045}
     6046
     6047#if ENABLE(FULLSCREEN_API)
     6048// TODO: We should remove this helper class when we decide to support all elements.
     6049static bool containsVideoTags(Element* element)
     6050{
     6051    for (Node* node = element->firstChild(); node; node = node->traverseNextNode(element)) {
     6052        if (node->hasTagName(HTMLNames::videoTag))
     6053            return true;
     6054    }
     6055    return false;
     6056}
     6057
     6058void WebPagePrivate::enterFullScreenForElement(Element* element)
     6059{
     6060#if ENABLE(VIDEO)
     6061    // TODO: We should not check video tag when we decide to support all elements.
     6062    if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element)))
     6063        return;
     6064    if (m_webSettings->fullScreenVideoCapable()) {
     6065        // The Browser chrome has its own fullscreen video widget it wants to
     6066        // use, and this is a video element. The only reason that
     6067        // webkitWillEnterFullScreenForElement() and
     6068        // webkitDidEnterFullScreenForElement() are still called in this case
     6069        // is so that exitFullScreenForElement() gets called later.
     6070        enterFullscreenForNode(element);
     6071    } else {
     6072        // No fullscreen video widget has been made available by the Browser
     6073        // chrome, or this is not a video element. The webkitRequestFullScreen
     6074        // Javascript call is often made on a div element.
     6075        // This is where we would hide the browser's chrome if we wanted to.
     6076        client()->fullscreenStart();
     6077        m_fullscreenVideoNode = element;
     6078    }
     6079#endif
     6080}
     6081
     6082void WebPagePrivate::exitFullScreenForElement(Element* element)
     6083{
     6084#if ENABLE(VIDEO)
     6085    // TODO: We should not check video tag when we decide to support all elements.
     6086    if (!element || !element->hasTagName(HTMLNames::videoTag))
     6087        return;
     6088    if (m_webSettings->fullScreenVideoCapable()) {
     6089        // The Browser chrome has its own fullscreen video widget.
     6090        exitFullscreenForNode(element);
     6091    } else {
     6092        // This is where we would restore the browser's chrome
     6093        // if hidden above.
     6094        client()->fullscreenStop();
     6095        m_fullscreenVideoNode = 0;
     6096    }
     6097#endif
     6098}
     6099#endif
    60396100
    60406101void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
  • trunk/Source/WebKit/blackberry/Api/WebPageClient.h

    r118719 r119119  
    232232    virtual void downloadRequested(Platform::FilterStream*, const WebString& suggestedFilename) = 0;
    233233
     234    virtual int fullscreenStart() = 0;
    234235    virtual int fullscreenStart(const char* contextName, Platform::Graphics::Window*, unsigned x, unsigned y, unsigned width, unsigned height) = 0;
    235236
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r119046 r119119  
    4242class DOMWrapperWorld;
    4343class Document;
     44class Element;
    4445class Frame;
    4546class GeolocationControllerClientBlackBerry;
     
    192193    void enterFullscreenForNode(WebCore::Node*);
    193194    void exitFullscreenForNode(WebCore::Node*);
     195#if ENABLE(FULLSCREEN_API)
     196    void enterFullScreenForElement(WebCore::Element*);
     197    void exitFullScreenForElement(WebCore::Element*);
     198#endif
    194199    void contentsSizeChanged(const WebCore::IntSize&);
    195200    void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; }
  • trunk/Source/WebKit/blackberry/ChangeLog

    r119105 r119119  
     12012-05-31  Chris Guan  <chris.guan@torchmobile.com.cn>
     2
     3        [Blackberry] WebKit's fullscreen mode needs to notify page client.
     4        https://bugs.webkit.org/show_bug.cgi?id=87337
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Move "fullScreenVideoCapable" into webpagePrivate to make code
     9        clean for "fullScreenForElement/Node" of cromeClientBlackberry,
     10        All Video checks and code path selections are in webpagePrivate now.
     11        For some UX and secure reasons, we could not apply fullscreen capacity
     12        for all elements, So we use client's fullscreenStart/Stop only for
     13        those video elements and those elements containing video tags.
     14
     15        * Api/WebPage.cpp:
     16        (BlackBerry::WebKit::WebPagePrivate::webContext):
     17        (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
     18        (WebKit):
     19        (BlackBerry::WebKit::containsVideoTags):
     20        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
     21        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
     22        * Api/WebPageClient.h:
     23        * Api/WebPage_p.h:
     24        (WebCore):
     25        (WebPagePrivate):
     26        * WebCoreSupport/ChromeClientBlackBerry.cpp:
     27        (WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
     28        (WebCore::ChromeClientBlackBerry::exitFullScreenForElement):
     29
    1302012-05-31  Arvid Nilsson  <anilsson@rim.com>
    231
  • trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp

    r118696 r119119  
    728728{
    729729    element->document()->webkitWillEnterFullScreenForElement(element);
    730     if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) {
    731         // The Browser chrome has its own fullscreen video widget it wants to
    732         // use, and this is a video element. The only reason that
    733         // webkitWillEnterFullScreenForElement() and
    734         // webkitDidEnterFullScreenForElement() are still called in this case
    735         // is so that exitFullScreenForElement() gets called later.
    736         enterFullscreenForNode(element);
    737     } else {
    738         // No fullscreen video widget has been made available by the Browser
    739         // chrome, or this is not a video element. The webkitRequestFullScreen
    740         // Javascript call is often made on a div element.
    741         // This is where we would hide the browser's chrome if we wanted to.
    742     }
     730    m_webPagePrivate->enterFullScreenForElement(element);
    743731    element->document()->webkitDidEnterFullScreenForElement(element);
    744732}
     
    747735{
    748736    element->document()->webkitWillExitFullScreenForElement(element);
    749     if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) {
    750         // The Browser chrome has its own fullscreen video widget.
    751         exitFullscreenForNode(element);
    752     } else {
    753         // This is where we would restore the browser's chrome
    754         // if hidden above.
    755     }
     737    m_webPagePrivate->exitFullScreenForElement(element);
    756738    element->document()->webkitDidExitFullScreenForElement(element);
    757739}
Note: See TracChangeset for help on using the changeset viewer.