Changeset 142220 in webkit


Ignore:
Timestamp:
Feb 7, 2013 7:01:40 PM (11 years ago)
Author:
mary.wu@torchmobile.com.cn
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):

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

Legend:

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

    r142137 r142220  
    423423#endif
    424424    , m_pendingOrientation(-1)
    425     , m_fullscreenVideoNode(0)
     425    , m_fullscreenNode(0)
    426426    , m_hasInRegionScrollableAreas(false)
    427427    , m_updateDelegatedOverlaysDispatched(false)
     
    25042504        m_touchEventHandler->resetLastFatFingersResult();
    25052505
    2506     // NOTE: m_fullscreenVideoNode, m_fullScreenPluginView and m_pluginViews
     2506    // NOTE: m_fullscreenNode, m_fullScreenPluginView and m_pluginViews
    25072507    // are cleared in other methods already.
    25082508}
     
    38393839    // When leaving fullscreen mode, restore the scale and scroll position if needed.
    38403840    // We also need to make sure the scale and scroll position won't cause over scale or over scroll.
    3841     if (m_scaleBeforeFullScreen > 0 && !m_fullscreenVideoNode) {
     3841    if (m_scaleBeforeFullScreen > 0 && !m_fullscreenNode) {
    38423842        // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here,
    38433843        // as it will multiply the scale rather than set the scale.
     
    51585158    UNUSED_PARAM(done);
    51595159#if ENABLE(VIDEO)
    5160     if (d->m_webSettings->fullScreenVideoCapable()) {
    5161         if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get()))
    5162             mediaElement->exitFullscreen();
    5163     } else {
     5160    Element* element = toElement(d->m_fullscreenNode.get());
     5161    if (!element)
     5162        return;
     5163    if (d->m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag))
     5164        static_cast<HTMLMediaElement*>(element)->exitFullscreen();
    51645165#if ENABLE(FULLSCREEN_API)
    5165         if (Element* element = static_cast<Element*>(d->m_fullscreenVideoNode.get()))
    5166             element->document()->webkitCancelFullScreen();
    5167 #endif
    5168     }
     5166    else
     5167        element->document()->webkitCancelFullScreen();
     5168#endif
    51695169#endif
    51705170}
     
    57825782
    57835783    mmrPlayer->setFullscreenWebPageClient(m_client);
    5784     m_fullscreenVideoNode = node;
     5784    m_fullscreenNode = node;
    57855785    m_client->fullscreenStart(contextName, window, mmrPlayer->getWindowScreenRect());
    57865786#endif
     
    57905790{
    57915791#if ENABLE(VIDEO)
    5792     if (m_fullscreenVideoNode.get()) {
     5792    if (m_fullscreenNode.get()) {
    57935793        m_client->fullscreenStop();
    5794         m_fullscreenVideoNode = 0;
     5794        m_fullscreenNode = 0;
    57955795    }
    57965796
     
    58125812
    58135813#if ENABLE(FULLSCREEN_API)
    5814 // TODO: We should remove this helper class when we decide to support all elements.
    5815 static bool containsVideoTags(Element* element)
    5816 {
    5817     for (Node* node = element->firstChild(); node; node = NodeTraversal::next(node, element)) {
    5818         if (node->hasTagName(HTMLNames::videoTag))
    5819             return true;
    5820     }
    5821     return false;
    5822 }
    5823 
    58245814void WebPagePrivate::enterFullScreenForElement(Element* element)
    58255815{
    58265816#if ENABLE(VIDEO)
    5827     // TODO: We should not check video tag when we decide to support all elements.
    5828     if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element)))
    5829         return;
    5830     if (m_webSettings->fullScreenVideoCapable()) {
     5817    if (!element)
     5818        return;
     5819    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
    58315820        // The Browser chrome has its own fullscreen video widget it wants to
    58325821        // use, and this is a video element. The only reason that
     
    58605849        // This is where we would hide the browser's chrome if we wanted to.
    58615850        client()->fullscreenStart();
    5862         m_fullscreenVideoNode = element;
     5851        m_fullscreenNode = element;
    58635852    }
    58645853#endif
     
    58685857{
    58695858#if ENABLE(VIDEO)
    5870     // TODO: We should not check video tag when we decide to support all elements.
    5871     if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element)))
    5872         return;
    5873     if (m_webSettings->fullScreenVideoCapable()) {
     5859    if (!element)
     5860        return;
     5861    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
    58745862        // The Browser chrome has its own fullscreen video widget.
    58755863        exitFullscreenForNode(element);
     
    58785866        // if hidden above.
    58795867        client()->fullscreenStop();
    5880         m_fullscreenVideoNode = 0;
     5868        m_fullscreenNode = 0;
    58815869    }
    58825870#endif
     
    58885876    // If we are in fullscreen video mode, and we change the FrameView::viewportRect,
    58895877    // we need to adjust the media container to the new size.
    5890     if (!m_fullscreenVideoNode || !m_fullscreenVideoNode->renderer()
    5891         || !m_fullscreenVideoNode->document() || !m_fullscreenVideoNode->document()->fullScreenRenderer())
    5892         return;
    5893 
    5894     ASSERT(m_fullscreenVideoNode->isElementNode());
    5895     ASSERT(static_cast<Element*>(m_fullscreenVideoNode.get())->isMediaElement());
    5896 
    5897     Document* document = m_fullscreenVideoNode->document();
     5878    if (!m_fullscreenNode || !m_fullscreenNode->renderer()
     5879        || !m_fullscreenNode->document() || !m_fullscreenNode->document()->fullScreenRenderer())
     5880        return;
     5881
     5882    ASSERT(m_fullscreenNode->isElementNode());
     5883    ASSERT(static_cast<Element*>(m_fullscreenNode.get())->isMediaElement());
     5884
     5885    Document* document = m_fullscreenNode->document();
    58985886    RenderStyle* fullScreenStyle = document->fullScreenRenderer()->style();
    58995887    ASSERT(fullScreenStyle);
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r140816 r142220  
    583583    int m_pendingOrientation;
    584584
    585     RefPtr<WebCore::Node> m_fullscreenVideoNode;
     585    RefPtr<WebCore::Node> m_fullscreenNode;
    586586    RefPtr<WebCore::PluginView> m_fullScreenPluginView;
    587587
  • trunk/Source/WebKit/blackberry/ChangeLog

    r142137 r142220  
     12013-02-07  Mary Wu  <mary.wu@torchmobile.com.cn>
     2
     3        [BlackBerry] Enable non-video element enter/exit fullscreen.
     4        https://bugs.webkit.org/show_bug.cgi?id=108314
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Webkit support non-video element (like div) to enter/exit
     9        fullscreen. We should pass this capability in blackberry porting.
     10
     11        RIM PR 256370, internally reviewed by Max Feil.
     12
     13        * Api/WebPage.cpp:
     14        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
     15        (BlackBerry::WebKit::WebPagePrivate::clearDocumentData):
     16        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
     17        (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
     18        (BlackBerry::WebKit::WebPagePrivate::enterFullscreenForNode):
     19        (BlackBerry::WebKit::WebPagePrivate::exitFullscreenForNode):
     20        (WebKit):
     21        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
     22        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
     23        (BlackBerry::WebKit::WebPagePrivate::adjustFullScreenElementDimensionsIfNeeded):
     24        * Api/WebPage_p.h:
     25        (WebPagePrivate):
     26
    1272013-02-07  Jakob Petsovits  <jpetsovits@rim.com>
    228
Note: See TracChangeset for help on using the changeset viewer.