Re: [CSS2] first-line-selector-011.htm

On Wed, 05 Jun 2013 08:50:17 +0200, Masataka Yakura  
<myakura.web@gmail.com> wrote:

> Hello,
>
> Looking at first-line-selector-011 I get confused.
> http://test.csswg.org/suites/css2.1/latest//first-line-selector-011.htm
>
> The spec says "The first line of an inline-block cannot be the first  
> formatted line of an ancestor element", so the first >"Test" in the  
> <span> element cannot be the first formatted line because it has  
> `display: inline-block` set. Hence, div:first->line { color: green }  
> does not apply to the <span> and it should show red.
>
> However, the test says it "passes if there is no red visible on the  
> page." That's wrong, isn't it? It should either say >"there is no green  
> visible", or switch the colors in the stylesheet.
>
> Why I'm confused is that both Gecko and Presto "passes" the test. They  
> show green. Which one is wrong; those two engines, or >the spec?

I think both are correct. :-)  But perhaps the spec could be more  
elaborate.

This statement is true:

"The first line of an inline-block cannot be the first formatted line of  
an ancestor element"

But I don't think it's the whole truth. The inline-block takes part in an  
inline formatting context and can be part of the first line as such. I  
would expect an inline-block that ends up on the first line of an ancestor  
element to get the first-line style for that ancestor like in this example  
(Gecko and Presto match my expectations):

<!DOCTYPE html>
<style>
div::first-line { color: green; }
span { display: inline-block; }
span::first-line { color: purple; }
</style>
<div>Green Green <span>Purple<hr>Green</span> Green<br>Not green.</div>


These are my intuitive expectations and not rooted in any spec discussions  
I've seen.

I'm not sure about ::first-letter.

-- 
Rune Lillesveen

Received on Wednesday, 5 June 2013 08:25:35 UTC