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

Unified Diff: Source/WebKit/chromium/src/WebFrameImpl.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/WebKit/chromium/src/WebFrameImpl.h ('k') | Source/WebKit/chromium/src/WebPopupMenuImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebFrameImpl.cpp
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp
index 03011143eba3bc049748c012e26ca29f063913e5..819d36723a27c9ff16d2dd6ca939ceeb3f288763 100644
--- a/Source/WebKit/chromium/src/WebFrameImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp
@@ -85,6 +85,7 @@
#include "DocumentMarkerController.h"
#include "Editor.h"
#include "EventHandler.h"
+#include "FocusController.h"
#include "FormState.h"
#include "FrameLoadRequest.h"
#include "FrameLoader.h"
@@ -98,6 +99,7 @@
#include "HTMLLinkElement.h"
#include "HTMLNames.h"
#include "HistoryItem.h"
+#include "HitTestResult.h"
#include "InspectorController.h"
#include "Page.h"
#include "painting/GraphicsContextBuilder.h"
@@ -1130,11 +1132,30 @@ bool WebFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length
if (!range)
return false;
IntRect intRect = frame()->editor()->firstRectForRange(range.get());
- rect = WebRect(intRect.x(), intRect.y(), intRect.width(), intRect.height());
+ rect = WebRect(intRect);
+ // When inside an text control, don't adjust the range.
+ if (!selectionRoot)
+ rect = frame()->view()->contentsToWindow(rect);
return true;
}
+unsigned WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const
+{
+ if (!frame())
+ return notFound;
+
+ IntPoint point = frame()->view()->windowToContents(webPoint);
+ HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false);
+ RefPtr<Range> range = frame()->rangeForPoint(result.point());
+ if (!range.get())
+ return notFound;
+
+ unsigned location, length;
+ range->getLocationAndLength(location, length);
+ return location;
+}
+
bool WebFrameImpl::executeCommand(const WebString& name)
{
ASSERT(frame());
« no previous file with comments | « Source/WebKit/chromium/src/WebFrameImpl.h ('k') | Source/WebKit/chromium/src/WebPopupMenuImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698