Source/WebCore: [css3-text] Rendering -webkit-each-line value for text-indent from...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2013 01:32:24 +0000 (01:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2013 01:32:24 +0000 (01:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113259

Patch by Jaehun Lim <ljaehun.lim@samsung.com> on 2013-04-02
Reviewed by Levi Weintraub.

CSS3 TEXT introduces new value, "each-line" for text-indent.
Indentation affects the first line of the block container as well as each line
after a forced line break, but does not affect lines after a soft wrap break.

This patch is the rendering part to support each-line value for text-indent.
It's prefixed and guarded by CSS3_TEXT flag.

Test: fast/css3-text/css3-text-indent/text-indent-each-line.html

* rendering/RenderBlock.h:
(WebCore::RenderBlock::availableLogicalWidthForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::startOffsetForLine):
(WebCore::RenderBlock::endOffsetForLine):
(WebCore::RenderBlock::pixelSnappedLogicalLeftOffsetForLine):
(WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
    Rename a parameter from firstLine to shouldIndentText.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::LineWidth):
(WebCore::LineWidth::shouldIndentText): Return boolean according to m_shouldIndentText.
(WebCore::LineWidth::updateAvailableWidth):
(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
(WebCore::LineWidth::fitBelowFloats):
    Add enum IndentTextOrNot and m_shouldIndentText.
    Use m_shouldIndentText instead of m_isFirstLine.

(WebCore::requiresIndent): Decide whether text indentation is required.
(WebCore::updateLogicalInlinePositions):
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):

LayoutTests: [css3-text] Rendering -webkit-each-line value for text-indent from css3-text
https://bugs.webkit.org/show_bug.cgi?id=113259

CSS3 TEXT introduces new value, "each-line" for text-indent.
Indentation affects the first line of the block container as well as each line
after a forced line break, but does not affect lines after a soft wrap break.

Patch by Jaehun Lim <ljaehun.lim@samsung.com> on 2013-04-02
Reviewed by Levi Weintraub.

* fast/css3-text/css3-text-indent/text-indent-each-line-expected.html: Added.
* fast/css3-text/css3-text-indent/text-indent-each-line.html: Added.
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp

index 66da01f..7fa8411 100644 (file)
@@ -1,3 +1,19 @@
+2013-04-02  Jaehun Lim  <ljaehun.lim@samsung.com>
+
+        [css3-text] Rendering -webkit-each-line value for text-indent from css3-text
+        https://bugs.webkit.org/show_bug.cgi?id=113259
+        
+        CSS3 TEXT introduces new value, "each-line" for text-indent.
+        Indentation affects the first line of the block container as well as each line
+        after a forced line break, but does not affect lines after a soft wrap break.
+
+        Reviewed by Levi Weintraub.
+
+        * fast/css3-text/css3-text-indent/text-indent-each-line-expected.html: Added.
+        * fast/css3-text/css3-text-indent/text-indent-each-line.html: Added.
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+
 2013-04-02  Dean Jackson  <dino@apple.com>
 
         Compositing tests failing after http://trac.webkit.org/changeset/147502
diff --git a/LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line-expected.html b/LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line-expected.html
new file mode 100644 (file)
index 0000000..f868a57
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+    <title>[css3-text] text-indent</title>
+    <style>
+    div { width:80px; font: 10px Ahem; background-color:lightgray; }
+    .normal { text-indent: 4em; }
+    .indent { color: blue; }
+    .eachline { padding-left:4em; }
+    </style>
+</head
+<body>
+<div class="normal">
+<span class="indent">xxxx</span><br>xxxx<br>xxxx
+</div>
+<br>
+<div class="normal">
+<span class="indent">xxxx</span> xxxx xxxx
+</div>
+<br>
+<div class="normal">
+<span class="indent">xxxx</span><br><span class="indent eachline">xxxx</span><br><span class="indent eachline">xxxx</span>
+</div>
+<br>
+<div class="normal">
+<span class="indent">xxxx</span> xxxx<br><span class="indent eachline">xxxx</span>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line.html b/LayoutTests/fast/css3-text/css3-text-indent/text-indent-each-line.html
new file mode 100644 (file)
index 0000000..bd4b014
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+<head>
+    <title>[css3-text] text-indent</title>
+    <style>
+    div { width:80px; font: 10px Ahem; background-color:lightgray; }
+    .normal { text-indent: 4em; }
+    .eachline { width:80px; text-indent: 4em -webkit-each-line; }
+    .indent { color: blue; }
+    </style>
+</head
+<body>
+<!--
+all black boxes should be left-aligned.
+all blue boxes should be right-aligned.
+-->
+
+<!-- normal text-indent -->
+<div class="normal">
+<span class="indent">xxxx</span><br>xxxx<br>xxxx
+</div>
+<br>
+<!-- -webkit-each-line with a soft wrap break -->
+<div class="eachline">
+<span class="indent">xxxx</span> xxxx xxxx
+</div>
+<br>
+<!-- -webkit-each-line with a forced line break -->
+<div class="eachline">
+<span class="indent">xxxx</span><br><span class="indent">xxxx</span><br><span class="indent">xxxx</span>
+</div>
+<br>
+<!-- -webkit-each-line with a soft wrap break and a forced line break -->
+<div class="eachline">
+<span class="indent">xxxx</span> xxxx<br><span class="indent">xxxx</span>
+</div>
+</body>
+</html>
index 188091d..acd67d0 100644 (file)
@@ -2507,8 +2507,7 @@ fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align
 fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-line.html
 fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-color.html
 fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-underline-position.html
-fast/css3-text/css3-text-indent/getComputedStyle/getComputedStyle-text-indent-inherited.html
-fast/css3-text/css3-text-indent/getComputedStyle/getComputedStyle-text-indent.html
+fast/css3-text/css3-text-indent [ Failure ]
 
 # Needs rebaseline.
 webkit.org/b/94198 fast/dom/HTMLImageElement/image-alt-text.html [ Failure ]
index e8f5ed7..1f52d65 100644 (file)
@@ -2983,8 +2983,7 @@ webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
 fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html
 fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last.html
 fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-line.html
-fast/css3-text/css3-text-indent/getComputedStyle/getComputedStyle-text-indent-inherited.html
-fast/css3-text/css3-text-indent/getComputedStyle/getComputedStyle-text-indent.html
+fast/css3-text/css3-text-indent [ Failure ]
 
 # Spellchecker behavior tests.
 webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Skip ]
index 350c0b7..d6f485d 100644 (file)
@@ -1,3 +1,43 @@
+2013-04-02  Jaehun Lim  <ljaehun.lim@samsung.com>
+
+        [css3-text] Rendering -webkit-each-line value for text-indent from css3-text
+        https://bugs.webkit.org/show_bug.cgi?id=113259
+
+        Reviewed by Levi Weintraub.
+
+        CSS3 TEXT introduces new value, "each-line" for text-indent.
+        Indentation affects the first line of the block container as well as each line
+        after a forced line break, but does not affect lines after a soft wrap break.
+
+        This patch is the rendering part to support each-line value for text-indent.
+        It's prefixed and guarded by CSS3_TEXT flag.
+
+        Test: fast/css3-text/css3-text-indent/text-indent-each-line.html
+
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::availableLogicalWidthForLine):
+        (WebCore::RenderBlock::logicalRightOffsetForLine):
+        (WebCore::RenderBlock::logicalLeftOffsetForLine):
+        (WebCore::RenderBlock::startOffsetForLine):
+        (WebCore::RenderBlock::endOffsetForLine):
+        (WebCore::RenderBlock::pixelSnappedLogicalLeftOffsetForLine):
+        (WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
+            Rename a parameter from firstLine to shouldIndentText.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::LineWidth::LineWidth):
+        (WebCore::LineWidth::shouldIndentText): Return boolean according to m_shouldIndentText.
+        (WebCore::LineWidth::updateAvailableWidth):
+        (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
+        (WebCore::LineWidth::fitBelowFloats):
+            Add enum IndentTextOrNot and m_shouldIndentText.
+            Use m_shouldIndentText instead of m_isFirstLine.
+
+        (WebCore::requiresIndent): Decide whether text indentation is required.
+        (WebCore::updateLogicalInlinePositions):
+        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
+        (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
+
 2013-04-02  Glenn Adams  <glenn@skynav.com>
 
         Generalize prior line break context state and names.
index 3eb5aa6..273393f 100644 (file)
@@ -165,66 +165,66 @@ public:
 
     // Versions that can compute line offsets with the region and page offset passed in. Used for speed to avoid having to
     // compute the region all over again when you already know it.
-    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
+    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     {
-        return max<LayoutUnit>(0, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
-            - logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight));
+        return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
+            - logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight));
     }
