summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-11-15 11:53:29 -0800
committerJohn Reck <jreck@google.com>2011-11-15 11:53:43 -0800
commit292448625cf74fa0cbb6776572d5b116d2e7eb15 (patch)
tree03b9a16007951640a6f210cd1d1e2076c46ffe70 /Source/WebKit
parent61a908361c8a96eeb70afdb5430e89845edb2bdd (diff)
downloadexternal_webkit-292448625cf74fa0cbb6776572d5b116d2e7eb15.zip
external_webkit-292448625cf74fa0cbb6776572d5b116d2e7eb15.tar.gz
external_webkit-292448625cf74fa0cbb6776572d5b116d2e7eb15.tar.bz2
Fix text selection handle positioning
Bug: 5620362 Change-Id: Ic75ba855b5b86f8b0c3a21ee5dcbcc92b0dc982a
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/nav/SelectText.cpp13
-rw-r--r--Source/WebKit/android/nav/SelectText.h2
-rw-r--r--Source/WebKit/android/nav/WebView.cpp2
3 files changed, 14 insertions, 3 deletions
diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp
index 4a6b509..d20c44a 100644
--- a/Source/WebKit/android/nav/SelectText.cpp
+++ b/Source/WebKit/android/nav/SelectText.cpp
@@ -1829,12 +1829,23 @@ bool SelectText::hitSelection(int x, int y) const
return m_selRegion.contains(x, y);
}
-void SelectText::getSelectionHandles(int* handles)
+void SelectText::getSelectionHandles(int* handles, LayerAndroid* root)
{
handles[0] = m_selStart.fLeft;
handles[1] = m_selStart.fBottom;
handles[2] = m_selEnd.fRight;
handles[3] = m_selEnd.fBottom;
+ if (root && m_layerId) {
+ Layer* layer = root->findById(m_layerId);
+ while (layer) {
+ const SkPoint& pos = layer->getPosition();
+ handles[0] += pos.fX;
+ handles[2] += pos.fX;
+ handles[1] += pos.fY;
+ handles[3] += pos.fY;
+ layer = layer->getParent();
+ }
+ }
}
void SelectText::moveSelection(const IntRect& vis, int x, int y)
diff --git a/Source/WebKit/android/nav/SelectText.h b/Source/WebKit/android/nav/SelectText.h
index 4abf378..b454b8e 100644
--- a/Source/WebKit/android/nav/SelectText.h
+++ b/Source/WebKit/android/nav/SelectText.h
@@ -59,7 +59,7 @@ public:
bool wordSelection(const CachedRoot* , const IntRect& vis, int x, int y);
void getSelectionRegion(const IntRect& vis, SkRegion *region, LayerAndroid* root);
void updateHandleScale(float handleScale);
- void getSelectionHandles(int* handles);
+ void getSelectionHandles(int* handles, LayerAndroid* root);
public:
float m_inverseScale; // inverse scale, x, y used for drawing select path
int m_selectX;
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 59fd6da..aea28bd 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -1505,7 +1505,7 @@ void getTextSelectionRegion(SkRegion *region)
void getTextSelectionHandles(int* handles)
{
- m_selectText.getSelectionHandles(handles);
+ m_selectText.getSelectionHandles(handles, compositeRoot());
}
void replaceBaseContent(PictureSet* set)