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()); |