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

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

Issue 19275016: Merge 152812 "Breaking whitespace in a white-space:pre-wrap shou..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1500/
Patch Set: Created 7 years, 5 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
===================================================================
--- Source/core/rendering/RenderBlockLineLayout.cpp (revision 154315)
+++ Source/core/rendering/RenderBlockLineLayout.cpp (working copy)
@@ -2618,6 +2618,7 @@
// 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();
@@ -2753,7 +2754,7 @@
&& 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;
}
}
@@ -2776,7 +2777,7 @@
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
@@ -2786,7 +2787,7 @@
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())
@@ -2870,8 +2871,9 @@
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);
@@ -3057,7 +3059,7 @@
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