<!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>[211222] 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/211222">211222</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2017-01-26 11:36:27 -0800 (Thu, 26 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
https://bugs.webkit.org/show_bug.cgi?id=167439
&lt;rdar://problem/30180184&gt;

Reviewed by Antti Koivisto.

Source/WebCore:

Implement pre and post hyphen length constrains for simple line layout.

Tests: fast/text/simple-line-layout-hyphen-limit-after.html
       fast/text/simple-line-layout-hyphen-limit-before.html

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForStyle):
(WebCore::SimpleLineLayout::printReason):
* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): Same as normal line layout default values.
(WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition):
* rendering/SimpleLineLayoutTextFragmentIterator.h:

LayoutTests:

* fast/text/simple-line-layout-hyphen-limit-after.html: Added.
* fast/text/simple-line-layout-hyphen-limit-before-expected.html: Added.
* fast/text/simple-line-layout-hyphen-limit-before.html: Added.
* platform/mac/fast/text/hyphenate-limit-before-after-expected.txt: progression.</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="#trunkSourceWebCorerenderingSimpleLineLayoutcpp">trunk/Source/WebCore/rendering/SimpleLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorcpp">trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorh">trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasttextsimplelinelayouthyphenlimitafterexpectedhtml">trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasttextsimplelinelayouthyphenlimitafterhtml">trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after.html</a></li>
<li><a href="#trunkLayoutTestsfasttextsimplelinelayouthyphenlimitbeforeexpectedhtml">trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasttextsimplelinelayouthyphenlimitbeforehtml">trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/LayoutTests/ChangeLog        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-01-26  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
+        https://bugs.webkit.org/show_bug.cgi?id=167439
+        &lt;rdar://problem/30180184&gt;
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/simple-line-layout-hyphen-limit-after.html: Added.
+        * fast/text/simple-line-layout-hyphen-limit-before-expected.html: Added.
+        * fast/text/simple-line-layout-hyphen-limit-before.html: Added.
+        * platform/mac/fast/text/hyphenate-limit-before-after-expected.txt: progression.
+
</ins><span class="cx"> 2017-01-26  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking swipe/main-frame-pinning-requirement.html as flaky on El Capitan.
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextsimplelinelayouthyphenlimitafterexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after-expected.html (0 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after-expected.html        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that simple and normal line layout produce the same lines with hyphenate-limit-after&lt;/title&gt;
+&lt;style&gt;
+div {
+  display: inline-block;
+  -webkit-hyphens: auto;
+  width: 50px;
+  border: 1px solid green;
+  margin-right: 50px;
+  vertical-align: top;
+}
+&lt;/style&gt;
+&lt;script&gt;
+if (internal.settings)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 1;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 2;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 3;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 4;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 5;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 6;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 7;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 8;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasttextsimplelinelayouthyphenlimitafterhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after.html (0 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after.html                                (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-after.html        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that simple and normal line layout produce the same lines with hyphenate-limit-after&lt;/title&gt;
+&lt;style&gt;
+div {
+  display: inline-block;
+  -webkit-hyphens: auto;
+  width: 50px;
+  border: 1px solid green;
+  margin-right: 50px;
+  vertical-align: top;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 1;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 2;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 3;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 4;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 5;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 6;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 7;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-after: 8;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasttextsimplelinelayouthyphenlimitbeforeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before-expected.html (0 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before-expected.html        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that simple and normal line layout produce the same lines with hyphenate-limit-before&lt;/title&gt;
+&lt;style&gt;
+div {
+  display: inline-block;
+  -webkit-hyphens: auto;
+  width: 50px;
+  border: 1px solid green;
+  margin-right: 50px;
+  vertical-align: top;
+}
+&lt;/style&gt;
+&lt;script&gt;
+if (internal.settings)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 0;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 1;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 2;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 3;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 4;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 5;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 6;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 7;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasttextsimplelinelayouthyphenlimitbeforehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before.html (0 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before.html                                (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-hyphen-limit-before.html        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that simple and normal line layout produce the same lines with hyphenate-limit-before&lt;/title&gt;
+&lt;style&gt;
+div {
+  display: inline-block;
+  -webkit-hyphens: auto;
+  width: 50px;
+  border: 1px solid green;
+  margin-right: 50px;
+  vertical-align: top;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 0;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 1;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 2;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 3;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 4;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 5;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 6;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;div style=&quot;-webkit-hyphenate-limit-before: 7;&quot;&gt;accoutrements accessories anomalistic auspicious favorable prosperous circumlocution conviviality coruscant cuddlesome cynosure equanimity excogitate gasconading idiosyncratic luminescent magnanimous nidificate penultimate perfidiousness perspicacious proficuous profitable advantageous remunerative profitability saxicolous sesquipedalian superabundant unencumbered responsibilities unparagoned peerless&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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 (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-before-after-expected.txt        2017-01-26 19:36:27 UTC (rev 211222)
</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: &quot; &quot;
</span><span class="cx">       RenderBlock {DIV} at (446,84) size 126x60 [border: (3px solid #000000)]
</span><del>-        RenderText {#text} at (3,3) size 74x54
</del><ins>+        RenderText {#text} at (3,3) size 89x54
</ins><span class="cx">           text run at (3,3) width 74: &quot;There is re&quot; + hyphen string &quot;-&quot;
</span><del>-          text run at (3,21) width 60: &quot;markable&quot;
-          text run at (3,39) width 61: &quot;evidence.&quot;
</del><ins>+          text run at (3,21) width 89: &quot;markable evi&quot; + hyphen string &quot;-&quot;
+          text run at (3,39) width 42: &quot;dence.&quot;
</ins><span class="cx">       RenderText {#text} at (580,123) size 4x18
</span><span class="cx">         text run at (580,123) width 4: &quot; &quot;
</span><span class="cx">       RenderBlock {DIV} at (592,84) size 126x60 [border: (3px solid #000000)]
</span><del>-        RenderText {#text} at (3,3) size 72x54
</del><ins>+        RenderText {#text} at (3,3) size 101x54
</ins><span class="cx">           text run at (3,3) width 52: &quot;There is&quot;
</span><del>-          text run at (3,21) width 72: &quot;remarkable&quot;
-          text run at (3,39) width 61: &quot;evidence.&quot;
</del><ins>+          text run at (3,21) width 101: &quot;remarkable evi&quot; + hyphen string &quot;-&quot;
+          text run at (3,39) width 42: &quot;dence.&quot;
</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 (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/Source/WebCore/ChangeLog        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-01-26  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
+        https://bugs.webkit.org/show_bug.cgi?id=167439
+        &lt;rdar://problem/30180184&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Implement pre and post hyphen length constrains for simple line layout.
+
+        Tests: fast/text/simple-line-layout-hyphen-limit-after.html
+               fast/text/simple-line-layout-hyphen-limit-before.html
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForStyle):
+        (WebCore::SimpleLineLayout::printReason):
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+        (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): Same as normal line layout default values.
+        (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition):
+        * rendering/SimpleLineLayoutTextFragmentIterator.h:
+
</ins><span class="cx"> 2017-01-26  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Gamepad support shows wrong values for PS4 controllers (D-pad is missing).
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">     FlowHasRTLOrdering                    = 1LLU  &lt;&lt; 20,
</span><span class="cx">     FlowHasLineAlignEdges                 = 1LLU  &lt;&lt; 21,
</span><span class="cx">     FlowHasLineSnap                       = 1LLU  &lt;&lt; 22,
</span><del>-    FlowHasHypensLimit                    = 1LLU  &lt;&lt; 23,
</del><ins>+    FlowHasHypensLineLimit                = 1LLU  &lt;&lt; 23,
</ins><span class="cx">     FlowHasTextEmphasisFillOrMark         = 1LLU  &lt;&lt; 24,
</span><span class="cx">     FlowHasTextShadow                     = 1LLU  &lt;&lt; 25,
</span><span class="cx">     FlowHasPseudoFirstLine                = 1LLU  &lt;&lt; 26,
</span><span class="lines">@@ -237,10 +237,8 @@
</span><span class="cx">         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineAlignEdges, reasons, includeReasons);
</span><span class="cx">     if (style.lineSnap() != LineSnapNone)
</span><span class="cx">         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineSnap, reasons, includeReasons);
</span><del>-    if (style.hyphenationLimitBefore() != RenderStyle::initialHyphenationLimitBefore()
-        || style.hyphenationLimitAfter() != RenderStyle::initialHyphenationLimitAfter()
-        || style.hyphenationLimitLines() != RenderStyle::initialHyphenationLimitLines())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasHypensLimit, reasons, includeReasons);
</del><ins>+    if (style.hyphenationLimitLines() != RenderStyle::initialHyphenationLimitLines())
+        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasHypensLineLimit, reasons, includeReasons);
</ins><span class="cx">     if (style.textEmphasisFill() != TextEmphasisFillFilled || style.textEmphasisMark() != TextEmphasisMarkNone)
</span><span class="cx">         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasTextEmphasisFillOrMark, reasons, includeReasons);
</span><span class="cx">     if (style.textShadow())
</span><span class="lines">@@ -991,8 +989,8 @@
</span><span class="cx">     case FlowHasLineSnap:
</span><span class="cx">         stream &lt;&lt; &quot;-webkit-line-snap property&quot;;
</span><span class="cx">         break;
</span><del>-    case FlowHasHypensLimit:
-        stream &lt;&lt; &quot;hyphen-limit-* property&quot;;
</del><ins>+    case FlowHasHypensLineLimit:
+        stream &lt;&lt; &quot;-webkit-hyphenate-limit-lines property&quot;;
</ins><span class="cx">         break;
</span><span class="cx">     case FlowHasTextEmphasisFillOrMark:
</span><span class="cx">         stream &lt;&lt; &quot;text-emphasis (fill/mark)&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -49,6 +49,8 @@
</span><span class="cx">     , tabWidth(collapseWhitespace ? 0 : style.tabSize())
</span><span class="cx">     , shouldHyphenate(style.hyphens() == HyphensAuto &amp;&amp; canHyphenate(style.locale()))
</span><span class="cx">     , hyphenStringWidth(shouldHyphenate ? font.width(TextRun(style.hyphenString())) : 0)
</span><ins>+    , hyphenLimitBefore(style.hyphenationLimitBefore() &lt; 0 ? 2 : style.hyphenationLimitBefore())
+    , hyphenLimitAfter(style.hyphenationLimitAfter() &lt; 0 ? 2 : style.hyphenationLimitAfter())
</ins><span class="cx">     , locale(style.locale())
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -176,20 +178,28 @@
</span><span class="cx">     return runWidth(segment, from, to, xPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::optional&lt;unsigned&gt; TextFragmentIterator::lastHyphenPosition(const TextFragmentIterator::TextFragment&amp; run, unsigned beforeIndex) const
</del><ins>+std::optional&lt;unsigned&gt; TextFragmentIterator::lastHyphenPosition(const TextFragmentIterator::TextFragment&amp; run, unsigned before) const
</ins><span class="cx"> {
</span><del>-    ASSERT(run.start() &lt; beforeIndex);
</del><ins>+    ASSERT(run.start() &lt; before);
</ins><span class="cx">     auto&amp; segment = *m_currentSegment;
</span><del>-    ASSERT(segment.start &lt;= beforeIndex &amp;&amp; beforeIndex &lt;= segment.end);
</del><ins>+    ASSERT(segment.start &lt;= before &amp;&amp; before &lt;= segment.end);
</ins><span class="cx">     ASSERT(is&lt;RenderText&gt;(segment.renderer));
</span><span class="cx">     if (!m_style.shouldHyphenate || run.type() != TextFragment::NonWhitespace)
</span><span class="cx">         return std::nullopt;
</span><del>-    
</del><ins>+    // Check if there are enough characters in the run.
+    unsigned runLength = run.end() - run.start();
+    if (m_style.hyphenLimitBefore &gt;= runLength || m_style.hyphenLimitAfter &gt;= runLength || m_style.hyphenLimitBefore + m_style.hyphenLimitAfter &gt; runLength)
+        return std::nullopt;
</ins><span class="cx">     auto runStart = segment.toSegmentPosition(run.start());
</span><del>-    auto before = segment.toSegmentPosition(beforeIndex) - runStart;
</del><ins>+    auto beforeIndex = segment.toSegmentPosition(before) - runStart;
+    if (beforeIndex &lt;= m_style.hyphenLimitBefore)
+        return std::nullopt;
+    // Adjust before index to accommodate the limit-after value (this is the last potential hyphen location).
+    beforeIndex = std::min(beforeIndex, runLength - m_style.hyphenLimitAfter + 1);
</ins><span class="cx">     auto substringForHyphenation = StringView(segment.text).substring(runStart, run.end() - run.start());
</span><del>-    auto hyphenLocation = lastHyphenLocation(substringForHyphenation, before, m_style.locale);
-    if (hyphenLocation)
</del><ins>+    auto hyphenLocation = lastHyphenLocation(substringForHyphenation, beforeIndex, m_style.locale);
+    // Check if there are enough characters before and after the hyphen.
+    if (hyphenLocation &amp;&amp; hyphenLocation &gt;= m_style.hyphenLimitBefore &amp;&amp; m_style.hyphenLimitAfter &lt;= (runLength - hyphenLocation))
</ins><span class="cx">         return segment.toRenderPosition(hyphenLocation + runStart);
</span><span class="cx">     return std::nullopt;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h (211221 => 211222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h        2017-01-26 19:25:12 UTC (rev 211221)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h        2017-01-26 19:36:27 UTC (rev 211222)
</span><span class="lines">@@ -118,6 +118,8 @@
</span><span class="cx">         unsigned tabWidth;
</span><span class="cx">         bool shouldHyphenate;
</span><span class="cx">         float hyphenStringWidth;
</span><ins>+        unsigned hyphenLimitBefore;
+        unsigned hyphenLimitAfter;
</ins><span class="cx">         AtomicString locale;
</span><span class="cx">     };
</span><span class="cx">     const Style&amp; style() const { return m_style; }
</span></span></pre>
</div>
</div>

</body>
</html>