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

Unified Diff: Source/WebCore/page/Frame.cpp

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/WebCore/page/Frame.h ('k') | Source/WebKit/chromium/WebKit.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/page/Frame.cpp
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
index 3e4bb2ea28f0e39f82a7e488306b3a0fe3a2c0c4..548e4668ed2f854973ddf3712c66a37d5e757b5b 100644
--- a/Source/WebCore/page/Frame.cpp
+++ b/Source/WebCore/page/Frame.cpp
@@ -804,6 +804,31 @@ Document* Frame::documentAtPoint(const IntPoint& point)
return result.innerNode() ? result.innerNode()->document() : 0;
}
+PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
+{
+ VisiblePosition position = visiblePositionForPoint(framePoint);
+ if (position.isNull())
+ return 0;
+
+ VisiblePosition previous = position.previous();
+ if (previous.isNotNull()) {
+ RefPtr<Range> previousCharacterRange = makeRange(previous, position);
+ IntRect rect = editor()->firstRectForRange(previousCharacterRange.get());
+ if (rect.contains(framePoint))
+ return previousCharacterRange.release();
+ }
+
+ VisiblePosition next = position.next();
+ if (next.isNotNull()) {
+ RefPtr<Range> nextCharacterRange = makeRange(position, next);
+ IntRect rect = editor()->firstRectForRange(nextCharacterRange.get());
+ if (rect.contains(framePoint))
+ return nextCharacterRange.release();
+ }
+
+ return 0;
+}
+
void Frame::createView(const IntSize& viewportSize,
const Color& backgroundColor, bool transparent,
const IntSize& fixedLayoutSize, bool useFixedLayout,
« no previous file with comments | « Source/WebCore/page/Frame.h ('k') | Source/WebKit/chromium/WebKit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698