Summary: Embedding levels aren't adjusted according to the direction and unicode-bidi properties of an inline container if its first child is an inline container. Similarly, embedding levels aren't reset after an inline container whose last child is an inline container -- in both cases, bidiNext() doesn't call embed(). To reproduce: open the attached testcase in Safari. Expected: all lines to read "ABCDEFGHI" (some letters may appear in italics. Firefox renders as expected. Actual: the letters are in the wrong order on the 2nd, 3rd and 5th lines.
Created attachment 4983 [details] testcase
Created attachment 4989 [details] Adjust embedding at inline containers' boundaries instead of inside
Comment on attachment 4989 [details] Adjust embedding at inline containers' boundaries instead of inside r=me. I even understood it!