diff options
author | Cary Clark <cary@android.com> | 2010-12-15 04:57:30 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-15 04:57:30 -0800 |
commit | 052fc207e3b0c145df08f85c14a7946b5ae3b79f (patch) | |
tree | 0cafe512b96e7935a8172ba514cab53c38c44105 /WebCore/platform/graphics | |
parent | c7911ffd666a7e73131dfd68919b769086a093e0 (diff) | |
parent | d2966aa787e0dcc4d26a10b6f0dc9f3a2f51abe4 (diff) | |
download | external_webkit-052fc207e3b0c145df08f85c14a7946b5ae3b79f.zip external_webkit-052fc207e3b0c145df08f85c14a7946b5ae3b79f.tar.gz external_webkit-052fc207e3b0c145df08f85c14a7946b5ae3b79f.tar.bz2 |
Merge "improve text selection"
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 20 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.h | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index f02136a..58d8772 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -255,7 +255,7 @@ protected: virtual bool onIRectGlyph(const SkIRect& , const SkBounder::GlyphRec& ) { - m_drewText = true; + m_drew = m_drewText = true; return false; } @@ -281,6 +281,8 @@ public: FindState(int x, int y) : m_x(x) , m_y(y) + , m_bestX(x) + , m_bestY(y) , m_best(0) { m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, TOUCH_SLOP * 2, @@ -290,6 +292,8 @@ public: } const LayerAndroid* best() const { return m_best; } + int bestX() const { return m_bestX; } + int bestY() const { return m_bestY; } bool drew(SkPicture* picture, const SkRect& localBounds) { m_findCheck.reset(); @@ -301,7 +305,11 @@ public: bool drewText() { return m_findCheck.drewText(); } - void setBest(const LayerAndroid* best) { m_best = best; } + void setBest(const LayerAndroid* best) { + m_best = best; + m_bestX = m_x; + m_bestY = m_y; + } int x() const { return m_x; } int y() const { return m_y; } @@ -313,6 +321,8 @@ public: protected: int m_x; int m_y; + int m_bestX; + int m_bestY; const LayerAndroid* m_best; FindCheck m_findCheck; SkBitmap m_bitmap; @@ -340,14 +350,16 @@ void LayerAndroid::findInner(LayerAndroid::FindState& state) const state.setBest(this); // set last match (presumably on top) } -const LayerAndroid* LayerAndroid::find(int x, int y, SkPicture* root) const +const LayerAndroid* LayerAndroid::find(int* xPtr, int* yPtr, SkPicture* root) const { - FindState state(x, y); + FindState state(*xPtr, *yPtr); SkRect rootBounds; rootBounds.setEmpty(); if (root && state.drew(root, rootBounds) && state.drewText()) return 0; // use the root picture only if it contains the text findInner(state); + *xPtr = state.bestX(); + *yPtr = state.bestY(); return state.best(); } diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 510014b..575ada7 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -163,7 +163,7 @@ public: void updatePositions(); void clipArea(SkTDArray<SkRect>* region) const; - const LayerAndroid* find(int x, int y, SkPicture* root) const; + const LayerAndroid* find(int* xPtr, int* yPtr, SkPicture* root) const; const LayerAndroid* findById(int uniqueID) const { return const_cast<LayerAndroid*>(this)->findById(uniqueID); } |