Skip to content

Commit 9c83ea0

Browse files
Anna Powolnyfacebook-github-bot
authored andcommitted
Remove deprecated visibilityOutputTag
Summary: it was only added as a part of qe. it is not needed anymore. I didnt think it will be so many changes related to it... so im adding Adi for double checking what i even removed :P Reviewed By: adityasharat Differential Revision: D60281653 fbshipit-source-id: 26dc830975939f7ab61eadac176d97a085a0c9b9
1 parent eace0c7 commit 9c83ea0

File tree

7 files changed

+14
-67
lines changed

7 files changed

+14
-67
lines changed

litho-core/src/main/java/com/facebook/litho/CommonProps.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
616616
otherProps.layerType(type, paint)
617617
}
618618

619-
fun visibilityOutputTag(visibilityOutputTag: String?) {
620-
otherProps.visibilityOutputTag(visibilityOutputTag)
621-
}
622-
623619
fun copyLayoutProps(layoutProps: LayoutProps) {
624620
_layoutProps?.copyInto(layoutProps)
625621
}
@@ -694,7 +690,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
694690
@DrawableRes private var stateListAnimatorRes: Int = 0
695691
private var layerType = LayerType.LAYER_TYPE_NOT_SET
696692
private var layerPaint: Paint? = null
697-
private var visibilityOutputTag: String? = null
698693

699694
private var systemGestureExclusionZones: MutableList<(Rect) -> Rect>? = null
700695

@@ -811,10 +806,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
811806
layerPaint = paint
812807
}
813808

814-
fun visibilityOutputTag(visibilityOutputTag: String?) {
815-
this.visibilityOutputTag = visibilityOutputTag
816-
}
817-
818809
fun addSystemGestureExclusionZone(exclusion: (Rect) -> Rect) {
819810
(systemGestureExclusionZones
820811
?: ArrayList<(Rect) -> Rect>().also { systemGestureExclusionZones = it })
@@ -887,7 +878,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
887878
node.stateListAnimatorRes(stateListAnimatorRes)
888879
}
889880
node.layerType(layerType, layerPaint)
890-
node.visibilityOutputTag(visibilityOutputTag)
891881

892882
systemGestureExclusionZones?.let { node.addSystemGestureExclusionZones(it) }
893883
}

litho-core/src/main/java/com/facebook/litho/Component.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,12 +2294,6 @@ public T tooltipText(@Nullable String tooltipText) {
22942294
return getThis();
22952295
}
22962296

2297-
@Deprecated
2298-
public T visibilityOutputTag(@Nullable String visibilityOutputTag) {
2299-
mComponent.getOrCreateCommonProps().visibilityOutputTag(visibilityOutputTag);
2300-
return getThis();
2301-
}
2302-
23032297
private @Nullable Component getOwner() {
23042298
return mContext.getComponentScope();
23052299
}

litho-core/src/main/java/com/facebook/litho/LithoNode.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ open class LithoNode : Node<LithoLayoutContext>, Cloneable {
191191
var layerType: Int = LayerType.LAYER_TYPE_NOT_SET
192192
internal set
193193

194-
var visibilityOutputTag: String? = null
195-
internal set
196-
197194
var importantForAccessibility: Int = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO
198195
internal set
199196

@@ -571,10 +568,6 @@ open class LithoNode : Node<LithoLayoutContext>, Cloneable {
571568
}
572569
}
573570

