Bug 63185 - CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
Summary: CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatt...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Robert Hogan
URL: http://fry.si/bugs/text-indent-test.html
Keywords: HasReduction
Depends on:
Blocks: 47141
  Show dependency treegraph
 
Reported: 2011-06-22 14:37 PDT by Marko Mrdjenovic
Modified: 2012-08-09 14:13 PDT (History)
8 users (show)

See Also:


Attachments
Reduced Test case (519 bytes, text/html)
2012-05-23 10:36 PDT, Pravin D
no flags Details
Patch (24.70 KB, patch)
2012-08-01 13:16 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.