Merge "Ensure that ViewGroup.getChildVisibleRect(...) is recursive." into nyc-dev

This commit is contained in:
Abodunrinwa Toki
2016-05-16 09:37:54 +00:00
committed by Android (Google) Code Review

View File

@@ -5482,6 +5482,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
} }
/** /**
* @param forceParentCheck true to guarantee that this call will propagate to all ancestors,
* false otherwise
*
* @hide * @hide
*/ */
public boolean getChildVisibleRect( public boolean getChildVisibleRect(
@@ -5541,7 +5544,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
(int) Math.ceil(rect.right), (int) Math.ceil(rect.bottom)); (int) Math.ceil(rect.right), (int) Math.ceil(rect.bottom));
if ((forceParentCheck || rectIsVisible) && mParent != null) { if ((forceParentCheck || rectIsVisible) && mParent != null) {
rectIsVisible = mParent.getChildVisibleRect(this, r, offset); if (mParent instanceof ViewGroup) {
rectIsVisible = ((ViewGroup) mParent)
.getChildVisibleRect(this, r, offset, forceParentCheck);
} else {
rectIsVisible = mParent.getChildVisibleRect(this, r, offset);
}
} }
return rectIsVisible; return rectIsVisible;
} }