In some float situations, the original layout is wrong and only corrects itself on repaint
https://bugs.webkit.org/show_bug.cgi?id=18939

Reviewed by Levi Weintraub.

Source/WebCore:

A <br> that follows collapsing spaces and has clearance set always needs to get a run and a linebox of its own.
This allows the line below it to check for clearance from the <br> if it gets dirtied but the line with the <br>
does not.

Test: fast/block/br-with-clearance-after-collapsing-space.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak):

LayoutTests:

* fast/block/br-with-clearance-after-collapsing-space-expected.html: Added.
* fast/block/br-with-clearance-after-collapsing-space.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp
index 93eff8e..1cfd1e0 100644
--- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -2404,6 +2404,14 @@
                 trailingObjects.clear();
                 lineInfo.setPreviousLineBrokeCleanly(true);
 
+                // A <br> with clearance always needs a linebox in case the lines below it get dirtied later and 
+                // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
+                // run for this object.
+                if (ignoringSpaces && currentStyle->clear() != CNONE) {
+                    addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Stop ignoring spaces.
+                    addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Start ignoring again.
+                }
+
                 if (!lineInfo.isEmpty())
                     m_clear = currentStyle->clear();
             }