summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/CachedNode.cpp
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2009-05-13 12:50:01 -0400
committerCary Clark <cary@android.com>2009-05-13 13:24:07 -0400
commitcf5ef6c01a2cd27a06391ab9cf3d2c9c24335e4d (patch)
tree4f8c31ff697957dce4d640d407bccaf20ea6c994 /WebKit/android/nav/CachedNode.cpp
parentdd63eb3e5e94bd7ac1305096cf67a12166beef8a (diff)
downloadexternal_webkit-cf5ef6c01a2cd27a06391ab9cf3d2c9c24335e4d.zip
external_webkit-cf5ef6c01a2cd27a06391ab9cf3d2c9c24335e4d.tar.gz
external_webkit-cf5ef6c01a2cd27a06391ab9cf3d2c9c24335e4d.tar.bz2
use one rectangle for browser focus ring
Check to see if the potentially larger hit-test bounds can be used in place of the normal bounds, or if the normal bounds can be used in place of the individual text bounds. Construct a region out of the individual focus ring rectangles, then see if any text is drawn inside the bounds but outside of the focus ring. If not, use one rectangle instead of the rings.
Diffstat (limited to 'WebKit/android/nav/CachedNode.cpp')
-rw-r--r--WebKit/android/nav/CachedNode.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/WebKit/android/nav/CachedNode.cpp b/WebKit/android/nav/CachedNode.cpp
index b786677..07d3491 100644
--- a/WebKit/android/nav/CachedNode.cpp
+++ b/WebKit/android/nav/CachedNode.cpp
@@ -24,8 +24,8 @@
*/
#include "CachedPrefix.h"
-#include "CachedFrame.h"
#include "CachedHistory.h"
+#include "CachedRoot.h"
#include "Node.h"
#include "PlatformString.h"
@@ -78,13 +78,29 @@ bool CachedNode::clip(const WebCore::IntRect& bounds)
#define OVERLAP 3
-void CachedNode::fixUpFocusRects()
+void CachedNode::fixUpFocusRects(const CachedRoot* root)
{
if (mFixedUpFocusRects)
return;
mFixedUpFocusRects = true;
+ // if the hit-test rect doesn't intersect any other rect, use it
+ if (mHitBounds != mBounds && mHitBounds.contains(mBounds) &&
+ root->checkRings(mFocusRing, mHitBounds)) {
+ DBG_NAV_LOGD("use mHitBounds (%d,%d,%d,%d)", mHitBounds.x(),
+ mHitBounds.y(), mHitBounds.width(), mHitBounds.height());
+ mUseHitBounds = true;
+ return;
+ }
if (mNavableRects <= 1)
return;
+ // if there is more than 1 rect, and the bounds doesn't intersect
+ // any other focus ring bounds, use it
+ if (root->checkRings(mFocusRing, mBounds)) {
+ DBG_NAV_LOGD("use mBounds (%d,%d,%d,%d)", mBounds.x(),
+ mBounds.y(), mBounds.width(), mBounds.height());
+ mUseBounds = true;
+ return;
+ }
#if DEBUG_NAV_UI
{
WebCore::IntRect* boundsPtr = mFocusRing.begin() - 1;