• 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
..
annotated_region_test.dart Loading commit data...
aspect_ratio_test.dart Loading commit data...
baseline_test.dart Loading commit data...
binding_pipeline_manifold_init_test.dart Loading commit data...
binding_pipeline_manifold_test.dart Loading commit data...
binding_test.dart Loading commit data...
box_constraints_test.dart Loading commit data...
box_test.dart Loading commit data...
cached_intrinsics_test.dart Loading commit data...
constraints_test.dart Loading commit data...
debug_overflow_indicator_test.dart Loading commit data...
debug_test.dart Loading commit data...
dynamic_intrinsics_test.dart Loading commit data...
editable_gesture_test.dart Loading commit data...
editable_test.dart Loading commit data...
error_test.dart Loading commit data...
first_frame_test.dart Loading commit data...
flex_overflow_test.dart Loading commit data...
flex_test.dart Loading commit data...
image_test.dart Loading commit data...
independent_layout_test.dart Loading commit data...
intrinsic_width_test.dart Loading commit data...
layer_annotations_test.dart Loading commit data...
layers_test.dart Loading commit data...
limited_box_test.dart Loading commit data...
localized_fonts_test.dart Loading commit data...
memory_allocations_test.dart Loading commit data...
mouse_tracker_cursor_test.dart Loading commit data...
mouse_tracker_test.dart Loading commit data...
mouse_tracker_test_utils.dart Loading commit data...
multi_view_binding_test.dart Loading commit data...
mutations_test.dart Loading commit data...
non_normalized_constraints_test.dart Loading commit data...
object_paint_dispose_test.dart Loading commit data...
object_test.dart Loading commit data...
offstage_test.dart Loading commit data...
overflow_test.dart Loading commit data...
paint_error_test.dart Loading commit data...
painting_context_test.dart Loading commit data...
paragraph_intrinsics_test.dart Loading commit data...
paragraph_test.dart Loading commit data...
pipeline_owner_tree_test.dart Loading commit data...
platform_view_test.dart Loading commit data...
positioned_box_test.dart Loading commit data...
proxy_box_test.dart Loading commit data...
proxy_getters_and_setters_test.dart Loading commit data...
proxy_sliver_test.dart Loading commit data...
reattach_test.dart Loading commit data...
relative_rect_test.dart Loading commit data...
relayout_boundary_test.dart Loading commit data...
rendering_tester.dart Loading commit data...
repaint_boundary_2_test.dart Loading commit data...
repaint_boundary_test.dart Loading commit data...
selection_test.dart Loading commit data...
semantics_and_children_test.dart Loading commit data...
simple_semantics_test.dart Loading commit data...
size_test.dart Loading commit data...
sliver_cache_test.dart Loading commit data...
sliver_fixed_extent_layout_test.dart Loading commit data...
sliver_persistent_header_test.dart Loading commit data...
sliver_utils.dart Loading commit data...
slivers_block_test.dart Loading commit data...
slivers_helpers_test.dart Loading commit data...
slivers_layout_test.dart Loading commit data...
slivers_test.dart Loading commit data...
stack_test.dart Loading commit data...
table_border_test.dart Loading commit data...
table_test.dart Loading commit data...
transform_test.dart Loading commit data...
view_chrome_style_test.dart Loading commit data...
view_test.dart Loading commit data...
viewport_caching_test.dart Loading commit data...
viewport_test.dart Loading commit data...
wrap_test.dart Loading commit data...