OSDN Git Service

Use fRight and fBottom instead of width() and height().
authorPatrick Scott <phanna@android.com>
Tue, 7 Jul 2009 15:11:15 +0000 (11:11 -0400)
committerPatrick Scott <phanna@android.com>
Tue, 7 Jul 2009 16:57:20 +0000 (12:57 -0400)
The methods width() and height() take in to account negative values for fLeft
and fTop. This can cause the width and height to be larger than the visible
rectangle which was causing cnn.com to grow arbitrarily large.

WebKit/android/jni/WebViewCore.cpp

index f60b6b5..f88b1d2 100644 (file)
@@ -437,7 +437,12 @@ void WebViewCore::recordPictureSet(PictureSet* content)
             int right = x + owner->width();
             int bottom = y + owner->height();
             SkIRect frameRect = {x, y, right, bottom};
-            if (SkIRect::Intersects(total, frameRect))
+            // Ignore a width or height that is smaller than 1. Some iframes
+            // have small dimensions in order to be hidden. The iframe
+            // expansion code does not expand in that case so we should ignore
+            // them here.
+            if (frameRect.width() > 1 && frameRect.height() > 1
+                    && SkIRect::Intersects(total, frameRect))
                 total.join(x, y, right, bottom);
         }
     }
@@ -446,7 +451,7 @@ void WebViewCore::recordPictureSet(PictureSet* content)
     // all the content.
     if (!contentRect.contains(total)) {
         // Resize the view to change the overflow clip.
-        view->resize(total.width(), total.height());
+        view->resize(total.fRight, total.fBottom);
 
         // We have to force a layout in order for the clip to change.
         m_mainFrame->contentRenderer()->setNeedsLayoutAndPrefWidthsRecalc();