OSDN Git Service

fix radio, checkbox hit testing
authorCary Clark <cary@android.com>
Wed, 24 Nov 2010 15:45:12 +0000 (10:45 -0500)
committerCary Clark <cary@android.com>
Wed, 24 Nov 2010 16:05:28 +0000 (11:05 -0500)
Radio and checkbox input types draw only a bitmap in
their navigation bounds, and require some special treatment.

Never treat them as transparent.

Use the slop box instead of the exact box when detecting
them, since our asset may be larger than the space webkit
provides.

Also, fix a debug test if the layer is null.

bug:3215174
Change-Id: I3b573e3aa215268390db2d58435ac47115804ed7

WebKit/android/nav/CacheBuilder.cpp
WebKit/android/nav/CachedRoot.cpp

index c631cd4..449b9e2 100644 (file)
@@ -1275,6 +1275,8 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
                 isUnclipped = isTransparent;
             } else if (input->isInputTypeHidden())
                 continue;
+            else if (input->isRadioButton() || input->isCheckbox())
+                isTransparent = false;
         } else if (node->hasTagName(HTMLNames::textareaTag)) {
             cachedInput.init();
             type = TEXT_INPUT_CACHEDNODETYPE;
index a41cfdc..1a31c15 100644 (file)
@@ -717,9 +717,8 @@ public:
                 layers->getBounds().fLeft, layers->getBounds().fTop,
                 layers->getBounds().fRight, layers->getBounds().fBottom);
             if (collectGlyphs && (layerType == kDrawGlyph_Type
-                || ((layerType == kDrawRect_Type
-                || layerType == kDrawBitmap_Type)
-                && mTextTest.contains(*layers)))) {
+                || ((layerType == kDrawRect_Type && mTextTest.contains(*layers))
+                || (layerType == kDrawBitmap_Type && mTextSlop.contains(*layers))))) {
                 DBG_NAV_LOGD("RingCheck #%d collectOvers", layers - mLayers.begin());
                 collectOvers = true;
                 clipped->op(*layers, SkRegion::kUnion_Op);
@@ -964,9 +963,9 @@ private:
                 mTextSlop.contains(*layers) ? "true" : "false",
                 gb.fLeft, gb.fTop, gb.fRight, gb.fBottom);
 #endif
-            if ((layerType == kDrawGlyph_Type && mTextSlop.contains(*layers))
-                || ((layerType == kDrawRect_Type
-                || layerType == kDrawBitmap_Type)
+            if (((layerType == kDrawGlyph_Type || layerType == kDrawBitmap_Type)
+                && mTextSlop.contains(*layers))
+                || (layerType == kDrawRect_Type
                 && mTextTest.contains(*layers))) {
                 if (!testLayer)
                     testLayer = layers;
@@ -1854,7 +1853,8 @@ void CachedRoot::Debug::print() const
     b->mHistory->mDebug.print(b);
     DUMP_NAV_LOGD("// int mMaxXScroll=%d, mMaxYScroll=%d;\n",
         b->mMaxXScroll, b->mMaxYScroll);
-    CachedLayer::Debug::printRootLayerAndroid(b->mRootLayer);
+    if (b->mRootLayer)
+        CachedLayer::Debug::printRootLayerAndroid(b->mRootLayer);
 #ifdef DUMP_NAV_CACHE_USING_PRINTF
     if (gNavCacheLogFile)
         fclose(gNavCacheLogFile);