Title: [156053] trunk
- Revision
- 156053
- Author
- rob...@webkit.org
- Date
- 2013-09-18 10:58:25 -0700 (Wed, 18 Sep 2013)
Log Message
Quirksmode: Break Tag Extra Space Bug
https://bugs.webkit.org/show_bug.cgi?id=11943
Reviewed by David Hyatt.
Source/WebCore:
Collapse away all space between text and a hard line-break when in a right-aligned
container so that the trailing space doesn't push the text away from the container edge.
Test: fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
LayoutTests:
* fast/text/whitespace/trailing-space-before-br-in-right-aligned-text-expected.html: Added.
* fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (156052 => 156053)
--- trunk/LayoutTests/ChangeLog 2013-09-18 17:45:11 UTC (rev 156052)
+++ trunk/LayoutTests/ChangeLog 2013-09-18 17:58:25 UTC (rev 156053)
@@ -1,3 +1,13 @@
+2013-09-18 Robert Hogan <rob...@webkit.org>
+
+ Quirksmode: Break Tag Extra Space Bug
+ https://bugs.webkit.org/show_bug.cgi?id=11943
+
+ Reviewed by David Hyatt.
+
+ * fast/text/whitespace/trailing-space-before-br-in-right-aligned-text-expected.html: Added.
+ * fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html: Added.
+
2013-09-18 Jer Noble <jer.no...@apple.com>
Merge blink MediaSource changes since fork.
Added: trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text-expected.html (0 => 156053)
--- trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text-expected.html 2013-09-18 17:58:25 UTC (rev 156053)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<head>
+<style>
+#testblock {
+ width:30%;
+ background-color:#FFA500;
+ text-align:right;
+}
+</style>
+<p>webkit.org/b/11943: trailing space after right-aligned text before a hard line-break should not push the text away from the right-edge of the container.
+ There should be no spaces between the text and right-hand edge of the container below.</p>
+<div id="testblock"><br>multiple trailing spaces<br>no trailing space<br>single trailing space<br>last line</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html (0 => 156053)
--- trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html (rev 0)
+++ trunk/LayoutTests/fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html 2013-09-18 17:58:25 UTC (rev 156053)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<head>
+<style>
+#testblock {
+ width:30%;
+ background-color:#FFA500;
+ text-align:right;
+}
+</style>
+<p>webkit.org/b/11943: trailing space after right-aligned text before a hard line-break should not push the text away from the right-edge of the container.
+ There should be no spaces between the text and right-hand edge of the container below.</p>
+<div id="testblock">
+<br>multiple trailing spaces
+<br>no trailing space
+<br>single trailing space
+<br>last line
+</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (156052 => 156053)
--- trunk/Source/WebCore/ChangeLog 2013-09-18 17:45:11 UTC (rev 156052)
+++ trunk/Source/WebCore/ChangeLog 2013-09-18 17:58:25 UTC (rev 156053)
@@ -1,3 +1,18 @@
+2013-09-18 Robert Hogan <rob...@webkit.org>
+
+ Quirksmode: Break Tag Extra Space Bug
+ https://bugs.webkit.org/show_bug.cgi?id=11943
+
+ Reviewed by David Hyatt.
+
+ Collapse away all space between text and a hard line-break when in a right-aligned
+ container so that the trailing space doesn't push the text away from the container edge.
+
+ Test: fast/text/whitespace/trailing-space-before-br-in-right-aligned-text.html
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
+
2013-09-18 Jer Noble <jer.no...@apple.com>
Unreviewed build fix for Qt (and other) ports after 156049.
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (156052 => 156053)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-09-18 17:45:11 UTC (rev 156052)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-09-18 17:58:25 UTC (rev 156053)
@@ -2708,6 +2708,11 @@
// run for this object.
if (ignoringSpaces && currentStyle->clear() != CNONE)
ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
+ // If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets
+ // collapsed away so that it doesn't push the text out from the container's right-hand edge.
+ // FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results.
+ else if (ignoringSpaces && (blockStyle->textAlign() == RIGHT || blockStyle->textAlign() == WEBKIT_RIGHT))
+ stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, current.m_pos));
if (!lineInfo.isEmpty())
m_clear = currentStyle->clear();
@@ -3099,6 +3104,15 @@
if (currentCharacterIsSpace && !previousCharacterIsSpace) {
ignoreStart.m_obj = current.m_obj;
ignoreStart.m_pos = current.m_pos;
+ // Spaces after right-aligned text and before a line-break get collapsed away completely so that the trailing
+ // space doesn't seem to push the text out from the right-hand edge.
+ // FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results.
+ if (next && next->isBR() && (blockStyle->textAlign() == RIGHT || blockStyle->textAlign() == WEBKIT_RIGHT)) {
+ ignoreStart.m_pos--;
+ // If there's just a single trailing space start ignoring it now so it collapses away.
+ if (current.m_pos == t->textLength() - 1)
+ startIgnoringSpaces(lineMidpointState, ignoreStart);
+ }
}
if (!currentCharacterIsWS && previousCharacterIsWS) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes