summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-10-25 19:14:04 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-25 19:14:04 -0700
commit1b1aeae55b7873e867eabd7c47d9acea34c2a606 (patch)
treebe4d5107d6941f62c1f45a6bfe80818bd6e7aea9 /Source
parentf6024a989d5eabfede72f4d156ffc128ed35f5a5 (diff)
parent0bab4025aed8786cb8307d2eede87f7f21cc0d65 (diff)
downloadexternal_webkit-1b1aeae55b7873e867eabd7c47d9acea34c2a606.zip
external_webkit-1b1aeae55b7873e867eabd7c47d9acea34c2a606.tar.gz
external_webkit-1b1aeae55b7873e867eabd7c47d9acea34c2a606.tar.bz2
Merge "DO NOT MERGE Adjust text selection position" into ics-mr1
Diffstat (limited to 'Source')
-rw-r--r--Source/WebKit/android/nav/SelectText.cpp11
-rw-r--r--Source/WebKit/android/nav/SelectText.h2
-rw-r--r--Source/WebKit/android/nav/WebView.cpp2
3 files changed, 12 insertions, 3 deletions
diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp
index 8427e6f..98ec574 100644
--- a/Source/WebKit/android/nav/SelectText.cpp
+++ b/Source/WebKit/android/nav/SelectText.cpp
@@ -1478,7 +1478,8 @@ static void addEnd(SkRegion* diff, const SkIRect& rect)
diff->op(bounds, SkRegion::kUnion_Op);
}
-void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
+void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region,
+ LayerAndroid* root)
{
SkIRect ivisBounds = vis;
ivisBounds.join(m_selStart);
@@ -1486,6 +1487,14 @@ void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
region->setEmpty();
buildSelection(*m_picture, ivisBounds, m_selStart, m_startBase,
m_selEnd, m_endBase, region);
+ if (root && m_layerId) {
+ Layer* layer = root->findById(m_layerId);
+ while (layer) {
+ const SkPoint& pos = layer->getPosition();
+ region->translate(pos.fX, pos.fY);
+ layer = layer->getParent();
+ }
+ }
}
void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
diff --git a/Source/WebKit/android/nav/SelectText.h b/Source/WebKit/android/nav/SelectText.h
index b1e1f11..e5f7f59 100644
--- a/Source/WebKit/android/nav/SelectText.h
+++ b/Source/WebKit/android/nav/SelectText.h
@@ -57,7 +57,7 @@ public:
void setExtendSelection(bool extend) { m_extendSelection = extend; }
bool startSelection(const CachedRoot* , const IntRect& vis, int x, int y);
bool wordSelection(const CachedRoot* , const IntRect& vis, int x, int y);
- void getSelectionRegion(const IntRect& vis, SkRegion *region);
+ void getSelectionRegion(const IntRect& vis, SkRegion *region, LayerAndroid* root);
void updateHandleScale(float handleScale);
public:
float m_inverseScale; // inverse scale, x, y used for drawing select path
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 4c75b58..46f608b 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -1552,7 +1552,7 @@ void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndic
void getTextSelectionRegion(SkRegion *region)
{
- m_selectText.getSelectionRegion(getVisibleRect(), region);
+ m_selectText.getSelectionRegion(getVisibleRect(), region, compositeRoot());
}
void replaceBaseContent(PictureSet* set)