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

Unified Diff: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h

Issue 2334143002: Fix BreakingContext::rewindToMidWordBreak to set m_currentCharacterIsSpace (Closed)
Patch Set: Fix Created 4 years, 3 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 | « third_party/WebKit/LayoutTests/fast/text/break-word-with-floats-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
diff --git a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
index c203467ba4fa2fc68bee0534f95a68392d6216a0..c8f2fc65a6464cb5c05d6c2939e0843005a2401c 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -115,6 +115,7 @@ public:
}
private:
+ void setCurrentCharacterIsSpace(UChar);
void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
bool shouldMidWordBreak(UChar, LineLayoutText, const Font&,
float& charWidth, float& widthFromLastBreakingOpportunity,
@@ -527,6 +528,11 @@ inline void nextCharacter(UChar& currentCharacter, UChar& lastCharacter, UChar&
lastCharacter = currentCharacter;
}
+ALWAYS_INLINE void BreakingContext::setCurrentCharacterIsSpace(UChar c)
+{
+ m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharacter || (!m_preservesNewline && (c == newlineCharacter));
+}
+
inline float firstPositiveWidth(const WordMeasurements& wordMeasurements)
{
for (size_t i = 0; i < wordMeasurements.size(); ++i) {
@@ -605,6 +611,7 @@ ALWAYS_INLINE bool BreakingContext::rewindToMidWordBreak(
wordMeasurement.width = width;
m_current.moveTo(m_current.getLineLayoutItem(), end, m_current.nextBreakablePosition());
+ setCurrentCharacterIsSpace(m_current.current());
m_lineBreak.moveTo(m_current.getLineLayoutItem(), end, m_current.nextBreakablePosition());
return true;
}
@@ -789,7 +796,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrementInTextNode()) {
bool previousCharacterIsSpace = m_currentCharacterIsSpace;
UChar c = m_current.current();
- m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharacter || (!m_preservesNewline && (c == newlineCharacter));
+ setCurrentCharacterIsSpace(c);
if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) {
m_lineInfo.setEmpty(false);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/break-word-with-floats-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698