Change the CSS position property of controller to relative
authorSeonae Kim <sunaeluv.kim@samsung.com>
Tue, 14 May 2013 13:34:20 +0000 (22:34 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 16 Sep 2013 06:40:00 +0000 (06:40 +0000)
[Title] Change the CSS position property of controller to relative
[Issue] N/A
[Problem] If panel position is fixed, siblings is difficult to calculate each position.
[Cause] The position of media controller is currently fixed.
[Solution] we replaced the position property from fixed to relative.

Change-Id: I0a026120d2fac1d88d600db8eb74c0e73fae2462

Source/WebCore/css/mediaControlsTizenFullscreenHorizontal.css
Source/WebCore/css/mediaControlsTizenFullscreenVertical.css
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlRootElement.cpp
Source/WebCore/rendering/RenderMedia.cpp
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index e14094b..4373193 100755 (executable)
@@ -29,7 +29,7 @@
 
 video:-webkit-full-screen::-webkit-media-controls-panel {
     -webkit-transform-origin: left bottom;
-    position: fixed;
+    position: relative;
     left: 0px;
     bottom: 0px;
     width: 1280px;
index 14de605..4715c01 100755 (executable)
@@ -29,7 +29,7 @@
 
 video:-webkit-full-screen::-webkit-media-controls-panel {
     -webkit-transform-origin: left bottom;
-    position: fixed;
+    position: relative;
     left: 0px;
     bottom: 0px;
     width: 720px;
index eb5cc46..e9dca74 100755 (executable)
@@ -2748,6 +2748,20 @@ void HTMLMediaElement::setControls(bool b)
     setBooleanAttribute(controlsAttr, b);
 }
 
+#if ENABLE(TIZEN_GSTREAMER_VIDEO)
+void HTMLMediaElement::showControls()
+{
+    if (hasMediaControls())
+        mediaControls()->show();
+}
+
+void HTMLMediaElement::hideControls()
+{
+    if (hasMediaControls())
+        mediaControls()->hide();
+}
+#endif
+
 float HTMLMediaElement::volume() const
 {
     return m_volume;
@@ -4142,10 +4156,6 @@ 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)
-        if (hasMediaControls())
-            mediaControls()->updateMediaControlScale();
-#endif
         return;
     }
 #endif
@@ -4184,13 +4194,11 @@ void HTMLMediaElement::exitFullscreen()
 }
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
-void HTMLMediaElement::updateMediaControlsStyle(bool needsRecalc)
+void HTMLMediaElement::updateMediaControlsStyle()
 {
+    recalcStyle(Node::Force);
     if (hasMediaControls())
         mediaControls()->updateMediaControlScale();
-
-    if (needsRecalc)
-        recalcStyle(Node::Force);
 }
 #endif
 
@@ -4388,12 +4396,14 @@ bool HTMLMediaElement::createMediaControls()
     if (!controls)
         return false;
 
-    controls->setMediaController(m_mediaController ? m_mediaController.get() : static_cast<MediaControllerInterface*>(this));
-    controls->reset();
 #if ENABLE(TIZEN_FULLSCREEN_API)
     if (isFullscreen())
         controls->updateMediaControlScale();
 #endif
+
+    controls->setMediaController(m_mediaController ? m_mediaController.get() : static_cast<MediaControllerInterface*>(this));
+    controls->reset();
+
     if (isFullscreen())
         controls->enteredFullscreen();
 
@@ -4414,6 +4424,11 @@ void HTMLMediaElement::configureMediaControls()
         return;
     }
 
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    if (hasMediaControls() && isFullscreen())
+        mediaControls()->updateMediaControlScale();
+#endif
+
     if (!hasMediaControls() && !createMediaControls())
         return;
 
index b146b5a..f9ad869 100755 (executable)
@@ -209,6 +209,10 @@ public:
 // controls
     bool controls() const;
     void setControls(bool);
+#if ENABLE(TIZEN_GSTREAMER_VIDEO)
+    void showControls();
+    void hideControls();
+#endif
     float volume() const;
     void setVolume(float, ExceptionCode&);
     bool muted() const;
@@ -338,7 +342,7 @@ public:
 #endif
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
-    void updateMediaControlsStyle(bool needsRecalc);
+    void updateMediaControlsStyle();
 #endif
 
 protected:
index 612ba08..d5d1491 100644 (file)
@@ -1099,9 +1099,6 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
                 document()->webkitCancelFullScreen();
             else {
                 document()->requestFullScreenForElement(toParentMediaElement(this), 0, Document::ExemptIFrameAllowFullScreenRequirement);
-#if ENABLE(TIZEN_FULLSCREEN_API)
-                toParentMediaElement(this)->updateMediaControlsStyle(false);
-#endif
             }
         } else
 #endif
