am 4258bfb7: Merge "Fix some drawing artifacts/bugs around overlays/text anchors" into gingerbread

Merge commit '4258bfb7a9fb18907fbfbe79ec0a937b4e7382b1' into gingerbread-plus-aosp

* commit '4258bfb7a9fb18907fbfbe79ec0a937b4e7382b1':
  Fix some drawing artifacts/bugs around overlays/text anchors
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index fd6769c..deba70c 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3542,10 +3542,10 @@
             for (int i = 0; i < childCount; i++) {
                 final View child = getChildAt(i);
                 if (child.isOverlayEnabled()) {
-                    canvas.translate(child.mLeft + child.mScrollX, child.mTop + child.mScrollY);
+                    canvas.translate(child.mLeft - child.mScrollX, child.mTop - child.mScrollY);
                     child.onDrawOverlay(canvas);
-                    canvas.translate(-(child.mLeft + child.mScrollX),
-                            -(child.mTop + child.mScrollY));
+                    canvas.translate(-(child.mLeft - child.mScrollX),
+                            -(child.mTop - child.mScrollY));
                 }
             }
         }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 54b2c00..07b22ea 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7732,8 +7732,9 @@
             bounds.bottom = bounds.top + drawableHeight;
 
             convertFromViewportToContentCoordinates(bounds);
+            invalidate();
             mDrawable.setBounds(bounds);
-            postInvalidate();
+            invalidate();
         }
 
         boolean hasFingerOn(float x, float y) {
@@ -7750,9 +7751,16 @@
             return Rect.intersects(mDrawable.getBounds(), fingerRect);
         }
 
+        void invalidate() {
+            final Rect bounds = mDrawable.getBounds();
+            TextView.this.invalidate(bounds.left, bounds.top,
+                    bounds.right, bounds.bottom);
+        }
+
         void postInvalidate() {
             final Rect bounds = mDrawable.getBounds();
-            TextView.this.postInvalidate(bounds.left, bounds.top, bounds.right, bounds.bottom);
+            TextView.this.postInvalidate(bounds.left, bounds.top,
+                    bounds.right, bounds.bottom);
         }
 
         void postInvalidateDelayed(long delay) {