Skip to content

Commit 82a2730

Browse files
mdvaccameta-codesync[bot]
authored andcommitted
Add KDoc documentation to ComputedBorderRadius.kt
Summary: Enhanced KDoc documentation for ComputedBorderRadius.kt: - ComputedBorderRadiusProp enum: Expanded documentation and documented each value - ComputedBorderRadius data class: Enhanced class documentation with property descriptions - hasRoundedBorders(): Added method documentation - isUniform(): Added method documentation - get(): Added method documentation - Secondary constructor: Added documentation changelog: [internal] internal bypass-github-export-checks Documentation only Reviewed By: javache Differential Revision: D91555054 fbshipit-source-id: 5e13dc2773babbc5ac2deda62d8e86c913e6554b
1 parent 4b67bda commit 82a2730

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,47 @@
77

88
package com.facebook.react.uimanager.style
99

10-
/** Represents the collection of possible computed border radius style properties. */
10+
/**
11+
* Enum representing the computed border radius properties for each physical corner.
12+
*
13+
* Unlike [BorderRadiusProp] which includes logical properties, this enum only contains the four
14+
* physical corners after layout direction resolution.
15+
*/
1116
public enum class ComputedBorderRadiusProp {
17+
/** The computed border radius for the top-left corner. */
1218
COMPUTED_BORDER_TOP_LEFT_RADIUS,
19+
/** The computed border radius for the top-right corner. */
1320
COMPUTED_BORDER_TOP_RIGHT_RADIUS,
21+
/** The computed border radius for the bottom-right corner. */
1422
COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS,
23+
/** The computed border radius for the bottom-left corner. */
1524
COMPUTED_BORDER_BOTTOM_LEFT_RADIUS,
1625
}
1726

18-
/** Physical edge lengths (in DIPs) for a border-radius. */
27+
/**
28+
* Represents the resolved border radius values for all four physical corners.
29+
*
30+
* This data class contains the final computed [CornerRadii] values (in DIPs) after resolving
31+
* logical properties based on layout direction and ensuring no corner overlap per CSS spec.
32+
*
33+
* @property topLeft The radii for the top-left corner
34+
* @property topRight The radii for the top-right corner
35+
* @property bottomLeft The radii for the bottom-left corner
36+
* @property bottomRight The radii for the bottom-right corner
37+
* @see BorderRadiusStyle
38+
* @see CornerRadii
39+
*/
1940
public data class ComputedBorderRadius(
2041
val topLeft: CornerRadii,
2142
val topRight: CornerRadii,
2243
val bottomLeft: CornerRadii,
2344
val bottomRight: CornerRadii,
2445
) {
46+
/**
47+
* Checks if any corner has a non-zero border radius.
48+
*
49+
* @return true if at least one corner has a positive radius
50+
*/
2551
public fun hasRoundedBorders(): Boolean {
2652
return topLeft.horizontal > 0f ||
2753
topLeft.vertical > 0f ||
@@ -32,10 +58,21 @@ public data class ComputedBorderRadius(
3258
bottomRight.horizontal > 0f
3359
}
3460

61+
/**
62+
* Checks if all corners have the same radius values.
63+
*
64+
* @return true if all corners are equal
65+
*/
3566
public fun isUniform(): Boolean {
3667
return topLeft == topRight && topLeft == bottomLeft && topLeft == bottomRight
3768
}
3869

70+
/**
71+
* Gets the corner radii for a specific computed border radius property.
72+
*
73+
* @param property The computed border radius property
74+
* @return The CornerRadii for the specified corner
75+
*/
3976
public fun get(property: ComputedBorderRadiusProp): CornerRadii {
4077
return when (property) {
4178
ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_LEFT_RADIUS -> topLeft
@@ -45,6 +82,7 @@ public data class ComputedBorderRadius(
4582
}
4683
}
4784

85+
/** Creates a ComputedBorderRadius with all corners set to zero radius. */
4886
public constructor() :
4987
this(CornerRadii(0f, 0f), CornerRadii(0f, 0f), CornerRadii(0f, 0f), CornerRadii(0f, 0f))
5088
}

0 commit comments

Comments
 (0)