• Dominic Mazzoni's avatar
    Fix bottleneck in computing win accessibility attributes · 94cd4635
    Dominic Mazzoni authored
    When a node is updated, on the browser side we need to
    go through a three-phase process to update the hypertext
    and other computed Windows attributes.
    
    In some cases we also need to update the parent node's
    attributes too - specifically when the original node is
    text that contributes to its parent's hypertext, or
    in an editable text region where things like spelling
    markers need to propagate.
    
    The previous algorithm was essentially that while updating
    a node, it'd force its parent to update too. This led to
    an inefficiency if you have a very flat document with
    thousands of nodes that are all children of a single
    parent. Every node that's updated triggers updating its
    parent, causing the parent to be updated thousands of
    times redundantly.
    
    The fix is to first precompute a set of all nodes that need
    to be updated, including following parents, and then
    update them all with no more recursion.
    
    This dramatically improves the load time of documents with
    thousands of lines of just flat text and line breaks.
    
    Bug: 921789
    
    Change-Id: I5246ea321fda8a6ddce45221377010a4b5543801
    Reviewed-on: https://chromium-review.googlesource.com/c/1455858
    Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
    Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#629898}
    94cd4635
browser_accessibility_manager.cc 40.4 KB