@@ -149,10 +149,9 @@ extension RunnerTests {
149149 let element : XCUIElement ?
150150 let refreshPoint : CGPoint ?
151151 let prefersFocusedElement : Bool
152- /// The live snapshot-frame vector for the reading session, read once when this target was built
153- /// (#3899). Every snapshot frame the target's reads produce is compared with screen points, so
154- /// every such read carries this vector (`ResolvedTextEntryInput.frameOnScreen`). Nil on a device
155- /// whose app fills the screen, where a snapshot frame is already a screen frame.
152+ /// The content vector of a placed window, read once for the command that built this target and
153+ /// handed to every read it produces, which turns its snapshot frames into screen points (#3899).
154+ /// Nil when the app fills the screen.
156155 let contentTranslation : CGSize ?
157156 let fromTapWitness : Bool
158157 /// The input the first resolved element was. Once bound, resolution refuses any other input.
@@ -187,25 +186,18 @@ extension RunnerTests {
187186 self . postFocusRead = postFocusRead
188187 }
189188
190- /// The target moved to the input a resolution read: its element and identity, and — when the
191- /// read carries a snapshot — a refresh point at that frame's center on the screen (`frameOnScreen`
192- /// plus this target's content vector, #3899). A read with no snapshot keeps the old refresh
193- /// point: its center would come from the live `element.frame`, the read a post-focus handle
194- /// cannot answer without recording a failure (#3060).
189+ /// The target moved to the input a resolution read: its element, a refresh point at its frame's
190+ /// center on the screen, and its identity while the target is unbound. A read with no snapshot has
191+ /// no frame here, so its center cannot come from the live `element.frame` — the read a post-focus
192+ /// handle cannot answer without recording a failure (#3060).
195193 func withResolvedInput ( _ input : ResolvedTextEntryInput ? ) -> TextEntryTarget {
196194 guard let input else {
197195 return self
198196 }
199- let nextRefreshPoint : CGPoint ?
200- if let snapshot = input . snapshot {
201- let frame = input . frameOnScreen
202- nextRefreshPoint = frame . isEmpty ? refreshPoint : CGPoint ( x : frame . midX , y : frame . midY )
203- } else {
204- nextRefreshPoint = refreshPoint
205- }
197+ let frame = input . snapshot == nil ? . zero : input . frameOnScreen
206198 return TextEntryTarget (
207199 element : input . element ,
208- refreshPoint : nextRefreshPoint ,
200+ refreshPoint : frame . isEmpty ? refreshPoint : CGPoint ( x : frame . midX , y : frame . midY ) ,
209201 prefersFocusedElement : prefersFocusedElement ,
210202 contentTranslation : contentTranslation ,
211203 fromTapWitness : fromTapWitness ,
@@ -222,18 +214,14 @@ extension RunnerTests {
222214 /// removed input or a focused Flutter password field (#3060), records an XCTest failure that ends
223215 /// the runner session, the snapshot only throws.
224216 ///
225- /// This type owns the probe-side space of #3899 (ADR 0004). `XCUIElementSnapshot.frame` reports a
226- /// placed window's content in the window's own space, while every point this read feeds — a refresh
227- /// point, a focus tap, a probe match, a readiness retap — is a screen point. So the read carries
228- /// the content vector it was taken under, and `frameOnScreen` is the only frame consumers use: a
229- /// snapshot frame plus the vector, or the live frame when there is no snapshot. Raw frames
230- /// (`snapshot.frame`) are compared only with each other.
217+ /// This type owns the probe-side space of #3899 (ADR 0004): a snapshot frame names a placed
218+ /// window's content space while every point this read feeds is a screen point, so consumers take
219+ /// `frameOnScreen` and compare raw frames only with each other.
231220 struct ResolvedTextEntryInput {
232221 let element : XCUIElement
233222 /// Nil when the element exists but could not be snapshotted.
234223 let snapshot : XCUIElementSnapshot ?
235- /// The live snapshot-frame vector read once for the command that made this read (#3899). Nil
236- /// when the app fills the screen, where a snapshot frame is already a screen frame.
224+ /// The vector of the command that made this read (#3899); nil when the app fills the screen.
237225 let contentTranslation : CGSize ?
238226
239227 private init ( element : XCUIElement , snapshot : XCUIElementSnapshot ? , contentTranslation : CGSize ? ) {
@@ -278,9 +266,9 @@ extension RunnerTests {
278266 return element
279267 }
280268
281- /// The input's box in screen space: the snapshot frame carried by `contentTranslation` to its
282- /// place on the screen, or the live frame when there is no snapshot — the live
283- /// `XCUIElement.frame` already reports a placed window's content in screen space (#3899).
269+ /// The input's box in screen space: the snapshot frame plus `contentTranslation`, or the live
270+ /// frame when there is no snapshot — that property already reports a placed window's content in
271+ /// screen space (#3899).
284272 var frameOnScreen : CGRect {
285273 guard let snapshot else {
286274 return element . frame
@@ -296,8 +284,6 @@ extension RunnerTests {
296284 /// `dispatch` runs, and resolves the target again after that, so a bound target refuses an input
297285 /// that took its place. Each resolution moves the target to the input it read. Every post and every
298286 /// pause between reads goes through `dispatch`; the pause a typing plan takes itself follows a post.
299- /// The reader hands the target's content vector to every read it resolves, so one vector rules the
300- /// command (#3899).
301287 struct TextEntryReader {
302288 private( set) var target : TextEntryTarget
303289 private var lastRead : ResolvedTextEntryInput ?
@@ -672,10 +658,8 @@ extension RunnerTests {
672658 // zero-size one (how a departed handle reads), there is no point to dispatch — an edge-tap
673659 // from a frame the field moved after records a failure or navigates away, the shape
674660 // `clearTextInput`'s comment refuses — so degrade to the caller's point-free delete burst.
675- // The read's snapshot frame names the window's own content space on a placed window, so the
676- // point enters `tapAt` through `frameOnScreen`, which carries the read's content vector (#3899).
677- // A read with no snapshot gets no point at all: `frameOnScreen`'s fallback is the live
678- // `element.frame` read this function exists to avoid.
661+ // A snapshotless read gets no point at all: `frameOnScreen`'s fallback is the live
662+ // `element.frame` read this function exists to avoid (#3060).
679663 guard input . snapshot ? . frame . isEmpty == false else {
680664 return
681665 }
0 commit comments