Page focus is going to the top of the webpage in the below scenario.
authordeepak <deepak.m1@samsung.com>
Fri, 5 Jul 2013 21:03:10 +0000 (02:33 +0530)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 21 Oct 2013 05:13:55 +0000 (05:13 +0000)
[Version]    ALL
[Title]      Page focus is going to the top of the webpage in the below scenario.
[BinType]    N/A
[Customer]   HQ
[Issue#]     WEB-3520
[Problem]    Page focus is going to the top of the webpage in the below scenario.
[Cause]      restored value of the scrollpoint and scalefactor get overwritted while calling initialize()
[Solution]   m_isInitializeCallBeforeFrameLoadFinished flag added to check if initialze function get called earlier .
[Team]       WebCoreSupport
[Developer]  deepak.m1@samsung.com
[Request]    N/A
[Horizontal expansion] N/A
[SCMRequest] NA

Change-Id: I5fee0ea844df629b79328f4db0d262028c3a2ece

Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h

index fd0dade..419ab49 100755 (executable)
@@ -97,6 +97,9 @@ PageClientImpl::PageClientImpl(EwkViewImpl* viewImpl)
     , m_restoredScaleFactor(0)
     , m_restoredScrollPosition(IntPoint())
 #endif
+#if ENABLE(TIZEN_WEBKIT2_RESTORE_SCROLLPOINT_ON_FRAME_LOAD_FINISH)
+    , m_isInitializeCallBeforeFrameLoadFinished(false)
+#endif
 #if ENABLE(TIZEN_WEBKIT2_BEFORE_PAGE_RENDERED_SCROLL_POSITION)
     , m_scrollPositionBeforePageRendered(IntPoint())
 #endif
@@ -283,6 +286,15 @@ void PageClientImpl::initializeVisibleContentRect()
         m_visibleContentRect.width(), m_visibleContentRect.height(), initialScaleFactor);
 #endif
 #endif
+#if ENABLE(TIZEN_WEBKIT2_RESTORE_SCROLLPOINT_ON_FRAME_LOAD_FINISH)
+    if(!m_isInitializeCallBeforeFrameLoadFinished)
+        m_isInitializeCallBeforeFrameLoadFinished = true;
+    else {
+        m_restoredScaleFactor = 0;
+        m_restoredScrollPosition = IntPoint();
+        m_isInitializeCallBeforeFrameLoadFinished = false;
+    }
+#endif
     setVisibleContentRect(IntRect(initialScrollPosition, m_visibleContentRect.size()), initialScaleFactor);
 #else
     // Set initial scale.
@@ -304,8 +316,15 @@ void PageClientImpl::setRestoredScrollPoints()
 {
     if(m_restoredScaleFactor)
         setVisibleContentRect(IntRect(m_restoredScrollPosition, m_visibleContentRect.size()), m_restoredScaleFactor);
-    m_restoredScaleFactor = 0;
-    m_restoredScrollPosition = IntPoint();
+#if ENABLE(TIZEN_WEBKIT2_RESTORE_SCROLLPOINT_ON_FRAME_LOAD_FINISH)
+    if(m_isInitializeCallBeforeFrameLoadFinished) {
+         m_isInitializeCallBeforeFrameLoadFinished = false;
+         m_restoredScaleFactor = 0;
+         m_restoredScrollPosition = IntPoint();
+    }
+    else
+         m_isInitializeCallBeforeFrameLoadFinished = true; // Not resetting m_restoredScaleFactor and m_restoredScrollPosition here.
+#endif
     displayViewport();
 }
 #endif
@@ -788,6 +807,9 @@ void PageClientImpl::didCommitLoadForMainFrame(bool)
     m_pageDidRendered = false;
     m_viewportFitsToContent = false;
     m_nonemptyLayoutRendered = false;
+#if ENABLE(TIZEN_WEBKIT2_RESTORE_SCROLLPOINT_ON_FRAME_LOAD_FINISH)
+    m_isInitializeCallBeforeFrameLoadFinished = false;
+#endif
     return;
 #endif
     notImplemented();
index 5690d24..ed9c8ec 100755 (executable)
@@ -433,6 +433,11 @@ protected:
     WebCore::IntPoint m_restoredScrollPosition;
     float m_restoredScaleFactor;
 #endif
+
+#if ENABLE(TIZEN_WEBKIT2_RESTORE_SCROLLPOINT_ON_FRAME_LOAD_FINISH)
+    bool m_isInitializeCallBeforeFrameLoadFinished;
+#endif
+
 #if ENABLE(TIZEN_WEBKIT2_BEFORE_PAGE_RENDERED_SCROLL_POSITION)
     WebCore::IntPoint m_scrollPositionBeforePageRendered;
 #endif