| Index: Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
|
| diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
|
| index bd1b109b6a507445b8db2a577d537ddb139893ba..f2f1602ddf535c3c78378f7901aed7ba810f537b 100644
|
| --- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
|
| +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
|
| @@ -160,33 +160,10 @@ void WebPage::getMarkedRange(uint64_t& location, uint64_t& length)
|
| Frame* frame = m_page->focusController()->focusedOrMainFrame();
|
| if (!frame)
|
| return;
|
| -
|
| - getLocationAndLengthFromRange(frame->editor()->compositionRange().get(), location, length);
|
| -}
|
|
|
| -static PassRefPtr<Range> characterRangeAtPoint(Frame* frame, const IntPoint& point)
|
| -{
|
| - VisiblePosition position = frame->visiblePositionForPoint(point);
|
| - if (position.isNull())
|
| - return 0;
|
| -
|
| - VisiblePosition previous = position.previous();
|
| - if (previous.isNotNull()) {
|
| - RefPtr<Range> previousCharacterRange = makeRange(previous, position);
|
| - IntRect rect = frame->editor()->firstRectForRange(previousCharacterRange.get());
|
| - if (rect.contains(point))
|
| - return previousCharacterRange.release();
|
| - }
|
| -
|
| - VisiblePosition next = position.next();
|
| - if (next.isNotNull()) {
|
| - RefPtr<Range> nextCharacterRange = makeRange(position, next);
|
| - IntRect rect = frame->editor()->firstRectForRange(nextCharacterRange.get());
|
| - if (rect.contains(point))
|
| - return nextCharacterRange.release();
|
| - }
|
| -
|
| - return 0;
|
| + Range* range = frame->editor()->compositionRange().get();
|
| + if (range)
|
| + range->getLocationAndLength(location, length);
|
| }
|
|
|
| void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index)
|
| @@ -199,12 +176,12 @@ void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index)
|
| HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
|
| frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
|
|
|
| - RefPtr<Range> range = characterRangeAtPoint(frame, result.point());
|
| + RefPtr<Range> range = frame->rangeForPoint(frame, result.point());
|
| if (!range)
|
| return;
|
|
|
| uint64_t length;
|
| - getLocationAndLengthFromRange(range.get(), index, length);
|
| + range->getLocationAndLength(index, length);
|
| }
|
|
|
| static PassRefPtr<Range> convertToRange(Frame* frame, NSRange nsrange)
|
| @@ -255,7 +232,7 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
|
| frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
|
|
|
| // Figure out if there are any characters under the point.
|
| - RefPtr<Range> characterRange = characterRangeAtPoint(frame, frame->view()->windowToContents(point));
|
| + RefPtr<Range> characterRange = frame->rangeForPoint(frame, frame->view()->windowToContents(point));
|
| if (!characterRange)
|
| return;
|
|
|
|
|