Speed up computation of inline text box bounding boxes.
In the layout tree, a LayoutText corresponds to a static text node in HTML, which can span more than one line. Each line of text is represented by an InlineTextBox. In the accessibility tree, we have an AXLayoutObject for the LayoutText, and an AXInlineTextBox for the InlineTextBox. The coordinates of the AXInlineTextBox need to be expressed relative to its parent object, just like everything in the accessibility tree. It turns out that we need the local bounding box of the parent object (the LayoutText) to compute this. However, this leads to an inefficiency, because when you have a very large LayoutText (as an example, a TEXTAREA element with thousands of lines of text), each AXInlineTextBox keeps querying its parent LayoutText for its bounds, but the LayoutText iterates over all of its InlineTextBox children to compute its bounds! This leads to n^2 complexity where n is the number of lines in the LayoutText. The solution is just to cache the bounds of the LayoutText, so it only needs to be computed once. Bug: 875344 Change-Id: I97578ec0eadc597f962b142fb074e6929e834802 Reviewed-on: https://chromium-review.googlesource.com/1180647Reviewed-by:Aaron Leventhal <aleventhal@chromium.org> Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org> Cr-Commit-Position: refs/heads/master@{#584528}
Showing
Please register or sign in to comment