Revert "Revert "Refine focus ring repainting code when web contents was changed.""
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / PageClientImpl.cpp
index e10ae50..3c577ed 100755 (executable)
 #include "ewk_context_private.h"
 #endif
 
-#if ENABLE(TIZEN_SCREEN_READER)
-#include "ScreenReaderProxy.h"
-#endif
-
 using namespace WebCore;
 using namespace std;
 
@@ -104,6 +100,7 @@ PageClientImpl::PageClientImpl(EwkViewImpl* viewImpl)
     , m_scrollPositionBeforePageRendered(IntPoint())
 #endif
     , m_isVisible(true)
+    , m_deferUpdateViewportSize(false)
     , m_isScrollableLayerFocused(false)
     , m_isScrollableNodeFocused(false)
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE_BACKUP_IMAGE)
@@ -193,6 +190,14 @@ void PageClientImpl::updateViewportSize(const IntSize& viewportSize, const int a
 #if ENABLE(TIZEN_DLOG_SUPPORT)
     TIZEN_LOGI(" view size: [%d, %d], angle: [%d]", viewportSize.width(), viewportSize.height(), angle);
 #endif
+#if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
+    if (m_deferUpdateViewportSize) {
+        m_visibleContentRect.setSize(viewportSize);
+        m_viewImpl->page()->setViewportSize(viewportSize);
+        m_deferUpdateViewportSize = false;
+        return;
+    }
+#endif
 
     // update viewport size of webkit
     m_viewImpl->page()->setViewportSize(viewportSize);
@@ -321,11 +326,6 @@ void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
 #else
     m_viewImpl->redrawRegion(rect);
 #endif
-
-#if ENABLE(TIZEN_SCREEN_READER)
-    if (rect.intersects(ewkViewGetFocusRing(m_viewImpl->view())->rect()))
-        m_viewImpl->page()->recalcScreenReaderFocusRect();
-#endif
 }
 
 void PageClientImpl::displayView()
@@ -445,6 +445,8 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut
     if (isRotated) {
         m_viewportAngle = angle;
         newScale = m_viewportConstraints.minimumScale * scaleRatioBeforeRotation;
+        if (m_viewportFitsToContent)
+            newScale = m_viewportConstraints.minimumScale;
         newScrollPosition.scale(newScale / m_scaleFactor, newScale / m_scaleFactor);
     }
 
@@ -880,7 +882,7 @@ IntRect PageClientImpl::adjustVisibleContentRect(IntRect visibleContentRect, flo
 
 void PageClientImpl::setVisibleContentRect(const IntRect& newRect, float newScale, const FloatPoint& trajectory)
 {
-#if ENABLE(TIZEN_SCREEN_READER)
+#if OS(TIZEN)
     IntPoint previousScrollPosition(scrollPosition());
     float previousScale = m_scaleFactor;
 #endif
@@ -919,10 +921,9 @@ void PageClientImpl::setVisibleContentRect(const IntRect& newRect, float newScal
 #endif
     displayViewport();
 
-#if ENABLE(TIZEN_SCREEN_READER)
-    if (ScreenReaderProxy::screenReader().isEnabled()
-        && (scrollPosition() != previousScrollPosition || m_scaleFactor != previousScale))
-        ewkViewGetFocusRing(m_viewImpl->view())->updateScrollAndScale(previousScrollPosition, previousScale);
+#if OS(TIZEN)
+    if (scrollPosition() != previousScrollPosition || m_scaleFactor != previousScale)
+        m_viewImpl->didChangeScrollAndScale(previousScrollPosition, previousScale);
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
@@ -938,10 +939,6 @@ void PageClientImpl::displayViewport()
 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
     updateScrollbar();
 #endif
-
-#if ENABLE(TIZEN_SCREEN_READER)
-    m_viewImpl->page()->recalcScreenReaderFocusRect();
-#endif
 }
 
 void PageClientImpl::drawContents()
@@ -1130,7 +1127,7 @@ void PageClientImpl::updateTextSelectionHandlesAndContextMenu(bool isShow, bool
         m_textSelection->updateHandlesAndContextMenu(isShow, isScrolling);
 }
 
-bool PageClientImpl::textSelectionDown(const WebCore::IntPoint& point, bool isStartedTextSelectionFromOutside)
+bool PageClientImpl::textSelectionDown(const WebCore::IntPoint& point)
 {
     if (!evas_object_focus_get(m_viewImpl->view())) {
         InputMethodContextEfl* inputMethodContext = m_viewImpl->inputMethodContext();
@@ -1140,12 +1137,12 @@ bool PageClientImpl::textSelectionDown(const WebCore::IntPoint& point, bool isSt
         evas_object_focus_set(m_viewImpl->view(), true);
     }
 
-    return m_textSelection->textSelectionDown(point, isStartedTextSelectionFromOutside);
+    return m_textSelection->textSelectionDown(point);
 }
 
-void PageClientImpl::textSelectionMove(const WebCore::IntPoint& point, bool isStartedTextSelectionFromOutside)
+void PageClientImpl::textSelectionMove(const WebCore::IntPoint& point)
 {
-    m_textSelection->textSelectionMove(point, isStartedTextSelectionFromOutside);
+    m_textSelection->textSelectionMove(point);
 }
 
 void PageClientImpl::textSelectionUp(const WebCore::IntPoint& point, bool isStartedTextSelectionFromOutside)
@@ -1299,7 +1296,7 @@ void PageClientImpl::startDrag(const DragData& dragData, PassRefPtr<ShareableBit
     String dragStorageName("Drag");
     m_viewImpl->page()->dragEntered(dragInfo, dragStorageName);
     setDragMode(true);
-    m_drag->setDragData(dragInfo);
+    m_drag->setDragData(dragInfo, dragImage);
     m_drag->Show();
 }
 #endif
@@ -1510,11 +1507,6 @@ void PageClientEvasGL::setViewNeedsDisplay(const WebCore::IntRect& rect)
 #endif
     drawContents();
     m_viewImpl->redrawRegion(rect);
-
-#if ENABLE(TIZEN_SCREEN_READER)
-    if (rect.intersects(ewkViewGetFocusRing(m_viewImpl->view())->rect()))
-        m_viewImpl->page()->recalcScreenReaderFocusRect();
-#endif
 }
 
 void PageClientEvasGL::displayViewport()
@@ -1531,15 +1523,11 @@ void PageClientEvasGL::displayViewport()
 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
     updateScrollbar();
 #endif
-
-#if ENABLE(TIZEN_SCREEN_READER)
-    m_viewImpl->page()->recalcScreenReaderFocusRect();
-#endif
 }
 
 void PageClientEvasGL::drawContents()
 {
-    if (!drawingArea() || !(drawingArea()->layerTreeCoordinatorProxy()))
+    if (!drawingArea() || !(drawingArea()->layerTreeCoordinatorProxy()) || !m_isVisible)
         return;
 
     WebLayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();