Add parameter of smartcallback to exit fullscreen element by Hardware back key.
authorKeonHo Kim <keonho07.kim@samsung.com>
Fri, 26 Jul 2013 13:01:38 +0000 (22:01 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 30 Sep 2013 07:59:44 +0000 (07:59 +0000)
[Title] Add parameter of smartcallback to exit fullscreen element by Hardware back key.
[Problem] P130719-5603
[Cause] There is no way for distinguish the case that user press button to enter fullscreen by default mediaplayer and W3C fullscreen api.
[Solution] Added parameter to smartcallback for WRT.WQ

Change-Id: I045e73964112df15c1c2ee03e5471810c37a4169

Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in
Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp

index 3a28f49..f4e6bfa 100755 (executable)
@@ -484,6 +484,9 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
     , m_fullScreenRenderer(0)
     , m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFired)
     , m_isAnimatingFullScreen(false)
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    , m_exitFullScreenByHwBackKey(false)
+#endif
 #endif
     , m_loadEventDelayCount(0)
     , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
@@ -5536,6 +5539,9 @@ void Document::requestFullScreenForElement(Element* element, unsigned short flag
         // 5. Return, and run the remaining steps asynchronously.
         // 6. Optionally, perform some animation.
         m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT;
+#if ENABLE(TIZEN_FULLSCREEN_API)
+        m_exitFullScreenByHwBackKey = flags & Element::HARDWARE_BACKKEY_EXIT;
+#endif
         page()->chrome()->client()->enterFullScreenForElement(element);
 
         // 7. Optionally, display a message indicating how the user can exit displaying the context object fullscreen.
@@ -5718,7 +5724,10 @@ void Document::webkitDidExitFullScreenForElement(Element*)
     m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
 
     m_areKeysEnabledInFullScreen = false;
-    
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    m_exitFullScreenByHwBackKey = false;
+#endif
+
     if (m_fullScreenRenderer)
         m_fullScreenRenderer->unwrapRenderer();
 
index 3d7954f..41cb3b3 100644 (file)
@@ -1105,6 +1105,9 @@ public:
     void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false);
     bool isAnimatingFullScreen() const;
     void setAnimatingFullScreen(bool);
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    bool exitFullScreenByHwBackKey() const { return m_exitFullScreenByHwBackKey; }
+#endif
 
     // W3C API
     bool webkitFullscreenEnabled() const;
@@ -1508,6 +1511,9 @@ private:
     Deque<RefPtr<Node> > m_fullScreenChangeEventTargetQueue;
     Deque<RefPtr<Node> > m_fullScreenErrorEventTargetQueue;
     bool m_isAnimatingFullScreen;
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    bool m_exitFullScreenByHwBackKey;
+#endif
     LayoutRect m_savedPlaceholderFrameRect;
     RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
 #endif
index 342a236..5e5d26f 100644 (file)
@@ -402,6 +402,9 @@ public:
     enum {
         ALLOW_KEYBOARD_INPUT = 1 << 0,
         LEGACY_MOZILLA_REQUEST = 1 << 1,
+#if ENABLE(TIZEN_FULLSCREEN_API)
+        HARDWARE_BACKKEY_EXIT = 1 << 2
+#endif
     };
     
     void webkitRequestFullScreen(unsigned short flags);
index e9dca74..8bdd49b 100755 (executable)
@@ -4156,6 +4156,9 @@ void HTMLMediaElement::enterFullscreen()
 #if ENABLE(FULLSCREEN_API)
     if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) {
         document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFullScreenRequirement);
+#if ENABLE(TIZEN_FULLSCREEN_API)
+        scheduleEvent(eventNames().webkitbeginfullscreenEvent);
+#endif
         return;
     }
 #endif
@@ -4176,8 +4179,12 @@ void HTMLMediaElement::exitFullscreen()
 
 #if ENABLE(FULLSCREEN_API)
     if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) {
-        if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == this)
+        if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == this) {
             document()->webkitCancelFullScreen();
+#if ENABLE(TIZEN_FULLSCREEN_API)
+            scheduleEvent(eventNames().webkitendfullscreenEvent);
+#endif
+        }
         return;
     }
 #endif
@@ -4478,13 +4485,8 @@ void HTMLMediaElement::updateClosedCaptionsControls()
 
 void* HTMLMediaElement::preDispatchEventHandler(Event* event)
 {
-    if (event && event->type() == eventNames().webkitfullscreenchangeEvent) {
+    if (event && event->type() == eventNames().webkitfullscreenchangeEvent)
         configureMediaControls();
-#if ENABLE(TIZEN_GSTREAMER_VIDEO)
-        if (!isFullscreen())
-            scheduleEvent(eventNames().webkitendfullscreenEvent);
-#endif
-    }
 
     return 0;
 }
