OSDN Git Service

don't call bounder when uninitialized
authorCary Clark <cary@android.com>
Wed, 23 Mar 2011 14:02:01 +0000 (10:02 -0400)
committerCary Clark <cary@android.com>
Wed, 23 Mar 2011 14:12:25 +0000 (10:12 -0400)
If the canvas' device list has never been set up, or
has been set to an empty clip, the bounder's clip will not be
initialized, and checking bounding rect may fail.

Check to see if the bounder was ever called for an individual
glyph before checking the result.

bug:4155270

Change-Id: I625e885d13208e82c44259277c74b8f0cef5b0cb

WebKit/android/nav/CachedRoot.cpp

index f5f8a71..64bf19a 100644 (file)
@@ -89,6 +89,8 @@ public:
         return doIRect(mUnion);
     }
 
+    bool isEmpty() { return mUnion.isEmpty(); }
+
     bool joinGlyphs(const SkIRect& rect) {
         bool isGlyph = mType == kDrawGlyph_Type;
         if (isGlyph)
@@ -188,7 +190,8 @@ public:
         mBounder.setEmpty();
         mBounder.setType(CommonCheck::kDrawGlyph_Type);
         INHERITED::drawPosText(text, byteLength, pos, paint);
-        mBounder.doRect(CommonCheck::kDrawPosText_Type);
+        if (!mBounder.isEmpty())
+            mBounder.doRect(CommonCheck::kDrawPosText_Type);
     }
 
     virtual void drawPosTextH(const void* text, size_t byteLength,