-    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const 
     {
-        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine, 0, logicalHeight);
+        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight);
     }
-    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const 
     {
-        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage), firstLine, 0, logicalHeight);
+        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight);
     }
-    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
+    LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     {
-        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
-            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
+        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
+            : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
     }
-    LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
+    LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const
     {
-        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
-            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
+        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
+            : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
     }
 
-    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
+    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
     {
-        return availableLogicalWidthForLine(position, firstLine, regionAtBlockOffset(position), offsetFromLogicalTopOfFirstPage(), logicalHeight);
+        return availableLogicalWidthForLine(position, shouldIndentText, regionAtBlockOffset(position), offsetFromLogicalTopOfFirstPage(), logicalHeight);
     }
-    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const 
     {
-        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0, logicalHeight);
+        return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), shouldIndentText, 0, logicalHeight);
     }
-    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const 
     {
-        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0, logicalHeight);
+        return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), shouldIndentText, 0, logicalHeight);
     }
-    LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const 
     {
-        return roundToInt(logicalLeftOffsetForLine(position, firstLine, logicalHeight));
+        return roundToInt(logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight));
     }
-    LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const 
+    LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const 
     {
         // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
         // by a subpixel value for all but the first column. This can lead to the actual pixel snapped width of the column being off
         // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
         // https://bugs.webkit.org/show_bug.cgi?id=105461
-        return floorToInt(logicalRightOffsetForLine(position, firstLine, logicalHeight));
+        return floorToInt(logicalRightOffsetForLine(position, shouldIndentText, logicalHeight));
     }
-    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
+    LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
     {
-        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, logicalHeight)
-            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, logicalHeight);
+        return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
+            : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
     }
-    LayoutUnit endOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const
+    LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
     {
-        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine, logicalHeight)
-            : logicalWidth() - logicalRightOffsetForLine(position, firstLine, logicalHeight);
+        return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
+            : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
     }
 
-    LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool firstLine);
+    LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentText);
     LayoutUnit textIndentOffset() const;
 
     virtual VisiblePosition positionForPoint(const LayoutPoint&);
index 2d7ccd6..a92d694 100644 (file)
@@ -89,9 +89,11 @@ ExclusionShapeInsideInfo* RenderBlock::layoutExclusionShapeInsideInfo() const
 }
 #endif
 
+enum IndentTextOrNot { DoNotIndentText, IndentText };
+
 class LineWidth {
 public:
-    LineWidth(RenderBlock* block, bool isFirstLine)
+    LineWidth(RenderBlock* block, bool isFirstLine, IndentTextOrNot shouldIndentText)
         : m_block(block)
         , m_uncommittedWidth(0)
         , m_committedWidth(0)
@@ -103,6 +105,7 @@ public:
         , m_segment(0)
 #endif
         , m_isFirstLine(isFirstLine)
+        , m_shouldIndentText(shouldIndentText)
     {
         ASSERT(block);
 #if ENABLE(CSS_EXCLUSIONS)
@@ -132,6 +135,8 @@ public:
     void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
     void fitBelowFloats();
 
+    bool shouldIndentText() { return m_shouldIndentText == IndentText; }
+
 private:
     void computeAvailableWidthFromLeftAndRight()
     {
@@ -150,14 +155,15 @@ private:
     const LineSegment* m_segment;
 #endif
     bool m_isFirstLine;
+    IndentTextOrNot m_shouldIndentText;
 };
 
 inline void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight)
 {
     LayoutUnit height = m_block->logicalHeight();
     LayoutUnit logicalHeight = logicalHeightForLine(m_block, m_isFirstLine, replacedHeight);
-    m_left = m_block->logicalLeftOffsetForLine(height, m_isFirstLine, logicalHeight);
-    m_right = m_block->logicalRightOffsetForLine(height, m_isFirstLine, logicalHeight);
+    m_left = m_block->logicalLeftOffsetForLine(height, shouldIndentText(), logicalHeight);
+    m_right = m_block->logicalRightOffsetForLine(height, shouldIndentText(), logicalHeight);
 
 #if ENABLE(CSS_EXCLUSIONS)
     if (m_segment) {
@@ -188,7 +194,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa
             newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta();
 #endif
 
-        if (m_isFirstLine && m_block->style()->isLeftToRightDirection())
+        if (shouldIndentText() && m_block->style()->isLeftToRightDirection())
             newLeft += floorToInt(m_block->textIndentOffset());
         m_left = max<float>(m_left, newLeft);
     } else {
@@ -198,7 +204,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa
             newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta();
 #endif
 
-        if (m_isFirstLine && !m_block->style()->isLeftToRightDirection())
+        if (shouldIndentText() && !m_block->style()->isLeftToRightDirection())
             newRight -= floorToInt(m_block->textIndentOffset());
         m_right = min<float>(m_right, newRight);
     }
@@ -235,8 +241,8 @@ void LineWidth::fitBelowFloats()
         if (floatLogicalBottom <= lastFloatLogicalBottom)
             break;
 
-        newLineLeft = m_block->logicalLeftOffsetForLine(floatLogicalBottom, m_isFirstLine);
-        newLineRight = m_block->logicalRightOffsetForLine(floatLogicalBottom, m_isFirstLine);
+        newLineLeft = m_block->logicalLeftOffsetForLine(floatLogicalBottom, shouldIndentText());
+        newLineRight = m_block->logicalRightOffsetForLine(floatLogicalBottom, shouldIndentText());
         newLineWidth = max(0.0f, newLineRight - newLineLeft);
         lastFloatLogicalBottom = floatLogicalBottom;
         if (newLineWidth >= m_uncommittedWidth)
@@ -951,11 +957,25 @@ void RenderBlock::updateLogicalWidthForAlignment(const ETextAlign& textAlign, Bi
     }
 }
 
-static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, LayoutUnit boxLogicalHeight)
+static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, RenderStyle* style)
+{
+    if (isFirstLine)
+        return IndentText;
+#if ENABLE(CSS3_TEXT)
+    if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine) 
+        return IndentText;
+#else
+    UNUSED_PARAM(isAfterHardLineBreak);
+    UNUSED_PARAM(style);
+#endif
+    return DoNotIndentText;
+}
+
+static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
 {
     LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLogicalHeight);
-    lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logicalHeight(), firstLine, lineLogicalHeight);
-    lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logicalHeight(), firstLine, lineLogicalHeight);
+    lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
+    lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
     availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
 }
 
@@ -966,11 +986,15 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
     
     // 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);
+    // CSS3 "text-indent", "-webkit-each-line" affects the first line of the block container as well as each line after a forced line break,
+    // but does not affect lines after a soft wrap break.
+    bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this);
+    bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()->endsWithBreak();
+    IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLineBreak, style());
     float lineLogicalLeft;
     float lineLogicalRight;
     float availableLogicalWidth;
-    updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, firstLine, 0);
+    updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0);
     bool needsWordSpacing;
 #if ENABLE(CSS_EXCLUSIONS)
     ExclusionShapeInsideInfo* exclusionShapeInsideInfo = layoutExclusionShapeInsideInfo();
@@ -1006,7 +1030,7 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
 
     if (firstRun && firstRun->m_object->isReplaced()) {
         RenderBox* renderBox = toRenderBox(firstRun->m_object);
-        updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, firstLine, renderBox->logicalHeight());
+        updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, renderBox->logicalHeight());
     }
 
     computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, lineLogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
@@ -2635,7 +2659,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
     bool includeEndWidth = true;
     LineMidpointState& lineMidpointState = resolver.midpointState();
 
-    LineWidth width(m_block, lineInfo.isFirstLine());
+    LineWidth width(m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.isFirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style()));
 
     skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width);