[Split off from bug 5166] Summary: The selection highlight is partial or offset when the selection consists of "CG-safe" characters only but it is preceded by "need-ATSUI" characters. To reproduce: double-click "dolor" in the testcase. The position of the highlight rectangle depends on the width of all text before the selection, so the ATSUI code path should be used to draw the highlight even if the selected range itself does not require ATSUI. The same applies to drawing text for the drag image when dragging a partial selection. The fix for both is to change shouldUseATSU to always scan from the beginning. This should not affect layout and rendering performance, since run->from is zero anyway in all but the above two cases.
Created attachment 5133 [details] testcase
Created attachment 5134 [details] patch (incl. layout test) Pixel mode required to detect regressions.
Comment on attachment 5134 [details] patch (incl. layout test) The code changes in this patch are identical to those in attachment 4965 [details].
Comment on attachment 5134 [details] patch (incl. layout test) r=me