<!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>[204531] trunk/Source</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/204531">204531</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-08-16 15:39:10 -0700 (Tue, 16 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Migrate line breaking code from ints to Optional&lt;unsigned&gt;s
https://bugs.webkit.org/show_bug.cgi?id=160859

Reviewed by Darin Adler.

Source/WebCore:

Previously, we were using -1 to mean &quot;before the beginning of the string&quot;. Now,
Nullopt means that.

This patch also renames break_lines.{h,cpp} to BreakLines.{h.cpp}. This file was
originally named during the KHTML days.

No new tests because there is no behavior change.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/BreakLines.cpp: Renamed from Source/WebCore/rendering/break_lines.cpp.
* rendering/BreakLines.h: Renamed from Source/WebCore/rendering/break_lines.h.
(WebCore::isBreakableSpace):
(WebCore::shouldBreakAfter):
(WebCore::needsLineBreakIterator):
(WebCore::nextBreakablePositionNonLoosely):
(WebCore::nextBreakablePositionLoosely):
(WebCore::nextBreakablePositionKeepingAllWords):
(WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP):
(WebCore::nextBreakablePosition):
(WebCore::nextBreakablePositionIgnoringNBSP):
(WebCore::nextBreakablePositionLoose):
(WebCore::nextBreakablePositionIgnoringNBSPLoose):
(WebCore::isBreakable):
* rendering/InlineIterator.h:
(WebCore::InlineIterator::moveTo):
(WebCore::InlineIterator::nextBreakablePosition):
(WebCore::InlineIterator::setNextBreakablePosition):
(WebCore::InlineIterator::InlineIterator): Deleted.
* rendering/InlineTextBox.cpp:
* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths):
* rendering/RenderingAllInOne.cpp:
* rendering/SimpleLineLayoutTextFragmentIterator.h:
* rendering/break_lines.h:
(WebCore::isBreakableSpace): Deleted.
(WebCore::shouldBreakAfter): Deleted.
(WebCore::needsLineBreakIterator): Deleted.
(WebCore::nextBreakablePositionNonLoosely): Deleted.
(WebCore::nextBreakablePositionLoosely): Deleted.
(WebCore::nextBreakablePositionKeepingAllWords): Deleted.
(WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP): Deleted.
(WebCore::nextBreakablePosition): Deleted.
(WebCore::nextBreakablePositionIgnoringNBSP): Deleted.
(WebCore::nextBreakablePositionLoose): Deleted.
(WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
(WebCore::isBreakable): Deleted.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::commitLineBreakAtCurrentWidth):
(WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition):
(WebCore::BreakingContext::InlineIteratorHistory::moveTo):
(WebCore::tryHyphenating):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):

Source/WebKit/ios:

