Fix the issue that javascript is not resumed after resume ewk_view
authorHurnjoo Lee <hurnjoo.lee@samsung.com>
Thu, 20 Jun 2013 04:15:24 +0000 (13:15 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 20 Jun 2013 05:51:56 +0000 (05:51 +0000)
[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
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp

index d7c577f..1afe539 100644 (file)
@@ -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;
     }
 
index c0f47e3..371bedb 100755 (executable)
@@ -560,6 +560,9 @@ public:
     void suspendJavaScriptAndResource();
     void resumeJavaScriptAndResource();
 
+    void suspendAnimations();
+    void resumeAnimations();
+
 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
     void suspendPlugin();
     void resumePlugin();
index 04de27b..cf0398f 100755 (executable)
@@ -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()
 {
index 59cf683..147122f 100644 (file)
@@ -264,6 +264,10 @@ public:
 
     void suspendJavaScriptAndResources();
     void resumeJavaScriptAndResources();
+
+    void suspendAnimations();
+    void resumeAnimations();
+
 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
     void suspendAnimationController();
     void resumeAnimationController();
index 042ea43..4db498e 100644 (file)
@@ -75,6 +75,9 @@ messages -> WebPage {
 #endif
     SuspendJavaScriptAndResources()
     ResumeJavaScriptAndResources()
+
+    SuspendAnimations()
+    ResumeAnimations()
 #endif
 
 #if ENABLE(TIZEN_WEB_STORAGE)
index c2af8d6..e73fcd7 100644 (file)
@@ -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()
 {