Re: Comments on 'line-height'-related tests for Quirks Mode

(12/11/23 17:25), Simon Pieters wrote:
>>   # span { padding:1px 0 }
>>   # <div id=test><span></span></div>
>>   # <div id=ref></div><div id=s_ref></div>
>>
>> This is a bit puzzling, in particular about "<div id=s_ref></div>". I
>> think what this test runs into is this part of CSS 2.1 9.4.2:
>>
>>   # Line boxes are created as needed to hold inline-level content
>>   # within an inline formatting context. Line boxes that contain no
>>   # text, no preserved white space, no inline elements with non-zero
>>   # margins, padding, or borders, and no other in-flow content (such as
>>   # images, inline blocks or inline tables), and do not end with a
>>   # preserved newline must be treated as zero-height line boxes for the
>>   # purposes of determining the positions of any elements inside of
>>   # them, and must be treated as not existing for any other purpose.
>>
>> While the condition "no inline elements with non-zero margins, padding,
>> or borders" probably has quirks-mode difference too (and should be
>> specced), if you are testing the current prose to see if the above
>> <span> contributes to line height, I'd suggest the test be written in
>> this way:
>>
>>   | div { line-height: 0} span { padding:1px 0; line-height: normal }
>>   | <div id=test>x<span></span></div><div id=ref>x</div>
>>   | <div id=s_ref>x<span>x</span></div>
>>
>> The 'x' at the beginning ensures that the tests don't go into the
>> "zero-height line boxes" situation.
>>
>> Ditto for all others.
> 
> I think this is intentional. We could add tests with "x" in as well,
> though, if that still makes the quirk kick in.
> 
> Do you have a test case demonstrating quirks-mode differences in "no
> inline elements with non-zero margins, padding, or borders"?

(By the way, the CSS 2.1 propose here should really be "non-zero
horizontal margins/paddings/borders/" as you have observed.)

Well, your test case:

  # span { margin:0 1px }
  # <div id=test><span></span></div>
  # <div id=ref></div><div id=s_ref>x</div>

shows that :) (whether non-zero margins matter only in standards mode).

What I am saying here is that if you compare this test with

  | div { line-height: 0;} span { margin:0 1px; line-height: normal; }
  | <div id=test>x<span></span></div>
  | <div id=ref>x</div><div id=s_ref>x<span>x</span></div>

you'll see that Firefox passes the former but not the latter. That is,
the <span> in "<div id=test>x<span></span></div>" does contribute to
line height (in a buggy way). This is probably an edgy bug Gecko has,
but the point is that the result could be differnt.

In other words, I guess the best option is to spec the quirk about
"zero-height line boxes" and include both test cases.



Cheers,
Kenny
-- 
Web Specialist, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/

Received on Friday, 23 November 2012 10:07:44 UTC