OSDN Git Service

hit test complete node even if partially visible
authorCary Clark <cary@android.com>
Mon, 29 Nov 2010 21:28:22 +0000 (16:28 -0500)
committerCary Clark <cary@android.com>
Mon, 29 Nov 2010 21:40:21 +0000 (16:40 -0500)
An older test incorrectly discards nodes if they are partially
off the screen. The test was attempting to ignore nodes that
were fully invisible, so change the test to do that.

bug:3198707
Change-Id: I3cb13de3c86b43d3388849161bdfc44f84d93b3d

WebKit/android/nav/CachedRoot.cpp

index 1a31c15..7d5f3d9 100644 (file)
@@ -1112,10 +1112,12 @@ void CachedRoot::calcBitBounds(const IntRect& nodeBounds, IntRect* bitBounds) co
     IntRect contentBounds = IntRect(0, 0, mPicture->width(), mPicture->height());
     IntRect overBounds = nodeBounds;
     overBounds.inflate(kMargin);
-    *bitBounds = mScrolledBounds;
-    bitBounds->unite(mViewBounds);
-    bitBounds->intersect(contentBounds);
+    IntRect viewableBounds = mScrolledBounds;
+    viewableBounds.unite(mViewBounds);
+    *bitBounds = contentBounds;
     bitBounds->intersect(overBounds);
+    if (!bitBounds->intersects(viewableBounds))
+        *bitBounds = IntRect(0, 0, 0, 0);
     DBG_NAV_LOGD("contentBounds=(%d,%d,r=%d,b=%d) overBounds=(%d,%d,r=%d,b=%d)"
         " mScrolledBounds=(%d,%d,r=%d,b=%d) mViewBounds=(%d,%d,r=%d,b=%d)"
         " bitBounds=(%d,%d,r=%d,b=%d)",