Title: [125202] trunk
Revision
125202
Author
[email protected]
Date
2012-08-09 14:12:44 -0700 (Thu, 09 Aug 2012)

Log Message

CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
https://bugs.webkit.org/show_bug.cgi?id=63185

Reviewed by Eric Seidel.

Source/WebCore:

Per CSS 2.1 (http://www.w3.org/TR/CSS21/text.html) : "'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."

Tests: fast/css/text-indent-first-line-001.html
       fast/css/text-indent-first-line-002.html
       fast/css/text-indent-first-line-003.html
       fast/css/text-indent-first-line-004.html
       fast/css/text-indent-first-line-005.html
       fast/css/text-indent-first-line-006.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): As well as being the first line under a parent block,
  check that this is also the first *formatted* line of an element by ensuring that we are at the start of a
  formatting context and not just a continuation of a previous anonymous block in an existing formatting context.

LayoutTests:

* css2.1/20110323/text-indent-014-expected.html: Added.
* css2.1/20110323/text-indent-014.htm: Added.
* fast/css/text-indent-first-line-001-expected.html: Added.
* fast/css/text-indent-first-line-001.html: Added.
* fast/css/text-indent-first-line-002-expected.html: Added.
* fast/css/text-indent-first-line-002.html: Added.
* fast/css/text-indent-first-line-003-expected.html: Added.
* fast/css/text-indent-first-line-003.html: Added.
* fast/css/text-indent-first-line-004-expected.html: Added.
* fast/css/text-indent-first-line-004.html: Added.
* fast/css/text-indent-first-line-005-expected.html: Added.
* fast/css/text-indent-first-line-005.html: Added.
  Text-indent in the span here is inherited from the div. CSS 2.1: "Since the 'text-indent'
  property inherits, when specified on a block element, it will affect descendant
  inline-block elements."
* fast/css/text-indent-first-line-006-expected.html: Added.
* fast/css/text-indent-first-line-006.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125201 => 125202)


--- trunk/LayoutTests/ChangeLog	2012-08-09 21:00:46 UTC (rev 125201)
+++ trunk/LayoutTests/ChangeLog	2012-08-09 21:12:44 UTC (rev 125202)
@@ -1,3 +1,28 @@
+2012-08-09  Robert Hogan  <[email protected]>
+
+        CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
+        https://bugs.webkit.org/show_bug.cgi?id=63185
+
+        Reviewed by Eric Seidel.
+
+        * css2.1/20110323/text-indent-014-expected.html: Added.
+        * css2.1/20110323/text-indent-014.htm: Added.
+        * fast/css/text-indent-first-line-001-expected.html: Added.
+        * fast/css/text-indent-first-line-001.html: Added.
+        * fast/css/text-indent-first-line-002-expected.html: Added.
+        * fast/css/text-indent-first-line-002.html: Added.
+        * fast/css/text-indent-first-line-003-expected.html: Added.
+        * fast/css/text-indent-first-line-003.html: Added.
+        * fast/css/text-indent-first-line-004-expected.html: Added.
+        * fast/css/text-indent-first-line-004.html: Added.
+        * fast/css/text-indent-first-line-005-expected.html: Added.
+        * fast/css/text-indent-first-line-005.html: Added.
+          Text-indent in the span here is inherited from the div. CSS 2.1: "Since the 'text-indent' 
+          property inherits, when specified on a block element, it will affect descendant 
+          inline-block elements."
+        * fast/css/text-indent-first-line-006-expected.html: Added.
+        * fast/css/text-indent-first-line-006.html: Added.
+
 2012-08-09  Roger Fong  <[email protected]>
 
         Gardening LayoutTests/platform/win/fast/canvas tests folder.

Added: trunk/LayoutTests/css2.1/20110323/text-indent-014-expected.html (0 => 125202)


--- trunk/LayoutTests/css2.1/20110323/text-indent-014-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/text-indent-014-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="Elika J. Etemad" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .controlA, .controlB {
+      background: black;
+      height: 3em;
+      width: 6em;
+    }
+    .controlA {
+      margin-left: 6em;
+      margin-bottom: -3em;
+    }
+    .controlB {
+      margin-top: 3em;
+    }
+  </style>
+</head>
+<body>
+  <p>There must be a 4-square checkerboard pattern in the orange box below
+    and no red present.</p>
+  <div class="container">
+    <div class="controlA"></div>
+    <div class="controlB"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css2.1/20110323/text-indent-014.htm (0 => 125202)


