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

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

Issue 1920293003: Fix line wrappiing when break-word/break-all and float with 100% width (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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/css3-text/css3-word-break/word-break-all-wrap-with-100percent-floats.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 81a80cb589d6341108f29b9597ea76fd70688b32..93435b8b11280e98a7367d43bb22b47d8444925e 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -784,14 +784,6 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
float lastWidthMeasurement;
WordMeasurement& wordMeasurement = calculateWordWidth(wordMeasurements, layoutText, lastSpace, lastWidthMeasurement, wordSpacingForWordMeasurement, font, wordTrailingSpaceWidth, c);
lastWidthMeasurement += lastSpaceWordSpacing;
-
- midWordBreak = false;
- if (canBreakMidWord && !m_width.fitsOnLine(lastWidthMeasurement)
- && rewindToMidWordBreak(layoutText, style, font, breakAll, wordMeasurement)) {
- lastWidthMeasurement = wordMeasurement.width;
- midWordBreak = true;
- }
-
m_width.addUncommittedWidth(lastWidthMeasurement);
// We keep track of the total width contributed by trailing space as we often want to exclude it when determining
@@ -811,6 +803,16 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
if (!m_width.committedWidth() && m_autoWrap && !m_width.fitsOnLine() && !widthMeasurementAtLastBreakOpportunity)
m_width.fitBelowFloats(m_lineInfo.isFirstLine());
+ midWordBreak = false;
+ if (canBreakMidWord && !m_width.fitsOnLine()) {
+ m_width.addUncommittedWidth(-wordMeasurement.width);
+ if (rewindToMidWordBreak(layoutText, style, font, breakAll, wordMeasurement)) {
+ lastWidthMeasurement = wordMeasurement.width + lastSpaceWordSpacing;
+ midWordBreak = true;
+ }
+ m_width.addUncommittedWidth(wordMeasurement.width);
+ }
+
// If there is a soft-break available at this whitespace position then take it.
applyWordSpacing = wordSpacing && m_currentCharacterIsSpace;
if (canBreakAtWhitespace(breakWords, wordMeasurement, stoppedIgnoringSpaces, hyphenated, charWidth, hyphenWidth, betweenWords, midWordBreak, canBreakMidWord, previousCharacterIsSpace, lastWidthMeasurement, layoutText, font, applyWordSpacing, wordSpacing))
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-all-wrap-with-100percent-floats.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698