diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/editing/SelectionController.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/editing/SelectionController.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp index 54f09cd95..b6874d6f1 100644 --- a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp +++ b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp @@ -100,6 +100,8 @@ void SelectionController::moveTo(const Position &base, const Position &extent, E void SelectionController::setSelection(const VisibleSelection& s, bool closeTyping, bool clearTypingStyle, bool userTriggered) { + m_lastChangeWasHorizontalExtension = false; + if (m_isDragCaretController) { invalidateCaretRect(); m_sel = s; @@ -223,29 +225,24 @@ void SelectionController::nodeWillBeRemoved(Node *node) void SelectionController::willBeModified(EAlteration alter, EDirection direction) { - switch (alter) { - case MOVE: - m_lastChangeWasHorizontalExtension = false; + if (alter != EXTEND) + return; + if (m_lastChangeWasHorizontalExtension) + return; + + Position start = m_sel.start(); + Position end = m_sel.end(); + // FIXME: This is probably not correct for right and left when the direction is RTL. + switch (direction) { + case RIGHT: + case FORWARD: + m_sel.setBase(start); + m_sel.setExtent(end); break; - case EXTEND: - if (!m_lastChangeWasHorizontalExtension) { - m_lastChangeWasHorizontalExtension = true; - Position start = m_sel.start(); - Position end = m_sel.end(); - switch (direction) { - // FIXME: right for bidi? - case RIGHT: - case FORWARD: - m_sel.setBase(start); - m_sel.setExtent(end); - break; - case LEFT: - case BACKWARD: - m_sel.setBase(end); - m_sel.setExtent(start); - break; - } - } + case LEFT: + case BACKWARD: + m_sel.setBase(end); + m_sel.setExtent(start); break; } } @@ -560,8 +557,8 @@ bool SelectionController::modify(EAlteration alter, EDirection dir, TextGranular { if (userTriggered) { SelectionController trialSelectionController; - trialSelectionController.setLastChangeWasHorizontalExtension(m_lastChangeWasHorizontalExtension); trialSelectionController.setSelection(m_sel); + trialSelectionController.setLastChangeWasHorizontalExtension(m_lastChangeWasHorizontalExtension); trialSelectionController.modify(alter, dir, granularity, false); bool change = m_frame->shouldChangeSelection(trialSelectionController.selection()); @@ -634,6 +631,8 @@ bool SelectionController::modify(EAlteration alter, EDirection dir, TextGranular setNeedsLayout(); + m_lastChangeWasHorizontalExtension = alter == EXTEND; + return true; } @@ -655,6 +654,7 @@ bool SelectionController::modify(EAlteration alter, int verticalDistance, bool u if (userTriggered) { SelectionController trialSelectionController; trialSelectionController.setSelection(m_sel); + trialSelectionController.setLastChangeWasHorizontalExtension(m_lastChangeWasHorizontalExtension); trialSelectionController.modify(alter, verticalDistance, false); bool change = m_frame->shouldChangeSelection(trialSelectionController.selection()); |