| 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 d7daadd88e4b7af220139a239a014dfc61ad1af2..513b3b414de99d61155bc7e21a7bdb49266043d0 100644
|
| --- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
|
| +++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
|
| @@ -895,6 +895,12 @@ ALWAYS_INLINE bool BreakingContext::isBreakAtSoftHyphen() const {
|
| : m_current.previousInSameNode() == softHyphenCharacter;
|
| }
|
|
|
| +static ALWAYS_INLINE bool hasVisibleText(LineLayoutText layoutText,
|
| + unsigned offset) {
|
| + return !layoutText.containsOnlyWhitespace(offset,
|
| + layoutText.textLength() - offset);
|
| +}
|
| +
|
| inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
|
| bool& hyphenated) {
|
| if (!m_current.offset())
|
| @@ -943,6 +949,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
|
| Hyphenation* hyphenation = style.getHyphenation();
|
| bool disableSoftHyphen = style.getHyphens() == HyphensNone;
|
| float hyphenWidth = 0;
|
| + bool isLineEmpty = m_lineInfo.isEmpty();
|
|
|
| if (layoutText.isSVGInlineText()) {
|
| breakWords = false;
|
| @@ -1102,7 +1109,9 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
|
| midWordBreak = true;
|
| }
|
| m_width.addUncommittedWidth(wordMeasurement.width);
|
| - } else if (hyphenation) {
|
| + } else if (hyphenation &&
|
| + (m_nextObject || isLineEmpty ||
|
| + hasVisibleText(layoutText, m_current.offset()))) {
|
| m_width.addUncommittedWidth(-wordMeasurement.width);
|
| DCHECK(lastSpace == static_cast<unsigned>(wordMeasurement.startOffset));
|
| DCHECK(m_current.offset() ==
|
| @@ -1191,6 +1200,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
|
| prepareForNextCharacter(layoutText, prohibitBreakInside,
|
| previousCharacterIsSpace);
|
| m_atStart = false;
|
| + isLineEmpty = m_lineInfo.isEmpty();
|
| nextCharacter(c, lastCharacter, secondToLastCharacter);
|
| }
|
|
|
| @@ -1241,7 +1251,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
|
| m_width.commit();
|
| m_atEnd = true;
|
| } else if (!m_width.fitsOnLine()) {
|
| - if (hyphenation && (m_nextObject || m_lineInfo.isEmpty())) {
|
| + if (hyphenation && (m_nextObject || isLineEmpty)) {
|
| m_width.addUncommittedWidth(-wordMeasurement.width);
|
| DCHECK(lastSpace == static_cast<unsigned>(wordMeasurement.startOffset));
|
| DCHECK(m_current.offset() ==
|
|
|