diff options
Diffstat (limited to 'Source/WebKit/android/nav')
-rw-r--r-- | Source/WebKit/android/nav/DrawExtra.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/nav/DrawExtra.h | 3 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 11 |
3 files changed, 11 insertions, 8 deletions
diff --git a/Source/WebKit/android/nav/DrawExtra.cpp b/Source/WebKit/android/nav/DrawExtra.cpp index 564cc21..2f57dc1 100644 --- a/Source/WebKit/android/nav/DrawExtra.cpp +++ b/Source/WebKit/android/nav/DrawExtra.cpp @@ -51,7 +51,8 @@ SkRegion* RegionLayerDrawExtra::getHighlightRegionsForLayer(const LayerAndroid* return m_highlightRegions.get(layerId); } -void RegionLayerDrawExtra::addHighlightRegion(const LayerAndroid* layer, const Vector<IntRect>& rects) +void RegionLayerDrawExtra::addHighlightRegion(const LayerAndroid* layer, const Vector<IntRect>& rects, + const IntPoint& additionalOffset) { if (rects.isEmpty()) return; @@ -61,7 +62,7 @@ void RegionLayerDrawExtra::addHighlightRegion(const LayerAndroid* layer, const V region = new SkRegion(); m_highlightRegions.set(layerId, region); } - IntPoint offset; + IntPoint offset = additionalOffset; WebViewCore::layerToAbsoluteOffset(layer, offset); for (size_t i = 0; i < rects.size(); i++) { IntRect r = rects.at(i); diff --git a/Source/WebKit/android/nav/DrawExtra.h b/Source/WebKit/android/nav/DrawExtra.h index 0cee861..83e7dcd 100644 --- a/Source/WebKit/android/nav/DrawExtra.h +++ b/Source/WebKit/android/nav/DrawExtra.h @@ -65,7 +65,8 @@ public: RegionLayerDrawExtra(); virtual ~RegionLayerDrawExtra(); - void addHighlightRegion(const LayerAndroid* layer, const Vector<IntRect>& rects); + void addHighlightRegion(const LayerAndroid* layer, const Vector<IntRect>& rects, + const IntPoint& additionalOffset = IntPoint()); virtual void draw(SkCanvas*, LayerAndroid*); virtual void drawGL(GLExtras*, const LayerAndroid*); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 8e819fb..c12adb5 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -1418,15 +1418,16 @@ int getHandleLayerId(SelectText::HandleId handleId, SkIRect& cursorRect) { if (!selectText) return -1; int layerId = selectText->caretLayerId(handleId); - const IntRect& r = selectText->caretRect(handleId); - cursorRect.set(r.x(), r.y(), r.maxX(), r.maxY()); + IntRect rect = selectText->caretRect(handleId); if (layerId != -1) { + // We need to make sure the drawTransform is up to date as this is + // called before a draw() or drawGL() + m_baseLayer->updateLayerPositions(m_visibleRect); LayerAndroid* root = compositeRoot(); LayerAndroid* layer = root ? root->findById(layerId) : 0; - IntPoint offset; - WebViewCore::layerToAbsoluteOffset(layer, offset); - cursorRect.offset(offset.x(), offset.y()); + rect = layer->drawTransform()->mapRect(rect); } + cursorRect.set(rect.x(), rect.y(), rect.maxX(), rect.maxY()); return layerId; } |