diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-07-31 11:52:57 +1000 |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-07-31 11:52:57 +1000 |
commit | aa9cf406d62004519ad54596e1c391f9a6439210 (patch) | |
tree | dd562b9c296981f2761b76623911be8496c7af84 /src/3rdparty/webkit/WebCore/editing/SelectionController.cpp | |
parent | 987aec28b950e1c9817a20a9dd71afc071cd93ea (diff) | |
parent | 56b6a5924008ab5cdbae36e9662eddba923acd5e (diff) |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
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()); |