summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2011-01-05 09:36:53 -0500
committerCary Clark <cary@android.com>2011-01-05 09:36:53 -0500
commit17355895d12e1d97f449ae6a2f2d82f28d50980f (patch)
tree23dacb6517cb4551b3677971a631e8c44110272d /WebKit
parent515943cc7c9a60faa661739271d5fa14fcba9df8 (diff)
downloadexternal_webkit-17355895d12e1d97f449ae6a2f2d82f28d50980f.zip
external_webkit-17355895d12e1d97f449ae6a2f2d82f28d50980f.tar.gz
external_webkit-17355895d12e1d97f449ae6a2f2d82f28d50980f.tar.bz2
use same matrix left when reading picture
In select text, the nav cache picture is read multiple times. If the matrix is different, it's possible that the text metrics will be off by one when the text position is near to but not equal to an integer (e.g., 315.999969). Pinning the matrix to zero makes the matrices the same in the bug case. Use the simpler doIRect interface if the glyph rec isn't needed. Check for contentRender() before dereferencing it. bug:3315620 Change-Id: I4bfaf9f9b7bf12f66b29f4609d744bceaf5b2964
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp6
-rw-r--r--WebKit/android/nav/SelectText.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 48583be..4cb9695 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1030,8 +1030,10 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
// The frame itself might be composited so we need to track the layer. Do
// not track the base frame's layer as the main content is draw as part of
// BaseLayerAndroid's picture.
- if (frame != root && frame->contentRenderer()->usesCompositing() && node->lastChild())
- TrackLayer(layerTracker, frame->contentRenderer(), node->lastChild(), globalOffsetX, globalOffsetY);
+ if (frame != root && frame->contentRenderer()
+ && frame->contentRenderer()->usesCompositing() && node->lastChild())
+ TrackLayer(layerTracker, frame->contentRenderer(), node->lastChild(),
+ globalOffsetX, globalOffsetY);
#endif
while (walk.mMore || (node = node->traverseNextNode()) != NULL) {
#if DUMP_NAV_CACHE
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index 7597450..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());
@@ -1980,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()) {