From b5858f562ce125c0273c5e089ddd8a5c9aa2e3f7 Mon Sep 17 00:00:00 2001 From: Hurnjoo Lee Date: Thu, 20 Jun 2013 13:15:24 +0900 Subject: [PATCH] Fix the issue that javascript is not resumed after resume ewk_view [Title] Fix the issue that javascript is not resumed after resume ewk_view [Issue#] N/A [Problem] Javascript is not resumed after resume ewk_view [Cause] Multiple suspend/resume ActiveDOMObject are not working correctly. (REGRESSION:https://review.tizenrsa.org/#/c/74281/) [Solution] Revert the code(https://review.tizenrsa.org/#/c/74281/) and add calls to suspend/resumeAnimations in ewk_suspend/resume_view. Change-Id: I007c5aa13a28c485d8447e85150c40747124bf39 --- Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 4 ++-- Source/WebKit2/UIProcess/WebPageProxy.h | 3 +++ Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp | 16 ++++++++++++++++ Source/WebKit2/WebProcess/WebPage/WebPage.h | 4 ++++ .../WebKit2/WebProcess/WebPage/WebPage.messages.in | 3 +++ Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp | 20 ++++++++++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d7c577f..1afe539 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -2656,8 +2656,8 @@ void ewk_view_suspend(Evas_Object* ewkView) // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of // the ActiveDOMObject. if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) { + impl->pageProxy->suspendAnimations(); impl->pageProxy->suspendJavaScriptAndResource(); - impl->pageProxy->suspendActiveDOMObjectsAndAnimations(); impl->suspendedResources = true; } @@ -2689,8 +2689,8 @@ void ewk_view_resume(Evas_Object* ewkView) // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of // the ActiveDOMObject. if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) { + impl->pageProxy->resumeAnimations(); impl->pageProxy->resumeJavaScriptAndResource(); - impl->pageProxy->resumeActiveDOMObjectsAndAnimations(); impl->suspendedResources = false; } diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index c0f47e3..371bedb 100755 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -560,6 +560,9 @@ public: void suspendJavaScriptAndResource(); void resumeJavaScriptAndResource(); + void suspendAnimations(); + void resumeAnimations(); + #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME) void suspendPlugin(); void resumePlugin(); diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp index 04de27b..cf0398f 100755 --- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp @@ -632,6 +632,22 @@ void WebPageProxy::resumeJavaScriptAndResource() process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID); } +void WebPageProxy::suspendAnimations() +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::SuspendAnimations(), m_pageID); +} + +void WebPageProxy::resumeAnimations() +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::ResumeAnimations(), m_pageID); +} + #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME) void WebPageProxy::suspendPlugin() { diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 59cf683..147122f 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -264,6 +264,10 @@ public: void suspendJavaScriptAndResources(); void resumeJavaScriptAndResources(); + + void suspendAnimations(); + void resumeAnimations(); + #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME) void suspendAnimationController(); void resumeAnimationController(); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 042ea43..4db498e 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -75,6 +75,9 @@ messages -> WebPage { #endif SuspendJavaScriptAndResources() ResumeJavaScriptAndResources() + + SuspendAnimations() + ResumeAnimations() #endif #if ENABLE(TIZEN_WEB_STORAGE) diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index c2af8d6..e73fcd7 100644 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -1032,6 +1032,26 @@ void WebPage::resumeJavaScriptAndResources() mainFrame->loader()->resumeAllLoaders(); } +void WebPage::suspendAnimations() +{ + Frame* mainFrame = m_page->mainFrame(); + if (!mainFrame) + return; + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) + frame->animation()->suspendAnimationsForDocument(frame->document()); +} + +void WebPage::resumeAnimations() +{ + Frame* mainFrame = m_page->mainFrame(); + if (!mainFrame) + return; + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) + frame->animation()->resumeAnimationsForDocument(frame->document()); +} + #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME) void WebPage::suspendAnimationController() { -- 2.7.4