When the embedding direction is LTR, the sequence R neutrals ET neutrals L should resolve to R L L L L but in TOT it resolves to R R L L L. This is the first example In the attached testcase: R WS ON WS ON WS ET ET WS L resolves to R R R R R R L L L L. Firefox handles it correctly. This happens due to the special way ETs are treated just in case they end up prefixing an EN. The idea in the patch for bug 3733 was to use bidi.eor to mark the last position before the first ET (need to know this position when deciding what goes with the EN), but for the other cases it introduced an eor in the middle of the neutrals, guessing that the neutrals will need to end up as R (setting bidi.status.eor to R). This guess turns out to be wrong in the first example in the testcase. While it might be possible to fix this by not guessing at all (setting bidi.status.eor to ON), this will require special treatment of this case (status.eor==ON) in all places that check status.eor (currently there are asserts that status.eor!=ON). A simpler and clearer solution is to add a bidi.lastET member for the exclusive use of the ET and EN-after-ET cases.
Created attachment 5003 [details] testcase
Created attachment 5007 [details] Keep track of the last position before the current run of ETs directly This even shortens bidi.cpp by a few lines!
Comment on attachment 5007 [details] Keep track of the last position before the current run of ETs directly Not that I fully understand this, but r=me.