index 5d37f78..c354517 100644 (file)
@@ -1101,7 +1101,11 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
             if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == toParentMediaElement(this))
                 document()->webkitCancelFullScreen();
             else {
+#if ENABLE(TIZEN_FULLSCREEN_API)
+                document()->requestFullScreenForElement(toParentMediaElement(this), Element::HARDWARE_BACKKEY_EXIT, Document::ExemptIFrameAllowFullScreenRequirement);
+#else
                 document()->requestFullScreenForElement(toParentMediaElement(this), 0, Document::ExemptIFrameAllowFullScreenRequirement);
+#endif
             }
         } else
 #endif
index d0ba6f2..9d9f961 100755 (executable)
@@ -703,7 +703,8 @@ Eina_Bool _ewk_view_smart_fullscreen_enter(Ewk_View_Smart_Data* smartData)
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
     ewk_view_main_frame_scrollbar_visible_set(impl->view(), false);
-    evas_object_smart_callback_call(impl->view(), "fullscreen,enterfullscreen", 0);
+    bool isNeed = impl->page()->fullScreenManager()->exitFullScreenByHwBackKey();
+    evas_object_smart_callback_call(impl->view(), "fullscreen,enterfullscreen", &isNeed);
     return true;
 }
 
index a858969..75b6413 100644 (file)
@@ -43,6 +43,9 @@ WebFullScreenManagerProxy::WebFullScreenManagerProxy(WebPageProxy* page)
     : m_page(page)
     , m_webView(0)
     , m_isFullScreen(false)
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    , m_exitFullScreenByHwBackKey(false)
+#endif
 {
 }
 
index ef52d5c..6845087 100644 (file)
@@ -90,6 +90,8 @@ public:
     void requestExitFullScreen();
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
+    bool exitFullScreenByHwBackKey() { return m_exitFullScreenByHwBackKey; }
+    void setExitFullScreenByHwBackKey(bool);
     void updateMediaControlsStyle();
 #endif
 
@@ -105,6 +107,9 @@ private:
     WebPageProxy* m_page;
     PlatformWebView* m_webView;
     bool m_isFullScreen;
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    bool m_exitFullScreenByHwBackKey;
+#endif
 
     void didReceiveWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     void didReceiveSyncWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply);
index 97e4613..a3d9ea3 100644 (file)
@@ -28,5 +28,8 @@ messages -> WebFullScreenManagerProxy {
     BeganEnterFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)
     BeganExitFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)
     Close()
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    SetExitFullScreenByHwBackKey(bool isNeeded)
+#endif
 }
 #endif
index 55dc76f..7f062ff 100755 (executable)
@@ -78,6 +78,9 @@ void WebFullScreenManagerProxy::exitFullScreen()
     didExitFullScreen();
 
     m_isFullScreen = false;
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    setExitFullScreenByHwBackKey(false);
+#endif
 }
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
@@ -85,6 +88,11 @@ void WebFullScreenManagerProxy::updateMediaControlsStyle()
 {
     m_page->process()->send(Messages::WebFullScreenManager::updateMediaControlsStyle(), m_page->pageID());
 }
+
+void WebFullScreenManagerProxy::setExitFullScreenByHwBackKey(bool isNeeded)
+{
+    m_exitFullScreenByHwBackKey = isNeeded;
+}
 #endif
 
 void WebFullScreenManagerProxy::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
index 96b9a18..1ea6065 100644 (file)
@@ -57,8 +57,13 @@ void InjectedBundlePageFullScreenClient::enterFullScreenForElement(WebPage *page
     if (m_client.enterFullScreenForElement) {
         RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(element);
         m_client.enterFullScreenForElement(toAPI(page), toAPI(nodeHandle.get()));
-    } else
+    } else {
+#if ENABLE(TIZEN_FULLSCREEN_API)
+        if (element && element->document() && element->document()->exitFullScreenByHwBackKey())
+            page->send(Messages::WebFullScreenManagerProxy::SetExitFullScreenByHwBackKey(true));
+#endif
         page->send(Messages::WebFullScreenManagerProxy::EnterFullScreen());
+    }
 }
 
 void InjectedBundlePageFullScreenClient::exitFullScreenForElement(WebPage *page, WebCore::Element *element)