Bug 63185

Summary: CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
Product: WebKit Reporter: Marko Mrdjenovic <fry>
Component: CSSAssignee: Robert Hogan <robert>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, mitz, pravind.2k4, robert, shanestephens, simon.fraser, thorton, webkit.review.bot
Priority: P2 Keywords: HasReduction
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://fry.si/bugs/text-indent-test.html
Bug Depends on:    
Bug Blocks: 47141    
Attachments:
Description Flags
Reduced Test case
none
Patch none

Description Marko Mrdjenovic 2011-06-22 14:37:15 PDT
Spec says "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block box is only affected if it is the first child of its parent element." [1]

The test [2] (first block) shows that :first-line is not applied to "Some text", neither is the anonymous box in question the first child of its parent element, yet text-indent is applied.

Reproduced in Safari, Chrome and nightly (r89415) on OSX and Safari and Chrome on Vista.

[1] http://www.w3.org/TR/CSS21/text.html#propdef-text-indent
[2] http://fry.si/bugs/text-indent-test.html
Comment 1 Pravin D 2012-05-23 10:36:58 PDT
Created attachment 143592 [details]
Reduced Test case
Comment 2 Pravin D 2012-05-23 10:54:18 PDT
Another scenario:

<style>
 body {background:#fff;}
 div {text-indent:50px;background:#eee;margin:0 0 10px; border}
 div:first-line {color:green;}
 span {display:block;background:#ddd;}
</style>

<body>
<div>
 First Line Text. This must be indented. 
 <span>Span Block. This must not be indented.</span>
 Text after span block. This must be not indented.
</div>
<body>

Need some clarification on this,
1) I'm not sure if the text-indent must be applied to the text in the span element or not. The text in the span is not the first formatted line, however FF and opera seem to indent the text in the span element.

2) According to spec text-indent is to applied only for the first line text. However it is applied in even where there is not text on the first line.

<div><img src="http://trac.webkit.org/chrome/site/icon.png" width="100px"/>
</div>
Is this expected behavior??
Comment 3 Robert Hogan 2012-08-01 13:16:16 PDT
Created attachment 155868 [details]
Patch
Comment 4 Robert Hogan 2012-08-01 13:56:27 PDT
(In reply to comment #2)
> Another scenario:
> 
> <style>
>  body {background:#fff;}
>  div {text-indent:50px;background:#eee;margin:0 0 10px; border}
>  div:first-line {color:green;}
>  span {display:block;background:#ddd;}
> </style>
> 
> <body>
> <div>
>  First Line Text. This must be indented. 
>  <span>Span Block. This must not be indented.</span>
>  Text after span block. This must be not indented.
> </div>
> <body>
> 
> Need some clarification on this,
> 1) I'm not sure if the text-indent must be applied to the text in the span element or not. The text in the span is not the first formatted line, however FF and opera seem to indent the text in the span element.

This is due to the span inheriting the indent from the div.

> 
> 2) According to spec text-indent is to applied only for the first line text. However it is applied in even where there is not text on the first line.
> 
> <div><img src="http://trac.webkit.org/chrome/site/icon.png" width="100px"/>
> </div>
> Is this expected behavior??

I think this is OK - it's the line-box that gets indented rather than the 'text'.
Comment 5 Eric Seidel (no email) 2012-08-09 13:36:17 PDT
Comment on attachment 155868 [details]
Patch

Seems reasonable.  Thanks!
Comment 6 WebKit Review Bot 2012-08-09 13:41:06 PDT
Comment on attachment 155868 [details]
Patch

Rejecting attachment 155868 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/PerformanceTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/13470348
Comment 7 Eric Seidel (no email) 2012-08-09 13:43:34 PDT
Comment on attachment 155868 [details]
Patch

The checkout got corrupted on one of the instances.  Adam is fixing.
Comment 8 WebKit Review Bot 2012-08-09 14:13:00 PDT
Comment on attachment 155868 [details]
Patch

Clearing flags on attachment: 155868

Committed r125202: <http://trac.webkit.org/changeset/125202>
Comment 9 WebKit Review Bot 2012-08-09 14:13:04 PDT
All reviewed patches have been landed.  Closing bug.