Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

Issue 6532004: DO NOT SUBMIT (Closed) Base URL: git://git.webkit.org/WebKit.git@master
Patch Set: Address feedback Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit2/WebProcess/WebPage/WebPage.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/WebKit2/WebProcess/WebPage/WebPage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698