#if ENABLE(TIZEN_CONTEXT_MENU_SELECT)
bool canEditableSelectRange() const;
#endif
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+ TextDirection getSelectionTextDirection() { return directionOfSelection(); }
+#endif
private:
enum EPositionType { START, END, BASE, EXTENT };
(object->*function)(replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
}
+template<typename C, typename MF, typename R1, typename R2, typename R3, typename R4>
+void callMemberFunction(const Arguments0&, Arguments4<R1, R2, R3, R4>& replyArgs, C* object, MF function)
+{
+ (object->*function)(replyArgs.argument1, replyArgs.argument2, replyArgs.argument3, replyArgs.argument4);
+}
+
template<typename C, typename MF, typename P1>
void callMemberFunction(const Arguments1<P1>& args, Arguments0&, C* object, MF function)
{
IntRect leftSelectionRect;
IntRect rightSelectionRect;
- if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) {
+ int selectionDirection = 1;
+ if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect, selectionDirection)) {
leftRect->x = 0;
leftRect->y = 0;
leftRect->w = 0;
} else {
WebCore::IntRect leftRect;
WebCore::IntRect rightRect;
- if (isTextSelectionDowned() || m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect))
+ int selectionDirection = LToR;
+ if (isTextSelectionDowned() || m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection))
return;
setIsTextSelectionMode(false);
void TextSelection::updateHandlers()
{
WebCore::IntRect leftRect, rightRect;
- if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect))
+ int selectionDirection = LToR;
+ if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection))
return;
m_lastLeftHandleRect = leftRect;
m_lastRightHandleRect = rightRect;
AffineTransform toEvasTransform = m_viewImpl->transformToScene();
- WebCore::IntPoint leftEvasPoint = toEvasTransform.mapPoint(leftRect.minXMaxYCorner());
- WebCore::IntPoint rightEvasPoint = toEvasTransform.mapPoint(rightRect.maxXMaxYCorner());
+ WebCore::IntPoint leftEvasPoint ;
+ WebCore::IntPoint rightEvasPoint ;
+ // Selection Direction 1 -> L2R, Selection is Left to Right
+ if (selectionDirection == LToR) {
+ leftEvasPoint = toEvasTransform.mapPoint(leftRect.minXMaxYCorner());
+ rightEvasPoint = toEvasTransform.mapPoint(rightRect.maxXMaxYCorner());
+ }
+ // Selection Direction 0 -> R2L, Selection is Right to Left
+ else {
+ leftEvasPoint = toEvasTransform.mapPoint(leftRect.maxXMaxYCorner());
+ rightEvasPoint = toEvasTransform.mapPoint(rightRect.minXMaxYCorner());
+ }
TextSelectionHandle* shownLeftHandle = m_leftHandle;
TextSelectionHandle* shownRightHandle = m_rightHandle;
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())) {
- shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
+ shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect), (selectionDirection == LToR?true:false));
shownLeftHandle->show();
}
if ((editorRightEvasPoint.x() >= rightEvasPoint.x() && editorRightEvasPoint.y() >= rightEvasPoint.y())
&& ((webViewX + webViewWidth) >= rightEvasPoint.x() && (webViewY <= rightEvasPoint.y() && (webViewY + webViewHeight) >= rightEvasPoint.y()))) {
- shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
+ shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect), (selectionDirection == LToR?true:false));
shownRightHandle->show();
}
} else {
- shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect));
+ shownLeftHandle->move(leftEvasPoint, m_viewImpl->transformToScene().mapRect(leftRect), (selectionDirection == LToR?true:false));
shownLeftHandle->show();
- shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect));
+ shownRightHandle->move(rightEvasPoint, m_viewImpl->transformToScene().mapRect(rightRect), (selectionDirection == LToR?true:false));
shownRightHandle->show();
}
}
#endif
if (editorState.selectionIsRange) {
WebCore::IntRect leftRect, rightRect;
- if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect))
+ int selectionDirection = LToR;
+ if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection))
return;
#if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
if (editorState.selectionIsRange) {
WebCore::IntRect leftRect, rightRect;
- if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect)) {
+ int selectionDirection = LToR, adjustValue = 2;
+ if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection)) {
clear();
return;
}
-
+ (editorState.isOnlyImageSelection == true)?adjustValue = 1:adjustValue = 2;
if (handle->isLeft()) {
- basePosition.setX(leftRect.x());
- if(editorState.isOnlyImageSelection)
- basePosition.setY(leftRect.y() + (leftRect.height()));
- else
- basePosition.setY(leftRect.y() + (leftRect.height()/2));
+ if (selectionDirection == LToR) {
+ basePosition.setX(leftRect.x());
+ basePosition.setY(leftRect.y() + (leftRect.height()/adjustValue));
+ } else {
+ basePosition.setX(leftRect.x() + leftRect.width());
+ basePosition.setY(leftRect.y() + (leftRect.height()/adjustValue));
+ }
} else {
- basePosition.setX(rightRect.x() + rightRect.width());
- if(editorState.isOnlyImageSelection)
- basePosition.setY(leftRect.y() + (leftRect.height()));
- else
- basePosition.setY(rightRect.y() + (rightRect.height()/2));
+ if (selectionDirection == LToR) {
+ basePosition.setX(rightRect.x() + rightRect.width());
+ basePosition.setY(rightRect.y() + (rightRect.height()/adjustValue));
+ } else {
+ basePosition.setX(rightRect.x());
+ basePosition.setY(rightRect.y() + (rightRect.height()/adjustValue));
+ }
}
-
handle->setBasePositionForMove(m_viewImpl->transformToScene().mapPoint(basePosition));
} else
return;
void TextSelection::showHandlesAndContextMenu()
{
WebCore::IntRect leftRect, rightRect;
- if (m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect)) {
+ int selectionDirection = LToR;
+ if (m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection)) {
if ((leftRect == m_lastLeftHandleRect) && (rightRect == m_lastRightHandleRect)) {
if (m_showTimer) {
ecore_timer_del(m_showTimer);
{
WebCore::IntPoint startPoint, endPoint;
WebCore::IntRect leftRect, rightRect;
+ int selectionDirection = LToR;
const EditorState& editor = m_viewImpl->page()->editorState();
IntRect caretRect;
endPoint.setX(caretRect.x() + caretRect.width());
endPoint.setY(caretRect.y() + caretRect.height());
}
- else if (m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect)) {
+ else if (m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection)) {
startPoint.setX(leftRect.x());
startPoint.setY(leftRect.y() + leftRect.height());
HandleMovingDirectionReverse,
};
+ enum TextSelectionDirection {
+ RToL = 0,
+ LToR,
+ };
+
void update();
bool isTextSelectionDowned() { return m_isTextSelectionDowned; }
void setIsTextSelectionDowned(bool isTextSelectionDowned) { m_isTextSelectionDowned = isTextSelectionDowned; }
}
}
-void TextSelectionHandle::move(const IntPoint& point, const IntRect& selectionRect)
+void TextSelectionHandle::move(const IntPoint& point, const IntRect& selectionRect, bool selectionDirection)
{
IntPoint movePoint = point;
const int reverseMargin = 32;
else {
if ((movePoint.y() + handleHeight) > (y + deviceHeight)) {
movePoint.setY(movePoint.y() - selectionRect.height());
- edje_object_signal_emit(m_icon, "elm,state,top", "elm");
+ if (selectionDirection)
+ edje_object_signal_emit(m_icon, "elm,state,top", "elm");
+ else
+ edje_object_signal_emit(m_icon, "elm,state,top,reversed", "elm");
m_isTop = true;
} else {
- edje_object_signal_emit(m_icon, "elm,state,bottom", "elm");
+ if (selectionDirection)
+ edje_object_signal_emit(m_icon, "elm,state,bottom", "elm");
+ else
+ edje_object_signal_emit(m_icon, "elm,state,bottom,reversed", "elm");
m_isTop = false;
}
}
TextSelectionHandle(Evas_Object* object, const char* path, const char* part, bool isLeft, TextSelection* textSelection);
~TextSelectionHandle();
- void move(const WebCore::IntPoint& point, const WebCore::IntRect& selectionRect);
+ void move(const WebCore::IntPoint& point, const WebCore::IntRect& selectionRect, bool selectionDirection);
void show();
void hide();
bool isLeft() const { return m_isLeft; }
bool selectClosestWord(const WebCore::IntPoint&);
int setLeftSelection(const WebCore::IntPoint&, const int direction);
int setRightSelection(const WebCore::IntPoint&, const int direction);
- bool getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect);
+ bool getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect, int& selectionDirection);
String getSelectionText();
bool selectionRangeClear();
bool scrollContentByCharacter(const WebCore::IntPoint&, WebCore::SelectionDirection direction);
return result;
}
-bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
+bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, int& selectionDirection)
{
if (!isValid())
return false;
bool result = false;
IntRect updateEditorRect(0, 0, 0, 0);
- process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect, updateEditorRect), m_pageID);
+ process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect, selectionDirection, updateEditorRect), m_pageID);
if (!leftRect.size().isZero() || !rightRect.size().isZero())
result = true;
if(m_editorState.editorRect != updateEditorRect) {
void setLeftSelection(const WebCore::IntPoint&, const int direction, int& result);
void setRightSelection(const WebCore::IntPoint&, const int direction, int& result);
bool isSelectionOnlyImage() const;
- void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect, WebCore::IntRect& updateEditorRect);
+ void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect, int& selectionDirection, WebCore::IntRect& updateEditorRect);
void getSelectionText(String& result);
void selectionRangeClear(bool& result);
void selectionClearAllSelection(WebCore::Frame* frame);
SelectClosestWord(WebCore::IntPoint point) -> (bool result)
SetLeftSelection(WebCore::IntPoint point, int direction) -> (int result)
SetRightSelection(WebCore::IntPoint point, int direction) -> (int result)
- GetSelectionHandlers() -> (WebCore::IntRect leftRect, WebCore::IntRect rightRect, WebCore::IntRect updateEditorRect)
+ GetSelectionHandlers() -> (WebCore::IntRect leftRect, WebCore::IntRect rightRect, int selectionDirection, WebCore::IntRect updateEditorRect)
GetSelectionText() -> (String result)
SelectionRangeClear() -> (bool result)
ScrollContentByCharacter(WebCore::IntPoint point, int direction) -> (bool result)
// This changes just the 'start' and 'end' positions of the VisibleSelection
// Find handlers positions
IntRect leftRect, rightRect, updatedEditorRect;
- getSelectionHandlers(leftRect, rightRect, updatedEditorRect);
+ int selectionDirection = 0;
+ getSelectionHandlers(leftRect, rightRect, selectionDirection, updatedEditorRect);
if (leftRect.size().isZero() && rightRect.size().isZero()) {
// Sometimes there is no selected text, but isNone() returns TRUE
// in this case ewk_frame_selection_handlers_get() returns FALSE and handlers are invalid
IntPoint pos = frameView->windowToContents(point);
IntRect leftRect, rightRect, updatedEditorRect;
- getSelectionHandlers(leftRect, rightRect, updatedEditorRect);
+ int selectionDirection = 0;
+ getSelectionHandlers(leftRect, rightRect, selectionDirection, updatedEditorRect);
if (selectionEndNode->rendererIsEditable() && !selectionEndNode->rendererIsRichlyEditable()) {
const int boundariesWidth = 2;
return isImage;
}
-void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, WebCore::IntRect& updatedEditorRect)
+void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, int& selectionDirection, WebCore::IntRect& updatedEditorRect)
{
Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
updatedEditorRect = m_editorState.editorRect;
leftRect = frameView->contentsToWindow(leftRect);
rightRect = frameView->contentsToWindow(rightRect);
+ selectionDirection = focusedFrame->selection()->getSelectionTextDirection();
}
}