WebCore:

        Reviewed by Sam Weinig.

        - fix http://bugs.webkit.org/show_bug.cgi?id=17152
          Paragraphs indented with :first-letter and text-align CSS render incorrectly

        Test: fast/text/apply-start-width-after-skipped-text.html

        * rendering/bidi.cpp:
        (WebCore::RenderBlock::findNextLineBreak): Improved the logic for when
        to figure in the padding, border and margin before a text node when the
        line begins inside a text node.

LayoutTests:

        Reviewed by Sam Weinig.

        - test for http://bugs.webkit.org/show_bug.cgi?id=17152
          Paragraphs indented with :first-letter and text-align CSS render incorrectly

        * fast/text/apply-start-width-after-skipped-text.html: Added.
        * platform/mac/fast/text/apply-start-width-after-skipped-text-expected.checksum: Added.
        * platform/mac/fast/text/apply-start-width-after-skipped-text-expected.png: Added.
        * platform/mac/fast/text/apply-start-width-after-skipped-text-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index f930fb8..f11d1ae 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -1353,6 +1353,8 @@
 
 BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi)
 {
+    bool appliedStartWidth = start.pos > 0;
+
     // eliminate spaces at beginning of line
     int width = skipWhitespace(start, bidi);
     int w = 0;
@@ -1542,6 +1544,9 @@
             } else
                 tmpW += o->width() + o->marginLeft() + o->marginRight() + inlineWidth(o);
         } else if (o->isText()) {
+            if (!pos)
+                appliedStartWidth = false;
+
             RenderText* t = static_cast<RenderText*>(o);
 
             int strlen = t->textLength();
@@ -1554,8 +1559,6 @@
             int wordSpacing = o->style()->wordSpacing();
             int lastSpaceWordSpacing = 0;
 
-            bool appliedStartWidth = pos > 0; // If the span originated on a previous line,
-                                              // then assume the start width has been applied.
             int wrapW = tmpW + inlineWidth(o, !appliedStartWidth, true);
             int charWidth = 0;
             int nextBreakable = -1;