574-
fun visibilityOutputTag(visibilityOutputTag: String?) {
575-
this.visibilityOutputTag = visibilityOutputTag
576-
}
577-
578571
fun fullImpressionHandler(fullImpressionHandler: EventHandler<FullImpressionVisibleEvent>?) {
579572
privateFlags = privateFlags or PFLAG_FULL_IMPRESSION_HANDLER_IS_SET
580573
this.fullImpressionHandler =

litho-core/src/main/java/com/facebook/litho/LithoReducer.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ internal object LithoReducer {
337337
renderTreeNode?.renderUnit?.id ?: 0,
338338
node.visibleHeightRatio,
339339
node.visibleWidthRatio,
340-
node.visibilityOutputTag,
341340
visibleHandler,
342341
invisibleHandler,
343342
focusedHandler,

litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityBoundsTransformer.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,4 @@ interface VisibilityBoundsTransformer {
2525
fun getTransformedLocalVisibleRect(host: ViewGroup): Rect?
2626

2727
fun getViewportRect(view: View): Rect
28-
29-
fun shouldUseTransformedVisibleRect(visibilityOutput: VisibilityOutput): Boolean
3028
}

litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityMountExtension.java

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,11 @@ private static void processVisibilityOutputsNonInc(
245245

246246
final @Nullable VisibilityBoundsTransformer transformer =
247247
extensionState.getState().mVisibilityBoundsTransformer;
248-
@Nullable Rect transformedLocalVisibleRect = null;
249248
if (transformer != null) {
250-
transformedLocalVisibleRect =
251-
transformer.getTransformedLocalVisibleRect(extensionState.getRootHost());
249+
Rect transformed = transformer.getTransformedLocalVisibleRect(extensionState.getRootHost());
250+
if (transformed != null) {
251+
localVisibleRect = transformed;
252+
}
252253
}
253254

254255
final boolean isTracing = RenderCoreSystrace.isTracing();
@@ -267,14 +268,9 @@ private static void processVisibilityOutputsNonInc(
267268

268269
final Rect visibilityOutputBounds = visibilityOutput.getBounds();
269270

270-
final boolean shouldUseTransformedVisibleRect =
271-
transformer != null && transformer.shouldUseTransformedVisibleRect(visibilityOutput);
272271
final boolean boundsIntersect =
273-
intersection.setIntersect(
274-
visibilityOutputBounds,
275-
shouldUseTransformedVisibleRect && transformedLocalVisibleRect != null
276-
? transformedLocalVisibleRect
277-
: localVisibleRect);
272+
intersection.setIntersect(visibilityOutputBounds, localVisibleRect);
273+
278274
final boolean isFullyVisible =
279275
boundsIntersect && intersection.equals(visibilityOutputBounds);
280276
final String visibilityOutputId = visibilityOutput.getId();
@@ -390,27 +386,10 @@ private static void processVisibilityOutputsNonInc(
390386
}
391387
}
392388

393-
Rect transformedViewportRect = null;
394-
if (focusedHandler != null
395-
|| unfocusedHandler != null
396-
|| visibilityChangedHandler != null) {
397-
if (shouldUseTransformedVisibleRect && transformer != null) {
398-
final Host host = getRootHost(extensionState);
399-
if (host != null && (host.getParent() instanceof View)) {
400-
final View parent = (View) host.getParent();
401-
transformedViewportRect = transformer.getViewportRect(parent);
402-
}
403-
}
404-
}
405-
406389
// Check if the component has entered or exited the focused range.
407390
if (focusedHandler != null || unfocusedHandler != null) {
408391
if (isInFocusedRange(
409-
extensionState,
410-
visibilityOutputBounds,
411-
intersection,
412-
shouldUseTransformedVisibleRect,
413-
transformedViewportRect)) {
392+
extensionState, visibilityOutputBounds, intersection, transformer)) {
414393
if (!visibilityItem.isInFocusedRange()) {
415394
visibilityItem.setFocusedRange(true);
416395
if (focusedHandler != null) {
@@ -441,10 +420,6 @@ private static void processVisibilityOutputsNonInc(
441420
final int visibleHeight = getVisibleHeight(intersection);
442421
int rootHostViewWidth = getRootHostViewWidth(extensionState);
443422
int rootHostViewHeight = getRootHostViewHeight(extensionState);
444-
if (shouldUseTransformedVisibleRect && transformedViewportRect != null) {
445-
rootHostViewWidth = transformedViewportRect.width();
446-
rootHostViewHeight = transformedViewportRect.height();
447-
}
448423

449424
VisibilityUtils.dispatchOnVisibilityChanged(
450425
visibilityChangedHandler,
@@ -533,8 +508,7 @@ private static boolean isInFocusedRange(
533508
ExtensionState<VisibilityMountExtensionState> extensionState,
534509
Rect componentBounds,
535510
Rect componentVisibleBounds,
536-
boolean shouldUseTransformedVisibleRect,
537-
@Nullable Rect transformedViewportRect) {
511+
@Nullable VisibilityBoundsTransformer transformer) {
538512
final Host host = getRootHost(extensionState);
539513
if (host == null) {
540514
return false;
@@ -547,10 +521,12 @@ private static boolean isInFocusedRange(
547521
return false;
548522
}
549523

550-
int halfViewportArea = parent.getWidth() * parent.getHeight() / 2;
551-
if (shouldUseTransformedVisibleRect && transformedViewportRect != null) {
552-
halfViewportArea = transformedViewportRect.width() * transformedViewportRect.height() / 2;
553-
}
524+
int halfViewportArea =
525+
(transformer != null)
526+
? transformer.getViewportRect(parent).width()
527+
* transformer.getViewportRect(parent).height()
528+
/ 2
529+
: parent.getWidth() * parent.getHeight() / 2;
554530

555531
final int totalComponentArea = computeRectArea(componentBounds);
556532
final int visibleComponentArea = computeRectArea(componentVisibleBounds);

litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityOutput.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class VisibilityOutput(
3737
@JvmField val renderUnitId: Long,
3838
val visibleHeightRatio: Float,
3939
val visibleWidthRatio: Float,
40-
val tag: String?,
4140
val visibleEventHandler: Function<Void?>?,
4241
val invisibleEventHandler: Function<Void?>?,
4342
val focusedEventHandler: Function<Void?>?,
@@ -54,7 +53,6 @@ class VisibilityOutput(
5453
bounds: Rect,
5554
visibleHeightRatio: Float,
5655
visibleWidthRatio: Float,
57-
tag: String?,
5856
visibleEventHandler: Function<Void?>?,
5957
invisibleEventHandler: Function<Void?>?,
6058
focusedEventHandler: Function<Void?>?,
@@ -69,7 +67,6 @@ class VisibilityOutput(
6967
0L,
7068
visibleHeightRatio,
7169
visibleWidthRatio,
72-
tag,
7370
visibleEventHandler,
7471
invisibleEventHandler,
7572
focusedEventHandler,

0 commit comments

Comments
 (0)