Created attachment 596416 [details]
1. Load the testcase.
2. Widen the window.
Result: The text stays where it is, so it's no longer aligned to the right.
Expected: The text should move in order to stay at the right side of the window.
nsBlockFrame::PrepareResizeReflow needs to be adjusted for text-align-last, probably?
Created attachment 596920 [details] [diff] [review]
Created attachment 596921 [details] [diff] [review]
Created attachment 596923 [details] [diff] [review]
Comment on attachment 596921 [details] [diff] [review]
+bool static inline IsAlignedLeft(const PRUint8 aAlignment,
+ const PRUint8 aDirection,
+ const PRUint8 aUnicodeBidi)
+ return (NS_STYLE_TEXT_ALIGN_LEFT == aAlignment ||
+ (NS_STYLE_TEXT_ALIGN_DEFAULT == aAlignment &&
+ NS_STYLE_DIRECTION_LTR == aDirection &&
+ !(NS_STYLE_UNICODE_BIDI_PLAINTEXT & aUnicodeBidi)) ||
+ (NS_STYLE_TEXT_ALIGN_END == aAlignment &&
+ NS_STYLE_DIRECTION_RTL == aDirection));
Two issues here:
(1) You probably need to check unicode-bidi: plaintext for the
rtl + end case as well, no? (Can we have a test for that too?)
(Yes, you're just moving an existing bug.)
(2) You should probably add a comment above the function that it's
a test for whether lines are *certain* to be aligned left so that
we can make resizing optimizations.
* put the result of GetStyleTextReset() in a variable at the top
(for the 2 uses)
* inside the interesting for loop, put |isLastLine| in a variable
since it can be used twice (once negated) and allow removing a comment
"not the last line"
r=dbaron with that
Comment on attachment 596923 [details] [diff] [review]
The tests look fine... except that I'm really curious why they're fuzzy? What part is fuzzy, and is it fixable? I really wouldn't have expected that... and I don't think you should need it in this case.
(I might be open to changing to review+ if there's a good reason.)
Created attachment 597849 [details] [diff] [review]
You might want to give this another quick look: As well as addressing your comments I've added a condition !line->IsLineWrapped() for the last line test in the for loop to catch lines that are not last lines but are followed by a forced line break, so text-align-last applies to them.
Created attachment 597852 [details] [diff] [review]
Adding letter-spacing makes the reftests pass without fuzz.
I still don't really know why the reftests needed fuzz before: they were showing differences in anti-aliasing pixels between the letters, similar to what we get when the test renders text in separate operations and the reftest renders it in one go, e.g. bug 696671 and several others. Nothing like that happens here though, my only guess is that it might be some kind of effect from rounding when calculating 50% of the width.
Comment on attachment 597852 [details] [diff] [review]
Well, r=dbaron, I guess, though the fuzz issue might be worth investigating sometime.
Comment on attachment 597849 [details] [diff] [review]
r=dbaron. Might also be worth testing the forced-break case. And don't forget to remove the try syntax from the commit message.