Skip to content

Commit 40b7ea4

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Accessibility focus drawing does not take into account view's transformation matrix." into jb-mr1-dev
2 parents 009d541 + 78bd983 commit 40b7ea4

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

core/java/android/view/View.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4906,7 +4906,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
49064906
*
49074907
* @param outRect The output location
49084908
*/
4909-
private void getBoundsOnScreen(Rect outRect) {
4909+
void getBoundsOnScreen(Rect outRect) {
49104910
if (mAttachInfo == null) {
49114911
return;
49124912
}
@@ -8661,7 +8661,9 @@ public final int getHeight() {
86618661
/**
86628662
* Return the visible drawing bounds of your view. Fills in the output
86638663
* rectangle with the values from getScrollX(), getScrollY(),
8664-
* getWidth(), and getHeight().
8664+
* getWidth(), and getHeight(). These bounds do not account for any
8665+
* transformation properties currently set on the view, such as
8666+
* {@link #setScaleX(float)} or {@link #setRotation(float)}.
86658667
*
86668668
* @param outRect The (scrolled) drawing bounds of the view.
86678669
*/

core/java/android/view/ViewRootImpl.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
import android.content.res.Configuration;
3030
import android.content.res.Resources;
3131
import android.graphics.Canvas;
32+
import android.graphics.Matrix;
3233
import android.graphics.Paint;
3334
import android.graphics.PixelFormat;
3435
import android.graphics.Point;
3536
import android.graphics.PointF;
3637
import android.graphics.PorterDuff;
3738
import android.graphics.Rect;
39+
import android.graphics.RectF;
3840
import android.graphics.Region;
3941
import android.graphics.drawable.Drawable;
4042
import android.media.AudioManager;
@@ -2319,24 +2321,14 @@ private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
23192321
mAccessibilityFocusedHost.getAccessibilityNodeProvider();
23202322
Rect bounds = mView.mAttachInfo.mTmpInvalRect;
23212323
if (provider == null) {
2322-
mAccessibilityFocusedHost.getDrawingRect(bounds);
2323-
if (mView instanceof ViewGroup) {
2324-
ViewGroup viewGroup = (ViewGroup) mView;
2325-
try {
2326-
viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds);
2327-
} catch (IllegalArgumentException iae) {
2328-
Log.e(TAG, "Temporary detached view that was neither removed not reattached: "
2329-
+ mAccessibilityFocusedHost);
2330-
return;
2331-
}
2332-
}
2324+
mAccessibilityFocusedHost.getBoundsOnScreen(bounds);
23332325
} else {
23342326
if (mAccessibilityFocusedVirtualView == null) {
23352327
return;
23362328
}
23372329
mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
2338-
bounds.offset(-mAttachInfo.mWindowLeft, -mAttachInfo.mWindowTop);
23392330
}
2331+
bounds.offset(-mAttachInfo.mWindowLeft, -mAttachInfo.mWindowTop);
23402332
drawable.setBounds(bounds);
23412333
drawable.draw(canvas);
23422334
}

0 commit comments

Comments
 (0)