diff options
author | Cary Clark <cary@android.com> | 2009-05-13 12:50:01 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-05-13 13:24:07 -0400 |
commit | cf5ef6c01a2cd27a06391ab9cf3d2c9c24335e4d (patch) | |
tree | 4f8c31ff697957dce4d640d407bccaf20ea6c994 /WebKit/android/nav/WebView.cpp | |
parent | dd63eb3e5e94bd7ac1305096cf67a12166beef8a (diff) | |
download | external_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/WebView.cpp')
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 7b98e56..c259501 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -700,12 +700,11 @@ void drawFocusRing(SkCanvas* canvas) DBG_NAV_LOG("!node->hasFocusRing()"); return; } - const WTF::Vector<WebCore::IntRect>& rings = node->focusRings(); - if (!rings.size()) { - DBG_NAV_LOG("!rings.size()"); + const WTF::Vector<WebCore::IntRect>* rings = &node->focusRings(); + if (!rings->size()) { + DBG_NAV_LOG("!rings->size()"); return; } - bool isButton = false; m_viewImpl->gButtonMutex.lock(); // If this is a button drawn by us (rather than webkit) do not draw the @@ -731,6 +730,7 @@ void drawFocusRing(SkCanvas* canvas) return; } FocusRing::Flavor flavor = FocusRing::NORMAL_FLAVOR; + WTF::Vector<WebCore::IntRect> oneRing; if (!isButton) { flavor = node->type() != NORMAL_CACHEDNODETYPE ? FocusRing::FAKE_FLAVOR : node->nodePointer() == m_invalidNode ? @@ -738,15 +738,20 @@ void drawFocusRing(SkCanvas* canvas) if (flavor != FocusRing::INVALID_FLAVOR && m_followedLink) { flavor = (FocusRing::Flavor) (flavor + FocusRing::NORMAL_ANIMATING); } + bool useHitBounds = node->useHitBounds(); + if (useHitBounds || node->useBounds()) { + oneRing.append(useHitBounds ? node->hitBounds() : node->bounds()); + rings = &oneRing; + } #if DEBUG_NAV_UI - const WebCore::IntRect& ring = rings[0]; + const WebCore::IntRect& ring = (*rings)[0]; DBG_NAV_LOGD("cachedFocusNode=%d (nodePointer=%p) flavor=%s rings=%d" " (%d, %d, %d, %d)", node->index(), node->nodePointer(), flavor == FocusRing::FAKE_FLAVOR ? "FAKE_FLAVOR" : flavor == FocusRing::INVALID_FLAVOR ? "INVALID_FLAVOR" : flavor == FocusRing::NORMAL_ANIMATING ? "NORMAL_ANIMATING" : flavor == FocusRing::FAKE_ANIMATING ? "FAKE_ANIMATING" : "NORMAL_FLAVOR", - rings.size(), ring.x(), ring.y(), ring.width(), ring.height()); + rings->size(), ring.x(), ring.y(), ring.width(), ring.height()); #endif } if (isButton || flavor >= FocusRing::NORMAL_ANIMATING) { @@ -761,7 +766,7 @@ void drawFocusRing(SkCanvas* canvas) } } if (!isButton) - FocusRing::DrawRing(canvas, rings, flavor); + FocusRing::DrawRing(canvas, *rings, flavor); } OutOfFocusFix fixOutOfDateFocus(bool useReplay) |