@@ -8,7 +8,6 @@ import androidx.compose.ui.graphics.isUnspecified
8
8
import androidx.compose.ui.graphics.toArgb
9
9
import androidx.compose.ui.layout.LayoutCoordinates
10
10
import androidx.compose.ui.layout.findRootCoordinates
11
- import androidx.compose.ui.layout.positionInWindow
12
11
import androidx.compose.ui.node.LayoutNode
13
12
import androidx.compose.ui.node.Owner
14
13
import androidx.compose.ui.semantics.SemanticsActions
@@ -87,12 +86,13 @@ internal object ComposeViewHierarchyNode {
87
86
(semantics == null || ! semantics.contains(SemanticsProperties .InvisibleToUser )) &&
88
87
visibleRect.height() > 0 && visibleRect.width() > 0
89
88
val isEditable = semantics?.contains(SemanticsActions .SetText ) == true
90
- val positionInWindow = node.coordinates.positionInWindow()
91
89
return when {
92
90
semantics?.contains(SemanticsProperties .Text ) == true || isEditable -> {
93
91
val shouldMask = isVisible && node.shouldMask(isImage = false , options)
94
92
95
93
parent?.setImportantForCaptureToAncestors(true )
94
+ // TODO: if we get reports that it's slow, we can drop this, and just mask
95
+ // TODO: the whole view instead of per-line
96
96
val textLayoutResults = mutableListOf<TextLayoutResult >()
97
97
semantics?.getOrNull(SemanticsActions .GetTextLayoutResult )
98
98
?.action
@@ -108,8 +108,8 @@ internal object ComposeViewHierarchyNode {
108
108
TextViewHierarchyNode (
109
109
layout = if (textLayoutResults.isNotEmpty() && ! isEditable) ComposeTextLayout (textLayoutResults.first(), hasFillModifier) else null ,
110
110
dominantColor = textColor?.toArgb()?.toOpaque(),
111
- x = positionInWindow.x ,
112
- y = positionInWindow.y ,
111
+ x = visibleRect.left.toFloat() ,
112
+ y = visibleRect.top.toFloat() ,
113
113
width = node.width,
114
114
height = node.height,
115
115
elevation = (parent?.elevation ? : 0f ),
@@ -128,8 +128,8 @@ internal object ComposeViewHierarchyNode {
128
128
129
129
parent?.setImportantForCaptureToAncestors(true )
130
130
ImageViewHierarchyNode (
131
- x = positionInWindow.x ,
132
- y = positionInWindow.y ,
131
+ x = visibleRect.left.toFloat() ,
132
+ y = visibleRect.top.toFloat() ,
133
133
width = node.width,
134
134
height = node.height,
135
135
elevation = (parent?.elevation ? : 0f ),
@@ -147,8 +147,8 @@ internal object ComposeViewHierarchyNode {
147
147
// TODO: traverse the ViewHierarchyNode here again. For now we can recommend
148
148
// TODO: using custom modifiers to obscure the entire node if it's sensitive
149
149
GenericViewHierarchyNode (
150
- x = positionInWindow.x ,
151
- y = positionInWindow.y ,
150
+ x = visibleRect.left.toFloat() ,
151
+ y = visibleRect.top.toFloat() ,
152
152
width = node.width,
153
153
height = node.height,
154
154
elevation = (parent?.elevation ? : 0f ),
0 commit comments