Loading core/java/android/view/View.java +12 −15 Original line number Diff line number Diff line Loading @@ -5795,8 +5795,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * <p>The Rectangle passed into this method should be in the View's content coordinate space. * It should not be affected by which part of the View is currently visible or its scroll * position. * * @param rectangle The rectangle. * @param rectangle The rectangle in the View's content coordinate space * @return Whether any parent scrolled. */ public boolean requestRectangleOnScreen(Rect rectangle) { Loading @@ -5810,11 +5813,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * * <p>The Rectangle passed into this method should be in the View's content coordinate space. * It should not be affected by which part of the View is currently visible or its scroll * position. * <p>When <code>immediate</code> is set to true, scrolling will not be * animated. * * @param rectangle The rectangle. * @param rectangle The rectangle in the View's content coordinate space * @param immediate True to forbid animated scrolling, false otherwise * @return Whether any parent scrolled. */ Loading @@ -5834,24 +5839,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, rectangle.set((int) position.left, (int) position.top, (int) position.right, (int) position.bottom); scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); if (!child.hasIdentityMatrix()) { child.getMatrix().mapRect(position); } position.offset(child.mLeft, child.mTop); scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); if (!(parent instanceof View)) { break; } View parentView = (View) parent; position.offset(-parentView.getScrollX(), -parentView.getScrollY()); // move it from child's content coordinate space to parent's content coordinate space position.offset(child.mLeft - child.getScrollX(), child.mTop -child.getScrollY()); child = parentView; child = (View) parent; parent = child.getParent(); } Loading core/java/android/view/ViewParent.java +2 −2 Original line number Diff line number Diff line Loading @@ -273,7 +273,7 @@ public interface ViewParent { * that: * <ul> * <li>child will be a direct child of this group</li> * <li>rectangle will be in the child's coordinates</li> * <li>rectangle will be in the child's content coordinates</li> * </ul> * * <p>{@link ViewGroup}s overriding this should uphold the contract:</p> Loading core/java/android/view/ViewRootImpl.java +12 −9 Original line number Diff line number Diff line Loading @@ -6729,8 +6729,12 @@ public final class ViewRootImpl implements ViewParent, @Override public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) { if (rectangle == null) { return scrollToRectOrFocus(null, immediate); } rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY()); final boolean scrolled = scrollToRectOrFocus(rectangle, immediate); if (rectangle != null) { mTempRect.set(rectangle); mTempRect.offset(0, -mCurScrollY); mTempRect.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); Loading @@ -6739,7 +6743,6 @@ public final class ViewRootImpl implements ViewParent, } catch (RemoteException re) { /* ignore */ } } return scrolled; } Loading Loading
core/java/android/view/View.java +12 −15 Original line number Diff line number Diff line Loading @@ -5795,8 +5795,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * <p>The Rectangle passed into this method should be in the View's content coordinate space. * It should not be affected by which part of the View is currently visible or its scroll * position. * * @param rectangle The rectangle. * @param rectangle The rectangle in the View's content coordinate space * @return Whether any parent scrolled. */ public boolean requestRectangleOnScreen(Rect rectangle) { Loading @@ -5810,11 +5813,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * * <p>The Rectangle passed into this method should be in the View's content coordinate space. * It should not be affected by which part of the View is currently visible or its scroll * position. * <p>When <code>immediate</code> is set to true, scrolling will not be * animated. * * @param rectangle The rectangle. * @param rectangle The rectangle in the View's content coordinate space * @param immediate True to forbid animated scrolling, false otherwise * @return Whether any parent scrolled. */ Loading @@ -5834,24 +5839,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, rectangle.set((int) position.left, (int) position.top, (int) position.right, (int) position.bottom); scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); if (!child.hasIdentityMatrix()) { child.getMatrix().mapRect(position); } position.offset(child.mLeft, child.mTop); scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); if (!(parent instanceof View)) { break; } View parentView = (View) parent; position.offset(-parentView.getScrollX(), -parentView.getScrollY()); // move it from child's content coordinate space to parent's content coordinate space position.offset(child.mLeft - child.getScrollX(), child.mTop -child.getScrollY()); child = parentView; child = (View) parent; parent = child.getParent(); } Loading
core/java/android/view/ViewParent.java +2 −2 Original line number Diff line number Diff line Loading @@ -273,7 +273,7 @@ public interface ViewParent { * that: * <ul> * <li>child will be a direct child of this group</li> * <li>rectangle will be in the child's coordinates</li> * <li>rectangle will be in the child's content coordinates</li> * </ul> * * <p>{@link ViewGroup}s overriding this should uphold the contract:</p> Loading
core/java/android/view/ViewRootImpl.java +12 −9 Original line number Diff line number Diff line Loading @@ -6729,8 +6729,12 @@ public final class ViewRootImpl implements ViewParent, @Override public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) { if (rectangle == null) { return scrollToRectOrFocus(null, immediate); } rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY()); final boolean scrolled = scrollToRectOrFocus(rectangle, immediate); if (rectangle != null) { mTempRect.set(rectangle); mTempRect.offset(0, -mCurScrollY); mTempRect.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); Loading @@ -6739,7 +6743,6 @@ public final class ViewRootImpl implements ViewParent, } catch (RemoteException re) { /* ignore */ } } return scrolled; } Loading