From b99dd716b4af0afde074e28b50b7b28ae3c03da7 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Fri, 15 Jan 2010 14:30:59 -0800 Subject: DO NOT MERGE When the hit result node has zero width, we can't use it. Try its parents. This happens in the story inside nytimes.com. They use a special tag. If it is the hit point, it has 0 width and height. Fix http://b/issue?id=2363260 --- WebKit/android/jni/WebViewCore.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index d13abe5..6ebf1df 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1092,6 +1092,14 @@ void WebViewCore::setSizeScreenWidthAndScale(int width, int height, bounds = node->getRect(); DBG_NAV_LOGD("ob:(x=%d,y=%d,w=%d,h=%d)", bounds.x(), bounds.y(), bounds.width(), bounds.height()); + // sites like nytimes.com insert a non-standard tag + // in the html. If it is the HitTestResult, it may have zero + // width and height. In this case, use its parent node. + if (bounds.width() == 0) { + node = node->parent(); + if (node) + bounds = node->getRect(); + } if ((anchorX | anchorY) == 0) { WebCore::IntPoint offset = WebCore::IntPoint( anchorPoint.x() - bounds.x(), anchorPoint.y() -- cgit v1.1