Merge "Fix getChildVisibleRect to clip correctly." into lmp-mr1-dev
This commit is contained in:
@@ -5045,14 +5045,30 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
offset.y += dy;
|
offset.y += dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect.intersect(0, 0, mRight - mLeft, mBottom - mTop)) {
|
boolean rectIsVisible = true;
|
||||||
if (mParent == null) return true;
|
if (mParent instanceof ViewGroup && ((ViewGroup)mParent).getClipChildren()) {
|
||||||
r.set((int) (rect.left + 0.5f), (int) (rect.top + 0.5f),
|
// clipChildren clips to the child's bounds
|
||||||
(int) (rect.right + 0.5f), (int) (rect.bottom + 0.5f));
|
rectIsVisible = rect.intersect(0, 0, mRight - mLeft, mBottom - mTop);
|
||||||
return mParent.getChildVisibleRect(this, r, offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
if (rectIsVisible && (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK) {
|
||||||
|
// Clip to padding
|
||||||
|
rectIsVisible = rect.intersect(mPaddingLeft, mPaddingTop,
|
||||||
|
mRight - mLeft - mPaddingLeft - mPaddingRight,
|
||||||
|
mBottom - mTop - mPaddingTop - mPaddingBottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rectIsVisible && mClipBounds != null) {
|
||||||
|
// Clip to clipBounds
|
||||||
|
rectIsVisible = rect.intersect(mClipBounds.left, mClipBounds.top, mClipBounds.right,
|
||||||
|
mClipBounds.bottom);
|
||||||
|
}
|
||||||
|
r.set((int) (rect.left + 0.5f), (int) (rect.top + 0.5f), (int) (rect.right + 0.5f),
|
||||||
|
(int) (rect.bottom + 0.5f));
|
||||||
|
if (rectIsVisible && mParent != null) {
|
||||||
|
rectIsVisible = mParent.getChildVisibleRect(this, r, offset);
|
||||||
|
}
|
||||||
|
return rectIsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user