diff options
author | John Reck <jreck@google.com> | 2012-01-18 09:35:28 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-01-18 09:36:43 -0800 |
commit | 955fdda057363dbf1ae95ffeb542cde8ace28b54 (patch) | |
tree | 1262c8203eeb42a3f545a491f17ffc7dc9e7f399 | |
parent | 70a957cef141437cdf84e19c2eaeabdfb85c6542 (diff) | |
download | frameworks_base-955fdda057363dbf1ae95ffeb542cde8ace28b54.zip frameworks_base-955fdda057363dbf1ae95ffeb542cde8ace28b54.tar.gz frameworks_base-955fdda057363dbf1ae95ffeb542cde8ace28b54.tar.bz2 |
Add tapHighlightColor support
Change-Id: I419eb3d8f1050efd05bb989a6b353ad45ee77acf
-rw-r--r-- | core/java/android/webkit/WebView.java | 16 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 1 |
2 files changed, 7 insertions, 10 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index c3b6416..e6fc3d6 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -712,13 +712,11 @@ public class WebView extends AbsoluteLayout static boolean sDisableNavcache = false; // the color used to highlight the touch rectangles - private static final int HIGHLIGHT_COLOR = 0x6633b5e5; - // the round corner for the highlight path - private static final float TOUCH_HIGHLIGHT_ARC = 5.0f; + static final int HIGHLIGHT_COLOR = 0x6633b5e5; // the region indicating where the user touched on the screen private Region mTouchHighlightRegion = new Region(); // the paint for the touch highlight - private Paint mTouchHightlightPaint; + private Paint mTouchHightlightPaint = new Paint(); // debug only private static final boolean DEBUG_TOUCH_HIGHLIGHT = true; private static final int TOUCH_HIGHLIGHT_ELAPSE_TIME = 2000; @@ -4430,10 +4428,6 @@ public class WebView extends AbsoluteLayout Rect r = mTouchHighlightRegion.getBounds(); postInvalidateDelayed(delay, r.left, r.top, r.right, r.bottom); } else { - if (mTouchHightlightPaint == null) { - mTouchHightlightPaint = new Paint(); - mTouchHightlightPaint.setColor(HIGHLIGHT_COLOR); - } RegionIterator iter = new RegionIterator(mTouchHighlightRegion); Rect r = new Rect(); while (iter.next(r)) { @@ -8874,7 +8868,7 @@ public class WebView extends AbsoluteLayout case HIT_TEST_RESULT: WebKitHitTest hit = (WebKitHitTest) msg.obj; mFocusedNode = hit; - setTouchHighlightRects(hit != null ? hit.mTouchRects : null); + setTouchHighlightRects(hit); if (hit == null) { mInitialHitTestResult = null; } else { @@ -8929,12 +8923,14 @@ public class WebView extends AbsoluteLayout } } - private void setTouchHighlightRects(Rect[] rects) { + private void setTouchHighlightRects(WebKitHitTest hit) { + Rect[] rects = hit != null ? hit.mTouchRects : null; if (!mTouchHighlightRegion.isEmpty()) { invalidate(mTouchHighlightRegion.getBounds()); mTouchHighlightRegion.setEmpty(); } if (rects != null) { + mTouchHightlightPaint.setColor(hit.mTapHighlightColor); for (Rect rect : rects) { Rect viewRect = contentToViewRect(rect); // some sites, like stories in nytimes.com, set diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index bfca07c..c4981e1 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -881,6 +881,7 @@ public final class WebViewCore { String mTitle; Rect[] mTouchRects; boolean mEditable; + int mTapHighlightColor = WebView.HIGHLIGHT_COLOR; // These are the input values that produced this hit test int mHitTestX; |