Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upText with <br> and text-align: justify is positioned wrong #11295
Comments
ocerman
commented
May 20, 2016
|
|
|
I can confirm that this bug is still present as of the 2017-04-14 Windows nightly build. I encountered it in the wild, reduced a test case, and then recognized that it was already reported here. |
|
This still happens. |
|
I'm not working on this, but I'm using inline bugs just as a reference point to investigate how the crazy world of layout works. I made some notes when looking at this one, there are just my impression of what the problem is; if these kind of notes aren't helpful just let me know. The problem here is that servo is treating <br> as a text fragment that contains a newline which cause the line scanner to wrap to a new line. This means that servo treats this sample as multiline text when chrome and firefox appear to treat each br as a break in the flow. You can see what chrome is doing when you start to consider the text-align-last property. text-align: justify will justify all lines apart from the last one which will inherit by default the auto(left) alignement from text-align-last. Setting text-align-last to justify chrome will do this
Because each line is independant setting the last line to justify aligns them all. Same with telling chrome to give the br a line height, in servo this will effect all lines of text but chrome it won't as they are not being treated as a set of inline elements. Chrome and firefox appear to differ on how to apply the line height to the rest of the text on that line, chrome doesn't simulating text-align:top type behaviour where firefox treats it like having any other inline element with a line height and sets it to the baseline which will be near center.
I don't really see anywhere in the specs that this behaviour is defined, br is just a special element. As for servo, if mimiching chrome and firefox, I thought that attempting to define this behaviour once it gets to the line scanner would be difficult. Thinking that splitting them earlier into three annonymous blocks would be easier, each with their own inlineflow so line-height and text justify would work. I tried looking at {ib} splits, but there is too much stuff I'm not understanding about layout still so I'm going to go back to just looking around layout code for now. |


