diff options
| author | John Reck <jreck@google.com> | 2011-10-25 08:54:29 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-25 08:54:29 -0700 |
| commit | 5b0ee46e1ba2b63f6601cf65f96a75ba5991d768 (patch) | |
| tree | 06f2708c9d96e01189505055af5ff00e6b3191a7 /Source | |
| parent | f3dbd5d3500f7c31700842aedeaa7502e2db502a (diff) | |
| parent | 19753631372030cd775d8861183d95ae5503b064 (diff) | |
| download | external_webkit-5b0ee46e1ba2b63f6601cf65f96a75ba5991d768.zip external_webkit-5b0ee46e1ba2b63f6601cf65f96a75ba5991d768.tar.gz external_webkit-5b0ee46e1ba2b63f6601cf65f96a75ba5991d768.tar.bz2 | |
Merge "Adjust text selection position"
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/WebKit/android/nav/SelectText.cpp | 11 | ||||
| -rw-r--r-- | Source/WebKit/android/nav/SelectText.h | 2 | ||||
| -rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 2 |
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) |
