summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-12-16 13:21:01 -0500
committerCary Clark <cary@android.com>2010-12-16 14:05:29 -0500
commit45caa82c86fc13574e7a4c476b92c593e999ebac (patch)
tree89d862ea4292157bf05ec4dae3281317627be839 /WebCore/platform/graphics/android
parent0bdd7f2d73cad03535071e5de0ba3d2f5feb1b00 (diff)
downloadexternal_webkit-45caa82c86fc13574e7a4c476b92c593e999ebac.zip
external_webkit-45caa82c86fc13574e7a4c476b92c593e999ebac.tar.gz
external_webkit-45caa82c86fc13574e7a4c476b92c593e999ebac.tar.bz2
improve text selection in scrollable divs
Detect which layer is hit by looking for scrollable layers. In this case it isn't necessary to see what is drawn or where, because the layer has already been prescreened by the parent clip. Adjust the x/y hit by the layer's position. This corrects the position when the layer scrolls. Fix CachedLayer's debug output to be in sync with LayerAndroid.h SelectText edge cases are corrected when there is not text to hit. To find the closest character, first look at the edge of the text line. If the hit is inside the line of text, measure from the center of the character. This helps when textlines overlap. bug:3275625 bug:3191699 Change-Id: I924cc0432f6dace32e0a7444fe69ef15dca2e77f
Diffstat (limited to 'WebCore/platform/graphics/android')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index b71f525..15b992a 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -316,10 +316,10 @@ public:
bool drewText() { return m_findCheck.drewText(); }
- void setBest(const LayerAndroid* best) {
+ void setBest(const LayerAndroid* best, int x, int y) {
m_best = best;
- m_bestX = m_x;
- m_bestY = m_y;
+ m_bestX = x;
+ m_bestY = y;
}
int x() const { return m_x; }
int y() const { return m_y; }
@@ -354,12 +354,14 @@ void LayerAndroid::findInner(LayerAndroid::FindState& state) const
for (int i = 0; i < countChildren(); i++)
getChild(i)->findInner(state);
// Move back into the parent coordinates.
+ int testX = state.x();
+ int testY = state.y();
state.setLocation(x + localBounds.fLeft, y + localBounds.fTop);
if (!m_recordingPicture)
return;
- if (!state.drew(m_recordingPicture, localBounds))
+ if (!contentIsScrollable() && !state.drew(m_recordingPicture, localBounds))
return;
- state.setBest(this); // set last match (presumably on top)
+ state.setBest(this, testX, testY); // set last match (presumably on top)
}
const LayerAndroid* LayerAndroid::find(int* xPtr, int* yPtr, SkPicture* root) const