• Dominic Mazzoni's avatar
    Actually serialize AXPosition when passing to AXTextMarker. · 7c972dfe
    Dominic Mazzoni authored
    Many Mac accessibility API use an AXTextMarker, which is an
    opaque application-specific struct representing a position in
    a document. Chrome implements these using AXPosition
    (in particular a subclass BrowserAccessibilityPosition).
    
    The code used the word "serialized" but it was actually
    copying the raw bytes from a BrowserAccessibilityPosition
    and then constructing a new C++ object with these bytes
    later, which isn't defined behavior and may be causing
    problems on macOS 10.15.
    
    Instead, implement actual Serialize and Unserialize methods
    on AXPosition and make use of those instead.
    
    Tested with a unit test of AXPosition (based on the existing
    test of Clone) and by manually manipulating some editable
    text in Chrome with VoiceOver running, to ensure the code is
    working correctly.
    
    Bug: 998896
    Change-Id: Ifb64b19ebdc96a8d36522456c77bca23cb58d552
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776901
    Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
    Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#691970}
    7c972dfe
ax_position.h 117 KB