Change the location of didChangeContents() was called
authorSangYong Park <sy302.park@samsung.com>
Wed, 4 Sep 2013 09:25:55 +0000 (18:25 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Wed, 4 Sep 2013 11:22:29 +0000 (11:22 +0000)
[Title] Change the location of didChangeContents() was called
[Issue#] N_SE-50951
[Problem] Focus ring did not update sometimes.
[Cause] didChangeContents() was in the wrong location.
[Solution] Change the location of didChangeContents() was called

Change-Id: I5ba705097aaaa97a0c75116b3f36355557c2d0a1

Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp

index 8ebc719..08cbcff 100755 (executable)
@@ -2050,7 +2050,7 @@ void ewkViewLoadCommitted(Evas_Object* ewkView)
 #endif
 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
     if (impl->focusRing())
-        impl->focusRing()->hide();
+        impl->focusRing()->hide(false);
 #endif
 #if ENABLE(TIZEN_ISF_PORT)
     impl->inputMethodContext()->hideIMFContext();
index 213a5f6..0784e81 100755 (executable)
@@ -491,10 +491,6 @@ void WebChromeClient::scroll(const IntSize& scrollOffset, const IntRect& scrollR
 void WebChromeClient::delegatedScrollRequested(const IntPoint& scrollOffset)
 {
     m_page->pageDidRequestScroll(scrollOffset);
-
-#if OS(TIZEN)
-    m_page->didChangeContents(m_page->bounds());
-#endif
 }
 #endif
 
index 38f813a..204effd 100755 (executable)
@@ -89,10 +89,6 @@ void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
     if (dirtyRect.isEmpty())
         return;
 
-#if OS(TIZEN)
-    m_webPage->didChangeContents(dirtyRect);
-#endif
-
     if (m_layerTreeHost) {
         ASSERT(m_dirtyRegion.isEmpty());
 
@@ -112,10 +108,6 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff
     if (!m_isPaintingEnabled)
         return;
 
-#if OS(TIZEN)
-    m_webPage->didChangeContents(scrollRect);
-#endif
-
     if (m_layerTreeHost) {
         ASSERT(m_scrollRect.isEmpty());
         ASSERT(m_scrollOffset.isEmpty());
index 576d024..20da4a6 100644 (file)
@@ -492,6 +492,10 @@ void LayerTreeCoordinator::performScheduledLayerFlush()
 
     m_webPage->layoutIfNeeded();
 
+#if OS(TIZEN)
+    m_webPage->didChangeContents();
+#endif
+
     // We can unlock the animations before flushing if there are no visible changes, for example if there are content updates
     // in a layer with opacity 0.
     bool canUnlockBeforeFlush = !m_isValid || !toWebGraphicsLayer(m_rootLayer.get())->hasPendingVisibleChanges();
index 97052f2..30765cc 100755 (executable)
@@ -845,7 +845,7 @@ public:
 #endif
 
 #if OS(TIZEN)
-    void didChangeContents(const WebCore::IntRect&);
+    void didChangeContents();
 #endif
 
 #if ENABLE(TIZEN_FOCUS_UI)
@@ -1041,7 +1041,7 @@ private:
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-    void updateEditorStateRect(const WebCore::Frame*, EditorState&) const;
+    bool updateEditorStateRect(const WebCore::Frame*, EditorState&) const;
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
index 4900176..632ddb7 100755 (executable)
@@ -698,20 +698,26 @@ void WebPage::deleteSurroundingText(int offset, int count)
     frame->editor()->deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
 }
 
-void WebPage::updateEditorStateRect(const Frame* frame, EditorState& state) const
+bool WebPage::updateEditorStateRect(const Frame* frame, EditorState& state) const
 {
     ASSERT(frame->selection()->rootEditableElement());
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
     Vector<IntRect> rects;
     calcFocusedRects(frame->selection()->rootEditableElement(), rects);
-    state.editorRect = unionRect(rects);
+    IntRect rect = unionRect(rects);
+    if (state.editorRect == rect)
+        return false;
+
+    state.editorRect = rect;
 #endif
 
     if (frame->selection()->isCaret())
         state.selectionRect = frame->view()->contentsToWindow(frame->selection()->absoluteCaretBounds());
     else if (frame->selection()->isRange())
         state.selectionRect = frame->view()->contentsToWindow(enclosingIntRect(frame->selection()->bounds(false)));
+
+    return true;
 }
 #endif
 
@@ -1895,7 +1901,7 @@ void WebPage::useSettingsFont()
 }
 #endif
 
-void WebPage::didChangeContents(const IntRect& rect)
+void WebPage::didChangeContents()
 {
     if (!m_page)
         return;
@@ -1905,14 +1911,9 @@ void WebPage::didChangeContents(const IntRect& rect)
         return;
 
 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-    if (m_editorState.isContentEditable && rect.intersects(m_editorState.editorRect) && frame->selection()->rootEditableElement()) {
-        IntRect previousEditorRect = m_editorState.editorRect;
-        updateEditorStateRect(frame, m_editorState);
-
-        if (m_editorState.editorRect != previousEditorRect) {
-            m_editorState.updateEditorRectOnly = true;
-            send(Messages::WebPageProxy::EditorStateChanged(m_editorState));
-        }
+    if (m_editorState.isContentEditable && frame->selection()->rootEditableElement() && updateEditorStateRect(frame, m_editorState)) {
+        m_editorState.updateEditorRectOnly = true;
+        send(Messages::WebPageProxy::EditorStateChanged(m_editorState));
     }
 #endif