<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199818] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199818">199818</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-04-21 09:25:13 -0700 (Thu, 21 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Don't hyphenate the last word in a paragraph of text.
https://bugs.webkit.org/show_bug.cgi?id=156803
Reviewed by Simon Fraser.
Source/WebCore:
Added fast/text/hyphenate-avoid-orphaned-word.html
* rendering/RenderText.h:
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
LayoutTests:
* fast/text/hyphenate-avoid-orphaned-word.html: Added.
* platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt: Added.
* platform/mac/fast/text/hyphenate-limit-before-after-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttexthyphenatelimitbeforeafterexpectedtxt">trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTexth">trunk/Source/WebCore/rendering/RenderText.h</a></li>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContexth">trunk/Source/WebCore/rendering/line/BreakingContext.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasttexthyphenateavoidorphanedwordhtml">trunk/LayoutTests/fast/text/hyphenate-avoid-orphaned-word.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttexthyphenateavoidorphanedwordexpectedtxt">trunk/LayoutTests/platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199817 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-21 16:07:18 UTC (rev 199817)
+++ trunk/LayoutTests/ChangeLog        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-04-21 Dave Hyatt <hyatt@apple.com>
+
+ Don't hyphenate the last word in a paragraph of text.
+ https://bugs.webkit.org/show_bug.cgi?id=156803
+
+ Reviewed by Simon Fraser.
+
+ * fast/text/hyphenate-avoid-orphaned-word.html: Added.
+ * platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt: Added.
+ * platform/mac/fast/text/hyphenate-limit-before-after-expected.txt:
+
</ins><span class="cx"> 2016-04-21 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed GTK+ gardening. Update expectations for some editing tests that are slow on Debug.
</span></span></pre></div>
<a id="trunkLayoutTestsfasttexthyphenateavoidorphanedwordhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/hyphenate-avoid-orphaned-word.html (0 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/hyphenate-avoid-orphaned-word.html         (rev 0)
+++ trunk/LayoutTests/fast/text/hyphenate-avoid-orphaned-word.html        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+<style>
+ html {
+ -webkit-locale: "en_US";
+ }
+
+ .text-box {
+ border: solid;
+ padding: 4px;
+ width: 330px;
+ font-size: 18px;
+ text-align: justify;
+ -webkit-hyphens: auto;
+ }
+
+ .float {
+ width: 75px;
+ height: 5em;
+ background-color: aliceblue;
+ float: right;
+ margin-left: 10px;
+ }
+
+ .hyphenate-character-auto {
+ -webkit-hyphenate-character: auto;
+ }
+
+ .hyphenate-character-bullet {
+ -webkit-hyphenate-character: "\2022";
+ }
+
+ .hyphenate-character-tilde-dot {
+ -webkit-hyphenate-character: "\B7~";
+ }
+
+ .test {
+ float: left;
+ margin: 0 4px;
+ }
+</style>
+<div class="test">
+ <p>The initial value (should be like <tt>auto</tt>)</p>
+ <div class="text-box">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened.</div>
+</div>
+<div class="test">
+ <p>The default (<tt>hyphenate-character: auto</tt>)</p>
+ <div class="text-box hyphenate-character-auto">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened.
+ </div>
+</div>
+<div class="test">
+ <p>Bullet (<tt>hyphenate-character: "\2022"</tt>)</p>
+ <div class="text-box hyphenate-character-bullet">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened. </div>
+</div>
+<div class="test">
+ <p>Middle dot and tilde (<tt>hyphenate-character: "\B7~"</tt>)</p>
+ <div class="text-box hyphenate-character-tilde-dot">
+ <div class="float"></div>
+ The chief difficulty Alice found at first was in managing her
+ flamingo: she succeeded in getting its body tucked away,
+ comfortably enough, under her arm, with its legs hanging down,
+ but generally, just as she had got its neck nicely straightened. </div>
+</div>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttexthyphenateavoidorphanedwordexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt (0 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/hyphenate-avoid-orphaned-word-expected.txt        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (floating) {DIV} at (4,0) size 344x240
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 208x18
+ text run at (0,0) width 208: "The initial value (should be like "
+ RenderInline {TT} at (0,0) size 33x15
+ RenderText {#text} at (207,2) size 33x15
+ text run at (207,2) width 33: "auto"
+ RenderText {#text} at (239,0) size 6x18
+ text run at (239,0) width 6: ")"
+ RenderBlock {DIV} at (0,50) size 344x190 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x176
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get" + hyphen string "-"
+ text run at (7,73) width 209: "ting its body tucked away, "
+ text run at (215,73) width 37: "com" + hyphen string "-"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 228: "with its legs hanging down, "
+ text run at (234,117) width 103: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely"
+ text run at (7,161) width 93: "straightened."
+ RenderBlock (floating) {DIV} at (356,0) size 344x240
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 83x18
+ text run at (0,0) width 83: "The default ("
+ RenderInline {TT} at (0,0) size 196x15
+ RenderText {#text} at (82,2) size 196x15
+ text run at (82,2) width 196: "hyphenate-character: auto"
+ RenderText {#text} at (277,0) size 6x18
+ text run at (277,0) width 6: ")"
+ RenderBlock {DIV} at (0,50) size 344x190 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x176
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get" + hyphen string "-"
+ text run at (7,73) width 209: "ting its body tucked away, "
+ text run at (215,73) width 37: "com" + hyphen string "-"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 228: "with its legs hanging down, "
+ text run at (234,117) width 103: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely"
+ text run at (7,161) width 93: "straightened."
+ RenderBlock (floating) {DIV} at (4,240) size 344x240
+ RenderBlock {P} at (0,16) size 344x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "Bullet ("
+ RenderInline {TT} at (0,0) size 219x15
+ RenderText {#text} at (48,2) size 219x15
+ text run at (48,2) width 219: "hyphenate-character: \"\\2022\""
+ RenderText {#text} at (266,0) size 7x18
+ text run at (266,0) width 7: ")"
+ RenderBlock {DIV} at (0,50) size 344x190 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x176
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get" + hyphen string "\x{2022}"
+ text run at (7,73) width 208: "ting its body tucked away, "
+ text run at (214,73) width 38: "com" + hyphen string "\x{2022}"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 228: "with its legs hanging down, "
+ text run at (234,117) width 103: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely"
+ text run at (7,161) width 93: "straightened."
+ RenderBlock (floating) {DIV} at (356,240) size 356x240
+ RenderBlock {P} at (0,16) size 356x18
+ RenderText {#text} at (0,0) size 140x18
+ text run at (0,0) width 140: "Middle dot and tilde ("
+ RenderInline {TT} at (0,0) size 212x15
+ RenderText {#text} at (139,2) size 212x15
+ text run at (139,2) width 212: "hyphenate-character: \"\\B7~\""
+ RenderText {#text} at (350,0) size 6x18
+ text run at (350,0) width 6: ")"
+ RenderBlock {DIV} at (0,50) size 344x190 [border: (3px solid #000000)]
+ RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+ RenderText {#text} at (7,7) size 330x176
+ text run at (7,7) width 245: "The chief difficulty Alice found"
+ text run at (7,29) width 245: "at first was in managing her"
+ text run at (7,51) width 245: "flamingo: she succeeded in get" + hyphen string "\x{B7}~"
+ text run at (7,73) width 200: "ting its body tucked away, "
+ text run at (206,73) width 46: "com" + hyphen string "\x{B7}~"
+ text run at (7,95) width 245: "fortably enough, under her arm,"
+ text run at (7,117) width 228: "with its legs hanging down, "
+ text run at (234,117) width 103: "but generally,"
+ text run at (7,139) width 330: "just as she had got its neck nicely"
+ text run at (7,161) width 93: "straightened."
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttexthyphenatelimitbeforeafterexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt (199817 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt        2016-04-21 16:07:18 UTC (rev 199817)
+++ trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -53,15 +53,15 @@
</span><span class="cx"> RenderText {#text} at (434,123) size 4x18
</span><span class="cx"> text run at (434,123) width 4: " "
</span><span class="cx"> RenderBlock {DIV} at (446,84) size 126x60 [border: (3px solid #000000)]
</span><del>- RenderText {#text} at (3,3) size 89x54
</del><ins>+ RenderText {#text} at (3,3) size 74x54
</ins><span class="cx"> text run at (3,3) width 74: "There is re" + hyphen string "-"
</span><del>- text run at (3,21) width 89: "markable evi" + hyphen string "-"
- text run at (3,39) width 42: "dence."
</del><ins>+ text run at (3,21) width 60: "markable"
+ text run at (3,39) width 61: "evidence."
</ins><span class="cx"> RenderText {#text} at (580,123) size 4x18
</span><span class="cx"> text run at (580,123) width 4: " "
</span><span class="cx"> RenderBlock {DIV} at (592,84) size 126x60 [border: (3px solid #000000)]
</span><del>- RenderText {#text} at (3,3) size 101x54
</del><ins>+ RenderText {#text} at (3,3) size 72x54
</ins><span class="cx"> text run at (3,3) width 52: "There is"
</span><del>- text run at (3,21) width 101: "remarkable evi" + hyphen string "-"
- text run at (3,39) width 42: "dence."
</del><ins>+ text run at (3,21) width 72: "remarkable"
+ text run at (3,39) width 61: "evidence."
</ins><span class="cx"> RenderText {#text} at (0,0) size 0x0
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199817 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-21 16:07:18 UTC (rev 199817)
+++ trunk/Source/WebCore/ChangeLog        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-04-21 Dave Hyatt <hyatt@apple.com>
+
+ Don't hyphenate the last word in a paragraph of text.
+ https://bugs.webkit.org/show_bug.cgi?id=156803
+
+ Reviewed by Simon Fraser.
+
+ Added fast/text/hyphenate-avoid-orphaned-word.html
+
+ * rendering/RenderText.h:
+ * rendering/line/BreakingContext.h:
+ (WebCore::BreakingContext::handleText):
+
</ins><span class="cx"> 2016-04-21 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Drop [UsePointersEvenForNonNullableObjectArguments] from Range
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.h (199817 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.h        2016-04-21 16:07:18 UTC (rev 199817)
+++ trunk/Source/WebCore/rendering/RenderText.h        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -170,6 +170,8 @@
</span><span class="cx"> StringView stringView(int start = 0, int stop = -1) const;
</span><span class="cx">
</span><span class="cx"> LayoutUnit topOfFirstText() const;
</span><ins>+
+ bool containsOnlyWhitespace(unsigned from, unsigned len) const;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual void computePreferredLogicalWidths(float leadWidth);
</span><span class="lines">@@ -194,7 +196,6 @@
</span><span class="cx">
</span><span class="cx"> bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) final { ASSERT_NOT_REACHED(); return false; }
</span><span class="cx">
</span><del>- bool containsOnlyWhitespace(unsigned from, unsigned len) const;
</del><span class="cx"> float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const Font*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;
</span><span class="cx"> bool isAllASCII() const { return m_isAllASCII; }
</span><span class="cx"> bool computeUseBackslashAsYenSymbol() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (199817 => 199818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-04-21 16:07:18 UTC (rev 199817)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-04-21 16:25:13 UTC (rev 199818)
</span><span class="lines">@@ -794,6 +794,7 @@
</span><span class="cx"> bool keepAllWords = m_currentStyle->wordBreak() == KeepAllWordBreak;
</span><span class="cx"> float hyphenWidth = 0;
</span><span class="cx"> bool isLooseCJKMode = false;
</span><ins>+ bool isLineEmpty = m_lineInfo.isEmpty();
</ins><span class="cx">
</span><span class="cx"> if (isSVGText) {
</span><span class="cx"> breakWords = false;
</span><span class="lines">@@ -937,7 +938,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if ((lineWasTooWide || !m_width.fitsOnLine()) && !m_hangsAtEnd) {
</span><del>- if (canHyphenate && !m_width.fitsOnLine()) {
</del><ins>+ // Don't try to hyphenate at the final break of a block, since this means there is
+ // no more content, and a hyphenated single word would end up on a line by itself. This looks
+ // bad so just don't allow it.
+ if (canHyphenate && !m_width.fitsOnLine() && (m_nextObject || !renderText.containsOnlyWhitespace(m_current.offset(), renderText.textLength() - m_current.offset()) || isLineEmpty)) {
</ins><span class="cx"> m_lineBreakHistory.push([&](InlineIterator& modifyMe) {
</span><span class="cx"> tryHyphenating(renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</span><span class="cx"> });
</span><span class="lines">@@ -1045,6 +1049,8 @@
</span><span class="cx"> m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ isLineEmpty = m_lineInfo.isEmpty();
</ins><span class="cx"> } else {
</span><span class="cx"> if (m_ignoringSpaces) {
</span><span class="cx"> // Stop ignoring spaces and begin at this new point.
</span><span class="lines">@@ -1120,7 +1126,10 @@
</span><span class="cx"> m_includeEndWidth = false;
</span><span class="cx">
</span><span class="cx"> if (!fitsOnLineOrHangsAtEnd()) {
</span><del>- if (canHyphenate) {
</del><ins>+ // Don't try to hyphenate at the final break of a block, since this means there is
+ // no more content, and a hyphenated single word would end up on a line by itself. This looks
+ // bad so just don't allow it.
+ if (canHyphenate && (m_nextObject || isLineEmpty)) {
</ins><span class="cx"> m_lineBreakHistory.push([&](InlineIterator& modifyMe) {
</span><span class="cx"> tryHyphenating(renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</span><span class="cx"> });
</span></span></pre>
</div>
</div>
</body>
</html>