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);
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);