• Benjamin Beaudry's avatar
    Fix wrong position created by AXPosition::ToPositionWithAffinity() · 786a9194
    Benjamin Beaudry authored
    When calling AXPosition::ToPositionWithAffinity() on a position with a
    |container_object_| of type AXInlineTextBox, the position returned is
    always in the parent node, the StaticText object. Think of it as
    a modification from a relative position to an absolute position, based
    in the StaticText object.
    
    However, when an InlineTextBox object has siblings (i.e. the parent
    node has multiple InlineTextBox children), the position returned is
    only valid for the first non-empty child. This bug was due to the fact
    that we wrongfully assumed that the text offset in the child object
    would be the same as the text offset in the parent position. This is
    only true for the first non-empty child.
    
    This CL introduces a fix for this bug. Instead of creating a position
    in the parent node at the exact same offset, we add to it the sum of
    the previous siblings MaxTextOffset().
    It also adds a unit test for this case.
    
    Bug: 928948
    Change-Id: I1b52c7506e726956bca8b2d41d5a33bee3a84597
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1846563Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
    Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
    Commit-Queue: Benjamin Beaudry <benjamin.beaudry@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#707817}
    786a9194
ax_object.h 48 KB