Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1305)

Unified Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 17434006: Breaking whitespace in a white-space:pre-wrap should never go on the new line. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address review feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/text/whitespace/pre-wrap-no-space-at-start-of-line-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockLineLayout.cpp
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index 168558173d7bdb5a400b5801a7ad9b1e7e7d8627..a645d5c79bc63853debe9a3ad15f8baa7654867c 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -2643,6 +2643,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
// this to detect when we encounter a second space so we know we have to terminate
// a run.
bool currentCharacterIsSpace = false;
+ bool currentCharacterShouldCollapseIfPreWap = false;
TrailingObjects trailingObjects;
InlineIterator lBreak = resolver.position();
@@ -2774,7 +2775,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
&& shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
// Like with list markers, we start ignoring spaces to make sure that any
// additional spaces we see will be discarded.
- currentCharacterIsSpace = true;
+ currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = true;
ignoringSpaces = true;
}
}
@@ -2797,7 +2798,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
lineInfo.setEmpty(false, m_block, &width);
ignoringSpaces = false;
- currentCharacterIsSpace = false;
+ currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = false;
trailingObjects.clear();
// Optimize for a common case. If we can't find whitespace after the list
@@ -2807,7 +2808,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
if (blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
// Like with inline flows, we start ignoring spaces to make sure that any
// additional spaces we see will be discarded.
- currentCharacterIsSpace = true;
+ currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = true;
ignoringSpaces = true;
}
if (toRenderListMarker(current.m_obj)->isInside())
@@ -2888,8 +2889,9 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
UChar secondToLastCharacter = renderTextInfo.m_lineBreakIterator.secondToLastCharacter();
for (; current.m_pos < t->textLength(); current.fastIncrementInTextNode()) {
bool previousCharacterIsSpace = currentCharacterIsSpace;
+ bool previousCharacterShouldCollapseIfPreWap = currentCharacterShouldCollapseIfPreWap;
UChar c = current.current();
- currentCharacterIsSpace = c == ' ' || c == '\t' || (!preserveNewline && (c == '\n'));
+ currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = c == ' ' || c == '\t' || (!preserveNewline && (c == '\n'));
if (!collapseWhiteSpace || !currentCharacterIsSpace)
lineInfo.setEmpty(false, m_block, &width);
@@ -3073,7 +3075,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
ignoreStart.m_pos = current.m_pos;
}
- if (!currentCharacterIsSpace && previousCharacterIsSpace) {
+ if (!currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWap) {
if (autoWrap && currentStyle->breakOnlyAfterWhiteSpace())
lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
}
« no previous file with comments | « LayoutTests/fast/text/whitespace/pre-wrap-no-space-at-start-of-line-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698