summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-11-15 14:25:20 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-15 14:25:20 -0800
commitd5940d193c17019f3fd46bc6ff49c2196149824e (patch)
treee6f0c8561eb6424cb961a671011d8ee6cade4700
parentee7bd5a65f850002be39285071d02e89db600a2d (diff)
parent292448625cf74fa0cbb6776572d5b116d2e7eb15 (diff)
downloadexternal_webkit-d5940d193c17019f3fd46bc6ff49c2196149824e.zip
external_webkit-d5940d193c17019f3fd46bc6ff49c2196149824e.tar.gz
external_webkit-d5940d193c17019f3fd46bc6ff49c2196149824e.tar.bz2
am 29244862: Fix text selection handle positioning
* commit '292448625cf74fa0cbb6776572d5b116d2e7eb15': Fix text selection handle positioning
-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)