summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2014-12-01 22:18:58 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-12-01 22:18:58 +0000
commitb08a028da62895ae646f129c15c61e8dda955175 (patch)
tree0488a3ebc89079c0b12ad1d05135116964d088a9
parent97f656899924d5494497b5e88d854f0657e4d54d (diff)
parent23dc05634d7bc4a1d436b27dc4cd8bc518834e49 (diff)
am 23dc0563: am e6bd61d5: Merge "Fix visible rect computation for views with padding" into lmp-mr1-dev
* commit '23dc05634d7bc4a1d436b27dc4cd8bc518834e49': Fix visible rect computation for views with padding
-rw-r--r--core/java/android/view/ViewGroup.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index abf23fc8bcb5..512ea999e58b 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5033,8 +5033,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
child.getMatrix().mapRect(rect);
}
- int dx = child.mLeft - mScrollX;
- int dy = child.mTop - mScrollY;
+ final int dx = child.mLeft - mScrollX;
+ final int dy = child.mTop - mScrollY;
rect.offset(dx, dy);
@@ -5052,21 +5052,23 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
offset.y += dy;
}
+ final int width = mRight - mLeft;
+ final int height = mBottom - mTop;
+
boolean rectIsVisible = true;
if (mParent instanceof ViewGroup && ((ViewGroup)mParent).getClipChildren()) {
- // clipChildren clips to the child's bounds
- rectIsVisible = rect.intersect(0, 0, mRight - mLeft, mBottom - mTop);
+ // Clip to bounds.
+ rectIsVisible = rect.intersect(0, 0, width, height);
}
if (rectIsVisible && (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK) {
- // Clip to padding
+ // Clip to padding.
rectIsVisible = rect.intersect(mPaddingLeft, mPaddingTop,
- mRight - mLeft - mPaddingLeft - mPaddingRight,
- mBottom - mTop - mPaddingTop - mPaddingBottom);
+ width - mPaddingRight, height - mPaddingBottom);
}
if (rectIsVisible && mClipBounds != null) {
- // Clip to clipBounds
+ // Clip to clipBounds.
rectIsVisible = rect.intersect(mClipBounds.left, mClipBounds.top, mClipBounds.right,
mClipBounds.bottom);
}