summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/CachedRoot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav/CachedRoot.cpp')
-rw-r--r--WebKit/android/nav/CachedRoot.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 7bedd4f..d529a00 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -876,11 +876,11 @@ public:
layers->getBounds().fRight, layers->getBounds().fBottom,
collectGlyphs ? "true" : "false",
mTestBounds.intersects(*layers) ? "true" : "false",
- mTestBounds.contains(*layers) ? "true" : "false");
+ mTextSlop.contains(*layers) ? "true" : "false");
if (collectGlyphs && layerType == kDrawGlyph_Type) {
if (!mTestBounds.intersects(*layers))
continue;
- if (!mTestBounds.contains(*layers))
+ if (!mTextSlop.contains(*layers))
return false;
foundGlyph = true;
}
@@ -898,7 +898,11 @@ protected:
&& mType != kDrawSprite_Type && mType != kDrawBitmap_Type)
return false;
if (mLayerTypes.isEmpty() || mLayerTypes.last() != mType
- || !mAppendLikeTypes) {
+ || !mAppendLikeTypes
+ // if the last was a rect, and the current one is also a rect,
+ // but the two rects have a gap between, don't join them -- push
+ // an empty between them
+ || (mType == kDrawRect_Type && !joinable(rect))) {
push(mType, mEmpty);
}
DBG_NAV_LOGD("RingCheck join %s (%d,%d,r=%d,b=%d) '%c'",
@@ -995,6 +999,20 @@ private:
}
}
+ bool joinable(const SkIRect& rect)
+ {
+ SkRegion region = mLayers.last();
+ if (!region.isRect())
+ return false;
+ const SkIRect& bounds1 = region.getBounds();
+ int area1 = bounds1.width() * bounds1.height();
+ area1 += rect.width() * rect.height();
+ region.op(rect, SkRegion::kUnion_Op);
+ const SkIRect& bounds2 = region.getBounds();
+ int area2 = bounds2.width() * bounds2.height();
+ return area2 <= area1;
+ }
+
void popEmpty()
{
if (mLayerTypes.size() == 0)