Do not adjust focused input node if node is visible now.
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_view.cpp
index fcdcee1..efd814c 100755 (executable)
@@ -1636,7 +1636,7 @@ void ewk_view_form_password_data_fill(Evas_Object* ewkView)
     for (size_t i = 0; i < passwordFormData.size(); i++) {
         passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
             " for (var i = 0; i < inputFields.length; i++)"
-            " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\"))"
+            " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))"
             " inputFields[i].value = \"%s\";",
             passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data());
     }
@@ -2462,7 +2462,6 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter
         return false;
 #endif
 
-    IntSize visibleSize(smartData->view.w, smartData->view.h);
     // caret position can be outside of visible rect.
     // we need to consider it.
     IntRect selectionRect = impl->pageProxy->getSelectionRect(true);
@@ -2477,13 +2476,17 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter
     if (selectionRect.isEmpty())
         return false;
 
-    // set paddings
-    IntPoint scrollPosition(selectionRect.x() - visibleSize.width() / 3, selectionRect.y() - visibleSize.height() / 3);
-    // If both input field's position x and selection rect can be displayed together,
-    // adjust scroll position to input field's position x.
-    if (!focusedNodeRect.isEmpty()
-        && selectionRect.x() - focusedNodeRect.x() < visibleSize.width() * 4 / 5)
-        scrollPosition.setX(focusedNodeRect.x());
+    IntRect visibleRect = impl->pageClient->visibleContentRect();
+    IntPoint scrollPosition = visibleRect.location();
+    // Do not adjust scroll position if selection rect (caret) is visible after scaling.
+    if (!visibleRect.contains(selectionRect)) {
+        // set paddings
+        scrollPosition = IntPoint(selectionRect.x() - visibleRect.width() / 3, selectionRect.y() - visibleRect.height() / 3);
+        // If both input field's position x and selection rect can be displayed together,
+        // adjust scroll position to input field's position x.
+        if (!focusedNodeRect.isEmpty() && selectionRect.x() - focusedNodeRect.x() < visibleRect.width() * 4 / 5)
+            scrollPosition.setX(focusedNodeRect.x());
+    }
 
 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
     impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor);