• auto-submit[bot]'s avatar
    Reverts "Make `TextSpan` hit testing precise." (#140468) · 9003f138
    auto-submit[bot] authored
    Reverts flutter/flutter#139717
    Initiated by: LongCatIsLooong
    This change reverts the following previous change:
    Original Description:
    Fixes https://github.com/flutter/flutter/issues/131435, #104594, #43400
    Needs https://github.com/flutter/engine/pull/48774 (to fix the web test failure).
    
    Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 
    
    The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.
    
    Potential issues:
    
    1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 
    
    This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
    9003f138
Name
Last commit
Last update
..
animated_size.dart Loading commit data...
binding.dart Loading commit data...
box.dart Loading commit data...
custom_layout.dart Loading commit data...
custom_paint.dart Loading commit data...
debug.dart Loading commit data...
debug_overflow_indicator.dart Loading commit data...
decorated_sliver.dart Loading commit data...
editable.dart Loading commit data...
error.dart Loading commit data...
flex.dart Loading commit data...
flow.dart Loading commit data...
image.dart Loading commit data...
layer.dart Loading commit data...
layout_helper.dart Loading commit data...
list_body.dart Loading commit data...
list_wheel_viewport.dart Loading commit data...
mouse_tracker.dart Loading commit data...
object.dart Loading commit data...
paragraph.dart Loading commit data...
performance_overlay.dart Loading commit data...
platform_view.dart Loading commit data...
proxy_box.dart Loading commit data...
proxy_sliver.dart Loading commit data...
rotated_box.dart Loading commit data...
selection.dart Loading commit data...
service_extensions.dart Loading commit data...
shifted_box.dart Loading commit data...
sliver.dart Loading commit data...
sliver_fill.dart Loading commit data...
sliver_fixed_extent_list.dart Loading commit data...
sliver_grid.dart Loading commit data...
sliver_group.dart Loading commit data...
sliver_list.dart Loading commit data...
sliver_multi_box_adaptor.dart Loading commit data...
sliver_padding.dart Loading commit data...
sliver_persistent_header.dart Loading commit data...
stack.dart Loading commit data...
table.dart Loading commit data...
table_border.dart Loading commit data...
texture.dart Loading commit data...
tweens.dart Loading commit data...
view.dart Loading commit data...
viewport.dart Loading commit data...
viewport_offset.dart Loading commit data...
wrap.dart Loading commit data...