--- trunk/LayoutTests/css2.1/20110323/text-indent-014.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/text-indent-014.htm	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="Elika J. Etemad" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .outer {
+      text-indent: 6em;
+    }
+    .inner {
+      text-indent: 0;
+    }
+    .outer {
+    }
+    .outer:before {
+      content: "BlockA";
+      display: block;
+    }
+
+    .controlA, .controlB {
+      background: red;
+      height: 3em;
+      width: 6em;
+    }
+    .controlA {
+      margin-left: 6em;
+      margin-bottom: -3em;
+    }
+    .controlB {
+      margin-top: -3em;
+    }
+  </style>
+</head>
+<body>
+  <p>There must be a 4-square checkerboard pattern in the orange box below
+    and no red present.</p>
+  <div class="container">
+    <div class="controlA"></div>
+    <div class="outer">
+      <div>
+        BlockA
+        <div>BlockA</div>
+        BlockB
+        <div class="inner">BlockB</div>
+        BlockB
+      </div>
+    </div>
+    <div class="controlB"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-001-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-001-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-001-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    <div class="outer">
+        <div>Block</div>
+        <div>Block</div>
+    </div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-001.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-001.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-001.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .control {
+      background: red;
+      height: 2em;
+      width: 5em;
+      margin-left: 0em;
+      margin-top: -2em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {text-indent:0;display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    <div class="outer">
+        <span>Block</span>
+        Block
+    </div>
+    <div class="control"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-002-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-002-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-002-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+      white-space: pre;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container"><span style="float:right;">Float</span> Block</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-002.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-002.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-002.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .control {
+      background: red;
+      height: 1em;
+      width: 5em;
+      margin-left: 1em;
+      margin-top: -1em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {text-indent:0;display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    <span style="float:right;">Float</span>
+    Block
+    <div class="control"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-003-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-003-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-003-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+      white-space: pre;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container"> Block<br>Block</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-003.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-003.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-003.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .controlA, .controlB {
+      background: red;
+      height: 1em;
+      width: 5em;
+    }
+    .controlA {
+      margin-left: 1em;
+      margin-top: -2em;
+      margin-bottom: 0em;
+    }
+    .controlB {
+      margin-left: 0em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {text-indent:0;display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    Block
+    <span>Block</span>
+    <div class="controlA"></div>
+    <div class="controlB"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-004-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-004-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-004-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+      white-space: pre;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container"> Block<br>Block</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-004.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-004.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-004.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .controlA, .controlB {
+      background: red;
+      height: 1em;
+      width: 5em;
+    }
+    .controlA {
+      margin-left: 1em;
+      margin-top: -2em;
+      margin-bottom: 0em;
+    }
+    .controlB {
+      margin-left: 0em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    <span>Block</span>
+    Block
+    <div class="controlA"></div>
+    <div class="controlB"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-005-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-005-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-005-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+      white-space: pre;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container"> Block<br> Block<br>Block</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-005.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-005.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-005.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .controlA, .controlB, .controlC {
+      background: red;
+      height: 1em;
+      width: 5em;
+    }
+    .controlA {
+      margin-left: 1em;
+      margin-top: -3em;
+      margin-bottom: 0em;
+    }
+    .controlB {
+      margin-left: 1em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    .controlC {
+      margin-left: 0em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    Block
+    <span>Block</span>
+    Block
+    <div class="controlA"></div>
+    <div class="controlB"></div>
+    <div class="controlC"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-006-expected.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-006-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-006-expected.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+      white-space: pre;
+    }
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container"> <img src="" width="100px" height="20px"/><br>Block<br> Block<br>Block</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/text-indent-first-line-006.html (0 => 125202)


--- trunk/LayoutTests/fast/css/text-indent-first-line-006.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-indent-first-line-006.html	2012-08-09 21:12:44 UTC (rev 125202)
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CSS Test: text-indent on anonymous blocks</title>
+  <link rel="author" title="WebKit" href=""
+  <link rel="help" href=""
+  <meta name="flags" content="">
+  <meta name="assert" content="text-indent affects only the first line of     a block container if that line is also the first formatted line of an     element.">
+  <style type="text/css">
+    .container {
+      font: 20px/1 Ahem;
+      border: solid orange;
+      width: 12em;
+    }
+    .controlA, .controlB, .controlC, .controlD {
+      background: red;
+      height: 1em;
+      width: 5em;
+    }
+    .controlA {
+      background: none;
+      text-indent: 0em;
+      margin-left: 1em;
+      margin-top: -4em;
+      margin-bottom: 0em;
+    }
+    .controlB {
+      margin-left: 0em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    .controlC {
+      margin-left: 1em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    .controlD {
+      margin-left: 0em;
+      margin-top: 0em;
+      margin-bottom: 0em;
+    }
+    div {text-indent:1em;}
+    span {display:block;}
+  </style>
+</head>
+<body>
+  <p>There should be no red.</p>
+  <div class="container">
+    <div><img src="" width="100px" height="20px"/></div> 
+    Block
+    <span>Block</span>
+    Block
+    <div class="controlA"><img style="margin-top: -0.2em" src="" width="100px" height="20px"/></div>
+    <div class="controlB"></div>
+    <div class="controlC"></div>
+    <div class="controlD"></div>
+  </div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (125201 => 125202)


--- trunk/Source/WebCore/ChangeLog	2012-08-09 21:00:46 UTC (rev 125201)
+++ trunk/Source/WebCore/ChangeLog	2012-08-09 21:12:44 UTC (rev 125202)
@@ -1,3 +1,26 @@
+2012-08-09  Robert Hogan  <[email protected]>
+
+        CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
+        https://bugs.webkit.org/show_bug.cgi?id=63185
+
+        Reviewed by Eric Seidel.
+
+        Per CSS 2.1 (http://www.w3.org/TR/CSS21/text.html) : "'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."
+
+        Tests: fast/css/text-indent-first-line-001.html
+               fast/css/text-indent-first-line-002.html
+               fast/css/text-indent-first-line-003.html
+               fast/css/text-indent-first-line-004.html
+               fast/css/text-indent-first-line-005.html
+               fast/css/text-indent-first-line-006.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): As well as being the first line under a parent block,
+          check that this is also the first *formatted* line of an element by ensuring that we are at the start of a 
+          formatting context and not just a continuation of a previous anonymous block in an existing formatting context.
+
 2012-08-09  Jan Keromnes  <[email protected]>
 
         Web Inspector: replace the Web Inspector editor with CodeMirror

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (125201 => 125202)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-09 21:00:46 UTC (rev 125201)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-09 21:12:44 UTC (rev 125202)
@@ -773,8 +773,11 @@
     ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
     
     LayoutUnit lineLogicalHeight = logicalHeightForLine(this);
-    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight);
-    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight) - logicalLeft;
+    // CSS 2.1: "'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."
+    bool firstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this);
+    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight);
+    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight) - logicalLeft;
 
     bool needsWordSpacing = false;
     float totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to