* Misc/WebUIKitSupport.mm:
(WebKitGetLastLineBreakInBuffer):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtftextTextBreakIteratorh">trunk/Source/WTF/wtf/text/TextBreakIterator.h</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineIteratorh">trunk/Source/WebCore/rendering/InlineIterator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextcpp">trunk/Source/WebCore/rendering/RenderText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderingAllInOnecpp">trunk/Source/WebCore/rendering/RenderingAllInOne.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>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContexth">trunk/Source/WebCore/rendering/line/BreakingContext.h</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosMiscWebUIKitSupportmm">trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingBreakLinescpp">trunk/Source/WebCore/rendering/BreakLines.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingBreakLinesh">trunk/Source/WebCore/rendering/BreakLines.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingbreak_linescpp">trunk/Source/WebCore/rendering/break_lines.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingbreak_linesh">trunk/Source/WebCore/rendering/break_lines.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFwtftextTextBreakIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/TextBreakIterator.h (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/TextBreakIterator.h        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WTF/wtf/text/TextBreakIterator.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -78,8 +78,8 @@
</span><span class="cx">         resetPriorContext();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    LazyLineBreakIterator(String string, const AtomicString&amp; locale = AtomicString(), LineBreakIteratorMode mode = LineBreakIteratorModeUAX14)
-        : m_string(string)
</del><ins>+    LazyLineBreakIterator(StringView stringView, const AtomicString&amp; locale = AtomicString(), LineBreakIteratorMode mode = LineBreakIteratorModeUAX14)
+        : m_stringView(stringView)
</ins><span class="cx">         , m_locale(locale)
</span><span class="cx">         , m_iterator(nullptr)
</span><span class="cx">         , m_cachedPriorContext(nullptr)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">             releaseLineBreakIterator(m_iterator);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    String string() const { return m_string; }
</del><ins>+    StringView stringView() const { return m_stringView; }
</ins><span class="cx">     bool isLooseCJKMode() const { return m_isCJK &amp;&amp; m_mode == LineBreakIteratorModeUAX14Loose; }
</span><span class="cx"> 
</span><span class="cx">     UChar lastCharacter() const
</span><span class="lines">@@ -152,21 +152,21 @@
</span><span class="cx">         ASSERT(priorContextLength &lt;= priorContextCapacity);
</span><span class="cx">         const UChar* priorContext = priorContextLength ? &amp;m_priorContext[priorContextCapacity - priorContextLength] : 0;
</span><span class="cx">         if (!m_iterator) {
</span><del>-            m_iterator = acquireLineBreakIterator(m_string, m_locale, priorContext, priorContextLength, m_mode, m_isCJK);
</del><ins>+            m_iterator = acquireLineBreakIterator(m_stringView, m_locale, priorContext, priorContextLength, m_mode, m_isCJK);
</ins><span class="cx">             m_cachedPriorContext = priorContext;
</span><span class="cx">             m_cachedPriorContextLength = priorContextLength;
</span><span class="cx">         } else if (priorContext != m_cachedPriorContext || priorContextLength != m_cachedPriorContextLength) {
</span><del>-            resetStringAndReleaseIterator(m_string, m_locale, m_mode);
</del><ins>+            resetStringAndReleaseIterator(m_stringView, m_locale, m_mode);
</ins><span class="cx">             return this-&gt;get(priorContextLength);
</span><span class="cx">         }
</span><span class="cx">         return m_iterator;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void resetStringAndReleaseIterator(String string, const AtomicString&amp; locale, LineBreakIteratorMode mode)
</del><ins>+    void resetStringAndReleaseIterator(StringView stringView, const AtomicString&amp; locale, LineBreakIteratorMode mode)
</ins><span class="cx">     {
</span><span class="cx">         if (m_iterator)
</span><span class="cx">             releaseLineBreakIterator(m_iterator);
</span><del>-        m_string = string;
</del><ins>+        m_stringView = stringView;
</ins><span class="cx">         m_locale = locale;
</span><span class="cx">         m_iterator = nullptr;
</span><span class="cx">         m_cachedPriorContext = nullptr;
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     static const unsigned priorContextCapacity = 2;
</span><del>-    String m_string;
</del><ins>+    StringView m_stringView;
</ins><span class="cx">     AtomicString m_locale;
</span><span class="cx">     TextBreakIterator* m_iterator;
</span><span class="cx">     const UChar* m_cachedPriorContext;
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -2412,6 +2412,7 @@
</span><span class="cx">     rendering/AutoTableLayout.cpp
</span><span class="cx">     rendering/BidiRun.cpp
</span><span class="cx">     rendering/BorderEdge.cpp
</span><ins>+    rendering/BreakLines.cpp
</ins><span class="cx">     rendering/ClipRect.cpp
</span><span class="cx">     rendering/CounterNode.cpp
</span><span class="cx">     rendering/EllipsisBox.cpp
</span><span class="lines">@@ -2530,7 +2531,6 @@
</span><span class="cx">     rendering/TextDecorationPainter.cpp
</span><span class="cx">     rendering/TextPaintStyle.cpp
</span><span class="cx">     rendering/TextPainter.cpp
</span><del>-    rendering/break_lines.cpp
</del><span class="cx"> 
</span><span class="cx">     rendering/line/LineBreaker.cpp
</span><span class="cx">     rendering/line/LineInfo.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/ChangeLog        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2016-08-16  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate line breaking code from ints to Optional&lt;unsigned&gt;s
+        https://bugs.webkit.org/show_bug.cgi?id=160859
+
+        Reviewed by Darin Adler.
+
+        Previously, we were using -1 to mean &quot;before the beginning of the string&quot;. Now,
+        Nullopt means that.
+
+        This patch also renames break_lines.{h,cpp} to BreakLines.{h.cpp}. This file was
+        originally named during the KHTML days.
+
+        No new tests because there is no behavior change.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/BreakLines.cpp: Renamed from Source/WebCore/rendering/break_lines.cpp.
+        * rendering/BreakLines.h: Renamed from Source/WebCore/rendering/break_lines.h.
+        (WebCore::isBreakableSpace):
+        (WebCore::shouldBreakAfter):
+        (WebCore::needsLineBreakIterator):
+        (WebCore::nextBreakablePositionNonLoosely):
+        (WebCore::nextBreakablePositionLoosely):
+        (WebCore::nextBreakablePositionKeepingAllWords):
+        (WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP):
+        (WebCore::nextBreakablePosition):
+        (WebCore::nextBreakablePositionIgnoringNBSP):
+        (WebCore::nextBreakablePositionLoose):
+        (WebCore::nextBreakablePositionIgnoringNBSPLoose):
+        (WebCore::isBreakable):
+        * rendering/InlineIterator.h:
+        (WebCore::InlineIterator::moveTo):
+        (WebCore::InlineIterator::nextBreakablePosition):
+        (WebCore::InlineIterator::setNextBreakablePosition):
+        (WebCore::InlineIterator::InlineIterator): Deleted.
+        * rendering/InlineTextBox.cpp:
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::computePreferredLogicalWidths):
+        * rendering/RenderingAllInOne.cpp:
+        * rendering/SimpleLineLayoutTextFragmentIterator.h:
+        * rendering/break_lines.h:
+        (WebCore::isBreakableSpace): Deleted.
+        (WebCore::shouldBreakAfter): Deleted.
+        (WebCore::needsLineBreakIterator): Deleted.
+        (WebCore::nextBreakablePositionNonLoosely): Deleted.
+        (WebCore::nextBreakablePositionLoosely): Deleted.
+        (WebCore::nextBreakablePositionKeepingAllWords): Deleted.
+        (WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP): Deleted.
+        (WebCore::nextBreakablePosition): Deleted.
+        (WebCore::nextBreakablePositionIgnoringNBSP): Deleted.
+        (WebCore::nextBreakablePositionLoose): Deleted.
+        (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
+        (WebCore::isBreakable): Deleted.
+        * rendering/line/BreakingContext.h:
+        (WebCore::BreakingContext::commitLineBreakAtCurrentWidth):
+        (WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition):
+        (WebCore::BreakingContext::InlineIteratorHistory::moveTo):
+        (WebCore::tryHyphenating):
+        (WebCore::BreakingContext::handleText):
+        (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
+
</ins><span class="cx"> 2016-08-16  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DOM4: getElementsByClassName should include non StyledElements
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -5671,8 +5671,7 @@
</span><span class="cx">                 BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */; };
</span><span class="cx">                 BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 BCEA4852097D93020094C9E4 /* RenderBlockLineLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4813097D93020094C9E4 /* RenderBlockLineLayout.cpp */; };
</span><del>-                BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4815097D93020094C9E4 /* break_lines.cpp */; };
-                BCEA4855097D93020094C9E4 /* break_lines.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4816097D93020094C9E4 /* break_lines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                BCEA4854097D93020094C9E4 /* BreakLines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4815097D93020094C9E4 /* BreakLines.cpp */; };
</ins><span class="cx">                 BCEA4859097D93020094C9E4 /* InlineTextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481A097D93020094C9E4 /* InlineTextBox.cpp */; };
</span><span class="cx">                 BCEA485A097D93020094C9E4 /* InlineTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481B097D93020094C9E4 /* InlineTextBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4820097D93020094C9E4 /* RenderBlock.cpp */; };
</span><span class="lines">@@ -5791,6 +5790,7 @@
</span><span class="cx">                 C280833F1C6DC26F001451B6 /* JSFontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = C280833E1C6DC22C001451B6 /* JSFontFace.h */; };
</span><span class="cx">                 C28083401C6DC275001451B6 /* JSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C280833D1C6DC22C001451B6 /* JSFontFace.cpp */; };
</span><span class="cx">                 C28083421C6DC96A001451B6 /* JSFontFaceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */; };
</span><ins>+                C2E1F43F1D6254E10094625C /* BreakLines.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4816097D93020094C9E4 /* BreakLines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 C330A22313EC196B0000B45B /* ColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = C330A22113EC196B0000B45B /* ColorChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; };
</span><span class="cx">                 C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; };
</span><span class="lines">@@ -13490,8 +13490,8 @@
</span><span class="cx">                 BCEA4789097CAAC80094C9E4 /* CSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BCEA478C097CAAC80094C9E4 /* CSSValueKeywords.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BCEA4813097D93020094C9E4 /* RenderBlockLineLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderBlockLineLayout.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                BCEA4815097D93020094C9E4 /* break_lines.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = break_lines.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                BCEA4816097D93020094C9E4 /* break_lines.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = break_lines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                BCEA4815097D93020094C9E4 /* BreakLines.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BreakLines.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                BCEA4816097D93020094C9E4 /* BreakLines.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BreakLines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 BCEA481A097D93020094C9E4 /* InlineTextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBox.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BCEA481B097D93020094C9E4 /* InlineTextBox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InlineTextBox.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BCEA4820097D93020094C9E4 /* RenderBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderBlock.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23634,8 +23634,8 @@
</span><span class="cx">                                 BCE789851120E7A60060ECE5 /* BidiRun.h */,
</span><span class="cx">                                 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */,
</span><span class="cx">                                 589556EC18D4A44000764B03 /* BorderEdge.h */,
</span><del>-                                BCEA4815097D93020094C9E4 /* break_lines.cpp */,
-                                BCEA4816097D93020094C9E4 /* break_lines.h */,
</del><ins>+                                BCEA4815097D93020094C9E4 /* BreakLines.cpp */,
+                                BCEA4816097D93020094C9E4 /* BreakLines.h */,
</ins><span class="cx">                                 FB92DF4915FED08700994433 /* ClipPathOperation.h */,
</span><span class="cx">                                 5803715F1A66F00A00BAF519 /* ClipRect.cpp */,
</span><span class="cx">                                 580371601A66F00A00BAF519 /* ClipRect.h */,
</span><span class="lines">@@ -24918,7 +24918,6 @@
</span><span class="cx">                                 589556ED18D4A44000764B03 /* BorderEdge.h in Headers */,
</span><span class="cx">                                 BC5EB5DB0E81B7EA00B25965 /* BorderValue.h in Headers */,
</span><span class="cx">                                 6ED8C37A183BFF8C009E53BD /* BoxShape.h in Headers */,
</span><del>-                                BCEA4855097D93020094C9E4 /* break_lines.h in Headers */,
</del><span class="cx">                                 93309DDB099E64920056E581 /* BreakBlockquoteCommand.h in Headers */,
</span><span class="cx">                                 599E759011055A1F00D904FA /* Bridge.h in Headers */,
</span><span class="cx">                                 59B5977511086579007159E8 /* BridgeJSC.h in Headers */,
</span><span class="lines">@@ -26119,6 +26118,7 @@
</span><span class="cx">                                 FDF09DC91399B62200688E5B /* JSBiquadFilterNode.h in Headers */,
</span><span class="cx">                                 2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */,
</span><span class="cx">                                 14DCF3B31B6BE2080062D4C3 /* JSByteLengthQueuingStrategy.h in Headers */,
</span><ins>+                                C2E1F43F1D6254E10094625C /* BreakLines.h in Headers */,
</ins><span class="cx">                                 1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */,
</span><span class="cx">                                 65DF323A09D1DE65000BE325 /* JSCanvasGradient.h in Headers */,
</span><span class="cx">                                 65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */,
</span><span class="lines">@@ -28809,7 +28809,7 @@
</span><span class="cx">                                 976D6C7E122B8A3D001FD1F7 /* BlobURL.cpp in Sources */,
</span><span class="cx">                                 58AEE2F418D4BCCF0022E7FE /* BorderEdge.cpp in Sources */,
</span><span class="cx">                                 6ED8C379183BFF8C009E53BD /* BoxShape.cpp in Sources */,
</span><del>-                                BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */,
</del><ins>+                                BCEA4854097D93020094C9E4 /* BreakLines.cpp in Sources */,
</ins><span class="cx">                                 93309DDA099E64920056E581 /* BreakBlockquoteCommand.cpp in Sources */,
</span><span class="cx">                                 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */,
</span><span class="cx">                                 7A45032F18DB717200377B34 /* BufferedLineReader.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingBreakLinescppfromrev204530trunkSourceWebCorerenderingbreak_linescpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/BreakLines.cpp (from rev 204530, trunk/Source/WebCore/rendering/break_lines.cpp) (0 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/BreakLines.cpp                                (rev 0)
+++ trunk/Source/WebCore/rendering/BreakLines.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+/*
+ * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;BreakLines.h&quot;
+
+#include &lt;wtf/ASCIICType.h&gt;
+#include &lt;wtf/StdLibExtras.h&gt;
+#include &lt;wtf/unicode/CharacterNames.h&gt;
+
+namespace WebCore {
+
+// Pack 8 bits into one byte
+#define B(a, b, c, d, e, f, g, h) \
+    ((a) | ((b) &lt;&lt; 1) | ((c) &lt;&lt; 2) | ((d) &lt;&lt; 3) | ((e) &lt;&lt; 4) | ((f) &lt;&lt; 5) | ((g) &lt;&lt; 6) | ((h) &lt;&lt; 7))
+
+// Line breaking table row for each digit (0-9)
+#define DI { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
+// Line breaking table row for ascii letters (a-z A-Z)
+#define AL { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
+#define F 0xFF
+
+// Line breaking table for printable ASCII characters. Line breaking opportunities in this table are as below:
+// - before opening punctuations such as '(', '&lt;', '[', '{' after certain characters (compatible with Firefox 3.6);
+// - after '-' and '?' (backward-compatible, and compatible with Internet Explorer).
+// Please refer to &lt;https://bugs.webkit.org/show_bug.cgi?id=37698&gt; for line breaking matrixes of different browsers
+// and the ICU standard.
+WEBCORE_EXPORT const unsigned char lineBreakTable[][lineBreakTableColumnCount] = {
+    //  !  &quot;  #  $  %  &amp;  '  (     )  *  +  ,  -  .  /  0  1-8   9  :  ;  &lt;  =  &gt;  ?  @     A-X      Y  Z  [  \  ]  ^  _  `     a-x      y  z  {  |  }  ~  DEL
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // !
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &quot;
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // #
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // $
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // %
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &amp;
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // '
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // (
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // )
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // *
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // +
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ,
+    { B(1, 1, 1, 1, 1, 1, 1, 1), B(1, 1, 1, 1, 1, 0, 1, 0), 0, B(0, 1, 1, 1, 1, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 1, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 1, 1, 1, 1) }, // - Note: breaking before '0'-'9' is handled hard-coded in shouldBreakAfter().
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // .
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // /
+    DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI, // 0-9
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // :
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ;
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // &lt;
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // =
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &gt;
+    { B(0, 0, 1, 1, 1, 1, 0, 1), B(0, 1, 1, 0, 1, 0, 0, 1), F, B(1, 0, 0, 1, 1, 1, 0, 1), F, F, F, B(1, 1, 1, 1, 0, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 0, 1, 1, 0) }, // ?
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // @
+    AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL, // A-Z
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // [
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // '\'
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ]
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // ^
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // _
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // `
+    AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL, // a-z
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // {
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // |
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // }
+    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ~
+    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // DEL
+};
+
+#undef B
+#undef F
+#undef DI
+#undef AL
+
+COMPILE_ASSERT(WTF_ARRAY_LENGTH(lineBreakTable) == lineBreakTableLastCharacter - lineBreakTableFirstCharacter + 1, TestLineBreakTableConsistency);
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingBreakLinesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/BreakLines.h (0 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/BreakLines.h                                (rev 0)
+++ trunk/Source/WebCore/rendering/BreakLines.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -0,0 +1,255 @@
</span><ins>+/*
+ * Copyright (C) 2005, 2007, 2010, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#pragma once
+
+#include &lt;unicode/ubrk.h&gt;
+#include &lt;wtf/ASCIICType.h&gt;
+#include &lt;wtf/StdLibExtras.h&gt;
+#include &lt;wtf/text/TextBreakIterator.h&gt;
+#include &lt;wtf/unicode/CharacterNames.h&gt;
+
+namespace WebCore {
+
+static const UChar lineBreakTableFirstCharacter = '!';
+static const UChar lineBreakTableLastCharacter = 127;
+static const unsigned lineBreakTableColumnCount = (lineBreakTableLastCharacter - lineBreakTableFirstCharacter) / 8 + 1;
+
+WEBCORE_EXPORT extern const unsigned char lineBreakTable[][lineBreakTableColumnCount];
+
+enum class NonBreakingSpaceBehavior {
+    IgnoreNonBreakingSpace,
+    TreatNonBreakingSpaceAsBreak,
+};
+
+template&lt;NonBreakingSpaceBehavior nonBreakingSpaceBehavior&gt;
+static inline bool isBreakableSpace(UChar character)
+{
+    switch (character) {
+    case ' ':
+    case '\n':
+    case '\t':
+        return true;
+    case noBreakSpace:
+        return nonBreakingSpaceBehavior == NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak;
+    default:
+        return false;
+    }
+}
+
+inline bool shouldBreakAfter(UChar lastCharacter, UChar character, UChar nextCharacter)
+{
+    // Don't allow line breaking between '-' and a digit if the '-' may mean a minus sign in the context,
+    // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long URLs.
+    if (character == '-' &amp;&amp; isASCIIDigit(nextCharacter))
+        return isASCIIAlphanumeric(lastCharacter);
+
+    // If both ch and nextCh are ASCII characters, use a lookup table for enhanced speed and for compatibility
+    // with other browsers (see comments for asciiLineBreakTable for details).
+    if (character &gt;= lineBreakTableFirstCharacter &amp;&amp; character &lt;= lineBreakTableLastCharacter &amp;&amp; nextCharacter &gt;= lineBreakTableFirstCharacter &amp;&amp; nextCharacter &lt;= lineBreakTableLastCharacter) {
+        const unsigned char* tableRow = lineBreakTable[character - lineBreakTableFirstCharacter];
+        unsigned nextCharacterIndex = nextCharacter - lineBreakTableFirstCharacter;
+        return tableRow[nextCharacterIndex / 8] &amp; (1 &lt;&lt; (nextCharacterIndex % 8));
+    }
+    // Otherwise defer to the Unicode algorithm by returning false.
+    return false;
+}
+
+template&lt;NonBreakingSpaceBehavior nonBreakingSpaceBehavior&gt;
+inline bool needsLineBreakIterator(UChar character)
+{
+    if (nonBreakingSpaceBehavior == NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak)
+        return character &gt; lineBreakTableLastCharacter;
+    return character &gt; lineBreakTableLastCharacter &amp;&amp; character != noBreakSpace;
+}
+
+// When in non-loose mode, we can use the ASCII shortcut table.
+template&lt;typename CharacterType, NonBreakingSpaceBehavior nonBreakingSpaceBehavior&gt;
+inline unsigned nextBreakablePositionNonLoosely(LazyLineBreakIterator&amp; lazyBreakIterator, const CharacterType* string, unsigned length, unsigned startPosition)
+{
+    Optional&lt;unsigned&gt; nextBreak;
+
+    CharacterType lastLastCharacter = startPosition &gt; 1 ? string[startPosition - 2] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.secondToLastCharacter());
+    CharacterType lastCharacter = startPosition &gt; 0 ? string[startPosition - 1] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.lastCharacter());
+    unsigned priorContextLength = lazyBreakIterator.priorContextLength();
+    for (unsigned i = startPosition; i &lt; length; i++) {
+        CharacterType character = string[i];
+
+        // Non-loose mode, so use ASCII shortcut (shouldBreakAfter) if not breakable space.
+        if (isBreakableSpace&lt;nonBreakingSpaceBehavior&gt;(character) || shouldBreakAfter(lastLastCharacter, lastCharacter, character))
+            return i;
+
+        // Non-loose mode, so conditionally use break iterator.
+        if (needsLineBreakIterator&lt;nonBreakingSpaceBehavior&gt;(character) || needsLineBreakIterator&lt;nonBreakingSpaceBehavior&gt;(lastCharacter)) {
+            if (!nextBreak || nextBreak.value() &lt; i) {
+                // Don't break if positioned at start of primary context and there is no prior context.
+                if (i || priorContextLength) {
+                    TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);
+                    if (breakIterator) {
+                        int candidate = textBreakFollowing(breakIterator, i - 1 + priorContextLength);
+                        if (candidate == TextBreakDone)
+                            nextBreak = Nullopt;
+                        else {
+                            unsigned result = candidate;
+                            ASSERT(result &gt;= priorContextLength);
+                            nextBreak = result - priorContextLength;
+                        }
+                    }
+                }
+            }
+            if (i == nextBreak &amp;&amp; !isBreakableSpace&lt;nonBreakingSpaceBehavior&gt;(lastCharacter))
+                return i;
+        }
+
+        lastLastCharacter = lastCharacter;
+        lastCharacter = character;
+    }
+
+    return length;
+}
+
+// When in loose mode, we can't use the ASCII shortcut table since loose mode allows &quot;$100&quot; to break after '$' in content marked as CJK.
+// N.B. It should be possible to combine the following with the non-loose version above by adding a LooseBehavior template parameter;
+// however, when doing this, a 10% performance regression appeared on chromium-win (https://bugs.webkit.org/show_bug.cgi?id=89235#c112).
+template&lt;typename CharacterType, NonBreakingSpaceBehavior nonBreakingSpaceBehavior&gt;
+static inline unsigned nextBreakablePositionLoosely(LazyLineBreakIterator&amp; lazyBreakIterator, const CharacterType* string, unsigned length, unsigned startPosition)
+{
+    Optional&lt;unsigned&gt; nextBreak;
+
+    CharacterType lastCharacter = startPosition &gt; 0 ? string[startPosition - 1] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.lastCharacter());
+    unsigned priorContextLength = lazyBreakIterator.priorContextLength();
+    for (unsigned i = startPosition; i &lt; length; i++) {
+        CharacterType character = string[i];
+
+        // Always loose mode, so don't use ASCII shortcut (shouldBreakAfter).
+        if (isBreakableSpace&lt;nonBreakingSpaceBehavior&gt;(character))
+            return i;
+
+        // Always use line break iterator in loose mode.
+        if (!nextBreak || nextBreak.value() &lt; i) {
+            // Don't break if positioned at start of primary context and there is no prior context.
+            if (i || priorContextLength) {
+                TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);
+                if (breakIterator) {
+                    ASSERT(i + priorContextLength &gt;= 1);
+                    int candidate = textBreakFollowing(breakIterator, i + priorContextLength - 1);
+                    if (candidate == TextBreakDone)
+                        nextBreak = Nullopt;
+                    else {
+                        unsigned result = candidate;
+                        ASSERT(result &gt; priorContextLength);
+                        nextBreak = result - priorContextLength;
+                    }
+                }
+            }
+        }
+        if (i == nextBreak &amp;&amp; !isBreakableSpace&lt;nonBreakingSpaceBehavior&gt;(lastCharacter))
+            return i;
+
+        lastCharacter = character;
+    }
+
+    return length;
+}
+
+template&lt;typename CharacterType, NonBreakingSpaceBehavior nonBreakingSpaceBehavior&gt;
+inline unsigned nextBreakablePositionKeepingAllWords(const CharacterType* string, unsigned length, unsigned startPosition)
+{
+    for (unsigned i = startPosition; i &lt; length; i++) {
+        if (isBreakableSpace&lt;nonBreakingSpaceBehavior&gt;(string[i]))
+            return i;
+    }
+    return length;
+}
+
+inline unsigned nextBreakablePositionKeepingAllWords(LazyLineBreakIterator&amp; lazyBreakIterator, unsigned startPosition)
+{
+    auto stringView = lazyBreakIterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionKeepingAllWords&lt;LChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionKeepingAllWords&lt;UChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline unsigned nextBreakablePositionKeepingAllWordsIgnoringNBSP(LazyLineBreakIterator&amp; iterator, unsigned startPosition)
+{
+    auto stringView = iterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionKeepingAllWords&lt;LChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionKeepingAllWords&lt;UChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline unsigned nextBreakablePosition(LazyLineBreakIterator&amp; iterator, unsigned startPosition)
+{
+    auto stringView = iterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionNonLoosely&lt;LChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(iterator, stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionNonLoosely&lt;UChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(iterator, stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline unsigned nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator&amp; lazyBreakIterator, unsigned startPosition)
+{
+    auto stringView = lazyBreakIterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionNonLoosely&lt;LChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(lazyBreakIterator, stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionNonLoosely&lt;UChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(lazyBreakIterator, stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline unsigned nextBreakablePositionLoose(LazyLineBreakIterator&amp; lazyBreakIterator, unsigned startPosition)
+{
+    auto stringView = lazyBreakIterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionLoosely&lt;LChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(lazyBreakIterator, stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionLoosely&lt;UChar, NonBreakingSpaceBehavior::TreatNonBreakingSpaceAsBreak&gt;(lazyBreakIterator, stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline unsigned nextBreakablePositionIgnoringNBSPLoose(LazyLineBreakIterator&amp; lazyBreakIterator, unsigned startPosition)
+{
+    auto stringView = lazyBreakIterator.stringView();
+    if (stringView.is8Bit())
+        return nextBreakablePositionLoosely&lt;LChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(lazyBreakIterator, stringView.characters8(), stringView.length(), startPosition);
+    return nextBreakablePositionLoosely&lt;UChar, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(lazyBreakIterator, stringView.characters16(), stringView.length(), startPosition);
+}
+
+inline bool isBreakable(LazyLineBreakIterator&amp; lazyBreakIterator, unsigned startPosition, Optional&lt;unsigned&gt;&amp; nextBreakable, bool breakNBSP, bool isLooseMode, bool keepAllWords)
+{
+    if (nextBreakable &amp;&amp; nextBreakable.value() &gt;= startPosition)
+        return startPosition == nextBreakable;
+
+    if (keepAllWords) {
+        if (breakNBSP)
+            nextBreakable = nextBreakablePositionKeepingAllWords(lazyBreakIterator, startPosition);
+        else
+            nextBreakable = nextBreakablePositionKeepingAllWordsIgnoringNBSP(lazyBreakIterator, startPosition);
+    } else if (isLooseMode) {
+        if (breakNBSP)
+            nextBreakable = nextBreakablePositionLoose(lazyBreakIterator, startPosition);
+        else
+            nextBreakable = nextBreakablePositionIgnoringNBSPLoose(lazyBreakIterator, startPosition);
+    } else {
+        if (breakNBSP)
+            nextBreakable = nextBreakablePosition(lazyBreakIterator, startPosition);
+        else
+            nextBreakable = nextBreakablePositionIgnoringNBSP(lazyBreakIterator, startPosition);
+    }
+    return startPosition == nextBreakable;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineIterator.h (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineIterator.h        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/InlineIterator.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -53,11 +53,6 @@
</span><span class="cx"> class InlineIterator {
</span><span class="cx"> public:
</span><span class="cx">     InlineIterator()
</span><del>-        : m_root(nullptr)
-        , m_renderer(nullptr)
-        , m_nextBreakablePosition(-1)
-        , m_pos(0)
-        , m_refersToEndOfPreviousNode(false)
</del><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -64,7 +59,6 @@
</span><span class="cx">     InlineIterator(RenderElement* root, RenderObject* o, unsigned p)
</span><span class="cx">         : m_root(root)
</span><span class="cx">         , m_renderer(o)
</span><del>-        , m_nextBreakablePosition(-1)
</del><span class="cx">         , m_pos(p)
</span><span class="cx">         , m_refersToEndOfPreviousNode(false)
</span><span class="cx">     {
</span><span class="lines">@@ -77,7 +71,7 @@
</span><span class="cx">         moveTo(object, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void moveTo(RenderObject* object, unsigned offset, int nextBreak = -1)
</del><ins>+    void moveTo(RenderObject* object, unsigned offset, Optional&lt;unsigned&gt; nextBreak = Nullopt)
</ins><span class="cx">     {
</span><span class="cx">         setRenderer(object);
</span><span class="cx">         setOffset(offset);
</span><span class="lines">@@ -89,8 +83,8 @@
</span><span class="cx">     unsigned offset() const { return m_pos; }
</span><span class="cx">     void setOffset(unsigned position);
</span><span class="cx">     RenderElement* root() const { return m_root; }
</span><del>-    int nextBreakablePosition() const { return m_nextBreakablePosition; }
-    void setNextBreakablePosition(int position) { m_nextBreakablePosition = position; }
</del><ins>+    Optional&lt;unsigned&gt; nextBreakablePosition() const { return m_nextBreakablePosition; }
+    void setNextBreakablePosition(Optional&lt;unsigned&gt; position) { m_nextBreakablePosition = position; }
</ins><span class="cx">     bool refersToEndOfPreviousNode() const { return m_refersToEndOfPreviousNode; }
</span><span class="cx">     void setRefersToEndOfPreviousNode();
</span><span class="cx"> 
</span><span class="lines">@@ -118,11 +112,11 @@
</span><span class="cx"> 
</span><span class="cx">     UCharDirection surrogateTextDirection(UChar currentCodeUnit) const;
</span><span class="cx"> 
</span><del>-    RenderElement* m_root;
-    RenderObject* m_renderer;
</del><ins>+    RenderElement* m_root { nullptr };
+    RenderObject* m_renderer { nullptr };
</ins><span class="cx"> 
</span><del>-    int m_nextBreakablePosition;
-    unsigned m_pos;
</del><ins>+    Optional&lt;unsigned&gt; m_nextBreakablePosition;
+    unsigned m_pos { 0 };
</ins><span class="cx"> 
</span><span class="cx">     // There are a couple places where we want to decrement an InlineIterator.
</span><span class="cx">     // Usually this take the form of decrementing m_pos; however, m_pos might be 0.
</span><span class="lines">@@ -129,7 +123,7 @@
</span><span class="cx">     // However, we shouldn't ever need to decrement an InlineIterator more than
</span><span class="cx">     // once, so rather than implementing a decrement() function which traverses
</span><span class="cx">     // nodes, we can simply keep track of this state and handle it.
</span><del>-    bool m_refersToEndOfPreviousNode;
</del><ins>+    bool m_refersToEndOfPreviousNode { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool operator==(const InlineIterator&amp; it1, const InlineIterator&amp; it2)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;InlineTextBox.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;BreakLines.h&quot;
</ins><span class="cx"> #include &quot;Chrome.h&quot;
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><span class="cx"> #include &quot;DashArray.h&quot;
</span><span class="lines">@@ -50,7 +51,6 @@
</span><span class="cx"> #include &quot;TextDecorationPainter.h&quot;
</span><span class="cx"> #include &quot;TextPaintStyle.h&quot;
</span><span class="cx"> #include &quot;TextPainter.h&quot;
</span><del>-#include &quot;break_lines.h&quot;
</del><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.cpp (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.cpp        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/RenderText.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;RenderText.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AXObjectCache.h&quot;
</span><ins>+#include &quot;BreakLines.h&quot;
</ins><span class="cx"> #include &quot;BreakingContext.h&quot;
</span><span class="cx"> #include &quot;CharacterProperties.h&quot;
</span><span class="cx"> #include &quot;EllipsisBox.h&quot;
</span><span class="lines">@@ -46,7 +47,6 @@
</span><span class="cx"> #include &lt;wtf/text/TextBreakIterator.h&gt;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &quot;VisiblePosition.h&quot;
</span><del>-#include &quot;break_lines.h&quot;
</del><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuffer.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="lines">@@ -791,7 +791,7 @@
</span><span class="cx">     const RenderStyle&amp; style = this-&gt;style();
</span><span class="cx">     const FontCascade&amp; font = style.fontCascade(); // FIXME: This ignores first-line.
</span><span class="cx">     float wordSpacing = font.wordSpacing();
</span><del>-    int len = textLength();
</del><ins>+    unsigned len = textLength();
</ins><span class="cx">     LazyLineBreakIterator breakIterator(m_text, style.locale(), mapLineBreakToIteratorMode(style.lineBreak()));
</span><span class="cx">     bool needsWordSpacing = false;
</span><span class="cx">     bool ignoringSpaces = false;
</span><span class="lines">@@ -798,8 +798,8 @@
</span><span class="cx">     bool isSpace = false;
</span><span class="cx">     bool firstWord = true;
</span><span class="cx">     bool firstLine = true;
</span><del>-    int nextBreakable = -1;
-    int lastWordBoundary = 0;
</del><ins>+    Optional&lt;unsigned&gt; nextBreakable;
+    unsigned lastWordBoundary = 0;
</ins><span class="cx"> 
</span><span class="cx">     // Non-zero only when kerning is enabled, in which case we measure words with their trailing
</span><span class="cx">     // space, then subtract its width.
</span><span class="lines">@@ -833,7 +833,7 @@
</span><span class="cx">     bool keepAllWords = style.wordBreak() == KeepAllWordBreak;
</span><span class="cx">     bool isLooseCJKMode = breakIterator.isLooseCJKMode();
</span><span class="cx"> 
</span><del>-    for (int i = 0; i &lt; len; i++) {
</del><ins>+    for (unsigned i = 0; i &lt; len; i++) {
</ins><span class="cx">         UChar c = uncheckedCharacterAt(i);
</span><span class="cx"> 
</span><span class="cx">         bool previousCharacterIsSpace = isSpace;
</span><span class="lines">@@ -869,6 +869,7 @@
</span><span class="cx">             lastWordBoundary++;
</span><span class="cx">             continue;
</span><span class="cx">         } else if (c == softHyphen &amp;&amp; style.hyphens() != HyphensNone) {
</span><ins>+            ASSERT(i &gt;= lastWordBoundary);
</ins><span class="cx">             currMaxWidth += widthFromCache(font, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &amp;fallbackFonts, &amp;glyphOverflow, style);
</span><span class="cx">             if (!firstGlyphLeftOverflow)
</span><span class="cx">                 firstGlyphLeftOverflow = glyphOverflow.left;
</span><span class="lines">@@ -878,7 +879,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool hasBreak = breakAll || isBreakable(breakIterator, i, nextBreakable, breakNBSP, isLooseCJKMode, keepAllWords);
</span><span class="cx">         bool betweenWords = true;
</span><del>-        int j = i;
</del><ins>+        unsigned j = i;
</ins><span class="cx">         while (c != '\n' &amp;&amp; !isSpaceAccordingToStyle(c, style) &amp;&amp; c != '\t' &amp;&amp; (c != softHyphen || style.hyphens() == HyphensNone)) {
</span><span class="cx">             j++;
</span><span class="cx">             if (j == len)
</span><span class="lines">@@ -892,7 +893,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        int wordLen = j - i;
</del><ins>+        unsigned wordLen = j - i;
</ins><span class="cx">         if (wordLen) {
</span><span class="cx">             float currMinWidth = 0;
</span><span class="cx">             bool isSpace = (j &lt; len) &amp;&amp; isSpaceAccordingToStyle(c, style);
</span><span class="lines">@@ -936,8 +937,10 @@
</span><span class="cx">             if (betweenWords) {
</span><span class="cx">                 if (lastWordBoundary == i)
</span><span class="cx">                     currMaxWidth += w;
</span><del>-                else
</del><ins>+                else {
+                    ASSERT(j &gt;= lastWordBoundary);
</ins><span class="cx">                     currMaxWidth += widthFromCache(font, lastWordBoundary, j - lastWordBoundary, leadWidth + currMaxWidth, &amp;fallbackFonts, &amp;glyphOverflow, style);
</span><ins>+                }
</ins><span class="cx">                 lastWordBoundary = j;
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderingAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderingAllInOne.cpp (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderingAllInOne.cpp        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/RenderingAllInOne.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #include &quot;AutoTableLayout.cpp&quot;
</span><span class="cx"> #include &quot;BidiRun.cpp&quot;
</span><span class="cx"> #include &quot;BorderEdge.cpp&quot;
</span><ins>+#include &quot;BreakLines.cpp&quot;
</ins><span class="cx"> #include &quot;ClipRect.cpp&quot;
</span><span class="cx"> #include &quot;CounterNode.cpp&quot;
</span><span class="cx"> #include &quot;EllipsisBox.cpp&quot;
</span><span class="lines">@@ -149,4 +150,3 @@
</span><span class="cx"> #include &quot;TextDecorationPainter.cpp&quot;
</span><span class="cx"> #include &quot;TextPaintStyle.cpp&quot;
</span><span class="cx"> #include &quot;TextPainter.cpp&quot;
</span><del>-#include &quot;break_lines.cpp&quot;
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -114,8 +114,9 @@
</span><span class="cx"> unsigned TextFragmentIterator::nextBreakablePosition(const FlowContents::Segment&amp; segment, unsigned startPosition)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(startPosition &lt; segment.end);
</span><del>-    if (segment.text.impl() != m_lineBreakIterator.string().impl()) {
-        const String&amp; currentText = m_lineBreakIterator.string();
</del><ins>+    StringView currentText = m_lineBreakIterator.stringView();
+    StringView segmentText = StringView(segment.text);
+    if (segmentText != currentText) {
</ins><span class="cx">         unsigned textLength = currentText.length();
</span><span class="cx">         UChar lastCharacter = textLength &gt; 0 ? currentText[textLength - 1] : 0;
</span><span class="cx">         UChar secondToLastCharacter = textLength &gt; 1 ? currentText[textLength - 2] : 0;
</span><span class="lines">@@ -125,7 +126,7 @@
</span><span class="cx">     const auto* characters = segment.text.characters&lt;CharacterType&gt;();
</span><span class="cx">     unsigned segmentLength = segment.end - segment.start;
</span><span class="cx">     unsigned segmentPosition = startPosition - segment.start;
</span><del>-    return segment.start + nextBreakablePositionNonLoosely&lt;CharacterType, NBSPBehavior::IgnoreNBSP&gt;(m_lineBreakIterator, characters, segmentLength, segmentPosition);
</del><ins>+    return segment.start + nextBreakablePositionNonLoosely&lt;CharacterType, NonBreakingSpaceBehavior::IgnoreNonBreakingSpace&gt;(m_lineBreakIterator, characters, segmentLength, segmentPosition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;typename CharacterType&gt;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,13 +23,12 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef SimpleLineLayoutTextFragmentIterator_h
-#define SimpleLineLayoutTextFragmentIterator_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><ins>+#include &quot;BreakLines.h&quot;
</ins><span class="cx"> #include &quot;RenderLineBreak.h&quot;
</span><span class="cx"> #include &quot;SimpleLineLayoutFlowContents.h&quot;
</span><span class="cx"> #include &lt;wtf/text/TextBreakIterator.h&gt;
</span><del>-#include &quot;break_lines.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -166,5 +165,3 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingbreak_linescpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/break_lines.cpp (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/break_lines.cpp        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/break_lines.cpp        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -1,100 +0,0 @@
</span><del>-/*
- * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;break_lines.h&quot;
-
-#include &lt;wtf/ASCIICType.h&gt;
-#include &lt;wtf/StdLibExtras.h&gt;
-#include &lt;wtf/unicode/CharacterNames.h&gt;
-
-namespace WebCore {
-
-// Pack 8 bits into one byte
-#define B(a, b, c, d, e, f, g, h) \
-    ((a) | ((b) &lt;&lt; 1) | ((c) &lt;&lt; 2) | ((d) &lt;&lt; 3) | ((e) &lt;&lt; 4) | ((f) &lt;&lt; 5) | ((g) &lt;&lt; 6) | ((h) &lt;&lt; 7))
-
-// Line breaking table row for each digit (0-9)
-#define DI { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-
-// Line breaking table row for ascii letters (a-z A-Z)
-#define AL { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-
-#define F 0xFF
-
-// Line breaking table for printable ASCII characters. Line breaking opportunities in this table are as below:
-// - before opening punctuations such as '(', '&lt;', '[', '{' after certain characters (compatible with Firefox 3.6);
-// - after '-' and '?' (backward-compatible, and compatible with Internet Explorer).
-// Please refer to &lt;https://bugs.webkit.org/show_bug.cgi?id=37698&gt; for line breaking matrixes of different browsers
-// and the ICU standard.
-WEBCORE_EXPORT const unsigned char asciiLineBreakTable[][asciiLineBreakTableColumnCount] = {
-    //  !  &quot;  #  $  %  &amp;  '  (     )  *  +  ,  -  .  /  0  1-8   9  :  ;  &lt;  =  &gt;  ?  @     A-X      Y  Z  [  \  ]  ^  _  `     a-x      y  z  {  |  }  ~  DEL
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // !
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &quot;
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // #
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // $
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // %
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &amp;
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // '
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // (
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // )
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // *
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // +
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ,
-    { B(1, 1, 1, 1, 1, 1, 1, 1), B(1, 1, 1, 1, 1, 0, 1, 0), 0, B(0, 1, 1, 1, 1, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 1, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 1, 1, 1, 1) }, // - Note: breaking before '0'-'9' is handled hard-coded in shouldBreakAfter().
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // .
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // /
-    DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI,  DI, // 0-9
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // :
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ;
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // &lt;
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // =
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // &gt;
-    { B(0, 0, 1, 1, 1, 1, 0, 1), B(0, 1, 1, 0, 1, 0, 0, 1), F, B(1, 0, 0, 1, 1, 1, 0, 1), F, F, F, B(1, 1, 1, 1, 0, 1, 1, 1), F, F, F, B(1, 1, 1, 1, 0, 1, 1, 0) }, // ?
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // @
-    AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL, // A-Z
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // [
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // '\'
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ]
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // ^
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // _
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // `
-    AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL,  AL, // a-z
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // {
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // |
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // }
-    { B(0, 0, 0, 0, 0, 0, 0, 1), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 1, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 1, 0, 0, 0, 0, 0) }, // ~
-    { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // DEL
-};
-
-#undef B
-#undef F
-#undef DI
-#undef AL
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1, TestLineBreakTableConsistency);
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingbreak_linesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/break_lines.h (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/break_lines.h        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/break_lines.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -1,248 +0,0 @@
</span><del>-/*
- * Copyright (C) 2005, 2007, 2010, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef break_lines_h
-#define break_lines_h
-
-#include &lt;wtf/ASCIICType.h&gt;
-#include &lt;wtf/StdLibExtras.h&gt;
-#include &lt;wtf/text/TextBreakIterator.h&gt;
-#include &lt;wtf/unicode/CharacterNames.h&gt;
-
-namespace WebCore {
-
-static const UChar asciiLineBreakTableFirstChar = '!';
-static const UChar asciiLineBreakTableLastChar = 127;
-static const unsigned asciiLineBreakTableColumnCount = (asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar) / 8 + 1;
-
-WEBCORE_EXPORT extern const unsigned char asciiLineBreakTable[][asciiLineBreakTableColumnCount];
-
-enum class NBSPBehavior {
-    IgnoreNBSP,
-    TreatNBSPAsBreak,
-};
-
-template&lt;NBSPBehavior nbspBehavior&gt;
-static inline bool isBreakableSpace(UChar ch)
-{
-    switch (ch) {
-    case ' ':
-    case '\n':
-    case '\t':
-        return true;
-    case noBreakSpace:
-        return nbspBehavior == NBSPBehavior::TreatNBSPAsBreak;
-    default:
-        return false;
-    }
-}
-
-inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh)
-{
-    // Don't allow line breaking between '-' and a digit if the '-' may mean a minus sign in the context,
-    // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long URLs.
-    if (ch == '-' &amp;&amp; isASCIIDigit(nextCh))
-        return isASCIIAlphanumeric(lastCh);
-
-    // If both ch and nextCh are ASCII characters, use a lookup table for enhanced speed and for compatibility
-    // with other browsers (see comments for asciiLineBreakTable for details).
-    if (ch &gt;= asciiLineBreakTableFirstChar &amp;&amp; ch &lt;= asciiLineBreakTableLastChar &amp;&amp; nextCh &gt;= asciiLineBreakTableFirstChar &amp;&amp; nextCh &lt;= asciiLineBreakTableLastChar) {
-        const unsigned char* tableRow = asciiLineBreakTable[ch - asciiLineBreakTableFirstChar];
-        int nextChIndex = nextCh - asciiLineBreakTableFirstChar;
-        return tableRow[nextChIndex / 8] &amp; (1 &lt;&lt; (nextChIndex % 8));
-    }
-    // Otherwise defer to the Unicode algorithm by returning false.
-    return false;
-}
-
-template&lt;NBSPBehavior nbspBehavior&gt;
-inline bool needsLineBreakIterator(UChar ch)
-{
-    if (nbspBehavior == NBSPBehavior::TreatNBSPAsBreak)
-        return ch &gt; asciiLineBreakTableLastChar;
-    return ch &gt; asciiLineBreakTableLastChar &amp;&amp; ch != noBreakSpace;
-}
-
-// When in non-loose mode, we can use the ASCII shortcut table.
-template&lt;typename CharacterType, NBSPBehavior nbspBehavior&gt;
-inline int nextBreakablePositionNonLoosely(LazyLineBreakIterator&amp; lazyBreakIterator, const CharacterType* str, unsigned length, int pos)
-{
-    int len = static_cast&lt;int&gt;(length);
-    int nextBreak = -1;
-
-    CharacterType lastLastCh = pos &gt; 1 ? str[pos - 2] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.secondToLastCharacter());
-    CharacterType lastCh = pos &gt; 0 ? str[pos - 1] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.lastCharacter());
-    unsigned priorContextLength = lazyBreakIterator.priorContextLength();
-    for (int i = pos; i &lt; len; i++) {
-        CharacterType ch = str[i];
-
-        // Non-loose mode, so use ASCII shortcut (shouldBreakAfter) if not breakable space.
-        if (isBreakableSpace&lt;nbspBehavior&gt;(ch) || shouldBreakAfter(lastLastCh, lastCh, ch))
-            return i;
-
-        // Non-loose mode, so conditionally use break iterator.
-        if (needsLineBreakIterator&lt;nbspBehavior&gt;(ch) || needsLineBreakIterator&lt;nbspBehavior&gt;(lastCh)) {
-            if (nextBreak &lt; i) {
-                // Don't break if positioned at start of primary context and there is no prior context.
-                if (i || priorContextLength) {
-                    TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);
-                    if (breakIterator) {
-                        nextBreak = textBreakFollowing(breakIterator, i - 1 + priorContextLength);
-                        if (nextBreak &gt;= 0)
-                            nextBreak -= priorContextLength;
-                    }
-                }
-            }
-            if (i == nextBreak &amp;&amp; !isBreakableSpace&lt;nbspBehavior&gt;(lastCh))
-                return i;
-        }
-
-        lastLastCh = lastCh;
-        lastCh = ch;
-    }
-
-    return len;
-}
-
-// When in loose mode, we can't use the ASCII shortcut table since loose mode allows &quot;$100&quot; to break after '$' in content marked as CJK.
-// N.B. It should be possible to combine the following with the non-loose version above by adding a LooseBehavior template parameter;
-// however, when doing this, a 10% performance regression appeared on chromium-win (https://bugs.webkit.org/show_bug.cgi?id=89235#c112).
-template&lt;typename CharacterType, NBSPBehavior nbspBehavior&gt;
-static inline int nextBreakablePositionLoosely(LazyLineBreakIterator&amp; lazyBreakIterator, const CharacterType* str, unsigned length, int pos)
-{
-    int len = static_cast&lt;int&gt;(length);
-    int nextBreak = -1;
-
-    CharacterType lastCh = pos &gt; 0 ? str[pos - 1] : static_cast&lt;CharacterType&gt;(lazyBreakIterator.lastCharacter());
-    unsigned priorContextLength = lazyBreakIterator.priorContextLength();
-    for (int i = pos; i &lt; len; i++) {
-        CharacterType ch = str[i];
-
-        // Always loose mode, so don't use ASCII shortcut (shouldBreakAfter).
-        if (isBreakableSpace&lt;nbspBehavior&gt;(ch))
-            return i;
-
-        // Always use line break iterator in loose mode.
-        if (nextBreak &lt; i) {
-            // Don't break if positioned at start of primary context and there is no prior context.
-            if (i || priorContextLength) {
-                TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);
-                if (breakIterator) {
-                    nextBreak = textBreakFollowing(breakIterator, i - 1 + priorContextLength);
-                    if (nextBreak &gt;= 0)
-                        nextBreak -= priorContextLength;
-                }
-            }
-        }
-        if (i == nextBreak &amp;&amp; !isBreakableSpace&lt;nbspBehavior&gt;(lastCh))
-            return i;
-
-        lastCh = ch;
-    }
-
-    return len;
-}
-
-template&lt;typename CharacterType, NBSPBehavior nbspBehavior&gt;
-inline unsigned nextBreakablePositionKeepingAllWords(const CharacterType* string, unsigned length, unsigned startPosition)
-{
-    for (unsigned i = startPosition; i &lt; length; i++) {
-        if (isBreakableSpace&lt;nbspBehavior&gt;(string[i]))
-            return i;
-    }
-    return length;
-}
-
-inline unsigned nextBreakablePositionKeepingAllWords(LazyLineBreakIterator&amp; lazyBreakIterator, int startPosition)
-{
-    String string = lazyBreakIterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionKeepingAllWords&lt;LChar, NBSPBehavior::TreatNBSPAsBreak&gt;(string.characters8(), string.length(), startPosition);
-    return nextBreakablePositionKeepingAllWords&lt;UChar, NBSPBehavior::TreatNBSPAsBreak&gt;(string.characters16(), string.length(), startPosition);
-}
-
-inline unsigned nextBreakablePositionKeepingAllWordsIgnoringNBSP(LazyLineBreakIterator&amp; iterator, int startPosition)
-{
-    String string = iterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionKeepingAllWords&lt;LChar, NBSPBehavior::IgnoreNBSP&gt;(string.characters8(), string.length(), startPosition);
-    return nextBreakablePositionKeepingAllWords&lt;UChar, NBSPBehavior::IgnoreNBSP&gt;(string.characters16(), string.length(), startPosition);
-}
-
-inline int nextBreakablePosition(LazyLineBreakIterator&amp; iterator, int pos)
-{
-    String string = iterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionNonLoosely&lt;LChar, NBSPBehavior::TreatNBSPAsBreak&gt;(iterator, string.characters8(), string.length(), pos);
-    return nextBreakablePositionNonLoosely&lt;UChar, NBSPBehavior::TreatNBSPAsBreak&gt;(iterator, string.characters16(), string.length(), pos);
-}
-
-inline int nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator&amp; lazyBreakIterator, int pos)
-{
-    String string = lazyBreakIterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionNonLoosely&lt;LChar, NBSPBehavior::IgnoreNBSP&gt;(lazyBreakIterator, string.characters8(), string.length(), pos);
-    return nextBreakablePositionNonLoosely&lt;UChar, NBSPBehavior::IgnoreNBSP&gt;(lazyBreakIterator, string.characters16(), string.length(), pos);
-}
-
-inline int nextBreakablePositionLoose(LazyLineBreakIterator&amp; lazyBreakIterator, int pos)
-{
-    String string = lazyBreakIterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionLoosely&lt;LChar, NBSPBehavior::TreatNBSPAsBreak&gt;(lazyBreakIterator, string.characters8(), string.length(), pos);
-    return nextBreakablePositionLoosely&lt;UChar, NBSPBehavior::TreatNBSPAsBreak&gt;(lazyBreakIterator, string.characters16(), string.length(), pos);
-}
-
-inline int nextBreakablePositionIgnoringNBSPLoose(LazyLineBreakIterator&amp; lazyBreakIterator, int pos)
-{
-    String string = lazyBreakIterator.string();
-    if (string.is8Bit())
-        return nextBreakablePositionLoosely&lt;LChar, NBSPBehavior::IgnoreNBSP&gt;(lazyBreakIterator, string.characters8(), string.length(), pos);
-    return nextBreakablePositionLoosely&lt;UChar, NBSPBehavior::IgnoreNBSP&gt;(lazyBreakIterator, string.characters16(), string.length(), pos);
-}
-
-inline bool isBreakable(LazyLineBreakIterator&amp; lazyBreakIterator, int pos, int&amp; nextBreakable, bool breakNBSP, bool isLooseMode, bool keepAllWords)
-{
-    if (pos &lt;= nextBreakable)
-        return pos == nextBreakable;
-
-    if (keepAllWords) {
-        if (breakNBSP)
-            nextBreakable = static_cast&lt;int&gt;(nextBreakablePositionKeepingAllWords(lazyBreakIterator, pos));
-        else
-            nextBreakable = static_cast&lt;int&gt;(nextBreakablePositionKeepingAllWordsIgnoringNBSP(lazyBreakIterator, pos));
-    } else if (isLooseMode) {
-        if (breakNBSP)
-            nextBreakable = nextBreakablePositionLoose(lazyBreakIterator, pos);
-        else
-            nextBreakable = nextBreakablePositionIgnoringNBSPLoose(lazyBreakIterator, pos);
-    } else {
-        if (breakNBSP)
-            nextBreakable = nextBreakablePosition(lazyBreakIterator, pos);
-        else
-            nextBreakable = nextBreakablePositionIgnoringNBSP(lazyBreakIterator, pos);
-    }
-    return pos == nextBreakable;
-}
-
-} // namespace WebCore
-
-#endif // break_lines_h
</del></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -22,9 +22,9 @@
</span><span class="cx">  *
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef BreakingContext_h
-#define BreakingContext_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><ins>+#include &quot;BreakLines.h&quot;
</ins><span class="cx"> #include &quot;Hyphenation.h&quot;
</span><span class="cx"> #include &quot;LineBreaker.h&quot;
</span><span class="cx"> #include &quot;LineInfo.h&quot;
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> #include &quot;RenderRubyRun.h&quot;
</span><span class="cx"> #include &quot;RenderSVGInlineText.h&quot;
</span><span class="cx"> #include &quot;TrailingObjects.h&quot;
</span><del>-#include &quot;break_lines.h&quot;
</del><span class="cx"> #include &lt;wtf/Optional.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringView.h&gt;
</span><span class="cx"> #include &lt;wtf/unicode/CharacterNames.h&gt;
</span><span class="lines">@@ -167,7 +166,7 @@
</span><span class="cx">         m_hangsAtEnd = false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void commitLineBreakAtCurrentWidth(RenderObject&amp; object, unsigned offset = 0, int nextBreak = -1)
</del><ins>+    void commitLineBreakAtCurrentWidth(RenderObject&amp; object, unsigned offset = 0, Optional&lt;unsigned&gt; nextBreak = Nullopt)
</ins><span class="cx">     {
</span><span class="cx">         m_width.commit();
</span><span class="cx">         m_lineBreakHistory.moveTo(&amp;object, offset, nextBreak);
</span><span class="lines">@@ -204,7 +203,7 @@
</span><span class="cx"> 
</span><span class="cx">         RenderObject* renderer() const { return this-&gt;at(0).renderer(); }
</span><span class="cx">         unsigned offset() const { return this-&gt;at(0).offset(); }
</span><del>-        int nextBreakablePosition() const { return this-&gt;at(0).nextBreakablePosition(); }
</del><ins>+        Optional&lt;unsigned&gt; nextBreakablePosition() const { return this-&gt;at(0).nextBreakablePosition(); }
</ins><span class="cx">         bool atTextParagraphSeparator() const { return this-&gt;at(0).atTextParagraphSeparator(); }
</span><span class="cx">         UChar previousInSameNode() const { return this-&gt;at(0).previousInSameNode(); }
</span><span class="cx">         const InlineIterator&amp; get(size_t i) const { return this-&gt;at(i); };
</span><span class="lines">@@ -211,7 +210,7 @@
</span><span class="cx">         const InlineIterator&amp; current() const { return get(0); }
</span><span class="cx">         size_t historyLength() const { return this-&gt;size(); }
</span><span class="cx"> 
</span><del>-        void moveTo(RenderObject* object, unsigned offset, int nextBreak = -1)
</del><ins>+        void moveTo(RenderObject* object, unsigned offset, Optional&lt;unsigned&gt; nextBreak = Nullopt)
</ins><span class="cx">         {
</span><span class="cx">             push([&amp;](InlineIterator&amp; modifyMe) {
</span><span class="cx">                 modifyMe.moveTo(object, offset, nextBreak);
</span><span class="lines">@@ -650,7 +649,7 @@
</span><span class="cx">     lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void tryHyphenating(RenderText&amp; text, const FontCascade&amp; font, const AtomicString&amp; localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator&amp; lineBreak, int nextBreakable, bool&amp; hyphenated)
</del><ins>+inline void tryHyphenating(RenderText&amp; text, const FontCascade&amp; font, const AtomicString&amp; localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator&amp; lineBreak, Optional&lt;unsigned&gt; nextBreakable, bool&amp; hyphenated)
</ins><span class="cx"> {
</span><span class="cx">     // Map 'hyphenate-limit-{before,after}: auto;' to 2.
</span><span class="cx">     unsigned minimumPrefixLength;
</span><span class="lines">@@ -857,7 +856,7 @@
</span><span class="cx">             midWordBreak = m_width.committedWidth() + wrapW + charWidth &gt; m_width.availableWidth();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        int nextBreakablePosition = m_current.nextBreakablePosition();
</del><ins>+        Optional&lt;unsigned&gt; nextBreakablePosition = m_current.nextBreakablePosition();
</ins><span class="cx">         bool betweenWords = c == '\n' || (m_currWS != PRE &amp;&amp; !m_atStart &amp;&amp; isBreakable(m_renderTextInfo.lineBreakIterator, m_current.offset(), nextBreakablePosition, breakNBSP, isLooseCJKMode, keepAllWords)
</span><span class="cx">             &amp;&amp; (style.hyphens() != HyphensNone || (m_current.previousInSameNode() != softHyphen)));
</span><span class="cx">         m_current.setNextBreakablePosition(nextBreakablePosition);
</span><span class="lines">@@ -959,14 +958,14 @@
</span><span class="cx">                     }
</span><span class="cx">                     // Check if the last breaking position is a soft-hyphen.
</span><span class="cx">                     if (!hyphenated &amp;&amp; style.hyphens() != HyphensNone) {
</span><del>-                        Optional&lt;int&gt; lastBreakingPositon;
</del><ins>+                        Optional&lt;unsigned&gt; lastBreakingPositon;
</ins><span class="cx">                         const RenderObject* rendererAtBreakingPosition = nullptr;
</span><del>-                        if (m_lineBreakHistory.offset() || m_lineBreakHistory.nextBreakablePosition() &gt; -1) {
</del><ins>+                        if (m_lineBreakHistory.offset() || m_lineBreakHistory.nextBreakablePosition()) {
</ins><span class="cx">                             lastBreakingPositon = m_lineBreakHistory.offset();
</span><span class="cx">                             rendererAtBreakingPosition = m_lineBreakHistory.renderer();
</span><del>-                        } else if (m_current.nextBreakablePosition() &gt; -1 &amp;&amp; (unsigned)m_current.nextBreakablePosition() &lt;= m_current.offset()) {
</del><ins>+                        } else if (m_current.nextBreakablePosition() &amp;&amp; m_current.nextBreakablePosition().value() &lt;= m_current.offset()) {
</ins><span class="cx">                             // We might just be right after the soft-hyphen
</span><del>-                            lastBreakingPositon = m_current.nextBreakablePosition();
</del><ins>+                            lastBreakingPositon = m_current.nextBreakablePosition().value();
</ins><span class="cx">                             rendererAtBreakingPosition = m_current.renderer();
</span><span class="cx">                         }
</span><span class="cx">                         if (lastBreakingPositon) {
</span><span class="lines">@@ -977,7 +976,7 @@
</span><span class="cx">                                 characterBeforeBreakingPosition = lastCharacterFromPreviousRenderText;
</span><span class="cx">                             else if (is&lt;RenderText&gt;(rendererAtBreakingPosition)) {
</span><span class="cx">                                 const auto&amp; textRenderer = downcast&lt;RenderText&gt;(*rendererAtBreakingPosition);
</span><del>-                                ASSERT(textRenderer.textLength() &gt; (unsigned)(lastBreakingPositon.value() - 1));
</del><ins>+                                ASSERT(lastBreakingPositon.value() &gt;= 1 &amp;&amp; textRenderer.textLength() &gt; (lastBreakingPositon.value() - 1));
</ins><span class="cx">                                 characterBeforeBreakingPosition = textRenderer.characterAt(lastBreakingPositon.value() - 1);
</span><span class="cx">                             }
</span><span class="cx">                             if (characterBeforeBreakingPosition)
</span><span class="lines">@@ -1315,9 +1314,9 @@
</span><span class="cx">         return lineBreak;
</span><span class="cx">     bool isLooseCJKMode = m_renderTextInfo.text != &amp;renderText &amp;&amp; m_renderTextInfo.lineBreakIterator.isLooseCJKMode();
</span><span class="cx">     bool breakNBSP = m_autoWrap &amp;&amp; m_currentStyle-&gt;nbspMode() == SPACE;
</span><del>-    int nextBreakablePosition = lineBreak.nextBreakablePosition();
</del><ins>+    Optional&lt;unsigned&gt; nextBreakablePosition = lineBreak.nextBreakablePosition();
</ins><span class="cx">     isBreakable(m_renderTextInfo.lineBreakIterator, lineBreak.offset() + 1, nextBreakablePosition, breakNBSP, isLooseCJKMode, m_currentStyle-&gt;wordBreak() == KeepAllWordBreak);
</span><del>-    if (nextBreakablePosition &lt; 0 || static_cast&lt;unsigned&gt;(nextBreakablePosition) != renderText.textLength())
</del><ins>+    if (!nextBreakablePosition || nextBreakablePosition.value() != renderText.textLength())
</ins><span class="cx">         return lineBreak;
</span><span class="cx">     const RenderStyle&amp; style = lineStyle(renderText, m_lineInfo);
</span><span class="cx">     const FontCascade&amp; font = style.fontCascade();
</span><span class="lines">@@ -1339,5 +1338,3 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span><del>-
-#endif // BreakingContext_h
</del></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebKit/ios/ChangeLog        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-08-16  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate line breaking code from ints to Optional&lt;unsigned&gt;s
+        https://bugs.webkit.org/show_bug.cgi?id=160859
+
+        Reviewed by Darin Adler.
+
+        * Misc/WebUIKitSupport.mm:
+        (WebKitGetLastLineBreakInBuffer):
+
</ins><span class="cx"> 2016-08-15  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unused includes of wtf headers
</span></span></pre></div>
<a id="trunkSourceWebKitiosMiscWebUIKitSupportmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm (204530 => 204531)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2016-08-16 22:33:32 UTC (rev 204530)
+++ trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2016-08-16 22:39:10 UTC (rev 204531)
</span><span class="lines">@@ -33,12 +33,12 @@
</span><span class="cx"> #import &quot;WebPlatformStrategies.h&quot;
</span><span class="cx"> #import &quot;WebSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebViewPrivate.h&quot;
</span><ins>+#import &lt;WebCore/BreakLines.h&gt;
</ins><span class="cx"> #import &lt;WebCore/PathUtilities.h&gt;
</span><span class="cx"> #import &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #import &lt;WebCore/Settings.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreSystemInterface.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreThreadSystemInterface.h&gt;
</span><del>-#import &lt;WebCore/break_lines.h&gt;
</del><span class="cx"> #import &lt;wtf/spi/darwin/dyldSPI.h&gt;
</span><span class="cx"> #import &lt;wtf/text/TextBreakIterator.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -89,12 +89,12 @@
</span><span class="cx"> 
</span><span class="cx"> int WebKitGetLastLineBreakInBuffer(UChar *characters, int position, int length)
</span><span class="cx"> {
</span><del>-    int lastBreakPos = position;
-    int breakPos = 0;
-    LazyLineBreakIterator breakIterator(String(characters, length));
-    while ((breakPos = nextBreakablePosition(breakIterator, breakPos)) &lt; position)
</del><ins>+    unsigned lastBreakPos = position;
+    unsigned breakPos = 0;
+    LazyLineBreakIterator breakIterator(StringView(characters, length));
+    while (static_cast&lt;int&gt;(breakPos = nextBreakablePosition(breakIterator, breakPos)) &lt; position)
</ins><span class="cx">         lastBreakPos = breakPos++;
</span><del>-    return lastBreakPos &lt; position ? (NSUInteger)lastBreakPos : INT_MAX;
</del><ins>+    return static_cast&lt;int&gt;(lastBreakPos) &lt; position ? lastBreakPos : INT_MAX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const char *WebKitPlatformSystemRootDirectory(void)
</span></span></pre>
</div>
</div>

</body>
</html>