#if ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
, m_selectedHandle(0)
#endif
+ , m_handleMovingDirection(HandleMovingDirectionNormal)
{
ASSERT(viewWidget);
WebCore::IntPoint leftEvasPoint = toEvasTransform.mapPoint(leftRect.minXMaxYCorner());
WebCore::IntPoint rightEvasPoint = toEvasTransform.mapPoint(rightRect.maxXMaxYCorner());
+ TextSelectionHandle* shownLeftHandle = m_leftHandle;
+ TextSelectionHandle* shownRightHandle = m_rightHandle;
+
+ if (m_handleMovingDirection == HandleMovingDirectionReverse) {
+ shownLeftHandle = m_rightHandle;
+ shownRightHandle = m_leftHandle;
+ }
+
EditorState editorState = m_viewImpl->page()->editorState();
if (editorState.isContentEditable) {
- m_leftHandle->hide();
- m_rightHandle->hide();
+ shownLeftHandle->hide();
+ shownRightHandle->hide();
WebCore::IntRect editorRect = editorState.editorRect;
WebCore::IntPoint editorLeftEvasPoint = toEvasTransform.mapPoint(editorRect.location());
evas_object_geometry_get(m_viewImpl->view(), &webViewX, &webViewY, &webViewWidth, &webViewHeight);
if ((editorLeftEvasPoint.x() <= leftEvasPoint.x() && editorLeftEvasPoint.y() <= leftEvasPoint.y())
&& (webViewX <= leftEvasPoint.x() && webViewY <= leftEvasPoint.y())) {
- m_leftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
- m_leftHandle->show();
+ shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
+ shownLeftHandle->show();
}
if ((editorRightEvasPoint.x() >= rightEvasPoint.x() && editorRightEvasPoint.y() >= rightEvasPoint.y())
&& ((webViewX + webViewWidth) >= rightEvasPoint.x() && (webViewY <= rightEvasPoint.y() && (webViewY + webViewHeight) >= rightEvasPoint.y()))) {
- m_rightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
- m_rightHandle->show();
+ shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
+ shownRightHandle->show();
}
} else {
- m_leftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
- m_leftHandle->show();
+ shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
+ shownLeftHandle->show();
- m_rightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
- m_rightHandle->show();
+ shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
+ shownRightHandle->show();
}
}
void TextSelection::setLeftSelectionToEvasPoint(const IntPoint& evasPoint)
{
- m_viewImpl->page()->setLeftSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint));
+ int result = m_viewImpl->page()->setLeftSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint), m_handleMovingDirection);
+ if (result)
+ m_handleMovingDirection = result;
updateHandlers();
}
void TextSelection::setRightSelectionToEvasPoint(const IntPoint& evasPoint)
{
- m_viewImpl->page()->setRightSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint));
+ int result = m_viewImpl->page()->setRightSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint), m_handleMovingDirection);
+ if (result)
+ m_handleMovingDirection = result;
updateHandlers();
}
void TextSelection::handleMouseUp(TextSelectionHandle* /* handle */, const IntPoint& /* position */)
{
+ m_handleMovingDirection = HandleMovingDirectionNormal;
+
hideMagnifier();
+ updateHandlers();
showContextMenu();
}