diff options
| author | John Reck <jreck@google.com> | 2011-10-24 16:49:45 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2011-10-25 16:47:20 -0700 |
| commit | 0bab4025aed8786cb8307d2eede87f7f21cc0d65 (patch) | |
| tree | 5ea4ae882b5152d45b45f0697546dba4930e9173 | |
| parent | c0fb399b4644c319c15e0a6a7e0f6c29917d9099 (diff) | |
| download | external_webkit-0bab4025aed8786cb8307d2eede87f7f21cc0d65.zip external_webkit-0bab4025aed8786cb8307d2eede87f7f21cc0d65.tar.gz external_webkit-0bab4025aed8786cb8307d2eede87f7f21cc0d65.tar.bz2 | |
DO NOT MERGE Adjust text selection position
Bug: 5507800
Change-Id: Icfcfdb9ff019fac7e3e40df679723594fab15dc6
| -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 493d4b3..a6c9ee9 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -1557,7 +1557,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) |
