diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-20 14:01:09 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-20 14:01:09 +0200 |
commit | 6dbcd09121fe266c7704a524b5cbd7f2754659c0 (patch) | |
tree | 5ae0d16cec0cc61f576d51c57b3a4613c7e91e22 /Source/WebKit/chromium/src/WebFrameImpl.cpp | |
parent | 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (diff) | |
download | qtwebkit-6dbcd09121fe266c7704a524b5cbd7f2754659c0.tar.gz |
Imported WebKit commit 080af0beaa6f0ba8ff8f44cb8bd8b5dcf75ac0af (http://svn.webkit.org/repository/webkit/trunk@129119)
New snapshot with prospective build fix for incorrect QtWebKit master module header file creation
Diffstat (limited to 'Source/WebKit/chromium/src/WebFrameImpl.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebFrameImpl.cpp | 66 |
1 files changed, 5 insertions, 61 deletions
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 7bb0efeea..6d68a6f23 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1029,7 +1029,7 @@ void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) m_frame->loader()->prepareForHistoryNavigation(); RefPtr<HistoryItem> currentItem = m_frame->loader()->history()->currentItem(); - m_inSameDocumentHistoryLoad = currentItem->shouldDoSameDocumentNavigationTo(historyItem.get()); + m_inSameDocumentHistoryLoad = currentItem && currentItem->shouldDoSameDocumentNavigationTo(historyItem.get()); m_frame->page()->goToItem(historyItem.get(), FrameLoadTypeIndexedBackForward); m_inSameDocumentHistoryLoad = false; @@ -1466,71 +1466,15 @@ bool WebFrameImpl::selectWordAroundCaret() return true; } -void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) +void WebFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent) { - if (start == end && moveCaret(start)) - return; - - if (moveSelectionStart(start, true) && moveSelectionEnd(end, true)) - return; - - // Failed to move endpoints, probably because there's no current selection. - // Just set the selection explicitly (but this won't handle editable boundaries correctly). - VisibleSelection newSelection(visiblePositionForWindowPoint(start), visiblePositionForWindowPoint(end)); + VisiblePosition basePos = visiblePositionForWindowPoint(base); + VisiblePosition extentPos = visiblePositionForWindowPoint(extent); + VisibleSelection newSelection = VisibleSelection(basePos, extentPos); if (frame()->selection()->shouldChangeSelection(newSelection)) frame()->selection()->setSelection(newSelection, CharacterGranularity); } -bool WebFrameImpl::moveSelectionStart(const WebPoint& point, bool allowCollapsedSelection) -{ - const VisibleSelection& selection = frame()->selection()->selection(); - if (selection.isNone()) - return false; - - VisiblePosition start = visiblePositionForWindowPoint(point); - if (!allowCollapsedSelection) { - VisiblePosition maxStart = selection.visibleEnd().previous(); - if (comparePositions(start, maxStart) > 0) - start = maxStart; - } - - // start is moving, so base=end, extent=start - VisibleSelection newSelection = VisibleSelection(selection.visibleEnd(), start); - frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); - return true; -} - -bool WebFrameImpl::moveSelectionEnd(const WebPoint& point, bool allowCollapsedSelection) -{ - const VisibleSelection& selection = frame()->selection()->selection(); - if (selection.isNone()) - return false; - - VisiblePosition end = visiblePositionForWindowPoint(point); - if (!allowCollapsedSelection) { - VisiblePosition minEnd = selection.visibleStart().next(); - if (comparePositions(end, minEnd) < 0) - end = minEnd; - } - - // end is moving, so base=start, extent=end - VisibleSelection newSelection = VisibleSelection(selection.visibleStart(), end); - frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); - return true; -} - -bool WebFrameImpl::moveCaret(const WebPoint& point) -{ - FrameSelection* frameSelection = frame()->selection(); - if (frameSelection->isNone() || !frameSelection->isContentEditable()) - return false; - - VisiblePosition pos = visiblePositionForWindowPoint(point); - frameSelection->setExtent(pos, UserTriggered); - frameSelection->setBase(frameSelection->extent(), UserTriggered); - return true; -} - void WebFrameImpl::selectRange(const WebRange& webRange) { RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange); |