From a3db866056adb01820bbd6389d20fc550be87eb3 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Tue, 19 Jul 2011 10:36:05 -0700 Subject: [PATCH] Don't constrain invalidation rect when not clipping children View.setClipChidlren(false) allows children to draw outside of their containers. But logic in ViewGroup.invalidateChildInParent() constrains the invalidation rectangle to the bounds of the parent, making the flag useless in some situations. Avoid intersecting the dirty rect with the parent bounds when the parent is set to not clip its children. Change-Id: Icc485b539758c96da0bd62ef57974a1bcb94f866 --- core/java/android/view/ViewGroup.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index cb3e9c684cbdc..c333c0af2c363 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3960,7 +3960,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final int left = mLeft; final int top = mTop; - if (dirty.intersect(0, 0, mRight - left, mBottom - top) || + if ((mGroupFlags & FLAG_CLIP_CHILDREN) != FLAG_CLIP_CHILDREN || + dirty.intersect(0, 0, mRight - left, mBottom - top) || (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) { mPrivateFlags &= ~DRAWING_CACHE_VALID; @@ -3978,8 +3979,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager location[CHILD_LEFT_INDEX] = mLeft; location[CHILD_TOP_INDEX] = mTop; - - dirty.set(0, 0, mRight - mLeft, mBottom - mTop); + if ((mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN) { + dirty.set(0, 0, mRight - mLeft, mBottom - mTop); + } else { + // in case the dirty rect extends outside the bounds of this container + dirty.union(0, 0, mRight - mLeft, mBottom - mTop); + } if (mLayerType != LAYER_TYPE_NONE) { mLocalDirtyRect.union(dirty);