index e6c4752..409c174 100644 (file)
@@ -53,6 +53,7 @@ using namespace std;
 namespace WebCore {
 
 static const double timeWithoutMouseMovementBeforeHidingControls = 3;
+
 #if ENABLE(TIZEN_FULLSCREEN_API)
 const FloatSize compareResolution(720.0f, 1280.0f);
 #endif
@@ -536,7 +537,8 @@ void MediaControlRootElement::updateMediaControlScale()
             scaleFactor *= (screenRect.width() / compareWidth);
     }
 
-    m_panel->setInlineStyleProperty(CSSPropertyWebkitTransform, "scale(" + String::number(scaleFactor) + ", " + String::number(scaleFactor) + ")", false);
+    setInlineStyleProperty(CSSPropertyWebkitTransform, "scale(" + String::number(scaleFactor) + ", " + String::number(scaleFactor) + ")", false);
+    setInlineStyleProperty(CSSPropertyWebkitTransformOrigin, "left top", false);
 }
 #endif
 
@@ -593,7 +595,8 @@ void MediaControlRootElement::exitedFullscreen()
     m_panel->resetPosition();
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
-    m_panel->removeInlineStyleProperty(CSSPropertyWebkitTransform);
+    removeInlineStyleProperty(CSSPropertyWebkitTransform);
+    removeInlineStyleProperty(CSSPropertyWebkitTransformOrigin);
 #endif
 
 #if !ENABLE(TIZEN_GSTREAMER_VIDEO)
index 9af648b..5219c1d 100644 (file)
 #include "HTMLMediaElement.h"
 #include "RenderView.h"
 
+#if ENABLE(TIZEN_FULLSCREEN_API)
+#include "Chrome.h"
+#include "Page.h"
+#endif
+
 namespace WebCore {
 
 RenderMedia::RenderMedia(HTMLMediaElement* video)
@@ -69,6 +74,11 @@ void RenderMedia::layout()
     if (newSize == oldSize && !controlsRenderer->needsLayout())
         return;
 
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    if (document()->webkitIsFullScreen() && document()->page())
+        newSize = IntSize(document()->page()->chrome()->windowRect().width(), document()->page()->chrome()->windowRect().height());
+#endif
+
     // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or 
     // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
     // and this method will be called many times per second during playback, use a LayoutStateMaintainer:
index 23595e6..adc62f3 100644 (file)
@@ -101,6 +101,10 @@ void WebFullScreenManager::enterFullScreenForElement(WebCore::Element* element)
     m_element = element;
     m_initialFrame = screenRectOfContents(m_element.get());
     m_page->injectedBundleFullScreenClient().enterFullScreenForElement(m_page.get(), element);
+
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    hideFullScreenControls();
+#endif
 }
 
 void WebFullScreenManager::exitFullScreenForElement(WebCore::Element* element)
@@ -122,6 +126,11 @@ void WebFullScreenManager::didEnterFullScreen()
 {
     ASSERT(m_element);
     m_element->document()->webkitDidEnterFullScreenForElement(m_element.get());
+
+    if (m_element->isMediaElement()) {
+        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_element.get());
+        mediaElement->showControls();
+    }
 }
 
 void WebFullScreenManager::willExitFullScreen()
@@ -139,12 +148,23 @@ void WebFullScreenManager::didExitFullScreen()
 }
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
+void WebFullScreenManager::hideFullScreenControls()
+{
+    if (!m_element->isMediaElement())
+        return;
+
+    HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_element.get());
+    mediaElement->hideControls();
+}
+
 void WebFullScreenManager::updateMediaControlsStyle()
 {
     ASSERT(m_element);
-    HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_element.get());
-    if (mediaElement)
-        mediaElement->updateMediaControlsStyle(true);
+    if (m_element->isMediaElement()) {
+        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_element.get());
+        mediaElement->updateMediaControlsStyle();
+        mediaElement->showControls();
+    }
 }
 #endif
 
index 64d88fb..3b28146 100644 (file)
@@ -64,6 +64,7 @@ public:
     void didExitFullScreen();
 
 #if ENABLE(TIZEN_FULLSCREEN_API)
+    void hideFullScreenControls();
     void updateMediaControlsStyle();
 #endif
 
index 86586e5..cc1d724 100755 (executable)
@@ -1140,6 +1140,11 @@ void WebPage::sendViewportAttributesChanged()
     mainFrameView()->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdge);
 #endif
 
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    if (fullScreenManager()->element() && fullScreenManager()->element()->document()->webkitIsFullScreen())
+        fullScreenManager()->hideFullScreenControls();
+#endif
+
     send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
 }