From 8670bc0d02b15b90e13dbe35222b064b85541128 Mon Sep 17 00:00:00 2001 From: YoungTaeck Song Date: Fri, 5 Apr 2013 18:02:10 +0900 Subject: [PATCH] Prerender first frame of new view size before angle is changed. [Title] Prerender first frame of new view size before angle is changed. [Issue#] DCM-745 [Problem] When rotating, a flicker has occurred. [Cause] Some frames of old view size is showed. [Solution] After first frame of new view size is rendered, run displaying. Change-Id: Ib5786401b38b269cf12da3aa036fb191204e2834 Conflicts: Source/WebKit2/UIProcess/API/efl/ewk_view.cpp Source/WebKit2/UIProcess/API/efl/ewk_view_private.h --- Source/WTF/wtf/Platform.h | 1 + .../WebKit2/UIProcess/API/efl/PageClientImpl.cpp | 25 ++++++++++++---- Source/WebKit2/UIProcess/API/efl/PageClientImpl.h | 13 +++++++-- Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 34 +++++++++++++++++++++- Source/WebKit2/UIProcess/API/efl/ewk_view.h | 16 ++++++++++ .../WebKit2/UIProcess/API/efl/ewk_view_private.h | 4 +++ 6 files changed, 85 insertions(+), 8 deletions(-) diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index c215a74..3f41f07 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -608,6 +608,7 @@ #define ENABLE_TIZEN_UV_MAPPING 1 /* Hyowon Kim(hw1008.kim@samsung.com) : UV mapping to use the platform-surface whose width should be multiple of 8 */ #endif #define ENABLE_TIZEN_NOT_USE_TRANSFORM_INFO_WHEN_GETTING_CARET_RECT 1 /* Youngtaeck Song(youngtaeck.song@samsung.com) : Patch to do not use transform infomation when getting caret rect */ +#define ENABLE_TIZEN_PRERENDERING_FOR_ROTATION 1 /* Youngtaeck Song(youngtaeck.song@samsung.com) : Prerender contents so that we display whole image immediately when rotating */ #endif #define ENABLE_TIZEN_WEBKIT2_TILED_AC_DONT_ADJUST_COVER_RECT 1 /* Eunsol Park(eunsol47.park@samsung. com) : Patch to do not adjust cover rect as fixed pixel size*/ diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index 31ed791..846e14d 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -110,6 +110,9 @@ PageClientImpl::PageClientImpl(EwkViewImpl* viewImpl) #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) , m_isContextMenuVisible(false) #endif +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + , m_waitFrameOfNewViewortSize(false) +#endif #endif // #if OS(TIZEN) { #if ENABLE(TIZEN_CANVAS_CAIRO_GLES_RENDERING) @@ -181,13 +184,12 @@ double PageClientImpl::adjustScaleWithViewport(double scale) } #if USE(TILED_BACKING_STORE) && ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) -void PageClientImpl::updateViewportSize(const IntSize& viewportSize) +void PageClientImpl::updateViewportSize(const IntSize& viewportSize, const int angle) { // update device width & height int deviceWidth = WebCore::getDefaultScreenResolution().width(); int deviceHeight = WebCore::getDefaultScreenResolution().height(); - Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewImpl->view())); - int angle = ecore_evas_rotation_get(ee); + if (angle == 90 || angle == 270) { int tempWidth = deviceWidth; deviceWidth = deviceHeight; @@ -394,6 +396,12 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut if (m_viewportFitsToContent) newScale = m_viewportConstraints.minimumScale; } + +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + if (m_waitFrameOfNewViewortSize) + ewk_view_resume(m_viewImpl->view()); +#endif + #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) setVisibleContentRect(m_visibleContentRect, newScale); #else @@ -1305,6 +1313,13 @@ void PageClientImpl::didRenderFrame() m_pageDidRendered = true; initializeVisibleContentRect(); } + +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + if (m_waitFrameOfNewViewortSize) { + m_waitFrameOfNewViewortSize = false; + ewkViewRotatePrepared(m_viewImpl->view()); + } +#endif } #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION) @@ -1422,7 +1437,7 @@ PageClientEvasGL::~PageClientEvasGL() m_viewImpl->page()->close(); } -void PageClientEvasGL::updateViewportSize(const WebCore::IntSize& viewportSize) +void PageClientEvasGL::updateViewportSize(const WebCore::IntSize& viewportSize, const int angle) { if (m_surface) { evas_gl_surface_destroy(m_evasGL, m_surface); @@ -1430,7 +1445,7 @@ void PageClientEvasGL::updateViewportSize(const WebCore::IntSize& viewportSize) } setTargetSurface(); - PageClientImpl::updateViewportSize(viewportSize); + PageClientImpl::updateViewportSize(viewportSize, angle); } void PageClientEvasGL::setViewNeedsDisplay(const WebCore::IntRect& rect) diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 8086a86..49ac0a0 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -110,7 +110,7 @@ public: ViewportConstraints computeViewportConstraints(const WebCore::ViewportAttributes&); double adjustScaleWithViewport(double); #if USE(TILED_BACKING_STORE) && ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) - TIZEN_VIRTUAL void updateViewportSize(const WebCore::IntSize& viewportSize); + TIZEN_VIRTUAL void updateViewportSize(const WebCore::IntSize&, const int); #endif void initializeVisibleContentRect(); double availableMinimumScale(); @@ -257,6 +257,10 @@ public: void showFormDataCandidate(const WebCore::IntRect& rect); #endif +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + void setWaitFrameOfNewViewortSize(bool waitFrameOfNewViewortSize) { m_waitFrameOfNewViewortSize = waitFrameOfNewViewortSize; } +#endif + #endif // #if OS(TIZEN) private: @@ -453,6 +457,11 @@ protected: Vector > m_undoCommands; Vector > m_redoCommands; + +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + bool m_waitFrameOfNewViewortSize; +#endif + #endif // #if OS(TIZEN) }; @@ -466,7 +475,7 @@ public: } ~PageClientEvasGL(); - virtual void updateViewportSize(const WebCore::IntSize& viewportSize); + virtual void updateViewportSize(const WebCore::IntSize&, const int); virtual void setViewNeedsDisplay(const WebCore::IntRect&); virtual void displayViewport(); virtual void drawContents(); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index f1f1642..025eb76 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -940,7 +940,8 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) drawingArea->setSize(IntSize(width, height), IntSize()); #endif #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR) - impl->pageClient->updateViewportSize(IntSize(width, height)); + Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas); + impl->pageClient->updateViewportSize(IntSize(width, height), ecore_evas_rotation_get(ee)); if (ewk_view_is_opengl_backend(ewkView)) impl->pageClient->displayViewport(); #endif @@ -4704,3 +4705,34 @@ void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_ UNUSED_PARAM(result); #endif } + +void ewk_view_rotation_prepare(Evas_Object* ewkView, int angle) +{ +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); + + int width, height; + if (angle == 0 || angle == 180) { + width = WebCore::getDefaultScreenResolution().width(); + height = WebCore::getDefaultScreenResolution().height() + 100; + } + if (angle == 90 || angle == 270) { + width = WebCore::getDefaultScreenResolution().height(); + height = WebCore::getDefaultScreenResolution().width() + 100; + } + + impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize()); + impl->pageClient->setWaitFrameOfNewViewortSize(true); + ewk_view_suspend(ewkView); + impl->pageClient->updateViewportSize(IntSize(width, height), angle); +#endif +} + +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) +void ewkViewRotatePrepared(Evas_Object* ewkView) +{ + evas_object_smart_callback_call(ewkView, "rotate,prepared", 0); +} +#endif + diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index b7279be..bc286e5 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -1680,6 +1680,22 @@ EAPI void ewk_view_content_security_policy_set(Evas_Object* o, const char* polic */ EAPI Eina_Bool ewk_view_page_save(Evas_Object* o, const char* path); +/* + * Prepare the rotation of the device. + * + * This function trigger prerendering first frame of new view size before target's angle is changed. + * When prerendering is done, "rotate,prepared" event will occur. + * + * @param o view object to receive orientation event. + * @param angle the new angle of the device. (degree) + * + * angle will be 0 degrees when the device is oriented to natural position, + * 90 degrees when it's right side is at the top, + * 180 degrees when it is upside down. + * 270 degrees when it's left side is at the top, + */ +EAPI void ewk_view_rotation_prepare(Evas_Object* ewkView, int angle); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index 99db2ed..27f6a92 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -290,4 +290,8 @@ void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, bool ewkViewExceededLocalFileSystemQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage); #endif +#if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION) +void ewkViewRotatePrepared(Evas_Object* ewkView); +#endif + #endif // ewk_view_private_h -- 2.7.4