Improve removeClippedSubviews for overflowing views

Summary:
Historically, removeClippedSubviews for Nodes would not clip views
that overflowed their parent. This patch changes that, so that Nodes can
properly clip views when they are off screen (even if they have descendants
that overflow the bounds of their parent).

This is done by calculating a set of offsets from the actual width and
height of the view, and using those in the clipping calculations.

Reviewed By: sriramramani

Differential Revision: D3409859
This commit is contained in:
Ahmed El-Helw
2016-06-09 13:45:14 -07:00
parent 4bb33f93cd
commit e1ece03593
5 changed files with 88 additions and 29 deletions

View File

@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
import java.util.Collection;
import android.graphics.Rect;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
@@ -67,10 +68,10 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
@Nullable DrawCommand[] drawCommands,
@Nullable AttachDetachListener[] listeners,
@Nullable NodeRegion[] nodeRegions,
boolean hasOverflowingElements) {
Rect logicalAdjustment) {
FlatViewGroup view = (FlatViewGroup) resolveView(reactTag);
if (drawCommands != null) {
view.mountDrawCommands(drawCommands, hasOverflowingElements);
view.mountDrawCommands(drawCommands, logicalAdjustment);
}
if (listeners != null) {
view.mountAttachDetachListeners(listeners);