From 1186c75829231a3d71a8b6e8426d43f844dff42c Mon Sep 17 00:00:00 2001 From: Seonae Kim Date: Wed, 10 Apr 2013 14:26:34 +0900 Subject: [PATCH] Fix zoom issue when enter fullscreen from media element [Title] Fix zoom issue when enter fullscreen from media element [Issue] N/A [Problem] In case of first enterance, media controls is bigger than the second case. [Cause] A scale factor of content is used. [Solution] Change a calculated scale factor from content to viewport Change-Id: I41b381cfe4ed3cffc723942ba1d8b4be1d65f8c9 --- .../WebCore/html/shadow/MediaControlElements.cpp | 5 ---- .../html/shadow/MediaControlRootElement.cpp | 10 ------- .../WebKit2/UIProcess/API/efl/PageClientImpl.cpp | 5 ++++ Source/WebKit2/UIProcess/API/efl/PageClientImpl.h | 3 ++ Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp | 5 ++++ .../WebKit2/UIProcess/WebFullScreenManagerProxy.h | 8 ++++++ .../WebFullScreenManagerProxy.messages.in | 4 +++ .../UIProcess/efl/WebFullScreenManagerProxyEfl.cpp | 33 ++++++++++++++++++++++ .../InjectedBundlePageFullScreenClient.cpp | 8 ++++++ Source/cmake/OptionsTizen.cmake | 1 + Source/cmakeconfig.h.cmake | 1 + 11 files changed, 68 insertions(+), 15 deletions(-) diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index 896e21d..937ba66 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -1098,11 +1098,6 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == toParentMediaElement(this)) document()->webkitCancelFullScreen(); else { -#if ENABLE(TIZEN_GSTREAMER_VIDEO) - // Scale content with minimum scale value to show control elements properly. - FrameView* frameView = document()->frame()->view(); - frameView->requestVisibleContentRectRestore(IntPoint(), 0.0); -#endif document()->requestFullScreenForElement(toParentMediaElement(this), 0, Document::ExemptIFrameAllowFullScreenRequirement); } } else diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.cpp b/Source/WebCore/html/shadow/MediaControlRootElement.cpp index 7ebc452..1f7df22 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElement.cpp @@ -523,12 +523,6 @@ void MediaControlRootElement::enteredFullscreen() if (Page* page = document()->page()) { page->chrome()->setCursorHiddenUntilMouseMoves(true); - -#if ENABLE(TIZEN_GSTREAMER_VIDEO) && ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT) - float scaleFactor = page->chrome()->contentsScaleFactor(); - if (scaleFactor > 0) - m_panel->setInlineStyleProperty(CSSPropertyZoom, 1 / scaleFactor, CSSPrimitiveValue::CSS_NUMBER); -#endif } #if !ENABLE(TIZEN_GSTREAMER_VIDEO) @@ -556,10 +550,6 @@ void MediaControlRootElement::exitedFullscreen() // And if we reenter fullscreen we also want the panel in the standard position. m_panel->resetPosition(); -#if ENABLE(TIZEN_GSTREAMER_VIDEO) && ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT) - m_panel->removeInlineStyleProperty(CSSPropertyZoom); -#endif - #if !ENABLE(TIZEN_GSTREAMER_VIDEO) stopHideFullscreenControlsTimer(); #endif diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index 31ed791..063a472 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -229,6 +229,11 @@ double PageClientImpl::availableMinimumScale() // recalculate minimum scale factor if contents' width exceeds viewport layout width and userScalable is true. // minimum scale factor shouldn't be smaller than 0.25(minimum zoom level) IntSize contentsSize = m_viewImpl->page()->contentsSize(); +#if ENABLE(TIZEN_FULLSCREEN_API) + if (m_viewImpl->page()->fullScreenManager()->isFullScreen()) + contentsSize = viewSize(); +#endif + double horizontalMinScale = max(((double)viewSize().width() / contentsSize.width()), 0.25); double verticalMinScale = max(((double)viewSize().height() / contentsSize.height()), 0.25); return min(max(horizontalMinScale, verticalMinScale), m_viewportConstraints.maximumScale); diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 8086a86..1dceceb 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -107,6 +107,9 @@ public: }; ViewportConstraints viewportConstraints() { return m_viewportConstraints; } +#if ENABLE(TIZEN_FULLSCREEN_API) + void setMinimumScale(double minimumScale) { m_viewportConstraints.minimumScale = minimumScale; } +#endif ViewportConstraints computeViewportConstraints(const WebCore::ViewportAttributes&); double adjustScaleWithViewport(double); #if USE(TILED_BACKING_STORE) && ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp index ce8814e..0ff6002 100755 --- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp @@ -315,7 +315,12 @@ void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot r m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately; +#if ENABLE(TIZEN_FULLSCREEN_API) + float scaleFactor = (m_webPageProxy->fullScreenManager()->isFullScreen()) ? 1.0f : m_webPageProxy->deviceScaleFactor(); + m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, scaleFactor, m_size, m_scrollOffset), m_webPageProxy->pageID()); +#else m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_webPageProxy->deviceScaleFactor(), m_size, m_scrollOffset), m_webPageProxy->pageID()); +#endif m_scrollOffset = IntSize(); if (m_isWaitingForDidUpdateBackingStoreState) { diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h index ba7572f..a858c05 100644 --- a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h @@ -95,12 +95,20 @@ private: void supportsFullScreen(bool withKeyboard, bool&); void enterFullScreen(); void exitFullScreen(); +#if ENABLE(TIZEN_FULLSCREEN_API) + void enterFullScreenForMediaElement(); + void exitFullScreenForMediaElement(); +#endif void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame); void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame); WebPageProxy* m_page; PlatformWebView* m_webView; bool m_isFullScreen; +#if ENABLE(TIZEN_FULLSCREEN_API) + double m_previousMinimumScale; + float m_previousScaleFactor; +#endif void didReceiveWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didReceiveSyncWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr& reply); diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in index 97e4613..8ecf0b9 100644 --- a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in @@ -25,6 +25,10 @@ messages -> WebFullScreenManagerProxy { SupportsFullScreen(bool withKeyboard) -> (bool supportsFullScreen) EnterFullScreen() ExitFullScreen() +#if ENABLE(TIZEN_FULLSCREEN_API) + EnterFullScreenForMediaElement() + ExitFullScreenForMediaElement() +#endif BeganEnterFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect) BeganExitFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect) Close() diff --git a/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp index e744331..28b0845 100755 --- a/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp @@ -80,6 +80,39 @@ void WebFullScreenManagerProxy::exitFullScreen() m_isFullScreen = false; } +#if ENABLE(TIZEN_FULLSCREEN_API) +void WebFullScreenManagerProxy::enterFullScreenForMediaElement() +{ + if (!m_webView) + return; + + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(m_webView); + PageClientImpl* pageClientImpl = viewImpl->pageClient.get(); + + m_previousMinimumScale = pageClientImpl->viewportConstraints().minimumScale; + m_previousScaleFactor = viewImpl->scaleFactor(); + + pageClientImpl->setMinimumScale(1.0); + viewImpl->setScaleFactor(1.0f); + + enterFullScreen(); +} + +void WebFullScreenManagerProxy::exitFullScreenForMediaElement() +{ + if (!m_webView) + return; + + EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(m_webView); + PageClientImpl* pageClientImpl = viewImpl->pageClient.get(); + + pageClientImpl->setMinimumScale(m_previousMinimumScale); + viewImpl->setScaleFactor(m_previousScaleFactor); + + exitFullScreen(); +} +#endif + void WebFullScreenManagerProxy::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame) { notImplemented(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp index 96b9a18..af2e28d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp @@ -57,6 +57,10 @@ void InjectedBundlePageFullScreenClient::enterFullScreenForElement(WebPage *page if (m_client.enterFullScreenForElement) { RefPtr nodeHandle = InjectedBundleNodeHandle::getOrCreate(element); m_client.enterFullScreenForElement(toAPI(page), toAPI(nodeHandle.get())); +#if ENABLE(TIZEN_FULLSCREEN_API) + } else if (element->isMediaElement()) { + page->send(Messages::WebFullScreenManagerProxy::EnterFullScreenForMediaElement()); +#endif } else page->send(Messages::WebFullScreenManagerProxy::EnterFullScreen()); } @@ -66,6 +70,10 @@ void InjectedBundlePageFullScreenClient::exitFullScreenForElement(WebPage *page, if (m_client.exitFullScreenForElement) { RefPtr nodeHandle = InjectedBundleNodeHandle::getOrCreate(element); m_client.exitFullScreenForElement(toAPI(page), toAPI(nodeHandle.get())); +#if ENABLE(TIZEN_FULLSCREEN_API) + } else if (element->isMediaElement()) { + page->send(Messages::WebFullScreenManagerProxy::ExitFullScreenForMediaElement()); +#endif } else page->send(Messages::WebFullScreenManagerProxy::ExitFullScreen()); } diff --git a/Source/cmake/OptionsTizen.cmake b/Source/cmake/OptionsTizen.cmake index 5f2821e..db205aa 100644 --- a/Source/cmake/OptionsTizen.cmake +++ b/Source/cmake/OptionsTizen.cmake @@ -95,6 +95,7 @@ WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_CSS_ALIASES "Enable Specifying CSS Property Al WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_CSS3_TEXT "Enable CSS3 TEXT" ON) WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_DBSPACE_PATH "Enable Tizen application's directory path" ON) WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_EXTENSIBLE_API "Enable Tizen extensible api" ON) +WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_FULLSCREEN_API "Enable Tizen fullscreen api" ON) WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_GC_ACTIVITY_CALLBACK "Use GC Activity Callback" ON) WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_INTERNATIONAL_TEXT_SUPPORT "Enable International text support for tizen webkit" ON) WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_KEYGEN "Enable Tizen WebKit2 feature" ON) diff --git a/Source/cmakeconfig.h.cmake b/Source/cmakeconfig.h.cmake index b5955e9..6161cfb 100644 --- a/Source/cmakeconfig.h.cmake +++ b/Source/cmakeconfig.h.cmake @@ -119,6 +119,7 @@ #cmakedefine01 ENABLE_TIZEN_CSS_ALIASES #cmakedefine01 ENABLE_TIZEN_CSS3_TEXT #cmakedefine01 ENABLE_TIZEN_EXTENSIBLE_API +#cmakedefine01 ENABLE_TIZEN_FULLSCREEN_API #cmakedefine01 ENABLE_TIZEN_INTERNATIONAL_TEXT_SUPPORT #cmakedefine01 ENABLE_TIZEN_REGISTER_CONTENT_HANDLER #cmakedefine01 ENABLE_TIZEN_RESET_PATH -- 2.7.4