summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/SelectText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav/SelectText.cpp')
-rw-r--r--WebKit/android/nav/SelectText.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index 0862284..f2d7521 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -486,7 +486,7 @@ public:
return false;
}
- virtual bool onIRectGlyph(const SkIRect& rect, const SkBounder::GlyphRec& )
+ virtual bool onIRect(const SkIRect& rect)
{
SkIRect bounds;
bounds.set(rect.fLeft, top(), rect.fRight, bottom());
@@ -1853,6 +1853,25 @@ void SelectText::reset()
m_layerId = 0;
}
+IntPoint SelectText::selectableText(const CachedRoot* root)
+{
+ int x = 0;
+ int y = 0;
+ SkPicture* picture = root->pictureAt(&x, &y, &m_layerId);
+ if (!picture) {
+ DBG_NAV_LOG("picture==0");
+ return IntPoint(0, 0);
+ }
+ int width = picture->width();
+ int height = picture->height();
+ IntRect vis(0, 0, width, height);
+ FirstCheck center(width >> 1, height >> 1, vis);
+ int base;
+ const SkIRect& closest = findClosest(center, *picture, &base);
+ return IntPoint((closest.fLeft + closest.fRight) >> 1,
+ (closest.fTop + closest.fBottom) >> 1);
+}
+
void SelectText::selectAll()
{
if (!m_picture)
@@ -1961,6 +1980,7 @@ bool SelectText::wordSelection(const CachedRoot* root, const IntRect& vis,
y = (m_selStart.fTop + m_selStart.fBottom) >> 1;
SkIRect clipRect = m_visibleRect;
clipRect.fLeft -= m_visibleRect.width() >> 1;
+ clipRect.fLeft = std::max(clipRect.fLeft, 0);
int base;
SkIRect left = findLeft(*m_picture, clipRect, x, y, &base);
if (!left.isEmpty()) {