<!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>[163712] 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/163712">163712</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2014-02-08 08:32:05 -0800 (Sat, 08 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
https://bugs.webkit.org/show_bug.cgi?id=128233

Reviewed by Anders Carlsson.

Source/WebCore:

* accessibility/AccessibilityNodeObject.cpp: Removed unneeded TextIterator.h include.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::hasMisspelling): Updated to use StringView for checkSpelling.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(AXAttributeStringSetSpelling): Changed to take a StringView.
(AXAttributedStringAppendText): Ditto.
(-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Pass StringView.

* editing/Editor.cpp:
(WebCore::Editor::misspelledWordAtCaretOrRange): Pass StringView.
(WebCore::Editor::misspelledSelectionString): Ditto.
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Ditto.

* editing/TextCheckingHelper.cpp:
(WebCore::findGrammaticalErrors): Renamed this function. Changed to use StringView.
(WebCore::findMisspellings): Use StringView.
(WebCore::TextCheckingHelper::findFirstMisspelling): Ditto. Also separated out assertions
that were asserting multiple things with &amp;&amp;.
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Ditto.
(WebCore::TextCheckingHelper::findFirstGrammarDetail): Ditto.
(WebCore::TextCheckingHelper::findFirstBadGrammar): Ditto.
(WebCore::TextCheckingHelper::isUngrammatical): Ditto.
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): Ditto.
(WebCore::checkTextOfParagraph): Ditto.

* editing/TextCheckingHelper.h: Made TextCheckingParagraph::text public. Deleted
TextCheckingParagraph::textDeprecatedCharacters. Added comments about additional
TextCheckingParagraph refinements. Changed checkTextOfParagraph to take a client
reference instead of pointer and StringView instead of characters pointer with length.

* editing/TextIterator.cpp:
(WebCore::TextIterator::appendTextToStringBuilder): Use data members directly,
rather than using functions, since we already checked m_textCharacters for null.
(WebCore::CharacterIterator::string): Use text() instead of characters().
(WebCore::WordAwareIterator::WordAwareIterator): Removed initialization of
m_previousText now that it's a StringView rather than a pointer.
(WebCore::WordAwareIterator::advance): Use TextIterator::text instead of
TextIterator::characters. Also added a FIXME about a fundamental problem
with the implementation of this class!
(WebCore::WordAwareIterator::length): Updated for m_previousText change.
(WebCore::WordAwareIterator::text): Replaced WordAwareIterator::characters with this.
(WebCore::SearchBuffer::append): Changed to take a StringView.
(WebCore::SearchBuffer::prependContext): Ditto.
(WebCore::SearchBuffer::isWordStartMatch): Use StringView.
(WebCore::SearchBuffer::search): Ditto.
(WebCore::findPlainText): Ditto.

* editing/TextIterator.h: Added TextIterator::text that returns a StringView, and
renamed TextIterator::characters to TextIterator::deprecatedTextIteratorCharacters
(easy to search for in source code). Added SimplifiedBackwardsTextIterator::text
and removed SimplifiedBackwardsTextIterator::characters. Added CharacterIterator::text,
and removed CharacterIterator::characters. Added WordAwareIterator::text and removed
WorkdAwareIterator::characters. Changed WordAwareIterator data members to use StringView.

* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::appendTrailingWhitespace): Use TextIterator::text instead
of TextIterator::characters.

* editing/VisibleUnits.cpp:
(WebCore::previousBoundary): Updated to use StringView.
(WebCore::nextBoundary): Ditto.
(WebCore::startWordBoundary): Ditto.
(WebCore::startOfWord): Ditto.
(WebCore::endWordBoundary): Ditto.
(WebCore::endOfWord): Fixed formatting.
(WebCore::previousWordPositionBoundary): Updated to use StringView.
(WebCore::previousWordPosition): Fixed formatting and got rid of local variable.
(WebCore::nextWordPositionBoundary): Updated to use StringView.
(WebCore::nextWordPosition): Fixed formatting and got rid of local variable.
(WebCore::inSameLine): Fixed formatting.
(WebCore::isStartOfLine): Ditto.
(WebCore::isEndOfLine): Ditto.
(WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to take a reference.
(WebCore::previousLinePosition): Fixed formatting chand changed to pass a reference.
(WebCore::nextLinePosition): Ditto.
(WebCore::startSentenceBoundary): Updated to use StringView and got rid of a local.
(WebCore::startOfSentence): Fixed formatting.
(WebCore::endSentenceBoundary): Updated to use StringView and got rid of a local.
(WebCore::endOfSentence): Fixed formatting.
(WebCore::previousSentencePositionBoundary): Updated to use StringView and got rid of
a local.
(WebCore::previousSentencePosition): Ditto.
(WebCore::nextSentencePositionBoundary): Ditto.
(WebCore::nextSentencePosition): Fixed formatting.
(WebCore::endOfParagraph): Ditto.
(WebCore::inSameParagraph): Ditto.
(WebCore::isStartOfParagraph): Ditto.
(WebCore::isEndOfParagraph): Ditto.
(WebCore::inSameBlock): Ditto.
(WebCore::isStartOfBlock): Ditto.
(WebCore::isEndOfBlock): Ditto.
(WebCore::startOfDocument): Ditto.
(WebCore::endOfDocument): Ditto.
(WebCore::inSameDocument): Ditto.
(WebCore::isStartOfDocument): Ditto.
(WebCore::isEndOfDocument): Ditto.
(WebCore::isEndOfEditableOrNonEditableContent): Ditto.

* loader/EmptyClients.h: Use StringView.

* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]): Use StringView.

* platform/text/TextBoundaries.cpp:
(WebCore::endOfFirstWordBoundaryContext): Use StringView and unsigned.
(WebCore::startOfLastWordBoundaryContext): Ditto.

* platform/text/TextBoundaries.h: Change interfaces to use StringView,
and in some cases, unsigned instead of int. All call sites were better off
with unsigned.

* platform/text/TextCheckerClient.h: Use StringView.

* platform/text/mac/TextBoundaries.mm: Changed conditionals to say
USE(APPKIT) instead of PLATFORM(IOS), since that's the real issue.
(WebCore::isSkipCharacter): Tweaked formatting.
(WebCore::isWhitespaceCharacter): Ditto.
(WebCore::isWordDelimitingCharacter): Ditto, also removed local variable.
(WebCore::isSymbolCharacter): Ditto.
(WebCore::tokenizerForString): Ditto.
(WebCore::findSimpleWordBoundary): Use StringView. Also changed to mostly
use unsigned instead of int.
(WebCore::findComplexWordBoundary): Use StringView. Also restructured to
be much more readable, with early returns and such.
(WebCore::findWordBoundary): Use StringView and unsigned.
(WebCore::findEndWordBoundary): Removed redudant copy of the findWordBoundary
function and changed this to just call findWordBoundary. The reason this
function exists is to optimize this case for some non-Mac, non-iOS platforms.
We can always do that for Mac and/or iOS later if we like.
(WebCore::findNextWordFromIndex): Use StringView. Also use wordBreakIterator
instead of using UBreakIterator directly so we get a cached iterator instead
of creating and destroying a new one each time this function is called.

* bindings/objc/DOMUIKitExtensions.mm: Removed unneeded includes.
* dom/Element.cpp: Ditto.
* dom/PositionIterator.cpp: Ditto.
* editing/ApplyBlockElementCommand.cpp: Ditto.
* editing/IndentOutdentCommand.cpp: Ditto.
* editing/InsertListCommand.cpp: Ditto.
* editing/markup.cpp: Ditto.
* html/HTMLElement.cpp: Ditto.
* html/HTMLTextAreaElement.cpp: Ditto.
* page/Frame.cpp: Ditto.
* rendering/RenderTextControl.cpp: Ditto.

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::checkSpellingOfString): Use StringView.
(WebCore::EditorClientEfl::checkGrammarOfString): Ditto.
* WebCoreSupport/EditorClientEfl.h: Ditto.

Source/WebKit/gtk:

* WebCoreSupport/TextCheckerClientGtk.cpp:
(WebKit::TextCheckerClientGtk::checkSpellingOfString): Use StringView.
(WebKit::TextCheckerClientGtk::checkGrammarOfString): Ditto.
* WebCoreSupport/TextCheckerClientGtk.h: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.h: Made most data members private. Moved inlines
for iOS out of the class definition. Fixed formatting. Added missing virtual keyword.
Changed interfaces to use StringView.

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::checkTextOfParagraph): Use the new StringView::createNSStringWithoutCopying
function instead of a similar function that was local in this file.
(WebEditorClient::ignoreWordInSpellDocument): Tweaked formatting.
(WebEditorClient::checkSpellingOfString): Changed to take a StringView.
(WebEditorClient::checkGrammarOfString): Ditto.

* WebView/WebTextIterator.mm:
(-[WebTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.
(-[WebTextIterator currentText]): Convert a the text to an NSString with TextIterator::text
instead of with TextIterator::characters/length.

Source/WebKit/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::checkSpellingOfString): Use StringView.
(WebEditorClient::checkGrammarOfString): Ditto.
* WebCoreSupport/WebEditorClient.h: Ditto.

Source/WebKit/wince:

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::checkSpellingOfString): Use StringView.
(WebKit::EditorClientWinCE::checkGrammarOfString): Ditto.
* WebCoreSupport/EditorClientWinCE.h: Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
(-[WKDOMTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::checkSpellingOfString): Use StringView.
(WebKit::WebEditorClient::checkGrammarOfString): Ditto.
* WebProcess/WebCoreSupport/WebEditorClient.h: Ditto.

Source/WTF:

* WTF.xcodeproj/project.pbxproj: Added new source files.

* wtf/text/StringView.h: Added operator[], createCFStringWithoutCopying, and
createNSStringWithoutCopying.
* wtf/text/cf/StringViewCF.cpp:
(WTF::StringView::createCFStringWithoutCopying): Added.
* wtf/text/mac/StringViewObjC.mm:
(WTF::StringView::createNSString): Added.
(WTF::StringView::createNSStringWithoutCopying): Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewh">trunk/Source/WTF/wtf/text/StringView.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMUIKitExtensionsmm">trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomPositionIteratorcpp">trunk/Source/WebCore/dom/PositionIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyBlockElementCommandcpp">trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingIndentOutdentCommandcpp">trunk/Source/WebCore/editing/IndentOutdentCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertListCommandcpp">trunk/Source/WebCore/editing/InsertListCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextCheckingHelpercpp">trunk/Source/WebCore/editing/TextCheckingHelper.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextCheckingHelperh">trunk/Source/WebCore/editing/TextCheckingHelper.h</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorh">trunk/Source/WebCore/editing/TextIterator.h</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleSelectioncpp">trunk/Source/WebCore/editing/VisibleSelection.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleUnitscpp">trunk/Source/WebCore/editing/VisibleUnits.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementcpp">trunk/Source/WebCore/html/HTMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextAreaElementcpp">trunk/Source/WebCore/html/HTMLTextAreaElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmacHTMLConvertermm">trunk/Source/WebCore/platform/mac/HTMLConverter.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextBoundariescpp">trunk/Source/WebCore/platform/text/TextBoundaries.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextBoundariesh">trunk/Source/WebCore/platform/text/TextBoundaries.h</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextCheckerClienth">trunk/Source/WebCore/platform/text/TextCheckerClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformtextmacTextBoundariesmm">trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlcpp">trunk/Source/WebCore/rendering/RenderTextControl.cpp</a></li>
<li><a href="#trunkSourceWebKiteflChangeLog">trunk/Source/WebKit/efl/ChangeLog</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportEditorClientEflcpp">trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportEditorClientEflh">trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h</a></li>
<li><a href="#trunkSourceWebKitgtkChangeLog">trunk/Source/WebKit/gtk/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitgtkWebCoreSupportTextCheckerClientGtkcpp">trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp</a></li>
<li><a href="#trunkSourceWebKitgtkWebCoreSupportTextCheckerClientGtkh">trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebTextIteratormm">trunk/Source/WebKit/mac/WebView/WebTextIterator.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebCoreSupportWebEditorClienth">trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitwinceChangeLog">trunk/Source/WebKit/wince/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinceWebCoreSupportEditorClientWinCEcpp">trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp</a></li>
<li><a href="#trunkSourceWebKitwinceWebCoreSupportEditorClientWinCEh">trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKDOMTextIteratormm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtftextcfStringViewCFcpp">trunk/Source/WTF/wtf/text/cf/StringViewCF.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextmacStringViewObjCmm">trunk/Source/WTF/wtf/text/mac/StringViewObjC.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WTF/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WTF.xcodeproj/project.pbxproj: Added new source files.
+
+        * wtf/text/StringView.h: Added operator[], createCFStringWithoutCopying, and
+        createNSStringWithoutCopying.
+        * wtf/text/cf/StringViewCF.cpp:
+        (WTF::StringView::createCFStringWithoutCopying): Added.
+        * wtf/text/mac/StringViewObjC.mm:
+        (WTF::StringView::createNSString): Added.
+        (WTF::StringView::createNSStringWithoutCopying): Added.
+
</ins><span class="cx"> 2014-02-06  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unused ENABLE(REPAINT_THROTTLING) flag.
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -71,6 +71,8 @@
</span><span class="cx">                 7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
</span><span class="cx">                 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
</span><span class="cx">                 8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
</span><ins>+                93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */; };
+                93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; };
</ins><span class="cx">                 93AC91A818942FC400244939 /* LChar.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AC91A718942FC400244939 /* LChar.h */; };
</span><span class="cx">                 93B1AA80180E5AF3004A2F05 /* PassRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B1AA7F180E5AF3004A2F05 /* PassRef.h */; };
</span><span class="cx">                 974CFC8E16A4F327006D5404 /* WeakPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 974CFC8D16A4F327006D5404 /* WeakPtr.h */; };
</span><span class="lines">@@ -344,6 +346,8 @@
</span><span class="cx">                 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93B1AA7F180E5AF3004A2F05 /* PassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRef.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 974CFC8D16A4F327006D5404 /* WeakPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakPtr.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -620,6 +624,7 @@
</span><span class="cx">                 A5BA15F11824339F00A82E69 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */,
</ins><span class="cx">                                 A5BA15F41824348000A82E69 /* StringImplMac.mm */,
</span><span class="cx">                                 A5BA15F2182433A900A82E69 /* StringMac.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -632,6 +637,7 @@
</span><span class="cx">                                 A5BA15F7182435A600A82E69 /* AtomicStringCF.cpp */,
</span><span class="cx">                                 A5BA15F8182435A600A82E69 /* StringCF.cpp */,
</span><span class="cx">                                 A5BA15F9182435A600A82E69 /* StringImplCF.cpp */,
</span><ins>+                                93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = cf;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1226,7 +1232,6 @@
</span><span class="cx">                                 A8A473BC151A825B004123FF /* DynamicAnnotations.cpp in Sources */,
</span><span class="cx">                                 A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */,
</span><span class="cx">                                 A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
</span><del>-                                A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */,
</del><span class="cx">                                 A5BA15FA182435A600A82E69 /* AtomicStringCF.cpp in Sources */,
</span><span class="cx">                                 E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */,
</span><span class="cx">                                 0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
</span><span class="lines">@@ -1245,25 +1250,28 @@
</span><span class="cx">                                 A8A47400151A825B004123FF /* PageAllocationAligned.cpp in Sources */,
</span><span class="cx">                                 A8A47402151A825B004123FF /* PageBlock.cpp in Sources */,
</span><span class="cx">                                 0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */,
</span><del>-                                A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */,
</del><span class="cx">                                 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
</span><span class="cx">                                 A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
</span><span class="cx">                                 A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */,
</span><span class="cx">                                 2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */,
</span><span class="cx">                                 2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */,
</span><span class="cx">                                 1469419316EAAF6D0024E146 /* RunLoopTimerCF.cpp in Sources */,
</span><ins>+                                A8A47421151A825B004123FF /* SHA1.cpp in Sources */,
</ins><span class="cx">                                 1469419916EAB0410024E146 /* SchedulePairCF.cpp in Sources */,
</span><del>-                                A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */,
</del><span class="cx">                                 1469419716EAAFF80024E146 /* SchedulePairMac.mm in Sources */,
</span><del>-                                A8A47421151A825B004123FF /* SHA1.cpp in Sources */,
</del><span class="cx">                                 A748745217A0BDAE00FA04CB /* SixCharacterHash.cpp in Sources */,
</span><span class="cx">                                 A8A47425151A825B004123FF /* SizeLimits.cpp in Sources */,
</span><span class="cx">                                 A8A47427151A825B004123FF /* StackBounds.cpp in Sources */,
</span><span class="cx">                                 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */,
</span><span class="cx">                                 A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */,
</span><span class="cx">                                 A8A47440151A825B004123FF /* StringImpl.cpp in Sources */,
</span><ins>+                                A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */,
+                                A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */,
+                                A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */,
</ins><span class="cx">                                 0FDDBFA71666DFA300C55FEF /* StringPrintStream.cpp in Sources */,
</span><span class="cx">                                 A8A47443151A825B004123FF /* StringStatics.cpp in Sources */,
</span><ins>+                                93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */,
+                                93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */,
</ins><span class="cx">                                 A8A473B7151A825B004123FF /* strtod.cc in Sources */,
</span><span class="cx">                                 A8A47431151A825B004123FF /* TCSystemAlloc.cpp in Sources */,
</span><span class="cx">                                 A8A47448151A825B004123FF /* ThreadIdentifierDataPthreads.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WTF/wtf/text/StringView.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -127,6 +127,25 @@
</span><span class="cx">         return StringImpl::createWithoutCopying(characters16(), length());
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    UChar operator[](unsigned index) const
+    {
+        ASSERT(index &lt; length());
+        if (is8Bit())
+            return characters8()[index];
+        return characters16()[index];
+    }
+
+#if USE(CF)
+    // This function converts null strings to empty strings.
+    WTF_EXPORT_STRING_API RetainPtr&lt;CFStringRef&gt; createCFStringWithoutCopying() const;
+#endif
+
+#ifdef __OBJC__
+    // These functions convert null strings to empty strings.
+    WTF_EXPORT_STRING_API RetainPtr&lt;NSString&gt; createNSString() const;
+    WTF_EXPORT_STRING_API RetainPtr&lt;NSString&gt; createNSStringWithoutCopying() const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     void initialize(const LChar* characters, unsigned length)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWTFwtftextcfStringViewCFcppfromrev163711trunkSourceWebKit2WebProcessInjectedBundleAPImacWKDOMTextIteratormm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/text/cf/StringViewCF.cpp (from rev 163711, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm) (0 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/cf/StringViewCF.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/text/cf/StringViewCF.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple 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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;StringView.h&quot;
+
+#import &quot;RetainPtr.h&quot;
+
+namespace WTF {
+
+RetainPtr&lt;CFStringRef&gt; StringView::createCFStringWithoutCopying() const
+{
+    if (is8Bit())
+        return adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, characters8(), length(), kCFStringEncodingISOLatin1, false, kCFAllocatorNull));
+
+    return adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters16(), length(), kCFAllocatorNull));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWTFwtftextmacStringViewObjCmmfromrev163711trunkSourceWebKit2WebProcessInjectedBundleAPImacWKDOMTextIteratormm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/text/mac/StringViewObjC.mm (from rev 163711, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm) (0 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/mac/StringViewObjC.mm                                (rev 0)
+++ trunk/Source/WTF/wtf/text/mac/StringViewObjC.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple 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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;StringView.h&quot;
+
+#import &quot;RetainPtr.h&quot;
+
+namespace WTF {
+
+RetainPtr&lt;NSString&gt; StringView::createNSString() const
+{
+    if (is8Bit())
+        return adoptNS([[NSString alloc] initWithBytes:const_cast&lt;LChar*&gt;(characters8()) length:length() encoding:NSISOLatin1StringEncoding]);
+
+    return adoptNS([[NSString alloc] initWithCharacters:const_cast&lt;UChar*&gt;(characters16()) length:length()]);
+}
+
+RetainPtr&lt;NSString&gt; StringView::createNSStringWithoutCopying() const
+{
+    if (is8Bit())
+        return adoptNS([[NSString alloc] initWithBytesNoCopy:const_cast&lt;LChar*&gt;(characters8()) length:length() encoding:NSISOLatin1StringEncoding freeWhenDone:NO]);
+
+    return adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(characters16()) length:length() freeWhenDone:NO]);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,157 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * accessibility/AccessibilityNodeObject.cpp: Removed unneeded TextIterator.h include.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::hasMisspelling): Updated to use StringView for checkSpelling.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (AXAttributeStringSetSpelling): Changed to take a StringView.
+        (AXAttributedStringAppendText): Ditto.
+        (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Pass StringView.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::misspelledWordAtCaretOrRange): Pass StringView.
+        (WebCore::Editor::misspelledSelectionString): Ditto.
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Ditto.
+
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::findGrammaticalErrors): Renamed this function. Changed to use StringView.
+        (WebCore::findMisspellings): Use StringView.
+        (WebCore::TextCheckingHelper::findFirstMisspelling): Ditto. Also separated out assertions
+        that were asserting multiple things with &amp;&amp;.
+        (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Ditto.
+        (WebCore::TextCheckingHelper::findFirstGrammarDetail): Ditto.
+        (WebCore::TextCheckingHelper::findFirstBadGrammar): Ditto.
+        (WebCore::TextCheckingHelper::isUngrammatical): Ditto.
+        (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): Ditto.
+        (WebCore::checkTextOfParagraph): Ditto.
+
+        * editing/TextCheckingHelper.h: Made TextCheckingParagraph::text public. Deleted
+        TextCheckingParagraph::textDeprecatedCharacters. Added comments about additional
+        TextCheckingParagraph refinements. Changed checkTextOfParagraph to take a client
+        reference instead of pointer and StringView instead of characters pointer with length.
+
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::appendTextToStringBuilder): Use data members directly,
+        rather than using functions, since we already checked m_textCharacters for null.
+        (WebCore::CharacterIterator::string): Use text() instead of characters().
+        (WebCore::WordAwareIterator::WordAwareIterator): Removed initialization of
+        m_previousText now that it's a StringView rather than a pointer.
+        (WebCore::WordAwareIterator::advance): Use TextIterator::text instead of
+        TextIterator::characters. Also added a FIXME about a fundamental problem
+        with the implementation of this class!
+        (WebCore::WordAwareIterator::length): Updated for m_previousText change.
+        (WebCore::WordAwareIterator::text): Replaced WordAwareIterator::characters with this.
+        (WebCore::SearchBuffer::append): Changed to take a StringView.
+        (WebCore::SearchBuffer::prependContext): Ditto.
+        (WebCore::SearchBuffer::isWordStartMatch): Use StringView.
+        (WebCore::SearchBuffer::search): Ditto.
+        (WebCore::findPlainText): Ditto.
+
+        * editing/TextIterator.h: Added TextIterator::text that returns a StringView, and
+        renamed TextIterator::characters to TextIterator::deprecatedTextIteratorCharacters
+        (easy to search for in source code). Added SimplifiedBackwardsTextIterator::text
+        and removed SimplifiedBackwardsTextIterator::characters. Added CharacterIterator::text,
+        and removed CharacterIterator::characters. Added WordAwareIterator::text and removed
+        WorkdAwareIterator::characters. Changed WordAwareIterator data members to use StringView.
+
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::appendTrailingWhitespace): Use TextIterator::text instead
+        of TextIterator::characters.
+
+        * editing/VisibleUnits.cpp:
+        (WebCore::previousBoundary): Updated to use StringView.
+        (WebCore::nextBoundary): Ditto.
+        (WebCore::startWordBoundary): Ditto.
+        (WebCore::startOfWord): Ditto.
+        (WebCore::endWordBoundary): Ditto.
+        (WebCore::endOfWord): Fixed formatting.
+        (WebCore::previousWordPositionBoundary): Updated to use StringView.
+        (WebCore::previousWordPosition): Fixed formatting and got rid of local variable.
+        (WebCore::nextWordPositionBoundary): Updated to use StringView.
+        (WebCore::nextWordPosition): Fixed formatting and got rid of local variable.
+        (WebCore::inSameLine): Fixed formatting.
+        (WebCore::isStartOfLine): Ditto.
+        (WebCore::isEndOfLine): Ditto.
+        (WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to take a reference.
+        (WebCore::previousLinePosition): Fixed formatting chand changed to pass a reference.
+        (WebCore::nextLinePosition): Ditto.
+        (WebCore::startSentenceBoundary): Updated to use StringView and got rid of a local.
+        (WebCore::startOfSentence): Fixed formatting.
+        (WebCore::endSentenceBoundary): Updated to use StringView and got rid of a local.
+        (WebCore::endOfSentence): Fixed formatting.
+        (WebCore::previousSentencePositionBoundary): Updated to use StringView and got rid of
+        a local.
+        (WebCore::previousSentencePosition): Ditto.
+        (WebCore::nextSentencePositionBoundary): Ditto.
+        (WebCore::nextSentencePosition): Fixed formatting.
+        (WebCore::endOfParagraph): Ditto.
+        (WebCore::inSameParagraph): Ditto.
+        (WebCore::isStartOfParagraph): Ditto.
+        (WebCore::isEndOfParagraph): Ditto.
+        (WebCore::inSameBlock): Ditto.
+        (WebCore::isStartOfBlock): Ditto.
+        (WebCore::isEndOfBlock): Ditto.
+        (WebCore::startOfDocument): Ditto.
+        (WebCore::endOfDocument): Ditto.
+        (WebCore::inSameDocument): Ditto.
+        (WebCore::isStartOfDocument): Ditto.
+        (WebCore::isEndOfDocument): Ditto.
+        (WebCore::isEndOfEditableOrNonEditableContent): Ditto.
+
+        * loader/EmptyClients.h: Use StringView.
+
+        * platform/mac/HTMLConverter.mm:
+        (+[WebHTMLConverter editingAttributedStringFromRange:]): Use StringView.
+
+        * platform/text/TextBoundaries.cpp:
+        (WebCore::endOfFirstWordBoundaryContext): Use StringView and unsigned.
+        (WebCore::startOfLastWordBoundaryContext): Ditto.
+
+        * platform/text/TextBoundaries.h: Change interfaces to use StringView,
+        and in some cases, unsigned instead of int. All call sites were better off
+        with unsigned.
+
+        * platform/text/TextCheckerClient.h: Use StringView.
+
+        * platform/text/mac/TextBoundaries.mm: Changed conditionals to say
+        USE(APPKIT) instead of PLATFORM(IOS), since that's the real issue.
+        (WebCore::isSkipCharacter): Tweaked formatting.
+        (WebCore::isWhitespaceCharacter): Ditto.
+        (WebCore::isWordDelimitingCharacter): Ditto, also removed local variable.
+        (WebCore::isSymbolCharacter): Ditto.
+        (WebCore::tokenizerForString): Ditto.
+        (WebCore::findSimpleWordBoundary): Use StringView. Also changed to mostly
+        use unsigned instead of int.
+        (WebCore::findComplexWordBoundary): Use StringView. Also restructured to
+        be much more readable, with early returns and such.
+        (WebCore::findWordBoundary): Use StringView and unsigned.
+        (WebCore::findEndWordBoundary): Removed redudant copy of the findWordBoundary
+        function and changed this to just call findWordBoundary. The reason this
+        function exists is to optimize this case for some non-Mac, non-iOS platforms.
+        We can always do that for Mac and/or iOS later if we like.
+        (WebCore::findNextWordFromIndex): Use StringView. Also use wordBreakIterator
+        instead of using UBreakIterator directly so we get a cached iterator instead
+        of creating and destroying a new one each time this function is called.
+
+        * bindings/objc/DOMUIKitExtensions.mm: Removed unneeded includes.
+        * dom/Element.cpp: Ditto.
+        * dom/PositionIterator.cpp: Ditto.
+        * editing/ApplyBlockElementCommand.cpp: Ditto.
+        * editing/IndentOutdentCommand.cpp: Ditto.
+        * editing/InsertListCommand.cpp: Ditto.
+        * editing/markup.cpp: Ditto.
+        * html/HTMLElement.cpp: Ditto.
+        * html/HTMLTextAreaElement.cpp: Ditto.
+        * page/Frame.cpp: Ditto.
+        * rendering/RenderTextControl.cpp: Ditto.
+
</ins><span class="cx"> 2014-02-08  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove two unused function declarations.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -74,7 +74,6 @@
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;TextControlInnerElements.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;UserGestureIndicator.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> #include &quot;Widget.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;TextCheckerClient.h&quot;
</span><span class="cx"> #include &quot;TextCheckingHelper.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;UserGestureIndicator.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="lines">@@ -330,13 +329,11 @@
</span><span class="cx">     if (!textChecker)
</span><span class="cx">         return false;
</span><span class="cx">     
</span><del>-    const UChar* chars = stringValue().deprecatedCharacters();
-    int charsLength = stringValue().length();
</del><span class="cx">     bool isMisspelled = false;
</span><span class="cx"> 
</span><span class="cx">     if (unifiedTextCheckerEnabled(frame)) {
</span><span class="cx">         Vector&lt;TextCheckingResult&gt; results;
</span><del>-        checkTextOfParagraph(textChecker, chars, charsLength, TextCheckingTypeSpelling, results);
</del><ins>+        checkTextOfParagraph(*textChecker, stringValue(), TextCheckingTypeSpelling, results);
</ins><span class="cx">         if (!results.isEmpty())
</span><span class="cx">             isMisspelled = true;
</span><span class="cx">         return isMisspelled;
</span><span class="lines">@@ -344,7 +341,7 @@
</span><span class="cx"> 
</span><span class="cx">     int misspellingLength = 0;
</span><span class="cx">     int misspellingLocation = -1;
</span><del>-    textChecker-&gt;checkSpellingOfString(chars, charsLength, &amp;misspellingLocation, &amp;misspellingLength);
</del><ins>+    textChecker-&gt;checkSpellingOfString(stringValue(), &amp;misspellingLocation, &amp;misspellingLength);
</ins><span class="cx">     if (misspellingLength || misspellingLocation != -1)
</span><span class="cx">         isMisspelled = true;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -853,7 +853,7 @@
</span><span class="cx">         [attrString removeAttribute:NSAccessibilityBlockQuoteLevelAttribute range:range];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, Node* node, const UChar* chars, int charLength, NSRange range)
</del><ins>+static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, Node* node, StringView text, NSRange range)
</ins><span class="cx"> {
</span><span class="cx">     if (unifiedTextCheckerEnabled(node-&gt;document().frame())) {
</span><span class="cx">         // Check the spelling directly since document-&gt;markersForNode() does not store the misspelled marking when the cursor is in a word.
</span><span class="lines">@@ -861,7 +861,7 @@
</span><span class="cx">         
</span><span class="cx">         // checkTextOfParagraph is the only spelling/grammar checker implemented in WK1 and WK2
</span><span class="cx">         Vector&lt;TextCheckingResult&gt; results;
</span><del>-        checkTextOfParagraph(checker, chars, charLength, TextCheckingTypeSpelling, results);
</del><ins>+        checkTextOfParagraph(*checker, text, TextCheckingTypeSpelling, results);
</ins><span class="cx">         
</span><span class="cx">         size_t size = results.size();
</span><span class="cx">         NSNumber* trueValue = [NSNumber numberWithBool:YES];
</span><span class="lines">@@ -874,15 +874,11 @@
</span><span class="cx">         }
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    
-    int currentPosition = 0;
-    while (charLength &gt; 0) {
-        const UChar* charData = chars + currentPosition;
-        TextCheckerClient* checker = node-&gt;document().frame()-&gt;editor().textChecker();
-        
</del><ins>+
+    for (unsigned currentPosition = 0; currentPosition &lt; text.length(); ) {
</ins><span class="cx">         int misspellingLocation = -1;
</span><span class="cx">         int misspellingLength = 0;
</span><del>-        checker-&gt;checkSpellingOfString(charData, charLength, &amp;misspellingLocation, &amp;misspellingLength);
</del><ins>+        node-&gt;document().frame()-&gt;editor().textChecker()-&gt;checkSpellingOfString(text.substring(currentPosition), &amp;misspellingLocation, &amp;misspellingLength);
</ins><span class="cx">         if (misspellingLocation == -1 || !misspellingLength)
</span><span class="cx">             break;
</span><span class="cx">         
</span><span class="lines">@@ -891,8 +887,8 @@
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx">         AXAttributeStringSetNumber(attrString, NSAccessibilityMarkedMisspelledTextAttribute, [NSNumber numberWithBool:YES], spellRange);
</span><span class="cx"> #endif
</span><del>-        charLength -= (misspellingLocation + misspellingLength);
-        currentPosition += (misspellingLocation + misspellingLength);
</del><ins>+
+        currentPosition += misspellingLocation + misspellingLength;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -945,17 +941,17 @@
</span><span class="cx">         [attrString removeAttribute:attribute range:range];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void AXAttributedStringAppendText(NSMutableAttributedString* attrString, Node* node, const UChar* chars, int length)
</del><ins>+static void AXAttributedStringAppendText(NSMutableAttributedString* attrString, Node* node, StringView text)
</ins><span class="cx"> {
</span><span class="cx">     // skip invisible text
</span><span class="cx">     if (!node-&gt;renderer())
</span><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     // easier to calculate the range before appending the string
</span><del>-    NSRange attrStringRange = NSMakeRange([attrString length], length);
</del><ins>+    NSRange attrStringRange = NSMakeRange([attrString length], text.length());
</ins><span class="cx">     
</span><span class="cx">     // append the string from this node
</span><del>-    [[attrString mutableString] appendString:[NSString stringWithCharacters:chars length:length]];
</del><ins>+    [[attrString mutableString] appendString:text.createNSStringWithoutCopying().get()];
</ins><span class="cx">     
</span><span class="cx">     // add new attributes and remove irrelevant inherited ones
</span><span class="cx">     // NOTE: color attributes are handled specially because -[NSMutableAttributedString addAttribute: value: range:] does not merge
</span><span class="lines">@@ -976,7 +972,7 @@
</span><span class="cx">     AXAttributeStringSetElement(attrString, NSAccessibilityLinkTextAttribute, AccessibilityObject::anchorElementForNode(node), attrStringRange);
</span><span class="cx">     
</span><span class="cx">     // do spelling last because it tends to break up the range
</span><del>-    AXAttributeStringSetSpelling(attrString, node, chars, length, attrStringRange);
</del><ins>+    AXAttributeStringSetSpelling(attrString, node, text, attrStringRange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static NSString* nsStringForReplacedNode(Node* replacedNode)
</span><span class="lines">@@ -1028,9 +1024,8 @@
</span><span class="cx">             // Add the text of the list marker item if necessary.
</span><span class="cx">             String listMarkerText = m_object-&gt;listMarkerTextForNodeAndPosition(node, VisiblePosition(it.range()-&gt;startPosition()));
</span><span class="cx">             if (!listMarkerText.isEmpty())
</span><del>-                AXAttributedStringAppendText(attrString, node, listMarkerText.deprecatedCharacters(), listMarkerText.length());
-            
-            AXAttributedStringAppendText(attrString, node, it.characters(), it.length());
</del><ins>+                AXAttributedStringAppendText(attrString, node, listMarkerText);
+            AXAttributedStringAppendText(attrString, node, it.text());
</ins><span class="cx">         } else {
</span><span class="cx">             Node* replacedNode = node-&gt;childNode(offset);
</span><span class="cx">             NSString *attachmentString = nsStringForReplacedNode(replacedNode);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMUIKitExtensionsmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/bindings/objc/DOMUIKitExtensions.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -63,7 +63,6 @@
</span><span class="cx"> #import &quot;RenderText.h&quot;
</span><span class="cx"> #import &quot;ResourceBuffer.h&quot;
</span><span class="cx"> #import &quot;SharedBuffer.h&quot;
</span><del>-#import &quot;TextIterator.h&quot;
</del><span class="cx"> #import &quot;VisiblePosition.h&quot;
</span><span class="cx"> #import &quot;VisibleUnits.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -87,7 +86,6 @@
</span><span class="cx"> using WebCore::RenderStyle;
</span><span class="cx"> using WebCore::RenderText;
</span><span class="cx"> using WebCore::RootInlineBox;
</span><del>-using WebCore::TextIterator;
</del><span class="cx"> using WebCore::VisiblePosition;
</span><span class="cx"> 
</span><span class="cx"> @implementation DOMRange (UIKitExtensions)
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -73,7 +73,6 @@
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;VoidCallback.h&quot;
</span><span class="cx"> #include &quot;WheelEvent.h&quot;
</span><span class="cx"> #include &quot;XMLNSNames.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PositionIterator.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PositionIterator.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/dom/PositionIterator.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><span class="cx"> #include &quot;RenderText.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyBlockElementCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -2107,7 +2107,7 @@
</span><span class="cx">     int wordLength = word.length();
</span><span class="cx">     int misspellingLocation = -1;
</span><span class="cx">     int misspellingLength = 0;
</span><del>-    textChecker()-&gt;checkSpellingOfString(word.deprecatedCharacters(), wordLength, &amp;misspellingLocation, &amp;misspellingLength);
</del><ins>+    textChecker()-&gt;checkSpellingOfString(word, &amp;misspellingLocation, &amp;misspellingLength);
</ins><span class="cx"> 
</span><span class="cx">     return misspellingLength == wordLength ? word : String();
</span><span class="cx"> }
</span><span class="lines">@@ -2121,7 +2121,7 @@
</span><span class="cx"> 
</span><span class="cx">     int misspellingLocation = -1;
</span><span class="cx">     int misspellingLength = 0;
</span><del>-    textChecker()-&gt;checkSpellingOfString(selectedString.deprecatedCharacters(), length, &amp;misspellingLocation, &amp;misspellingLength);
</del><ins>+    textChecker()-&gt;checkSpellingOfString(selectedString, &amp;misspellingLocation, &amp;misspellingLength);
</ins><span class="cx">     
</span><span class="cx">     // The selection only counts as misspelled if the selected text is exactly one misspelled word
</span><span class="cx">     if (misspellingLength != length)
</span><span class="lines">@@ -2423,14 +2423,13 @@
</span><span class="cx">     RefPtr&lt;SpellCheckRequest&gt; request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessIncremental, asynchronous ? paragraphRange : rangeToCheck, paragraphRange);
</span><span class="cx"> 
</span><span class="cx">     if (asynchronous) {
</span><del>-        m_spellChecker-&gt;requestCheckingFor(request);
</del><ins>+        m_spellChecker-&gt;requestCheckingFor(request.release());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TextCheckingResult&gt; results;
</span><del>-    checkTextOfParagraph(textChecker(), paragraphToCheck.textDeprecatedCharacters(), paragraphToCheck.textLength(),
-        resolveTextCheckingTypeMask(textCheckingOptions), results);
-    markAndReplaceFor(request, results);
</del><ins>+    checkTextOfParagraph(*textChecker(), paragraphToCheck.text(), resolveTextCheckingTypeMask(textCheckingOptions), results);
+    markAndReplaceFor(request.release(), results);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isAutomaticTextReplacementType(TextCheckingType type)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingIndentOutdentCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include &quot;RenderObject.h&quot;
</span><span class="cx"> #include &quot;SplitElementCommand.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertListCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertListCommand.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -24,14 +24,15 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;InsertListCommand.h&quot;
+
</ins><span class="cx"> #include &quot;Element.h&quot;
</span><span class="cx"> #include &quot;ElementTraversal.h&quot;
</span><del>-#include &quot;InsertListCommand.h&quot;
</del><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><ins>+#include &quot;Range.h&quot;
</ins><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextCheckingHelpercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -43,61 +43,68 @@
</span><span class="cx"> #if !USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx"> 
</span><span class="cx"> #if USE(GRAMMAR_CHECKING)
</span><del>-static void findBadGrammars(TextCheckerClient* client, const UChar* text, int start, int length, Vector&lt;TextCheckingResult&gt;&amp; results)
</del><ins>+
+static void findGrammaticalErrors(TextCheckerClient&amp; client, StringView text, Vector&lt;TextCheckingResult&gt;&amp; results)
</ins><span class="cx"> {
</span><del>-    int checkLocation = start;
-    int checkLength = length;
-
-    while (0 &lt; checkLength) {
</del><ins>+    for (unsigned checkLocation = 0; checkLocation &lt; text.length(); ) {
</ins><span class="cx">         int badGrammarLocation = -1;
</span><span class="cx">         int badGrammarLength = 0;
</span><span class="cx">         Vector&lt;GrammarDetail&gt; badGrammarDetails;
</span><del>-        client-&gt;checkGrammarOfString(text + checkLocation, checkLength, badGrammarDetails, &amp;badGrammarLocation, &amp;badGrammarLength);
</del><ins>+        client.checkGrammarOfString(text.substring(checkLocation), badGrammarDetails, &amp;badGrammarLocation, &amp;badGrammarLength);
</ins><span class="cx">         if (!badGrammarLength)
</span><span class="cx">             break;
</span><del>-        ASSERT(0 &lt;= badGrammarLocation &amp;&amp; badGrammarLocation &lt;= checkLength);
-        ASSERT(0 &lt; badGrammarLength &amp;&amp; badGrammarLocation + badGrammarLength &lt;= checkLength);
</del><ins>+
+        ASSERT(badGrammarLocation &gt;= 0);
+        ASSERT(static_cast&lt;unsigned&gt;(badGrammarLocation) &lt;= text.length() - checkLocation);
+        ASSERT(badGrammarLength &gt; 0);
+        ASSERT(static_cast&lt;unsigned&gt;(badGrammarLength) &lt;= text.length() - checkLocation - badGrammarLocation);
+
</ins><span class="cx">         TextCheckingResult badGrammar;
</span><span class="cx">         badGrammar.type = TextCheckingTypeGrammar;
</span><span class="cx">         badGrammar.location = checkLocation + badGrammarLocation;
</span><span class="cx">         badGrammar.length = badGrammarLength;
</span><del>-        badGrammar.details.swap(badGrammarDetails);
</del><ins>+        badGrammar.details = std::move(badGrammarDetails);
</ins><span class="cx">         results.append(badGrammar);
</span><span class="cx"> 
</span><del>-        checkLocation += (badGrammarLocation + badGrammarLength);
-        checkLength -= (badGrammarLocation + badGrammarLength);
</del><ins>+        checkLocation += badGrammarLocation + badGrammarLength;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-static void findMisspellings(TextCheckerClient* client, const UChar* text, int length, Vector&lt;TextCheckingResult&gt;&amp; results)
</del><ins>+static void findMisspellings(TextCheckerClient&amp; client, StringView text, Vector&lt;TextCheckingResult&gt;&amp; results)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* iterator = wordBreakIterator(StringView(text, length));
</del><ins>+    TextBreakIterator* iterator = wordBreakIterator(text);
</ins><span class="cx">     if (!iterator)
</span><span class="cx">         return;
</span><del>-    int wordStart = textBreakCurrent(iterator);
-    while (0 &lt;= wordStart) {
</del><ins>+    for (int wordStart = textBreakCurrent(iterator); wordStart &gt; 0; ) {
</ins><span class="cx">         int wordEnd = textBreakNext(iterator);
</span><span class="cx">         if (wordEnd &lt; 0)
</span><span class="cx">             break;
</span><ins>+
</ins><span class="cx">         int wordLength = wordEnd - wordStart;
</span><span class="cx">         int misspellingLocation = -1;
</span><span class="cx">         int misspellingLength = 0;
</span><del>-        client-&gt;checkSpellingOfString(text + wordStart, wordLength, &amp;misspellingLocation, &amp;misspellingLength);
-        if (0 &lt; misspellingLength) {
-            ASSERT(0 &lt;= misspellingLocation &amp;&amp; misspellingLocation &lt;= wordLength);
-            ASSERT(0 &lt; misspellingLength &amp;&amp; misspellingLocation + misspellingLength &lt;= wordLength);
</del><ins>+        client.checkSpellingOfString(text.substring(wordStart, wordLength), &amp;misspellingLocation, &amp;misspellingLength);
+
+        if (misspellingLength &gt; 0) {
+            ASSERT(misspellingLocation &gt;= 0);
+            ASSERT(misspellingLocation &lt;= wordLength);
+            ASSERT(misspellingLength &gt; 0);
+            ASSERT(misspellingLocation + misspellingLength &lt;= wordLength);
+
</ins><span class="cx">             TextCheckingResult misspelling;
</span><span class="cx">             misspelling.type = TextCheckingTypeSpelling;
</span><span class="cx">             misspelling.location = wordStart + misspellingLocation;
</span><span class="cx">             misspelling.length = misspellingLength;
</span><del>-            misspelling.replacement = client-&gt;getAutoCorrectSuggestionForMisspelledWord(String(text + misspelling.location, misspelling.length));
</del><ins>+            misspelling.replacement = client.getAutoCorrectSuggestionForMisspelledWord(text.substring(misspelling.location, misspelling.length).toStringWithoutCopying());
</ins><span class="cx">             results.append(misspelling);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         wordStart = wordEnd;
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> static PassRefPtr&lt;Range&gt; expandToParagraphBoundary(PassRefPtr&lt;Range&gt; range)
</span><span class="lines">@@ -234,6 +241,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> String TextCheckingHelper::findFirstMisspelling(int&amp; firstMisspellingOffset, bool markAll, RefPtr&lt;Range&gt;&amp; firstMisspellingRange)
</span><span class="cx"> {
</span><span class="cx">     WordAwareIterator it(m_range.get());
</span><span class="lines">@@ -243,15 +251,14 @@
</span><span class="cx">     int currentChunkOffset = 0;
</span><span class="cx"> 
</span><span class="cx">     while (!it.atEnd()) {
</span><del>-        const UChar* chars = it.characters();
-        int len = it.length();
-        
</del><ins>+        StringView text = it.text();
+        int textLength = text.length();
+
</ins><span class="cx">         // Skip some work for one-space-char hunks
</span><del>-        if (!(len == 1 &amp;&amp; chars[0] == ' ')) {
-            
</del><ins>+        if (textLength == 1 &amp;&amp; text[0] == ' ') {
</ins><span class="cx">             int misspellingLocation = -1;
</span><span class="cx">             int misspellingLength = 0;
</span><del>-            m_client-&gt;textChecker()-&gt;checkSpellingOfString(chars, len, &amp;misspellingLocation, &amp;misspellingLength);
</del><ins>+            m_client-&gt;textChecker()-&gt;checkSpellingOfString(text, &amp;misspellingLocation, &amp;misspellingLength);
</ins><span class="cx"> 
</span><span class="cx">             // 5490627 shows that there was some code path here where the String constructor below crashes.
</span><span class="cx">             // We don't know exactly what combination of bad input caused this, so we're making this much
</span><span class="lines">@@ -259,19 +266,18 @@
</span><span class="cx">             ASSERT(misspellingLength &gt;= 0);
</span><span class="cx">             ASSERT(misspellingLocation &gt;= -1);
</span><span class="cx">             ASSERT(!misspellingLength || misspellingLocation &gt;= 0);
</span><del>-            ASSERT(misspellingLocation &lt; len);
-            ASSERT(misspellingLength &lt;= len);
-            ASSERT(misspellingLocation + misspellingLength &lt;= len);
-            
-            if (misspellingLocation &gt;= 0 &amp;&amp; misspellingLength &gt; 0 &amp;&amp; misspellingLocation &lt; len &amp;&amp; misspellingLength &lt;= len &amp;&amp; misspellingLocation + misspellingLength &lt;= len) {
-                
</del><ins>+            ASSERT(misspellingLocation &lt; textLength);
+            ASSERT(misspellingLength &lt;= textLength);
+            ASSERT(misspellingLocation + misspellingLength &lt;= textLength);
+
+            if (misspellingLocation &gt;= 0 &amp;&amp; misspellingLength &gt; 0 &amp;&amp; misspellingLocation &lt; textLength &amp;&amp; misspellingLength &lt;= textLength &amp;&amp; misspellingLocation + misspellingLength &lt;= textLength) {
</ins><span class="cx">                 // Compute range of misspelled word
</span><span class="cx">                 RefPtr&lt;Range&gt; misspellingRange = TextIterator::subrange(m_range.get(), currentChunkOffset + misspellingLocation, misspellingLength);
</span><span class="cx"> 
</span><span class="cx">                 // Remember first-encountered misspelling and its offset.
</span><span class="cx">                 if (!firstMisspelling) {
</span><span class="cx">                     firstMisspellingOffset = currentChunkOffset + misspellingLocation;
</span><del>-                    firstMisspelling = String(chars + misspellingLocation, misspellingLength);
</del><ins>+                    firstMisspelling = text.substring(misspellingLocation, misspellingLength).toString();
</ins><span class="cx">                     firstMisspellingRange = misspellingRange;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -284,7 +290,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        currentChunkOffset += len;
</del><ins>+        currentChunkOffset += textLength;
</ins><span class="cx">         it.advance();
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -345,26 +351,29 @@
</span><span class="cx">                 
</span><span class="cx">                 Vector&lt;TextCheckingResult&gt; results;
</span><span class="cx">                 TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
</span><del>-                checkTextOfParagraph(m_client-&gt;textChecker(), paragraphString.deprecatedCharacters(), paragraphString.length(), checkingTypes, results);
</del><ins>+                checkTextOfParagraph(*m_client-&gt;textChecker(), paragraphString, checkingTypes, results);
</ins><span class="cx">                 
</span><span class="cx">                 for (unsigned i = 0; i &lt; results.size(); i++) {
</span><span class="cx">                     const TextCheckingResult* result = &amp;results[i];
</span><span class="cx">                     if (result-&gt;type == TextCheckingTypeSpelling &amp;&amp; result-&gt;location &gt;= currentStartOffset &amp;&amp; result-&gt;location + result-&gt;length &lt;= currentEndOffset) {
</span><del>-                        ASSERT(result-&gt;length &gt; 0 &amp;&amp; result-&gt;location &gt;= 0);
</del><ins>+                        ASSERT(result-&gt;length &gt; 0);
+                        ASSERT(result-&gt;location &gt;= 0);
</ins><span class="cx">                         spellingLocation = result-&gt;location;
</span><span class="cx">                         misspelledWord = paragraphString.substring(result-&gt;location, result-&gt;length);
</span><span class="cx">                         ASSERT(misspelledWord.length());
</span><span class="cx">                         break;
</span><span class="cx">                     }
</span><span class="cx">                     if (checkGrammar &amp;&amp; result-&gt;type == TextCheckingTypeGrammar &amp;&amp; result-&gt;location &lt; currentEndOffset &amp;&amp; result-&gt;location + result-&gt;length &gt; currentStartOffset) {
</span><del>-                        ASSERT(result-&gt;length &gt; 0 &amp;&amp; result-&gt;location &gt;= 0);
</del><ins>+                        ASSERT(result-&gt;length &gt; 0);
+                        ASSERT(result-&gt;location &gt;= 0);
</ins><span class="cx">                         // We can't stop after the first grammar result, since there might still be a spelling result after
</span><span class="cx">                         // it begins but before the first detail in it, but we can stop if we find a second grammar result.
</span><span class="cx">                         if (foundGrammar)
</span><span class="cx">                             break;
</span><span class="cx">                         for (unsigned j = 0; j &lt; result-&gt;details.size(); j++) {
</span><span class="cx">                             const GrammarDetail* detail = &amp;result-&gt;details[j];
</span><del>-                            ASSERT(detail-&gt;length &gt; 0 &amp;&amp; detail-&gt;location &gt;= 0);
</del><ins>+                            ASSERT(detail-&gt;length &gt; 0);
+                            ASSERT(detail-&gt;location &gt;= 0);
</ins><span class="cx">                             if (result-&gt;location + detail-&gt;location &gt;= currentStartOffset &amp;&amp; result-&gt;location + detail-&gt;location + detail-&gt;length &lt;= currentEndOffset &amp;&amp; (!foundGrammar || result-&gt;location + detail-&gt;location &lt; grammarDetailLocation)) {
</span><span class="cx">                                 grammarDetailIndex = j;
</span><span class="cx">                                 grammarDetailLocation = result-&gt;location + detail-&gt;location;
</span><span class="lines">@@ -414,9 +423,11 @@
</span><span class="cx">     }
</span><span class="cx">     return firstFoundItem;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // !PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if USE(GRAMMAR_CHECKING)
</span><ins>+
</ins><span class="cx"> int TextCheckingHelper::findFirstGrammarDetail(const Vector&lt;GrammarDetail&gt;&amp; grammarDetails, int badGrammarPhraseLocation, int startOffset, int endOffset, bool markAll) const
</span><span class="cx"> {
</span><span class="cx">     // Found some bad grammar. Find the earliest detail range that starts in our search range (if any).
</span><span class="lines">@@ -425,7 +436,8 @@
</span><span class="cx">     int earliestDetailIndex = -1;
</span><span class="cx">     for (unsigned i = 0; i &lt; grammarDetails.size(); i++) {
</span><span class="cx">         const GrammarDetail* detail = &amp;grammarDetails[i];
</span><del>-        ASSERT(detail-&gt;length &gt; 0 &amp;&amp; detail-&gt;location &gt;= 0);
</del><ins>+        ASSERT(detail-&gt;length &gt; 0);
+        ASSERT(detail-&gt;location &gt;= 0);
</ins><span class="cx">         
</span><span class="cx">         int detailStartOffsetInParagraph = badGrammarPhraseLocation + detail-&gt;location;
</span><span class="cx">         
</span><span class="lines">@@ -469,12 +481,11 @@
</span><span class="cx">     TextCheckingParagraph paragraph(m_range);
</span><span class="cx">     
</span><span class="cx">     // Start checking from beginning of paragraph, but skip past results that occur before the start of the original search range.
</span><del>-    int startOffset = 0;
-    while (startOffset &lt; paragraph.checkingEnd()) {
</del><ins>+    for (int startOffset = 0; startOffset &lt; paragraph.checkingEnd(); ) {
</ins><span class="cx">         Vector&lt;GrammarDetail&gt; grammarDetails;
</span><span class="cx">         int badGrammarPhraseLocation = -1;
</span><span class="cx">         int badGrammarPhraseLength = 0;
</span><del>-        m_client-&gt;textChecker()-&gt;checkGrammarOfString(paragraph.textDeprecatedCharacters() + startOffset, paragraph.textLength() - startOffset, grammarDetails, &amp;badGrammarPhraseLocation, &amp;badGrammarPhraseLength);
</del><ins>+        m_client-&gt;textChecker()-&gt;checkGrammarOfString(StringView(paragraph.text()).substring(startOffset), grammarDetails, &amp;badGrammarPhraseLocation, &amp;badGrammarPhraseLength);
</ins><span class="cx">         
</span><span class="cx">         if (!badGrammarPhraseLength) {
</span><span class="cx">             ASSERT(badGrammarPhraseLocation == -1);
</span><span class="lines">@@ -484,7 +495,6 @@
</span><span class="cx">         ASSERT(badGrammarPhraseLocation &gt;= 0);
</span><span class="cx">         badGrammarPhraseLocation += startOffset;
</span><span class="cx"> 
</span><del>-        
</del><span class="cx">         // Found some bad grammar. Find the earliest detail range that starts in our search range (if any).
</span><span class="cx">         int badGrammarIndex = findFirstGrammarDetail(grammarDetails, badGrammarPhraseLocation, paragraph.checkingStart(), paragraph.checkingEnd(), markAll);
</span><span class="cx">         if (badGrammarIndex &gt;= 0) {
</span><span class="lines">@@ -511,7 +521,6 @@
</span><span class="cx">     return firstBadGrammarPhrase;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> bool TextCheckingHelper::isUngrammatical() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_client)
</span><span class="lines">@@ -535,9 +544,10 @@
</span><span class="cx">     // Bad grammar, but phrase (e.g. sentence) starts beyond start of range.
</span><span class="cx">     if (grammarPhraseOffset &gt; 0)
</span><span class="cx">         return false;
</span><del>-    
-    ASSERT(grammarDetail.location &gt;= 0 &amp;&amp; grammarDetail.length &gt; 0);
-    
</del><ins>+
+    ASSERT(grammarDetail.location &gt;= 0);
+    ASSERT(grammarDetail.length &gt; 0);
+
</ins><span class="cx">     // Bad grammar, but start of detail (e.g. ungrammatical word) doesn't match start of range
</span><span class="cx">     if (grammarDetail.location + grammarPhraseOffset)
</span><span class="cx">         return false;
</span><span class="lines">@@ -554,8 +564,9 @@
</span><span class="cx">     
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><ins>+#endif // USE(GRAMMAR_CHECKING)
+
</ins><span class="cx"> Vector&lt;String&gt; TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool&amp; misspelled, bool&amp; ungrammatical) const
</span><span class="cx"> {
</span><span class="cx">     if (!unifiedTextCheckerEnabled())
</span><span class="lines">@@ -575,7 +586,7 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TextCheckingResult&gt; results;
</span><span class="cx">     TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
</span><del>-    checkTextOfParagraph(m_client-&gt;textChecker(), paragraph.textDeprecatedCharacters(), paragraph.textLength(), checkingTypes, results);
</del><ins>+    checkTextOfParagraph(*m_client-&gt;textChecker(), paragraph.text(), checkingTypes, results);
</ins><span class="cx">     
</span><span class="cx">     for (unsigned i = 0; i &lt; results.size(); i++) {
</span><span class="cx">         const TextCheckingResult* result = &amp;results[i];
</span><span class="lines">@@ -597,7 +608,8 @@
</span><span class="cx">         if (result-&gt;type == TextCheckingTypeGrammar &amp;&amp; paragraph.isCheckingRangeCoveredBy(result-&gt;location, result-&gt;length)) {
</span><span class="cx">             for (unsigned j = 0; j &lt; result-&gt;details.size(); j++) {
</span><span class="cx">                 const GrammarDetail* detail = &amp;result-&gt;details[j];
</span><del>-                ASSERT(detail-&gt;length &gt; 0 &amp;&amp; detail-&gt;location &gt;= 0);
</del><ins>+                ASSERT(detail-&gt;length &gt; 0);
+                ASSERT(detail-&gt;location &gt;= 0);
</ins><span class="cx">                 if (paragraph.checkingRangeMatches(result-&gt;location + detail-&gt;location, detail-&gt;length)) {
</span><span class="cx">                     String badGrammarPhrase = paragraph.textSubstring(result-&gt;location, result-&gt;length);
</span><span class="cx">                     ASSERT(badGrammarPhrase.length());
</span><span class="lines">@@ -613,8 +625,8 @@
</span><span class="cx">     return guesses;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> void TextCheckingHelper::markAllMisspellings(RefPtr&lt;Range&gt;&amp; firstMisspellingRange)
</span><span class="cx"> {
</span><span class="cx">     // Use the &quot;markAll&quot; feature of findFirstMisspelling. Ignore the return value and the &quot;out parameter&quot;;
</span><span class="lines">@@ -633,6 +645,7 @@
</span><span class="cx">     findFirstBadGrammar(ignoredGrammarDetail, ignoredOffset, true);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> #endif // !PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> bool TextCheckingHelper::unifiedTextCheckerEnabled() const
</span><span class="lines">@@ -640,40 +653,33 @@
</span><span class="cx">     return m_range &amp;&amp; WebCore::unifiedTextCheckerEnabled(m_range-&gt;ownerDocument().frame());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length,
-                          TextCheckingTypeMask checkingTypes, Vector&lt;TextCheckingResult&gt;&amp; results)
</del><ins>+void checkTextOfParagraph(TextCheckerClient&amp; client, StringView text, TextCheckingTypeMask checkingTypes, Vector&lt;TextCheckingResult&gt;&amp; results)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><del>-    results = client-&gt;checkTextOfParagraph(StringView(text, length), checkingTypes);
</del><ins>+    results = client.checkTextOfParagraph(text, checkingTypes);
</ins><span class="cx"> #else
</span><del>-    Vector&lt;TextCheckingResult&gt; spellingResult;
</del><ins>+    Vector&lt;TextCheckingResult&gt; mispellings;
</ins><span class="cx">     if (checkingTypes &amp; TextCheckingTypeSpelling)
</span><del>-        findMisspellings(client, text, length, spellingResult);
</del><ins>+        findMisspellings(client, text, mispellings);
</ins><span class="cx"> 
</span><span class="cx"> #if USE(GRAMMAR_CHECKING)
</span><del>-    Vector&lt;TextCheckingResult&gt; grammarResult;
</del><ins>+    // Look for grammatical errors that occur before the first misspelling.
+    Vector&lt;TextCheckingResult&gt; grammaticalErrors;
</ins><span class="cx">     if (checkingTypes &amp; TextCheckingTypeGrammar) {
</span><del>-        // Only checks grammartical error before the first misspellings
-        int grammarCheckLength = length;
-        for (size_t i = 0; i &lt; spellingResult.size(); ++i) {
-            if (spellingResult[i].location &lt; grammarCheckLength)
-                grammarCheckLength = spellingResult[i].location;
-        }
-
-        findBadGrammars(client, text, 0, grammarCheckLength, grammarResult);
</del><ins>+        unsigned grammarCheckLength = text.length();
+        for (auto&amp; mispelling : mispellings)
+            grammarCheckLength = std::min&lt;unsigned&gt;(grammarCheckLength, mispelling.location);
+        findGrammaticalErrors(client, text.substring(0, grammarCheckLength), grammaticalErrors);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (grammarResult.size())
-        results.swap(grammarResult);
</del><ins>+    results = std::move(grammaticalErrors);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (spellingResult.size()) {
-        if (results.isEmpty())
-            results.swap(spellingResult);
-        else
-            results.appendVector(spellingResult);
-    }
-#endif
</del><ins>+    if (results.isEmpty())
+        results = std::move(mispellings);
+    else
+        results.appendVector(mispellings);
+#endif // USE(UNIFIED_TEXT_CHECKING)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool unifiedTextCheckerEnabled(const Frame* frame)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextCheckingHelperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextCheckingHelper.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextCheckingHelper.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -43,13 +43,16 @@
</span><span class="cx">     int offsetTo(const Position&amp;, ExceptionCode&amp;) const;
</span><span class="cx">     void expandRangeToNextEnd();
</span><span class="cx"> 
</span><ins>+    // FIXME: Consider changing this to return a StringView.
+    const String&amp; text() const;
+
+    // FIXME: Consider removing these and just having the caller use text() directly.
</ins><span class="cx">     int textLength() const { return text().length(); }
</span><span class="cx">     String textSubstring(unsigned pos, unsigned len = UINT_MAX) const { return text().substring(pos, len); }
</span><del>-    const UChar* textDeprecatedCharacters() const { return text().deprecatedCharacters(); }
</del><span class="cx">     UChar textCharAt(int index) const { return text()[static_cast&lt;unsigned&gt;(index)]; }
</span><ins>+    bool isTextEmpty() const { return text().isEmpty(); }
</ins><span class="cx"> 
</span><span class="cx">     bool isEmpty() const;
</span><del>-    bool isTextEmpty() const { return text().isEmpty(); }
</del><span class="cx">     bool isRangeEmpty() const { return checkingStart() &gt;= checkingEnd(); }
</span><span class="cx"> 
</span><span class="cx">     int checkingStart() const;
</span><span class="lines">@@ -66,7 +69,6 @@
</span><span class="cx">     void invalidateParagraphRangeValues();
</span><span class="cx">     PassRefPtr&lt;Range&gt; checkingRange() const { return m_checkingRange; }
</span><span class="cx">     PassRefPtr&lt;Range&gt; offsetAsRange() const;
</span><del>-    const String&amp; text() const;
</del><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Range&gt; m_checkingRange;
</span><span class="cx">     mutable RefPtr&lt;Range&gt; m_paragraphRange;
</span><span class="lines">@@ -103,8 +105,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length,
-    TextCheckingTypeMask checkingTypes, Vector&lt;TextCheckingResult&gt;&amp; results);
</del><ins>+void checkTextOfParagraph(TextCheckerClient&amp;, StringView, TextCheckingTypeMask, Vector&lt;TextCheckingResult&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx"> bool unifiedTextCheckerEnabled(const Frame*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2005 Alexey Proskuryakov.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -76,9 +76,9 @@
</span><span class="cx">     ~SearchBuffer();
</span><span class="cx"> 
</span><span class="cx">     // Returns number of characters appended; guaranteed to be in the range [1, length].
</span><del>-    size_t append(const UChar*, size_t length);
</del><ins>+    size_t append(StringView);
</ins><span class="cx">     bool needsMoreContext() const;
</span><del>-    void prependContext(const UChar*, size_t length);
</del><ins>+    void prependContext(StringView);
</ins><span class="cx">     void reachedBreak();
</span><span class="cx"> 
</span><span class="cx">     // Result is the size in characters of what was found.
</span><span class="lines">@@ -480,7 +480,7 @@
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     if (!m_textCharacters)
</span><del>-        return string()[startOffset() + index];
</del><ins>+        return m_text[m_positionStartOffset + index];
</ins><span class="cx"> 
</span><span class="cx">     return m_textCharacters[index];
</span><span class="cx"> }
</span><span class="lines">@@ -488,9 +488,9 @@
</span><span class="cx"> void TextIterator::appendTextToStringBuilder(StringBuilder&amp; builder) const
</span><span class="cx"> {
</span><span class="cx">     if (!m_textCharacters)
</span><del>-        builder.append(string(), startOffset(), length());
</del><ins>+        builder.append(m_text, m_positionStartOffset, m_textLength);
</ins><span class="cx">     else
</span><del>-        builder.append(characters(), length());
</del><ins>+        builder.append(m_textCharacters, m_textLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TextIterator::handleTextNode()
</span><span class="lines">@@ -1484,13 +1484,22 @@
</span><span class="cx">     m_runOffset = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void append(Vector&lt;UChar&gt;&amp; buffer, StringView string)
+{
+    unsigned oldSize = buffer.size();
+    unsigned length = string.length();
+    buffer.grow(oldSize + length);
+    for (unsigned i = 0; i &lt; length; ++i)
+        buffer[oldSize + i] = string[i];
+}
+
</ins><span class="cx"> String CharacterIterator::string(int numChars)
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;UChar&gt; result;
</span><span class="cx">     result.reserveInitialCapacity(numChars);
</span><span class="cx">     while (numChars &gt; 0 &amp;&amp; !atEnd()) {
</span><span class="cx">         int runSize = std::min(numChars, length());
</span><del>-        result.append(characters(), runSize);
</del><ins>+        append(result, text().substring(0, runSize));
</ins><span class="cx">         numChars -= runSize;
</span><span class="cx">         advance(runSize);
</span><span class="cx">     }
</span><span class="lines">@@ -1580,8 +1589,7 @@
</span><span class="cx"> // --------
</span><span class="cx"> 
</span><span class="cx"> WordAwareIterator::WordAwareIterator(const Range* r)
</span><del>-    : m_previousText(0)
-    , m_didLookAhead(true) // so we consider the first chunk from the text iterator
</del><ins>+    : m_didLookAhead(true) // so we consider the first chunk from the text iterator
</ins><span class="cx">     , m_textIterator(r)
</span><span class="cx"> {
</span><span class="cx">     advance(); // get in position over the first chunk of text
</span><span class="lines">@@ -1602,7 +1610,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WordAwareIterator::advance()
</span><span class="cx"> {
</span><del>-    m_previousText = 0;
</del><ins>+    m_previousText = StringView();
</ins><span class="cx">     m_buffer.clear();      // toss any old buffer we built up
</span><span class="cx"> 
</span><span class="cx">     // If last time we did a look-ahead, start with that looked-ahead chunk now
</span><span class="lines">@@ -1622,30 +1630,32 @@
</span><span class="cx">     
</span><span class="cx">     while (1) {
</span><span class="cx">         // If this chunk ends in whitespace we can just use it as our chunk.
</span><del>-        if (isSpaceOrNewline(m_textIterator.characters()[m_textIterator.length() - 1]))
</del><ins>+        if (isSpaceOrNewline(m_textIterator.text()[m_textIterator.length() - 1]))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         // If this is the first chunk that failed, save it in previousText before look ahead
</span><span class="cx">         if (m_buffer.isEmpty()) {
</span><del>-            m_previousText = m_textIterator.characters();
-            m_previousLength = m_textIterator.length();
</del><ins>+            // FIXME: It's not safe to keep a StringView alive to the previous text once the
+            // TextIterator advances. In cases where the TextIterator synthesizes a character,
+            // the pointer is no longer valid once we call advance. To fix this, we might need
+            // to add a new function to TextIterator to handle those cases.
+            m_previousText = m_textIterator.text();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Look ahead to next chunk.  If it is whitespace or a break, we can use the previous stuff
</span><span class="cx">         m_textIterator.advance();
</span><del>-        if (m_textIterator.atEnd() || m_textIterator.length() == 0 || isSpaceOrNewline(m_textIterator.characters()[0])) {
</del><ins>+        if (m_textIterator.atEnd() || !m_textIterator.length() || isSpaceOrNewline(m_textIterator.text()[0])) {
</ins><span class="cx">             m_didLookAhead = true;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (m_buffer.isEmpty()) {
</span><span class="cx">             // Start gobbling chunks until we get to a suitable stopping point
</span><del>-            m_buffer.append(m_previousText, m_previousLength);
-            m_previousText = 0;
</del><ins>+            append(m_buffer, m_previousText);
+            m_previousText = StringView();
</ins><span class="cx">         }
</span><del>-        m_buffer.append(m_textIterator.characters(), m_textIterator.length());
-        int exception = 0;
-        m_range-&gt;setEnd(m_textIterator.range()-&gt;endContainer(), m_textIterator.range()-&gt;endOffset(), exception);
</del><ins>+        append(m_buffer, m_textIterator.text());
+        m_range-&gt;setEnd(m_textIterator.range()-&gt;endContainer(), m_textIterator.range()-&gt;endOffset());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1654,17 +1664,17 @@
</span><span class="cx">     if (!m_buffer.isEmpty())
</span><span class="cx">         return m_buffer.size();
</span><span class="cx">     if (m_previousText)
</span><del>-        return m_previousLength;
</del><ins>+        return m_previousText.length();
</ins><span class="cx">     return m_textIterator.length();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const UChar* WordAwareIterator::characters() const
</del><ins>+StringView WordAwareIterator::text() const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_buffer.isEmpty())
</span><del>-        return m_buffer.data();
</del><ins>+        return StringView(m_buffer.data(), m_buffer.size());
</ins><span class="cx">     if (m_previousText)
</span><span class="cx">         return m_previousText;
</span><del>-    return m_textIterator.characters();
</del><ins>+    return m_textIterator.text();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // --------
</span><span class="lines">@@ -2062,9 +2072,9 @@
</span><span class="cx">     unlockSearcher();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline size_t SearchBuffer::append(const UChar* characters, size_t length)
</del><ins>+inline size_t SearchBuffer::append(StringView text)
</ins><span class="cx"> {
</span><del>-    ASSERT(length);
</del><ins>+    ASSERT(text.length());
</ins><span class="cx"> 
</span><span class="cx">     if (m_atBreak) {
</span><span class="cx">         m_buffer.shrink(0);
</span><span class="lines">@@ -2077,9 +2087,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     size_t oldLength = m_buffer.size();
</span><del>-    size_t usableLength = std::min(m_buffer.capacity() - oldLength, length);
</del><ins>+    size_t usableLength = std::min&lt;size_t&gt;(m_buffer.capacity() - oldLength, text.length());
</ins><span class="cx">     ASSERT(usableLength);
</span><del>-    m_buffer.append(characters, usableLength);
</del><ins>+    m_buffer.grow(oldLength + usableLength);
+    for (unsigned i = 0; i &lt; usableLength; ++i)
+        m_buffer[oldLength + i] = text[i];
</ins><span class="cx">     foldQuoteMarksAndSoftHyphens(m_buffer.data() + oldLength, usableLength);
</span><span class="cx">     return usableLength;
</span><span class="cx"> }
</span><span class="lines">@@ -2089,24 +2101,24 @@
</span><span class="cx">     return m_needsMoreContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void SearchBuffer::prependContext(const UChar* characters, size_t length)
</del><ins>+inline void SearchBuffer::prependContext(StringView text)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_needsMoreContext);
</span><span class="cx">     ASSERT(m_prefixLength == m_buffer.size());
</span><span class="cx"> 
</span><del>-    if (!length)
</del><ins>+    if (!text.length())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_atBreak = false;
</span><span class="cx"> 
</span><del>-    size_t wordBoundaryContextStart = length;
</del><ins>+    size_t wordBoundaryContextStart = text.length();
</ins><span class="cx">     if (wordBoundaryContextStart) {
</span><del>-        U16_BACK_1(characters, 0, wordBoundaryContextStart);
-        wordBoundaryContextStart = startOfLastWordBoundaryContext(characters, wordBoundaryContextStart);
</del><ins>+        U16_BACK_1(text, 0, wordBoundaryContextStart);
+        wordBoundaryContextStart = startOfLastWordBoundaryContext(text.substring(0, wordBoundaryContextStart));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    size_t usableLength = std::min(m_buffer.capacity() - m_prefixLength, length - wordBoundaryContextStart);
-    m_buffer.insert(0, characters + length - usableLength, usableLength);
</del><ins>+    size_t usableLength = std::min(m_buffer.capacity() - m_prefixLength, text.length() - wordBoundaryContextStart);
+    WebCore::append(m_buffer, text.substring(text.length() - usableLength, usableLength));
</ins><span class="cx">     m_prefixLength += usableLength;
</span><span class="cx"> 
</span><span class="cx">     if (wordBoundaryContextStart || m_prefixLength == m_buffer.capacity())
</span><span class="lines">@@ -2234,7 +2246,7 @@
</span><span class="cx"> 
</span><span class="cx">     size_t wordBreakSearchStart = start + length;
</span><span class="cx">     while (wordBreakSearchStart &gt; start)
</span><del>-        wordBreakSearchStart = findNextWordFromIndex(m_buffer.data(), m_buffer.size(), wordBreakSearchStart, false /* backwards */);
</del><ins>+        wordBreakSearchStart = findNextWordFromIndex(StringView(m_buffer.data(), m_buffer.size()), wordBreakSearchStart, false /* backwards */);
</ins><span class="cx">     return wordBreakSearchStart == start;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2275,9 +2287,9 @@
</span><span class="cx">         if (m_options &amp; AtWordStarts) {
</span><span class="cx">             // Ensure that there is sufficient context before matchStart the next time around for
</span><span class="cx">             // determining if it is at a word boundary.
</span><del>-            int wordBoundaryContextStart = matchStart;
</del><ins>+            unsigned wordBoundaryContextStart = matchStart;
</ins><span class="cx">             U16_BACK_1(m_buffer.data(), 0, wordBoundaryContextStart);
</span><del>-            wordBoundaryContextStart = startOfLastWordBoundaryContext(m_buffer.data(), wordBoundaryContextStart);
</del><ins>+            wordBoundaryContextStart = startOfLastWordBoundaryContext(StringView(m_buffer.data(), wordBoundaryContextStart));
</ins><span class="cx">             overlap = std::min(size - 1, std::max(overlap, size - wordBoundaryContextStart));
</span><span class="cx">         }
</span><span class="cx">         memcpy(m_buffer.data(), m_buffer.data() + size - overlap, overlap * sizeof(UChar));
</span><span class="lines">@@ -2601,14 +2613,14 @@
</span><span class="cx">         RefPtr&lt;Range&gt; beforeStartRange = startRange-&gt;ownerDocument().createRange();
</span><span class="cx">         beforeStartRange-&gt;setEnd(startRange-&gt;startContainer(), startRange-&gt;startOffset(), IGNORE_EXCEPTION);
</span><span class="cx">         for (SimplifiedBackwardsTextIterator backwardsIterator(beforeStartRange.get()); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
</span><del>-            buffer.prependContext(backwardsIterator.characters(), backwardsIterator.length());
</del><ins>+            buffer.prependContext(backwardsIterator.text());
</ins><span class="cx">             if (!buffer.needsMoreContext())
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     while (!it.atEnd()) {
</span><del>-        it.advance(buffer.append(it.characters(), it.length()));
</del><ins>+        it.advance(buffer.append(it.text()));
</ins><span class="cx"> tryAgain:
</span><span class="cx">         size_t matchStartOffset;
</span><span class="cx">         if (size_t newMatchLength = buffer.search(matchStartOffset)) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/TextIterator.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2006, 2009, 2014 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">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;FindOptions.h&quot;
</span><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -93,8 +94,11 @@
</span><span class="cx">     bool atEnd() const { return !m_positionNode || m_shouldStop; }
</span><span class="cx">     void advance();
</span><span class="cx">     
</span><ins>+    StringView text() const { return m_textCharacters ? StringView(m_textCharacters, m_textLength) : StringView(m_text).substring(m_positionStartOffset, m_textLength); }
</ins><span class="cx">     int length() const { return m_textLength; }
</span><del>-    const UChar* characters() const { return m_textCharacters ? m_textCharacters : m_text.deprecatedCharacters() + startOffset(); }
</del><ins>+
+    const UChar* deprecatedTextIteratorCharacters() const { return m_textCharacters ? m_textCharacters : m_text.deprecatedCharacters() + m_positionStartOffset; }
+
</ins><span class="cx">     UChar characterAt(unsigned index) const;
</span><span class="cx">     void appendTextToStringBuilder(StringBuilder&amp;) const;
</span><span class="cx">     
</span><span class="lines">@@ -107,8 +111,6 @@
</span><span class="cx">     static PassRefPtr&lt;Range&gt; subrange(Range* entireRange, int characterOffset, int characterCount);
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-    int startOffset() const { return m_positionStartOffset; }
-    const String&amp; string() const { return m_text; }
</del><span class="cx">     void exitNode();
</span><span class="cx">     bool shouldRepresentNodeOffsetZero();
</span><span class="cx">     bool shouldEmitSpaceBeforeAndAfterNode(Node*);
</span><span class="lines">@@ -209,9 +211,10 @@
</span><span class="cx">     void advance();
</span><span class="cx"> 
</span><span class="cx">     Node* node() const { return m_node; }
</span><ins>+
+    StringView text() const { return StringView(m_textCharacters, m_textLength); }
</ins><span class="cx">     int length() const { return m_textLength; }
</span><del>-    const UChar* characters() const { return m_textCharacters; }
-    
</del><ins>+
</ins><span class="cx">     PassRefPtr&lt;Range&gt; range() const;
</span><span class="cx">         
</span><span class="cx"> private:
</span><span class="lines">@@ -279,13 +282,14 @@
</span><span class="cx">     bool atBreak() const { return m_atBreak; }
</span><span class="cx">     bool atEnd() const { return m_textIterator.atEnd(); }
</span><span class="cx">     
</span><ins>+    StringView text() const { return m_textIterator.text().substring(m_runOffset); }
</ins><span class="cx">     int length() const { return m_textIterator.length() - m_runOffset; }
</span><del>-    const UChar* characters() const { return m_textIterator.characters() + m_runOffset; }
-    String string(int numChars);
</del><ins>+
+    String string(int numCharacters);
</ins><span class="cx">     
</span><span class="cx">     int characterOffset() const { return m_offset; }
</span><span class="cx">     PassRefPtr&lt;Range&gt; range() const;
</span><del>-        
</del><ins>+
</ins><span class="cx"> private:
</span><span class="cx">     int m_offset;
</span><span class="cx">     int m_runOffset;
</span><span class="lines">@@ -323,20 +327,18 @@
</span><span class="cx">     void advance();
</span><span class="cx">     
</span><span class="cx">     int length() const;
</span><del>-    const UChar* characters() const;
-    
-    // Range of the text we're currently returning
</del><ins>+
+    StringView text() const;
</ins><span class="cx">     PassRefPtr&lt;Range&gt; range() const { return m_range; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    // text from the previous chunk from the textIterator
-    const UChar* m_previousText;
-    int m_previousLength;
</del><ins>+    // Text from the previous chunk from the text iterator.
+    StringView m_previousText;
</ins><span class="cx"> 
</span><del>-    // many chunks from textIterator concatenated
</del><ins>+    // Many chunks from text iterator concatenated.
</ins><span class="cx">     Vector&lt;UChar&gt; m_buffer;
</span><span class="cx">     
</span><del>-    // Did we have to look ahead in the textIterator to confirm the current chunk?
</del><ins>+    // Did we have to look ahead in the text iterator to confirm the current chunk?
</ins><span class="cx">     bool m_didLookAhead;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Range&gt; m_range;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleSelection.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -237,7 +237,7 @@
</span><span class="cx">     CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
</span><span class="cx"> 
</span><span class="cx">     for (; charIt.length(); charIt.advance(1)) {
</span><del>-        UChar c = charIt.characters()[0];
</del><ins>+        UChar c = charIt.text()[0];
</ins><span class="cx">         if ((!isSpaceOrNewline(c) &amp;&amp; c != noBreakSpace) || c == '\n')
</span><span class="cx">             break;
</span><span class="cx">         m_end = charIt.range()-&gt;endPosition();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleUnitscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -55,13 +55,13 @@
</span><span class="cx">             return node;
</span><span class="cx">         node = previousLeafNode(node);
</span><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Node* nextLeafWithSameEditability(Node* node, EditableType editableType = ContentIsEditable)
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     
</span><span class="cx">     bool editable = node-&gt;hasEditableStyle(editableType);
</span><span class="cx">     node = nextLeafNode(node);
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">             return node;
</span><span class="cx">         node = nextLeafNode(node);
</span><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: consolidate with code in previousLinePosition.
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx"> const InlineBox* CachedLogicallyOrderedLeafBoxes::previousTextOrLineBreakBox(const RootInlineBox* root, const InlineTextBox* box)
</span><span class="cx"> {
</span><span class="cx">     if (!root)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     collectBoxes(root);
</span><span class="cx"> 
</span><span class="lines">@@ -157,13 +157,13 @@
</span><span class="cx">             return box;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const InlineBox* CachedLogicallyOrderedLeafBoxes::nextTextOrLineBreakBox(const RootInlineBox* root, const InlineTextBox* box)
</span><span class="cx"> {
</span><span class="cx">     if (!root)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     collectBoxes(root);
</span><span class="cx"> 
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx">             return box;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const Vector&lt;InlineBox*&gt;&amp; CachedLogicallyOrderedLeafBoxes::collectBoxes(const RootInlineBox* root)
</span><span class="lines">@@ -444,8 +444,44 @@
</span><span class="cx"> 
</span><span class="cx"> enum BoundarySearchContextAvailability { DontHaveMoreContext, MayHaveMoreContext };
</span><span class="cx"> 
</span><del>-typedef unsigned (*BoundarySearchFunction)(const UChar*, unsigned length, unsigned offset, BoundarySearchContextAvailability, bool&amp; needMoreContext);
</del><ins>+typedef unsigned (*BoundarySearchFunction)(StringView, unsigned offset, BoundarySearchContextAvailability, bool&amp; needMoreContext);
</ins><span class="cx"> 
</span><ins>+static void prepend(Vector&lt;UChar, 1024&gt;&amp; buffer, StringView string)
+{
+    unsigned oldSize = buffer.size();
+    unsigned length = string.length();
+    buffer.grow(oldSize + length);
+    memmove(buffer.data() + length, buffer.data(), oldSize * sizeof(UChar));
+    for (unsigned i = 0; i &lt; length; ++i)
+        buffer[i] = string[i];
+}
+
+static void prependRepeatedCharacter(Vector&lt;UChar, 1024&gt;&amp; buffer, UChar character, unsigned count)
+{
+    unsigned oldSize = buffer.size();
+    buffer.grow(oldSize + count);
+    memmove(buffer.data() + count, buffer.data(), oldSize * sizeof(UChar));
+    for (unsigned i = 0; i &lt; count; ++i)
+        buffer[i] = character;
+}
+
+static void append(Vector&lt;UChar, 1024&gt;&amp; buffer, StringView string)
+{
+    unsigned oldSize = buffer.size();
+    unsigned length = string.length();
+    buffer.grow(oldSize + length);
+    for (unsigned i = 0; i &lt; length; ++i)
+        buffer[oldSize + i] = string[i];
+}
+
+static void appendRepeatedCharacter(Vector&lt;UChar, 1024&gt;&amp; buffer, UChar character, unsigned count)
+{
+    unsigned oldSize = buffer.size();
+    buffer.grow(oldSize + count);
+    for (unsigned i = 0; i &lt; count; ++i)
+        buffer[oldSize + i] = character;
+}
+
</ins><span class="cx"> static VisiblePosition previousBoundary(const VisiblePosition&amp; c, BoundarySearchFunction searchFunction)
</span><span class="cx"> {
</span><span class="cx">     Position pos = c.deepEquivalent();
</span><span class="lines">@@ -468,12 +504,11 @@
</span><span class="cx">         forwardsScanRange-&gt;setStart(end.deprecatedNode(), end.deprecatedEditingOffset(), ec);
</span><span class="cx">         TextIterator forwardsIterator(forwardsScanRange.get());
</span><span class="cx">         while (!forwardsIterator.atEnd()) {
</span><del>-            const UChar* characters = forwardsIterator.characters();
-            int length = forwardsIterator.length();
-            int i = endOfFirstWordBoundaryContext(characters, length);
-            string.append(characters, i);
</del><ins>+            StringView text = forwardsIterator.text();
+            unsigned i = endOfFirstWordBoundaryContext(text);
+            append(string, text.substring(0, i));
</ins><span class="cx">             suffixLength += i;
</span><del>-            if (i &lt; length)
</del><ins>+            if (i &lt; text.length())
</ins><span class="cx">                 break;
</span><span class="cx">             forwardsIterator.advance();
</span><span class="cx">         }
</span><span class="lines">@@ -493,26 +528,22 @@
</span><span class="cx">         bool inTextSecurityMode = it.node() &amp;&amp; it.node()-&gt;renderer() &amp;&amp; it.node()-&gt;renderer()-&gt;style().textSecurity() != TSNONE;
</span><span class="cx">         // iterate to get chunks until the searchFunction returns a non-zero value.
</span><span class="cx">         if (!inTextSecurityMode) 
</span><del>-            string.insert(0, it.characters(), it.length());
</del><ins>+            prepend(string, it.text());
</ins><span class="cx">         else {
</span><span class="cx">             // Treat bullets used in the text security mode as regular characters when looking for boundaries
</span><del>-            String iteratorString(it.characters(), it.length());
-#if PLATFORM(IOS)
-            iteratorString = iteratorString.impl()-&gt;fill('x');
-#else
-            iteratorString.fill('x');
-#endif
-            string.insert(0, iteratorString.deprecatedCharacters(), iteratorString.length());
</del><ins>+            prependRepeatedCharacter(string, 'x', it.length());
</ins><span class="cx">         }
</span><del>-        next = searchFunction(string.data(), string.size(), string.size() - suffixLength, MayHaveMoreContext, needMoreContext);
-        if (next &gt; 1) // FIXME: This is a work around for https://webkit.org/b/115070. We need to provide more contexts in general case.
-            break;
</del><ins>+        if (string.size() &gt; suffixLength) {
+            next = searchFunction(StringView(string.data(), string.size()), string.size() - suffixLength, MayHaveMoreContext, needMoreContext);
+            if (next &gt; 1) // FIXME: This is a work around for https://webkit.org/b/115070. We need to provide more contexts in general case.
+                break;
+        }
</ins><span class="cx">         it.advance();
</span><span class="cx">     }
</span><del>-    if (needMoreContext) {
</del><ins>+    if (needMoreContext &amp;&amp; string.size() &gt; suffixLength) {
</ins><span class="cx">         // The last search returned the beginning of the buffer and asked for more context,
</span><span class="cx">         // but there is no earlier text. Force a search with what's available.
</span><del>-        next = searchFunction(string.data(), string.size(), string.size() - suffixLength, DontHaveMoreContext, needMoreContext);
</del><ins>+        next = searchFunction(StringView(string.data(), string.size()), string.size() - suffixLength, DontHaveMoreContext, needMoreContext);
</ins><span class="cx">         ASSERT(!needMoreContext);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -550,11 +581,10 @@
</span><span class="cx">         backwardsScanRange-&gt;setEnd(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
</span><span class="cx">         SimplifiedBackwardsTextIterator backwardsIterator(backwardsScanRange.get());
</span><span class="cx">         while (!backwardsIterator.atEnd()) {
</span><del>-            const UChar* characters = backwardsIterator.characters();
-            int length = backwardsIterator.length();
-            int i = startOfLastWordBoundaryContext(characters, length);
-            string.insert(0, characters + i, length - i);
-            prefixLength += length - i;
</del><ins>+            StringView text = backwardsIterator.text();
+            int i = startOfLastWordBoundaryContext(text);
+            prepend(string, text.substring(i));
+            prefixLength += text.length() - i;
</ins><span class="cx">             if (i &gt; 0)
</span><span class="cx">                 break;
</span><span class="cx">             backwardsIterator.advance();
</span><span class="lines">@@ -571,39 +601,35 @@
</span><span class="cx">         // Keep asking the iterator for chunks until the search function
</span><span class="cx">         // returns an end value not equal to the length of the string passed to it.
</span><span class="cx">         if (!inTextSecurityMode)
</span><del>-            string.append(it.characters(), it.length());
</del><ins>+            append(string, it.text());
</ins><span class="cx">         else {
</span><span class="cx">             // Treat bullets used in the text security mode as regular characters when looking for boundaries
</span><del>-            String iteratorString(it.characters(), it.length());
-#if PLATFORM(IOS)
-            iteratorString = iteratorString.impl()-&gt;fill('x');
-#else
-            iteratorString.fill('x');
-#endif
-            string.append(iteratorString.deprecatedCharacters(), iteratorString.length());
</del><ins>+            appendRepeatedCharacter(string, 'x', it.length());
</ins><span class="cx">         }
</span><del>-        next = searchFunction(string.data(), string.size(), prefixLength, MayHaveMoreContext, needMoreContext);
-        if (next != string.size())
-            break;
</del><ins>+        if (string.size() &gt; prefixLength) {
+            next = searchFunction(StringView(string.data(), string.size()), prefixLength, MayHaveMoreContext, needMoreContext);
+            if (next != string.size())
+                break;
+        }
</ins><span class="cx">         it.advance();
</span><span class="cx">     }
</span><del>-    if (needMoreContext) {
</del><ins>+    if (needMoreContext &amp;&amp; string.size() &gt; prefixLength) {
</ins><span class="cx">         // The last search returned the end of the buffer and asked for more context,
</span><span class="cx">         // but there is no further text. Force a search with what's available.
</span><del>-        next = searchFunction(string.data(), string.size(), prefixLength, DontHaveMoreContext, needMoreContext);
</del><ins>+        next = searchFunction(StringView(string.data(), string.size()), prefixLength, DontHaveMoreContext, needMoreContext);
</ins><span class="cx">         ASSERT(!needMoreContext);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    if (it.atEnd() &amp;&amp; next == string.size()) {
</del><ins>+    if (it.atEnd() &amp;&amp; next == string.size())
</ins><span class="cx">         pos = it.range()-&gt;startPosition();
</span><del>-    } else if (next != prefixLength) {
</del><ins>+    else if (next &gt; prefixLength) {
</ins><span class="cx">         // Use the character iterator to translate the next value into a DOM position.
</span><span class="cx">         CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
</span><span class="cx">         charIt.advance(next - prefixLength - 1);
</span><span class="cx">         RefPtr&lt;Range&gt; characterRange = charIt.range();
</span><span class="cx">         pos = characterRange-&gt;endPosition();
</span><span class="cx">         
</span><del>-        if (*charIt.characters() == '\n') {
</del><ins>+        if (charIt.text()[0] == '\n') {
</ins><span class="cx">             // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines (see rdar://5192593)
</span><span class="cx">             VisiblePosition visPos = VisiblePosition(pos);
</span><span class="cx">             if (visPos == VisiblePosition(characterRange-&gt;startPosition())) {
</span><span class="lines">@@ -619,21 +645,21 @@
</span><span class="cx"> 
</span><span class="cx"> // ---------
</span><span class="cx"> 
</span><del>-static unsigned startWordBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</del><ins>+static unsigned startWordBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(offset);
</span><del>-    if (mayHaveMoreContext &amp;&amp; !startOfLastWordBoundaryContext(characters, offset)) {
</del><ins>+    if (mayHaveMoreContext &amp;&amp; !startOfLastWordBoundaryContext(text.substring(0, offset))) {
</ins><span class="cx">         needMoreContext = true;
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx">     needMoreContext = false;
</span><span class="cx">     int start, end;
</span><del>-    U16_BACK_1(characters, 0, offset);
-    findWordBoundary(characters, length, offset, &amp;start, &amp;end);
</del><ins>+    U16_BACK_1(text, 0, offset);
+    findWordBoundary(text, offset, &amp;start, &amp;end);
</ins><span class="cx">     return start;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition startOfWord(const VisiblePosition &amp;c, EWordSide side)
</del><ins>+VisiblePosition startOfWord(const VisiblePosition&amp; c, EWordSide side)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: This returns a null VP for c at the start of the document
</span><span class="cx">     // and side == LeftWordIfOnBoundary
</span><span class="lines">@@ -650,26 +676,20 @@
</span><span class="cx">     return previousBoundary(p, startWordBoundary);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned endWordBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</del><ins>+static unsigned endWordBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</ins><span class="cx"> {
</span><del>-    ASSERT(offset &lt;= length);
-    if (mayHaveMoreContext &amp;&amp; endOfFirstWordBoundaryContext(characters + offset, length - offset) == static_cast&lt;int&gt;(length - offset)) {
</del><ins>+    ASSERT(offset &lt;= text.length());
+    if (mayHaveMoreContext &amp;&amp; endOfFirstWordBoundaryContext(text.substring(offset)) == text.length() - offset) {
</ins><span class="cx">         needMoreContext = true;
</span><del>-        return length;
</del><ins>+        return text.length();
</ins><span class="cx">     }
</span><span class="cx">     needMoreContext = false;
</span><del>-#if PLATFORM(IOS)
-    // FIXME: Bug 126830: [iOS] Implement WebCore::findEndWordBoundary()
-    int start, end;
-    findWordBoundary(characters, length, offset, &amp;start, &amp;end);
-#else
</del><span class="cx">     int end;
</span><del>-    findEndWordBoundary(characters, length, offset, &amp;end);
-#endif
</del><ins>+    findEndWordBoundary(text, offset, &amp;end);
</ins><span class="cx">     return end;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition endOfWord(const VisiblePosition &amp;c, EWordSide side)
</del><ins>+VisiblePosition endOfWord(const VisiblePosition&amp; c, EWordSide side)
</ins><span class="cx"> {
</span><span class="cx">     VisiblePosition p = c;
</span><span class="cx">     if (side == LeftWordIfOnBoundary) {
</span><span class="lines">@@ -685,36 +705,34 @@
</span><span class="cx">     return nextBoundary(p, endWordBoundary);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned previousWordPositionBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</del><ins>+static unsigned previousWordPositionBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</ins><span class="cx"> {
</span><del>-    if (mayHaveMoreContext &amp;&amp; !startOfLastWordBoundaryContext(characters, offset)) {
</del><ins>+    if (mayHaveMoreContext &amp;&amp; !startOfLastWordBoundaryContext(text.substring(0, offset))) {
</ins><span class="cx">         needMoreContext = true;
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx">     needMoreContext = false;
</span><del>-    return findNextWordFromIndex(characters, length, offset, false);
</del><ins>+    return findNextWordFromIndex(text, offset, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition previousWordPosition(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition previousWordPosition(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    VisiblePosition prev = previousBoundary(c, previousWordPositionBoundary);
-    return c.honorEditingBoundaryAtOrBefore(prev);
</del><ins>+    return position.honorEditingBoundaryAtOrBefore(previousBoundary(position, previousWordPositionBoundary));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned nextWordPositionBoundary(const UChar* characters, unsigned length, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</del><ins>+static unsigned nextWordPositionBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool&amp; needMoreContext)
</ins><span class="cx"> {
</span><del>-    if (mayHaveMoreContext &amp;&amp; endOfFirstWordBoundaryContext(characters + offset, length - offset) == static_cast&lt;int&gt;(length - offset)) {
</del><ins>+    if (mayHaveMoreContext &amp;&amp; endOfFirstWordBoundaryContext(text.substring(offset)) == text.length() - offset) {
</ins><span class="cx">         needMoreContext = true;
</span><del>-        return length;
</del><ins>+        return text.length();
</ins><span class="cx">     }
</span><span class="cx">     needMoreContext = false;
</span><del>-    return findNextWordFromIndex(characters, length, offset, true);
</del><ins>+    return findNextWordFromIndex(text, offset, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition nextWordPosition(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition nextWordPosition(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    VisiblePosition next = nextBoundary(c, nextWordPositionBoundary);    
-    return c.honorEditingBoundaryAtOrAfter(next);
</del><ins>+    return position.honorEditingBoundaryAtOrAfter(nextBoundary(position, nextWordPositionBoundary));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool isStartOfWord(const VisiblePosition&amp; p)
</span><span class="lines">@@ -900,36 +918,35 @@
</span><span class="cx">     return endOfLine(currentPosition, UseLogicalOrdering);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool inSameLine(const VisiblePosition &amp;a, const VisiblePosition &amp;b)
</del><ins>+bool inSameLine(const VisiblePosition&amp; a, const VisiblePosition&amp; b)
</ins><span class="cx"> {
</span><span class="cx">     return a.isNotNull() &amp;&amp; startOfLine(a) == startOfLine(b);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isStartOfLine(const VisiblePosition &amp;p)
</del><ins>+bool isStartOfLine(const VisiblePosition&amp; p)
</ins><span class="cx"> {
</span><span class="cx">     return p.isNotNull() &amp;&amp; p == startOfLine(p);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isEndOfLine(const VisiblePosition &amp;p)
</del><ins>+bool isEndOfLine(const VisiblePosition&amp; p)
</ins><span class="cx"> {
</span><span class="cx">     return p.isNotNull() &amp;&amp; p == endOfLine(p);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline IntPoint absoluteLineDirectionPointToLocalPointInBlock(RootInlineBox* root, int lineDirectionPoint)
</del><ins>+static inline IntPoint absoluteLineDirectionPointToLocalPointInBlock(RootInlineBox&amp; root, int lineDirectionPoint)
</ins><span class="cx"> {
</span><del>-    ASSERT(root);
-    RenderBlockFlow&amp; containingBlock = root-&gt;blockFlow();
</del><ins>+    RenderBlockFlow&amp; containingBlock = root.blockFlow();
</ins><span class="cx">     FloatPoint absoluteBlockPoint = containingBlock.localToAbsolute(FloatPoint());
</span><span class="cx">     if (containingBlock.hasOverflowClip())
</span><span class="cx">         absoluteBlockPoint -= containingBlock.scrolledContentOffset();
</span><span class="cx"> 
</span><span class="cx">     if (containingBlock.isHorizontalWritingMode())
</span><del>-        return IntPoint(lineDirectionPoint - absoluteBlockPoint.x(), root-&gt;blockDirectionPointInLine());
</del><ins>+        return IntPoint(lineDirectionPoint - absoluteBlockPoint.x(), root.blockDirectionPointInLine());
</ins><span class="cx"> 
</span><del>-    return IntPoint(root-&gt;blockDirectionPointInLine(), lineDirectionPoint - absoluteBlockPoint.y());
</del><ins>+    return IntPoint(root.blockDirectionPointInLine(), lineDirectionPoint - absoluteBlockPoint.y());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition previousLinePosition(const VisiblePosition &amp;visiblePosition, int lineDirectionPoint, EditableType editableType)
</del><ins>+VisiblePosition previousLinePosition(const VisiblePosition&amp; visiblePosition, int lineDirectionPoint, EditableType editableType)
</ins><span class="cx"> {
</span><span class="cx">     Position p = visiblePosition.deepEquivalent();
</span><span class="cx">     Node* node = p.deprecatedNode();
</span><span class="lines">@@ -967,7 +984,7 @@
</span><span class="cx">     
</span><span class="cx">     if (root) {
</span><span class="cx">         // FIXME: Can be wrong for multi-column layout and with transforms.
</span><del>-        IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(root, lineDirectionPoint);
</del><ins>+        IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(*root, lineDirectionPoint);
</ins><span class="cx">         RenderObject&amp; renderer = root-&gt;closestLeafChildForPoint(pointInLine, isEditablePosition(p))-&gt;renderer();
</span><span class="cx">         Node* node = renderer.node();
</span><span class="cx">         if (node &amp;&amp; editingIgnoresContent(node))
</span><span class="lines">@@ -984,7 +1001,7 @@
</span><span class="cx">     return VisiblePosition(firstPositionInNode(rootElement), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition nextLinePosition(const VisiblePosition &amp;visiblePosition, int lineDirectionPoint, EditableType editableType)
</del><ins>+VisiblePosition nextLinePosition(const VisiblePosition&amp; visiblePosition, int lineDirectionPoint, EditableType editableType)
</ins><span class="cx"> {
</span><span class="cx">     Position p = visiblePosition.deepEquivalent();
</span><span class="cx">     Node* node = p.deprecatedNode();
</span><span class="lines">@@ -1025,7 +1042,7 @@
</span><span class="cx">     
</span><span class="cx">     if (root) {
</span><span class="cx">         // FIXME: Can be wrong for multi-column layout and with transforms.
</span><del>-        IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(root, lineDirectionPoint);
</del><ins>+        IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(*root, lineDirectionPoint);
</ins><span class="cx">         RenderObject&amp; renderer = root-&gt;closestLeafChildForPoint(pointInLine, isEditablePosition(p))-&gt;renderer();
</span><span class="cx">         Node* node = renderer.node();
</span><span class="cx">         if (node &amp;&amp; editingIgnoresContent(node))
</span><span class="lines">@@ -1044,56 +1061,50 @@
</span><span class="cx"> 
</span><span class="cx"> // ---------
</span><span class="cx"> 
</span><del>-static unsigned startSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&amp;)
</del><ins>+static unsigned startSentenceBoundary(StringView text, unsigned, BoundarySearchContextAvailability, bool&amp;)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
</del><span class="cx">     // FIXME: The following function can return -1; we don't handle that.
</span><del>-    return textBreakPreceding(iterator, length);
</del><ins>+    return textBreakPreceding(sentenceBreakIterator(text), text.length());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition startOfSentence(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition startOfSentence(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    return previousBoundary(c, startSentenceBoundary);
</del><ins>+    return previousBoundary(position, startSentenceBoundary);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned endSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&amp;)
</del><ins>+static unsigned endSentenceBoundary(StringView text, unsigned, BoundarySearchContextAvailability, bool&amp;)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
-    return textBreakNext(iterator);
</del><ins>+    return textBreakNext(sentenceBreakIterator(text));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: This includes the space after the punctuation that marks the end of the sentence.
-VisiblePosition endOfSentence(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition endOfSentence(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    return nextBoundary(c, endSentenceBoundary);
</del><ins>+    // FIXME: This includes the space after the punctuation that marks the end of the sentence.
+    return nextBoundary(position, endSentenceBoundary);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned previousSentencePositionBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&amp;)
</del><ins>+static unsigned previousSentencePositionBoundary(StringView text, unsigned, BoundarySearchContextAvailability, bool&amp;)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: This is identical to startSentenceBoundary. I'm pretty sure that's not right.
</span><del>-    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
</del><span class="cx">     // FIXME: The following function can return -1; we don't handle that.
</span><del>-    return textBreakPreceding(iterator, length);
</del><ins>+    return textBreakPreceding(sentenceBreakIterator(text), text.length());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition previousSentencePosition(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition previousSentencePosition(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    VisiblePosition prev = previousBoundary(c, previousSentencePositionBoundary);
-    return c.honorEditingBoundaryAtOrBefore(prev);
</del><ins>+    return position.honorEditingBoundaryAtOrBefore(previousBoundary(position, previousSentencePositionBoundary));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&amp;)
</del><ins>+static unsigned nextSentencePositionBoundary(StringView text, unsigned, BoundarySearchContextAvailability, bool&amp;)
</ins><span class="cx"> {
</span><del>-    // FIXME: This is identical to endSentenceBoundary. This isn't right, it needs to 
-    // move to the equivlant position in the following sentence.
-    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
-    return textBreakFollowing(iterator, 0);
</del><ins>+    // FIXME: This is identical to endSentenceBoundary.
+    // That isn't right. This function needs to move to the equivalent position in the following sentence.
+    return textBreakFollowing(sentenceBreakIterator(text), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition nextSentencePosition(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition nextSentencePosition(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    VisiblePosition next = nextBoundary(c, nextSentencePositionBoundary);    
-    return c.honorEditingBoundaryAtOrAfter(next);
</del><ins>+    return position.honorEditingBoundaryAtOrAfter(nextBoundary(position, nextSentencePositionBoundary));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition startOfParagraph(const VisiblePosition&amp; c, EditingBoundaryCrossingRule boundaryCrossingRule)
</span><span class="lines">@@ -1175,7 +1186,7 @@
</span><span class="cx">     return VisiblePosition(Position(node, type), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition endOfParagraph(const VisiblePosition &amp;c, EditingBoundaryCrossingRule boundaryCrossingRule)
</del><ins>+VisiblePosition endOfParagraph(const VisiblePosition&amp; c, EditingBoundaryCrossingRule boundaryCrossingRule)
</ins><span class="cx"> {    
</span><span class="cx">     if (c.isNull())
</span><span class="cx">         return VisiblePosition();
</span><span class="lines">@@ -1265,17 +1276,17 @@
</span><span class="cx">     return afterParagraphEnd;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool inSameParagraph(const VisiblePosition &amp;a, const VisiblePosition &amp;b, EditingBoundaryCrossingRule boundaryCrossingRule)
</del><ins>+bool inSameParagraph(const VisiblePosition&amp; a, const VisiblePosition&amp; b, EditingBoundaryCrossingRule boundaryCrossingRule)
</ins><span class="cx"> {
</span><span class="cx">     return a.isNotNull() &amp;&amp; startOfParagraph(a, boundaryCrossingRule) == startOfParagraph(b, boundaryCrossingRule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isStartOfParagraph(const VisiblePosition &amp;pos, EditingBoundaryCrossingRule boundaryCrossingRule)
</del><ins>+bool isStartOfParagraph(const VisiblePosition&amp; pos, EditingBoundaryCrossingRule boundaryCrossingRule)
</ins><span class="cx"> {
</span><span class="cx">     return pos.isNotNull() &amp;&amp; pos == startOfParagraph(pos, boundaryCrossingRule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isEndOfParagraph(const VisiblePosition &amp;pos, EditingBoundaryCrossingRule boundaryCrossingRule)
</del><ins>+bool isEndOfParagraph(const VisiblePosition&amp; pos, EditingBoundaryCrossingRule boundaryCrossingRule)
</ins><span class="cx"> {
</span><span class="cx">     return pos.isNotNull() &amp;&amp; pos == endOfParagraph(pos, boundaryCrossingRule);
</span><span class="cx"> }
</span><span class="lines">@@ -1324,17 +1335,17 @@
</span><span class="cx">     return lastPositionInNode(endBlock);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool inSameBlock(const VisiblePosition &amp;a, const VisiblePosition &amp;b)
</del><ins>+bool inSameBlock(const VisiblePosition&amp; a, const VisiblePosition&amp; b)
</ins><span class="cx"> {
</span><span class="cx">     return !a.isNull() &amp;&amp; enclosingBlock(a.deepEquivalent().containerNode()) == enclosingBlock(b.deepEquivalent().containerNode());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isStartOfBlock(const VisiblePosition &amp;pos)
</del><ins>+bool isStartOfBlock(const VisiblePosition&amp; pos)
</ins><span class="cx"> {
</span><span class="cx">     return pos.isNotNull() &amp;&amp; pos == startOfBlock(pos, CanCrossEditingBoundary);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isEndOfBlock(const VisiblePosition &amp;pos)
</del><ins>+bool isEndOfBlock(const VisiblePosition&amp; pos)
</ins><span class="cx"> {
</span><span class="cx">     return pos.isNotNull() &amp;&amp; pos == endOfBlock(pos, CanCrossEditingBoundary);
</span><span class="cx"> }
</span><span class="lines">@@ -1350,7 +1361,7 @@
</span><span class="cx">     // The canonicalization of the position at (documentElement, 0) can turn the visible
</span><span class="cx">     // position to null, even when there's a valid candidate to be had, because the root HTML element
</span><span class="cx">     // is not content editable.  So we construct directly from the valid candidate.
</span><del>-    // FIXME: Merge this to Open Source. https://bugs.webkit.org/show_bug.cgi?id=56437
</del><ins>+    // FIXME: Do this for non-iOS platforms too. https://bugs.webkit.org/show_bug.cgi?id=56437
</ins><span class="cx">     Position firstCandidate = nextCandidate(createLegacyEditingPosition(node-&gt;document().documentElement(), 0));
</span><span class="cx">     if (firstCandidate.isNull())
</span><span class="cx">         return VisiblePosition();
</span><span class="lines">@@ -1360,7 +1371,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition startOfDocument(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition startOfDocument(const VisiblePosition&amp; c)
</ins><span class="cx"> {
</span><span class="cx">     return startOfDocument(c.deepEquivalent().deprecatedNode());
</span><span class="cx"> }
</span><span class="lines">@@ -1374,25 +1385,23 @@
</span><span class="cx">     // (As above, in startOfDocument.)  The canonicalization can reject valid visible positions
</span><span class="cx">     // when descending from the root element, so we construct the visible position directly from a
</span><span class="cx">     // valid candidate.
</span><del>-    // FIXME: Merge this to Open Source. https://bugs.webkit.org/show_bug.cgi?id=56437
-#endif
-    Element* doc = node-&gt;document().documentElement();
-#if PLATFORM(IOS)
-    Position lastPosition = createLegacyEditingPosition(node-&gt;document().documentElement(), doc-&gt;childNodeCount());
</del><ins>+    // FIXME: Do this for non-iOS platforms too. https://bugs.webkit.org/show_bug.cgi?id=56437
+    Position lastPosition = createLegacyEditingPosition(node-&gt;document().documentElement(), node-&gt;document().documentElement()-&gt;childNodeCount());
</ins><span class="cx">     Position lastCandidate = previousCandidate(lastPosition);
</span><span class="cx">     if (lastCandidate.isNull())
</span><span class="cx">         return VisiblePosition();
</span><span class="cx">     return VisiblePosition(lastCandidate);
</span><ins>+#else
+    return VisiblePosition(lastPositionInNode(node-&gt;document().documentElement()), DOWNSTREAM);
</ins><span class="cx"> #endif
</span><del>-    return VisiblePosition(lastPositionInNode(doc), DOWNSTREAM);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition endOfDocument(const VisiblePosition &amp;c)
</del><ins>+VisiblePosition endOfDocument(const VisiblePosition&amp; c)
</ins><span class="cx"> {
</span><span class="cx">     return endOfDocument(c.deepEquivalent().deprecatedNode());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool inSameDocument(const VisiblePosition &amp;a, const VisiblePosition &amp;b)
</del><ins>+bool inSameDocument(const VisiblePosition&amp; a, const VisiblePosition&amp; b)
</ins><span class="cx"> {
</span><span class="cx">     Position ap = a.deepEquivalent();
</span><span class="cx">     Node* an = ap.deprecatedNode();
</span><span class="lines">@@ -1406,12 +1415,12 @@
</span><span class="cx">     return &amp;an-&gt;document() == &amp;bn-&gt;document();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isStartOfDocument(const VisiblePosition &amp;p)
</del><ins>+bool isStartOfDocument(const VisiblePosition&amp; p)
</ins><span class="cx"> {
</span><span class="cx">     return p.isNotNull() &amp;&amp; p.previous(CanCrossEditingBoundary).isNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isEndOfDocument(const VisiblePosition &amp;p)
</del><ins>+bool isEndOfDocument(const VisiblePosition&amp; p)
</ins><span class="cx"> {
</span><span class="cx">     return p.isNotNull() &amp;&amp; p.next(CanCrossEditingBoundary).isNull();
</span><span class="cx"> }
</span><span class="lines">@@ -1436,7 +1445,7 @@
</span><span class="cx">     return lastPositionInNode(highestRoot);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isEndOfEditableOrNonEditableContent(const VisiblePosition &amp;p)
</del><ins>+bool isEndOfEditableOrNonEditableContent(const VisiblePosition&amp; p)
</ins><span class="cx"> {
</span><span class="cx">     return p.isNotNull() &amp;&amp; p.next().isNull();
</span><span class="cx"> }
</span><span class="lines">@@ -1452,6 +1461,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> static bool directionIsDownstream(SelectionDirection direction)
</span><span class="cx"> {
</span><span class="cx">     if (direction == DirectionBackward)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/editing/markup.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -53,7 +53,6 @@
</span><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;VisibleSelection.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="cx"> #include &quot;SubframeLoader.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;XMLNames.h&quot;
</span><span class="cx"> #include &quot;markup.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -47,7 +47,6 @@
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;TextBreakIterator.h&quot;
</span><span class="cx"> #include &quot;TextControlInnerElements.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;TextNodeTraversal.h&quot;
</span><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -403,9 +403,9 @@
</span><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const override { return true; }
</span><span class="cx">     virtual void ignoreWordInSpellDocument(const String&amp;) override { }
</span><span class="cx">     virtual void learnWord(const String&amp;) override { }
</span><del>-    virtual void checkSpellingOfString(const UChar*, int, int*, int*) override { }
</del><ins>+    virtual void checkSpellingOfString(StringView, int*, int*) override { }
</ins><span class="cx">     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&amp;) override { return String(); }
</span><del>-    virtual void checkGrammarOfString(const UChar*, int, Vector&lt;GrammarDetail&gt;&amp;, int*, int*) override { }
</del><ins>+    virtual void checkGrammarOfString(StringView, Vector&lt;GrammarDetail&gt;&amp;, int*, int*) override { }
</ins><span class="cx"> 
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx">     virtual Vector&lt;TextCheckingResult&gt; checkTextOfParagraph(StringView, TextCheckingTypeMask) override { return Vector&lt;TextCheckingResult&gt;(); }
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/page/Frame.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -91,7 +91,6 @@
</span><span class="cx"> #include &quot;ScrollingCoordinator.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;TextNodeTraversal.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> #include &quot;UserContentController.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacHTMLConvertermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/HTMLConverter.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -2472,6 +2472,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> // This function uses TextIterator, which makes offsets in its result compatible with HTML editing.
</span><span class="cx"> + (NSAttributedString *)editingAttributedStringFromRange:(Range*)range
</span><span class="cx"> {
</span><span class="lines">@@ -2523,18 +2524,20 @@
</span><span class="cx">         else
</span><span class="cx">             [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName];
</span><span class="cx"> 
</span><del>-        RetainPtr&lt;NSString&gt; substring = adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(it.characters()) length:currentTextLength freeWhenDone:NO]);
-        [string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:substring.get()];
</del><ins>+        [string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:it.text().createNSStringWithoutCopying().get()];
</ins><span class="cx">         [string setAttributes:attrs.get() range:NSMakeRange(stringLength, currentTextLength)];
</span><span class="cx">         stringLength += currentTextLength;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return [string autorelease];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> static NSFileWrapper *fileWrapperForURL(DocumentLoader *dataSource, NSURL *URL)
</span><span class="cx"> {
</span><span class="cx">     if ([URL isFileURL])
</span><span class="lines">@@ -2585,4 +2588,5 @@
</span><span class="cx"> 
</span><span class="cx">     return wrapper;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextBoundariescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextBoundaries.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextBoundaries.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/platform/text/TextBoundaries.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -32,24 +32,26 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-int endOfFirstWordBoundaryContext(const UChar* characters, int length)
</del><ins>+unsigned endOfFirstWordBoundaryContext(StringView text)
</ins><span class="cx"> {
</span><del>-    for (int i = 0; i &lt; length; ) {
-        int first = i;
</del><ins>+    unsigned length = text.length();
+    for (unsigned i = 0; i &lt; length; ) {
+        unsigned first = i;
</ins><span class="cx">         UChar32 ch;
</span><del>-        U16_NEXT(characters, i, length, ch);
</del><ins>+        U16_NEXT(text, i, length, ch);
</ins><span class="cx">         if (!requiresContextForWordBoundary(ch))
</span><span class="cx">             return first;
</span><span class="cx">     }
</span><span class="cx">     return length;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int startOfLastWordBoundaryContext(const UChar* characters, int length)
</del><ins>+unsigned startOfLastWordBoundaryContext(StringView text)
</ins><span class="cx"> {
</span><del>-    for (int i = length; i &gt; 0; ) {
-        int last = i;
</del><ins>+    unsigned length = text.length();
+    for (unsigned i = length; i &gt; 0; ) {
+        unsigned last = i;
</ins><span class="cx">         UChar32 ch;
</span><del>-        U16_PREV(characters, 0, i, ch);
</del><ins>+        U16_PREV(text, 0, i, ch);
</ins><span class="cx">         if (!requiresContextForWordBoundary(ch))
</span><span class="cx">             return last;
</span><span class="cx">     }
</span><span class="lines">@@ -58,26 +60,26 @@
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA)
</span><span class="cx"> 
</span><del>-int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
</del><ins>+int findNextWordFromIndex(StringView text, int position, bool forward)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
</del><ins>+    TextBreakIterator* it = wordBreakIterator(text);
</ins><span class="cx"> 
</span><span class="cx">     if (forward) {
</span><span class="cx">         position = textBreakFollowing(it, position);
</span><span class="cx">         while (position != TextBreakDone) {
</span><span class="cx">             // We stop searching when the character preceeding the break is alphanumeric.
</span><del>-            if (position &lt; len &amp;&amp; u_isalnum(chars[position - 1]))
</del><ins>+            if (static_cast&lt;unsigned&gt;(position) &lt; text.length() &amp;&amp; u_isalnum(text[position - 1]))
</ins><span class="cx">                 return position;
</span><span class="cx"> 
</span><span class="cx">             position = textBreakFollowing(it, position);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return len;
</del><ins>+        return text.length();
</ins><span class="cx">     } else {
</span><span class="cx">         position = textBreakPreceding(it, position);
</span><span class="cx">         while (position != TextBreakDone) {
</span><span class="cx">             // We stop searching when the character following the break is alphanumeric.
</span><del>-            if (position &gt; 0 &amp;&amp; u_isalnum(chars[position]))
</del><ins>+            if (position &amp;&amp; u_isalnum(text[position]))
</ins><span class="cx">                 return position;
</span><span class="cx"> 
</span><span class="cx">             position = textBreakPreceding(it, position);
</span><span class="lines">@@ -87,18 +89,18 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
</del><ins>+void findWordBoundary(StringView text, int position, int* start, int* end)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
</del><ins>+    TextBreakIterator* it = wordBreakIterator(text);
</ins><span class="cx">     *end = textBreakFollowing(it, position);
</span><span class="cx">     if (*end &lt; 0)
</span><span class="cx">         *end = textBreakLast(it);
</span><span class="cx">     *start = textBreakPrevious(it);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void findEndWordBoundary(const UChar* chars, int len, int position, int* end)
</del><ins>+void findEndWordBoundary(StringView text, int position, int* end)
</ins><span class="cx"> {
</span><del>-    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
</del><ins>+    TextBreakIterator* it = wordBreakIterator(text);
</ins><span class="cx">     *end = textBreakFollowing(it, position);
</span><span class="cx">     if (*end &lt; 0)
</span><span class="cx">         *end = textBreakLast(it);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextBoundariesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextBoundaries.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextBoundaries.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/platform/text/TextBoundaries.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define TextBoundaries_h
</span><span class="cx"> 
</span><span class="cx"> #include &lt;unicode/uchar.h&gt;
</span><ins>+#include &lt;wtf/Forward.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -41,12 +42,12 @@
</span><span class="cx">         return lineBreak == U_LB_COMPLEX_CONTEXT || lineBreak == WK_U_LB_CONDITIONAL_JAPANESE_STARTER || lineBreak == U_LB_IDEOGRAPHIC;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int endOfFirstWordBoundaryContext(const UChar* characters, int length);
-    int startOfLastWordBoundaryContext(const UChar* characters, int length);
</del><ins>+    unsigned endOfFirstWordBoundaryContext(StringView);
+    unsigned startOfLastWordBoundaryContext(StringView);
</ins><span class="cx"> 
</span><del>-    void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
-    void findEndWordBoundary(const UChar*, int len, int position, int* end);
-    int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
</del><ins>+    void findWordBoundary(StringView, int position, int* start, int* end);
+    void findEndWordBoundary(StringView, int position, int* end);
+    int findNextWordFromIndex(StringView, int position, bool forward);
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextCheckerClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextCheckerClient.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextCheckerClient.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/platform/text/TextCheckerClient.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const = 0;
</span><span class="cx">     virtual void ignoreWordInSpellDocument(const String&amp;) = 0;
</span><span class="cx">     virtual void learnWord(const String&amp;) = 0;
</span><del>-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
</del><ins>+    virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) = 0;
</ins><span class="cx">     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&amp; misspelledWord) = 0;
</span><del>-    virtual void checkGrammarOfString(const UChar*, int length, Vector&lt;GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) = 0;
</del><ins>+    virtual void checkGrammarOfString(StringView, Vector&lt;GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) = 0;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx">     virtual Vector&lt;TextCheckingResult&gt; checkTextOfParagraph(StringView, TextCheckingTypeMask checkingTypes) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextmacTextBoundariesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2006, 2014 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">@@ -26,7 +26,7 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;TextBoundaries.h&quot;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><ins>+#import &quot;TextBreakIterator.h&quot;
</ins><span class="cx"> #import &quot;TextBreakIteratorInternalICU.h&quot;
</span><span class="cx"> #import &lt;CoreFoundation/CFStringTokenizer.h&gt;
</span><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="lines">@@ -34,45 +34,33 @@
</span><span class="cx"> #import &lt;unicode/uchar.h&gt;
</span><span class="cx"> #import &lt;unicode/ustring.h&gt;
</span><span class="cx"> #import &lt;unicode/utypes.h&gt;
</span><del>-#import &lt;wtf/unicode/CharacterNames.h&gt;
</del><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><del>-#endif
</del><ins>+#import &lt;wtf/text/StringView.h&gt;
+#import &lt;wtf/unicode/CharacterNames.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><ins>+#if !USE(APPKIT)
</ins><span class="cx"> 
</span><span class="cx"> static bool isSkipCharacter(UChar32 c)
</span><span class="cx"> {
</span><del>-    return c == 0xA0 || 
-        c == '\n' || 
-        c == '.' || 
-        c == ',' || 
-        c == '!'  || 
-        c == '?' || 
-        c == ';' || 
-        c == ':' || 
-        u_isspace(c);
</del><ins>+    return c == 0xA0 || c == '\n' || c == '.' || c == ',' || c == '!'  || c == '?' || c == ';' || c == ':' || u_isspace(c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isWhitespaceCharacter(UChar32 c)
</span><span class="cx"> {
</span><del>-    return c == 0xA0 || 
-        c == '\n' || 
-        u_isspace(c);
</del><ins>+    return c == 0xA0 || c == '\n' || u_isspace(c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isWordDelimitingCharacter(UChar32 c)
</span><span class="cx"> {
</span><del>-    CFCharacterSetRef set = CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric);
</del><span class="cx">     // Ampersand is an exception added to treat AT&amp;T as a single word (see &lt;rdar://problem/5022264&gt;).
</span><del>-    return !CFCharacterSetIsLongCharacterMember(set, c) &amp;&amp; c != '&amp;';
</del><ins>+    return !CFCharacterSetIsLongCharacterMember(CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric), c) &amp;&amp; c != '&amp;';
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isSymbolCharacter(UChar32 c)
</span><span class="cx"> {
</span><del>-    CFCharacterSetRef set = CFCharacterSetGetPredefined(kCFCharacterSetSymbol);
-    return CFCharacterSetIsLongCharacterMember(set, c);
</del><ins>+    return CFCharacterSetIsLongCharacterMember(CFCharacterSetGetPredefined(kCFCharacterSetSymbol), c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isAmbiguousBoundaryCharacter(UChar32 character)
</span><span class="lines">@@ -83,39 +71,36 @@
</span><span class="cx"> 
</span><span class="cx"> static CFStringTokenizerRef tokenizerForString(CFStringRef str)
</span><span class="cx"> {
</span><del>-    static CFStringTokenizerRef tokenizer = nullptr;
</del><span class="cx">     static CFLocaleRef locale = nullptr;
</span><del>-
</del><span class="cx">     if (!locale) {
</span><span class="cx">         const char* temp = currentTextBreakLocaleID();
</span><del>-        RetainPtr&lt;CFStringRef&gt; currentLocaleID = adoptCF(CFStringCreateWithBytesNoCopy(nullptr, reinterpret_cast&lt;const UInt8*&gt;(temp), strlen(temp),  kCFStringEncodingASCII, false, kCFAllocatorNull));
-        locale = CFLocaleCreate(nullptr, currentLocaleID.get());
</del><ins>+        RetainPtr&lt;CFStringRef&gt; currentLocaleID = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast&lt;const UInt8*&gt;(temp), strlen(temp), kCFStringEncodingASCII, false, kCFAllocatorNull));
+        locale = CFLocaleCreate(kCFAllocatorDefault, currentLocaleID.get());
</ins><span class="cx">         if (!locale)
</span><span class="cx">             return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CFRange entireRange = CFRangeMake(0, CFStringGetLength(str));    
</span><span class="cx"> 
</span><ins>+    static CFStringTokenizerRef tokenizer = nullptr;
</ins><span class="cx">     if (!tokenizer)
</span><del>-        tokenizer = CFStringTokenizerCreate(nullptr, str, entireRange, kCFStringTokenizerUnitWordBoundary, locale);
</del><ins>+        tokenizer = CFStringTokenizerCreate(kCFAllocatorDefault, str, entireRange, kCFStringTokenizerUnitWordBoundary, locale);
</ins><span class="cx">     else
</span><span class="cx">         CFStringTokenizerSetString(tokenizer, str, entireRange);
</span><span class="cx">     return tokenizer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-// Simple case: a word is a stream of characters
-// delimited by a special set of word-delimiting characters.
-static void findSimpleWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
</del><ins>+// Simple case: A word is a stream of characters delimited by a special set of word-delimiting characters.
+static void findSimpleWordBoundary(StringView text, int position, int* start, int* end)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(position &gt;= 0);
</span><del>-    ASSERT(position &lt; len);
</del><ins>+    ASSERT(static_cast&lt;unsigned&gt;(position) &lt; text.length());
</ins><span class="cx"> 
</span><del>-    int startPos = position;
</del><ins>+    unsigned startPos = position;
</ins><span class="cx">     while (startPos &gt; 0) {
</span><span class="cx">         int i = startPos;
</span><span class="cx">         UChar32 characterBeforeStartPos;
</span><del>-        U16_PREV(chars, 0, i, characterBeforeStartPos);
</del><ins>+        U16_PREV(text, 0, i, characterBeforeStartPos);
</ins><span class="cx">         if (isWordDelimitingCharacter(characterBeforeStartPos)) {
</span><span class="cx">             ASSERT(i &gt;= 0);
</span><span class="cx">             if (!i)
</span><span class="lines">@@ -125,40 +110,40 @@
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><span class="cx">             UChar32 characterBeforeBeforeStartPos;
</span><del>-            U16_PREV(chars, 0, i, characterBeforeBeforeStartPos);
</del><ins>+            U16_PREV(text, 0, i, characterBeforeBeforeStartPos);
</ins><span class="cx">             if (isWordDelimitingCharacter(characterBeforeBeforeStartPos))
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><del>-        U16_BACK_1(chars, 0, startPos);
</del><ins>+        U16_BACK_1(text, 0, startPos);
</ins><span class="cx">     }
</span><span class="cx">     
</span><del>-    int endPos = position;
-    while (endPos &lt; len) {
</del><ins>+    unsigned endPos = position;
+    while (endPos &lt; text.length()) {
</ins><span class="cx">         UChar32 character;
</span><del>-        U16_GET(chars, 0, endPos, len, character);
</del><ins>+        U16_GET(text, 0, endPos, text.length(), character);
</ins><span class="cx">         if (isWordDelimitingCharacter(character)) {
</span><del>-            int i = endPos;
-            U16_FWD_1(chars, i, len);
-            ASSERT(i &lt;= len);
-            if (i == len)
</del><ins>+            unsigned i = endPos;
+            U16_FWD_1(text, i, text.length());
+            ASSERT(i &lt;= text.length());
+            if (i == text.length())
</ins><span class="cx">                 break;
</span><span class="cx">             UChar32 characterAfterEndPos;
</span><del>-            U16_NEXT(chars, i, len, characterAfterEndPos);
</del><ins>+            U16_NEXT(text, i, text.length(), characterAfterEndPos);
</ins><span class="cx">             if (!isAmbiguousBoundaryCharacter(character))
</span><span class="cx">                 break;
</span><span class="cx">             if (isWordDelimitingCharacter(characterAfterEndPos))
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><del>-        U16_FWD_1(chars, endPos, len);
</del><ins>+        U16_FWD_1(text, endPos, text.length());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // The text may consist of all delimiter characters (e.g. &quot;++++++++&quot; or a series of emoji), and returning an empty range
</span><span class="cx">     // makes no sense (and doesn't match findComplexWordBoundary() behavior).
</span><del>-    if (startPos == endPos &amp;&amp; endPos &lt; len) {
</del><ins>+    if (startPos == endPos &amp;&amp; endPos &lt; text.length()) {
</ins><span class="cx">         UChar32 character;
</span><del>-        U16_GET(chars, 0, endPos, len, character);
</del><ins>+        U16_GET(text, 0, endPos, text.length(), character);
</ins><span class="cx">         if (isSymbolCharacter(character))
</span><del>-            U16_FWD_1(chars, endPos, len);
</del><ins>+            U16_FWD_1(text, endPos, text.length());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     *start = startPos;
</span><span class="lines">@@ -166,143 +151,115 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Complex case: use CFStringTokenizer to find word boundary.
</span><del>-static void findComplexWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
</del><ins>+static void findComplexWordBoundary(StringView text, int position, int* start, int* end)
</ins><span class="cx"> {
</span><del>-    CFStringRef charString = CFStringCreateWithCharactersNoCopy(NULL, chars, len, kCFAllocatorNull);
-    ASSERT(charString);
-    
-    CFStringTokenizerRef tokenizer = tokenizerForString(charString);
-    if (tokenizer) {        
-        CFStringTokenizerTokenType  token = CFStringTokenizerGoToTokenAtIndex(tokenizer, position);
-        CFRange result;
-        if (token != kCFStringTokenizerTokenNone) {
-            result = CFStringTokenizerGetCurrentTokenRange(tokenizer);
-        } else {
-            // if no token found: select entire block
-            // NB: I never hit this section in all my testing...
-            result.location = 0;
-            result.length = len;
-        }
-        
-        *start = result.location;
-        *end = result.location + result.length;
-    } else {    // error creating tokenizer
-        findSimpleWordBoundary(chars, len, position, start, end);
</del><ins>+    RetainPtr&lt;CFStringRef&gt; charString = text.createCFStringWithoutCopying();
+
+    CFStringTokenizerRef tokenizer = tokenizerForString(charString.get());
+    if (!tokenizer) {
+        // Error creating tokenizer, so just use simple function.
+        findSimpleWordBoundary(text, position, start, end);
+        return;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    CFRelease(charString);
</del><ins>+    CFStringTokenizerTokenType  token = CFStringTokenizerGoToTokenAtIndex(tokenizer, position);
+    if (token == kCFStringTokenizerTokenNone) {
+        // No token found: select entire block.
+        // NB: I never hit this section in all my testing.
+        *start = 0;
+        *end = text.length();
+        return;
+    }
+
+    CFRange result = CFStringTokenizerGetCurrentTokenRange(tokenizer);
+    *start = result.location;
+    *end = result.location + result.length;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
</del><ins>+void findWordBoundary(StringView text, int position, int* start, int* end)
</ins><span class="cx"> {
</span><del>-#if !PLATFORM(IOS)
-    NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;unichar*&gt;(chars)
-        length:len freeWhenDone:NO];
-    NSAttributedString* attr = [[NSAttributedString alloc] initWithString:string];
-    NSRange range = [attr doubleClickAtIndex:(position &gt;= len) ? len - 1 : position];
-    [attr release];
-    [string release];
</del><ins>+#if USE(APPKIT)
+    NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:text.createNSStringWithoutCopying().get()];
+    NSRange range = [attributedString doubleClickAtIndex:std::min&lt;unsigned&gt;(position, text.length() - 1)];
+    [attributedString release];
</ins><span class="cx">     *start = range.location;
</span><span class="cx">     *end = range.location + range.length;
</span><span class="cx"> #else
</span><del>-    int pos = position;
-    if ( position == len &amp;&amp; position != 0)
-        pos--;
-    
</del><ins>+    unsigned pos = position;
+    if (pos == text.length() &amp;&amp; pos)
+        --pos;
+
</ins><span class="cx">     // For complex text (Thai, Japanese, Chinese), visible_units will pass the text in as a 
</span><span class="cx">     // single contiguous run of characters, providing as much context as is possible.
</span><span class="cx">     // We only need one character to determine if the text is complex.
</span><span class="cx">     UChar32 ch;
</span><del>-    int i = pos;
-    U16_NEXT(chars,i,len,ch);
</del><ins>+    unsigned i = pos;
+    U16_NEXT(text, i, text.length(), ch);
</ins><span class="cx">     bool isComplex = requiresContextForWordBoundary(ch);
</span><del>-    
</del><ins>+
</ins><span class="cx">     // FIXME: This check improves our word boundary behavior, but doesn't actually go far enough.
</span><span class="cx">     // See &lt;rdar://problem/8853951&gt; Take complex word boundary finding path when necessary
</span><span class="cx">     if (!isComplex) {
</span><span class="cx">         // Check again for complex text, at the start of the run.
</span><span class="cx">         i = 0;
</span><del>-        U16_NEXT(chars, i, len, ch);
</del><ins>+        U16_NEXT(text, i, text.length(), ch);
</ins><span class="cx">         isComplex = requiresContextForWordBoundary(ch);
</span><span class="cx">     }
</span><del>-    
-    if (isComplex) {
-        findComplexWordBoundary(chars,len, position, start, end);
-    } else {
-        findSimpleWordBoundary(chars,len, position, start, end);
-    }
</del><span class="cx"> 
</span><ins>+    if (isComplex)
+        findComplexWordBoundary(text, position, start, end);
+    else
+        findSimpleWordBoundary(text, position, start, end);
+
</ins><span class="cx"> #define LOG_WORD_BREAK 0
</span><span class="cx"> #if LOG_WORD_BREAK
</span><del>-    CFStringRef uniString = CFStringCreateWithCharacters(NULL, chars, len);
-    CFStringRef foundWord = CFStringCreateWithCharacters(NULL, (const UniChar *) chars + *start, *end - *start);        
-    NSLog(@&quot;%s_BREAK '%@' (%d,%d) in '%@' (%p) at %d, length=%d&quot;, isComplex ? &quot;COMPLEX&quot; : &quot;SIMPLE&quot;, foundWord, *start, *end, uniString, uniString, position, len);
-    CFRelease(foundWord);
-    CFRelease(uniString);
</del><ins>+    auto uniString = text.createCFStringWithoutCopying();
+    auto foundWord = text.substring(*start, *end - *start).createCFStringWithoutCopying();
+    NSLog(@&quot;%s_BREAK '%@' (%d,%d) in '%@' (%p) at %d, length=%d&quot;, isComplex ? &quot;COMPLEX&quot; : &quot;SIMPLE&quot;, foundWord.get(), *start, *end, uniString.get(), uniString.get(), position, text.length());
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void findEndWordBoundary(const UChar* chars, int len, int position, int* end)
</del><ins>+void findEndWordBoundary(StringView text, int position, int* end)
</ins><span class="cx"> {
</span><del>-#if !PLATFORM(IOS)
-    NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;unichar*&gt;(chars)
-        length:len freeWhenDone:NO];
-    NSAttributedString* attr = [[NSAttributedString alloc] initWithString:string];
-    NSRange range = [attr doubleClickAtIndex:(position &gt;= len) ? len - 1 : position];
-    [attr release];
-    [string release];
-    *end = range.location + range.length;
-#else
-    // FIXME: Bug 126830: [iOS] Implement WebCore::findEndWordBoundary()
-    UNUSED_PARAM(chars);
-    UNUSED_PARAM(len);
-    UNUSED_PARAM(position);
-    UNUSED_PARAM(end);
-#endif
</del><ins>+    int start;
+    findWordBoundary(text, position, &amp;start, end);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
</del><ins>+int findNextWordFromIndex(StringView text, int position, bool forward)
</ins><span class="cx"> {   
</span><del>-#if !PLATFORM(IOS)
-    NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;unichar*&gt;(chars)
-        length:len freeWhenDone:NO];
-    NSAttributedString* attr = [[NSAttributedString alloc] initWithString:string];
-    int result = [attr nextWordFromIndex:position forward:forward];
-    [attr release];
-    [string release];
</del><ins>+#if USE(APPKIT)
+    NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:text.createNSStringWithoutCopying().get()];
+    int result = [attributedString nextWordFromIndex:position forward:forward];
+    [attributedString release];
</ins><span class="cx">     return result;
</span><span class="cx"> #else
</span><span class="cx">     // This very likely won't behave exactly like the non-iPhone version, but it works
</span><span class="cx">     // for the contexts in which it is used on iPhone, and in the future will be
</span><span class="cx">     // tuned to improve the iPhone-specific behavior for the keyboard and text editing.
</span><span class="cx">     int pos = position;
</span><del>-    UErrorCode status = U_ZERO_ERROR;
-    UBreakIterator *boundary = ubrk_open(UBRK_WORD, currentTextBreakLocaleID(), const_cast&lt;unichar *&gt;(reinterpret_cast&lt;const unichar *&gt;(chars)), len, &amp;status);
-
-    if (boundary &amp;&amp; U_SUCCESS(status)) {
</del><ins>+    TextBreakIterator* boundary = wordBreakIterator(text);
+    if (boundary) {
</ins><span class="cx">         if (forward) {
</span><span class="cx">             do {
</span><del>-                pos = ubrk_following(boundary, pos);    
-                if (pos == UBRK_DONE) {
-                    pos = len;
-                }
-            } while (pos &lt; len &amp;&amp; (pos == 0 || !isSkipCharacter(chars[pos-1])) &amp;&amp; isSkipCharacter(chars[pos]));
</del><ins>+                pos = textBreakFollowing(boundary, pos);
+                if (pos == UBRK_DONE)
+                    pos = text.length();
+            } while (static_cast&lt;unsigned&gt;(pos) &lt; text.length() &amp;&amp; (pos == 0 || !isSkipCharacter(text[pos - 1])) &amp;&amp; isSkipCharacter(text[pos]));
</ins><span class="cx">         }
</span><span class="cx">         else {
</span><span class="cx">             do {
</span><del>-                pos = ubrk_preceding(boundary, pos);
-                if (pos == UBRK_DONE) {
</del><ins>+                pos = textBreakPreceding(boundary, pos);
+                if (pos == UBRK_DONE)
</ins><span class="cx">                     pos = 0;
</span><del>-                }
-            } while (pos &gt; 0 &amp;&amp; isSkipCharacter(chars[pos]) &amp;&amp; !isWhitespaceCharacter(chars[pos-1]));
</del><ins>+            } while (pos &gt; 0 &amp;&amp; isSkipCharacter(text[pos]) &amp;&amp; !isWhitespaceCharacter(text[pos - 1]));
</ins><span class="cx">         }
</span><del>-        ubrk_close(boundary);
</del><span class="cx">     }
</span><span class="cx">     return pos;
</span><del>-#endif // !PLATFORM(IOS)
</del><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #include &quot;ScrollbarTheme.h&quot;
</span><span class="cx"> #include &quot;StyleInheritedData.h&quot;
</span><span class="cx"> #include &quot;TextControlInnerElements.h&quot;
</span><del>-#include &quot;TextIterator.h&quot;
</del><span class="cx"> #include &quot;VisiblePosition.h&quot;
</span><span class="cx"> #include &lt;wtf/unicode/CharacterNames.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKiteflChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/efl/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/EditorClientEfl.cpp:
+        (WebCore::EditorClientEfl::checkSpellingOfString): Use StringView.
+        (WebCore::EditorClientEfl::checkGrammarOfString): Ditto.
+        * WebCoreSupport/EditorClientEfl.h: Ditto.
+
</ins><span class="cx"> 2014-02-07  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove isInitialState flag from Page::setViewState
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportEditorClientEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -409,7 +409,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EditorClientEfl::checkSpellingOfString(const UChar*, int, int*, int*)
</del><ins>+void EditorClientEfl::checkSpellingOfString(StringView, int*, int*)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -420,7 +420,7 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EditorClientEfl::checkGrammarOfString(const UChar*, int, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</del><ins>+void EditorClientEfl::checkGrammarOfString(StringView, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportEditorClientEflh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -136,9 +136,9 @@
</span><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const;
</span><span class="cx">     virtual void ignoreWordInSpellDocument(const String&amp;);
</span><span class="cx">     virtual void learnWord(const String&amp;);
</span><del>-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
</del><ins>+    virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength);
</ins><span class="cx">     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&amp; misspelledWord);
</span><del>-    virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector&lt;GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength);
</del><ins>+    virtual void checkGrammarOfString(StringView, WTF::Vector&lt;GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength);
</ins><span class="cx">     virtual void updateSpellingUIWithGrammarString(const String&amp;, const GrammarDetail&amp;);
</span><span class="cx">     virtual void updateSpellingUIWithMisspelledWord(const String&amp;);
</span><span class="cx">     virtual void showSpellingUI(bool show);
</span></span></pre></div>
<a id="trunkSourceWebKitgtkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/gtk/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/gtk/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/gtk/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/TextCheckerClientGtk.cpp:
+        (WebKit::TextCheckerClientGtk::checkSpellingOfString): Use StringView.
+        (WebKit::TextCheckerClientGtk::checkGrammarOfString): Ditto.
+        * WebCoreSupport/TextCheckerClientGtk.h: Ditto.
+
</ins><span class="cx"> 2014-02-07  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove isInitialState flag from Page::setViewState
</span></span></pre></div>
<a id="trunkSourceWebKitgtkWebCoreSupportTextCheckerClientGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &lt;glib.h&gt;
</span><span class="cx"> #include &lt;wtf/gobject/GOwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -59,10 +60,9 @@
</span><span class="cx">     webkit_spell_checker_learn_word(m_spellChecker.get(), text.utf8().data());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextCheckerClientGtk::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
</del><ins>+void TextCheckerClientGtk::checkSpellingOfString(StringView text, int* misspellingLocation, int* misspellingLength)
</ins><span class="cx"> {
</span><del>-    String textAsString(text, length);
-    webkit_spell_checker_check_spelling_of_string(m_spellChecker.get(), textAsString.utf8().data(), misspellingLocation, misspellingLength);
</del><ins>+    webkit_spell_checker_check_spelling_of_string(m_spellChecker.get(), text.toStringWithoutCopying().utf8().data(), misspellingLocation, misspellingLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String TextCheckerClientGtk::getAutoCorrectSuggestionForMisspelledWord(const String&amp; inputWord)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     return webkit_spell_checker_get_autocorrect_suggestions_for_misspelled_word(m_spellChecker.get(), inputWord.utf8().data());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextCheckerClientGtk::checkGrammarOfString(const UChar*, int, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</del><ins>+void TextCheckerClientGtk::checkGrammarOfString(StringView, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitgtkWebCoreSupportTextCheckerClientGtkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -42,14 +42,14 @@
</span><span class="cx">     public:
</span><span class="cx">         TextCheckerClientGtk(WebKitSpellChecker*);
</span><span class="cx">         ~TextCheckerClientGtk();
</span><del>-        virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const;
-        virtual void ignoreWordInSpellDocument(const WTF::String&amp;);
-        virtual void learnWord(const WTF::String&amp;);
-        virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
-        virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;);
-        virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength);
-        virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses);
-    virtual void requestCheckingOfString(WTF::PassRefPtr&lt;WebCore::TextCheckingRequest&gt;) { }
</del><ins>+        virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
+        virtual void ignoreWordInSpellDocument(const WTF::String&amp;) override;
+        virtual void learnWord(const WTF::String&amp;) override;
+        virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) override;
+        virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) override;
+        virtual void checkGrammarOfString(StringView, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
+        virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses) override;
+        virtual void requestCheckingOfString(WTF::PassRefPtr&lt;WebCore::TextCheckingRequest&gt;) override { }
</ins><span class="cx"> 
</span><span class="cx">         void updateSpellCheckingLanguage(const char*);
</span><span class="cx">     private:
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebEditorClient.h: Made most data members private. Moved inlines
+        for iOS out of the class definition. Fixed formatting. Added missing virtual keyword.
+        Changed interfaces to use StringView.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::checkTextOfParagraph): Use the new StringView::createNSStringWithoutCopying
+        function instead of a similar function that was local in this file.
+        (WebEditorClient::ignoreWordInSpellDocument): Tweaked formatting.
+        (WebEditorClient::checkSpellingOfString): Changed to take a StringView.
+        (WebEditorClient::checkGrammarOfString): Ditto.
+
+        * WebView/WebTextIterator.mm:
+        (-[WebTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.
+        (-[WebTextIterator currentText]): Convert a the text to an NSString with TextIterator::text
+        instead of with TextIterator::characters/length.
+
</ins><span class="cx"> 2014-02-07  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove isInitialState flag from Page::setViewState
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -40,22 +40,17 @@
</span><span class="cx"> public:
</span><span class="cx">     WebEditorClient(WebView *);
</span><span class="cx">     virtual ~WebEditorClient();
</span><ins>+
+    void didCheckSucceed(int sequence, NSArray *results);
+
+private:
</ins><span class="cx">     virtual void pageDestroyed() override;
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx">     virtual bool isGrammarCheckingEnabled() override;
</span><span class="cx">     virtual void toggleGrammarChecking() override;
</span><span class="cx">     virtual bool isContinuousSpellCheckingEnabled() override;
</span><span class="cx">     virtual void toggleContinuousSpellChecking() override;
</span><span class="cx">     virtual int spellCheckerDocumentTag() override;
</span><del>-#else
-    virtual bool isGrammarCheckingEnabled() override { return false; }
-    virtual void toggleGrammarChecking() override { }
-    // Note: isContinuousSpellCheckingEnabled() is implemented.
-    virtual bool isContinuousSpellCheckingEnabled() override;
-    virtual void toggleContinuousSpellChecking() override { }
-    virtual int spellCheckerDocumentTag() override { return 0; }
-#endif
</del><span class="cx"> 
</span><span class="cx">     virtual bool smartInsertDeleteEnabled() override;
</span><span class="cx">     virtual bool isSelectTrailingWhitespaceEnabled() override;
</span><span class="lines">@@ -65,7 +60,7 @@
</span><span class="cx">     virtual bool shouldBeginEditing(WebCore::Range*) override;
</span><span class="cx">     virtual bool shouldEndEditing(WebCore::Range*) override;
</span><span class="cx">     virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction) override;
</span><del>-    virtual bool shouldInsertText(const WTF::String&amp;, WebCore::Range*, WebCore::EditorInsertAction) override;
</del><ins>+    virtual bool shouldInsertText(const String&amp;, WebCore::Range*, WebCore::EditorInsertAction) override;
</ins><span class="cx">     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) override;
</span><span class="cx"> 
</span><span class="cx">     virtual bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) override;
</span><span class="lines">@@ -78,11 +73,11 @@
</span><span class="cx">     virtual void didWriteSelectionToPasteboard() override;
</span><span class="cx">     virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;WebCore::SharedBuffer&gt;&gt;&amp; pasteboardData) override;
</span><span class="cx"> 
</span><del>-    virtual NSString* userVisibleString(NSURL *) override;
</del><ins>+    virtual NSString *userVisibleString(NSURL *) override;
</ins><span class="cx">     virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector&lt; RefPtr&lt;WebCore::ArchiveResource&gt;&gt;&amp;) override;
</span><span class="cx">     virtual void setInsertionPasteboard(const String&amp;) override;
</span><del>-    virtual NSURL* canonicalizeURL(NSURL*) override;
-    virtual NSURL* canonicalizeURLString(NSString*) override;
</del><ins>+    virtual NSURL *canonicalizeURL(NSURL *) override;
+    virtual NSURL *canonicalizeURLString(NSString *) override;
</ins><span class="cx">     
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx">     virtual void uppercaseWord() override;
</span><span class="lines">@@ -110,7 +105,7 @@
</span><span class="cx">     virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    TextCheckerClient* textChecker() override { return this; }
</del><ins>+    virtual TextCheckerClient* textChecker() override { return this; }
</ins><span class="cx"> 
</span><span class="cx">     virtual void respondToChangedContents() override;
</span><span class="cx">     virtual void respondToChangedSelection(WebCore::Frame*) override;
</span><span class="lines">@@ -152,42 +147,24 @@
</span><span class="cx">     virtual int pasteboardChangeCount() override;
</span><span class="cx"> #endif
</span><span class="cx">     
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
</span><del>-    virtual void ignoreWordInSpellDocument(const WTF::String&amp;) override;
-    virtual void learnWord(const WTF::String&amp;) override;
-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) override;
-    virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) override;
-    virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
</del><ins>+    virtual void ignoreWordInSpellDocument(const String&amp;) override;
+    virtual void learnWord(const String&amp;) override;
+    virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) override;
+    virtual String getAutoCorrectSuggestionForMisspelledWord(const String&amp;) override;
+    virtual void checkGrammarOfString(StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
</ins><span class="cx">     virtual Vector&lt;WebCore::TextCheckingResult&gt; checkTextOfParagraph(StringView, WebCore::TextCheckingTypeMask checkingTypes) override;
</span><del>-    virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp;) override;
-    virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;) override;
</del><ins>+    virtual void updateSpellingUIWithGrammarString(const String&amp;, const WebCore::GrammarDetail&amp;) override;
+    virtual void updateSpellingUIWithMisspelledWord(const String&amp;) override;
</ins><span class="cx">     virtual void showSpellingUI(bool show) override;
</span><span class="cx">     virtual bool spellingUIIsShowing() override;
</span><del>-    virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses) override;
-#else
-    virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override { return true; }
-    virtual void ignoreWordInSpellDocument(const WTF::String&amp;) override { }
-    virtual void learnWord(const WTF::String&amp;) override { }
-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) override { }
-    virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) override { return &quot;&quot;; }
-    virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override { }
-    virtual Vector&lt;WebCore::TextCheckingResult&gt; checkTextOfParagraph(StringView, WebCore::TextCheckingTypeMask checkingTypes) override;
-    virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp;) override { }
-    virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;) override { }
-    virtual void showSpellingUI(bool show) override { }
-    virtual bool spellingUIIsShowing() override { return false; }
-    virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses) override { }
-#endif // PLATFORM(IOS)
</del><ins>+    virtual void getGuessesForWord(const String&amp; word, const String&amp; context, Vector&lt;String&gt;&amp; guesses) override;
+
</ins><span class="cx">     virtual void willSetInputMethodState() override;
</span><span class="cx">     virtual void setInputMethodState(bool enabled) override;
</span><span class="cx">     virtual void requestCheckingOfString(PassRefPtr&lt;WebCore::TextCheckingRequest&gt;) override;
</span><span class="cx"> 
</span><del>-    void didCheckSucceed(int sequence, NSArray* results);
-
-private:
</del><span class="cx">     void registerUndoOrRedoStep(PassRefPtr&lt;WebCore::UndoStep&gt;, bool isRedo);
</span><del>-    WebEditorClient();
</del><span class="cx"> 
</span><span class="cx">     WebView *m_webView;
</span><span class="cx">     RetainPtr&lt;WebEditorUndoTarget&gt; m_undoTarget;
</span><span class="lines">@@ -199,3 +176,72 @@
</span><span class="cx">     bool m_hasDelayedContentChangeNotification;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><ins>+
+#if PLATFORM(IOS)
+
+inline bool WebEditorClient::isGrammarCheckingEnabled()
+{
+    return false;
+}
+
+inline void WebEditorClient::toggleGrammarChecking()
+{
+}
+
+inline void WebEditorClient::toggleContinuousSpellChecking()
+{
+}
+
+inline int WebEditorClient::spellCheckerDocumentTag()
+{
+    return 0;
+}
+
+inline bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const
+{
+    return true;
+}
+
+inline void WebEditorClient::ignoreWordInSpellDocument(const String&amp;)
+{
+}
+
+inline void WebEditorClient::learnWord(const String&amp;)
+{
+}
+
+inline void WebEditorClient::checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength)
+{
+}
+
+inline String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&amp;)
+{
+    return &quot;&quot;;
+}
+
+inline void WebEditorClient::checkGrammarOfString(StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength)
+{
+}
+
+inline void WebEditorClient::updateSpellingUIWithGrammarString(const String&amp;, const WebCore::GrammarDetail&amp;)
+{
+}
+
+inline void WebEditorClient::updateSpellingUIWithMisspelledWord(const String&amp;)
+{
+}
+
+inline void WebEditorClient::showSpellingUI(bool show)
+{
+}
+
+inline bool WebEditorClient::spellingUIIsShowing()
+{
+    return false;
+}
+
+inline void WebEditorClient::getGuessesForWord(const String&amp;, const String&amp;, Vector&lt;String&gt;&amp;)
+{
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -797,15 +797,8 @@
</span><span class="cx">     CallFormDelegate(m_webView, @selector(textDidChangeInTextArea:inFrame:), textAreaElement, kit(element-&gt;document().frame()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RetainPtr&lt;NSString&gt; nsStringWithoutCopying(StringView stringView)
-{
-    if (stringView.is8Bit())
-        return adoptNS([[NSString alloc] initWithBytesNoCopy:const_cast&lt;LChar*&gt;(stringView.characters8()) length:stringView.length() encoding:NSISOLatin1StringEncoding freeWhenDone:NO]);
-
-    return adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast&lt;unichar*&gt;(stringView.characters16()) length:stringView.length() freeWhenDone:NO]);
-}
-
</del><span class="cx"> #if PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> void WebEditorClient::suppressSelectionNotifications() 
</span><span class="cx"> {
</span><span class="cx">     m_selectionNotificationSuppressions++;
</span><span class="lines">@@ -889,8 +882,7 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TextCheckingResult&gt; results;
</span><span class="cx"> 
</span><del>-    auto textString = nsStringWithoutCopying(string);
-    NSArray *incomingResults = [[m_webView _UIKitDelegateForwarder] checkSpellingOfString:textString.get()];
</del><ins>+    NSArray *incomingResults = [[m_webView _UIKitDelegateForwarder] checkSpellingOfString:string.createNSStringWithoutCopying().get()];
</ins><span class="cx">     for (NSValue *incomingResult in incomingResults) {
</span><span class="cx">         NSRange resultRange = [incomingResult rangeValue];
</span><span class="cx">         ASSERT(resultRange.location != NSNotFound &amp;&amp; resultRange.length &gt; 0);
</span><span class="lines">@@ -903,9 +895,11 @@
</span><span class="cx"> 
</span><span class="cx">     return results;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const
</span><span class="cx"> {
</span><span class="cx">     // This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions.
</span><span class="lines">@@ -914,8 +908,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::ignoreWordInSpellDocument(const String&amp; text)
</span><span class="cx"> {
</span><del>-    [[NSSpellChecker sharedSpellChecker] ignoreWord:text 
-                             inSpellDocumentWithTag:spellCheckerDocumentTag()];
</del><ins>+    [[NSSpellChecker sharedSpellChecker] ignoreWord:text inSpellDocumentWithTag:spellCheckerDocumentTag()];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::learnWord(const String&amp; text)
</span><span class="lines">@@ -923,11 +916,10 @@
</span><span class="cx">     [[NSSpellChecker sharedSpellChecker] learnWord:text];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
</del><ins>+void WebEditorClient::checkSpellingOfString(StringView text, int* misspellingLocation, int* misspellingLength)
</ins><span class="cx"> {
</span><del>-    NSString* textString = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(text) length:length freeWhenDone:NO];
-    NSRange range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:textString startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:spellCheckerDocumentTag() wordCount:NULL];
-    [textString release];
</del><ins>+    NSRange range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:text.createNSStringWithoutCopying().get() startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:spellCheckerDocumentTag() wordCount:NULL];
+
</ins><span class="cx">     if (misspellingLocation) {
</span><span class="cx">         // WebCore expects -1 to represent &quot;not found&quot;
</span><span class="cx">         if (range.location == NSNotFound)
</span><span class="lines">@@ -947,12 +939,10 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector&lt;GrammarDetail&gt;&amp; details, int* badGrammarLocation, int* badGrammarLength)
</del><ins>+void WebEditorClient::checkGrammarOfString(StringView text, Vector&lt;GrammarDetail&gt;&amp; details, int* badGrammarLocation, int* badGrammarLength)
</ins><span class="cx"> {
</span><span class="cx">     NSArray *grammarDetails;
</span><del>-    NSString* textString = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(text) length:length freeWhenDone:NO];
-    NSRange range = [[NSSpellChecker sharedSpellChecker] checkGrammarOfString:textString startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:spellCheckerDocumentTag() details:&amp;grammarDetails];
-    [textString release];
</del><ins>+    NSRange range = [[NSSpellChecker sharedSpellChecker] checkGrammarOfString:text.createNSStringWithoutCopying().get() startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:spellCheckerDocumentTag() details:&amp;grammarDetails];
</ins><span class="cx">     if (badGrammarLocation)
</span><span class="cx">         // WebCore expects -1 to represent &quot;not found&quot;
</span><span class="cx">         *badGrammarLocation = (range.location == NSNotFound) ? -1 : static_cast&lt;int&gt;(range.location);
</span><span class="lines">@@ -1057,11 +1047,7 @@
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;TextCheckingResult&gt; WebEditorClient::checkTextOfParagraph(StringView string, TextCheckingTypeMask checkingTypes)
</span><span class="cx"> {
</span><del>-    auto textString = nsStringWithoutCopying(string);
-
-    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get() range:NSMakeRange(0, [textString length]) types:(checkingTypes|NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL];
-
-    return core(incomingResults, checkingTypes);
</del><ins>+    return core([[NSSpellChecker sharedSpellChecker] checkString:string.createNSStringWithoutCopying().get() range:NSMakeRange(0, string.length()) types:(checkingTypes | NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL], checkingTypes);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::updateSpellingUIWithGrammarString(const String&amp; badGrammarPhrase, const GrammarDetail&amp; grammarDetail)
</span><span class="lines">@@ -1116,6 +1102,7 @@
</span><span class="cx">             guesses.append(string);
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // !PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::willSetInputMethodState()
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebTextIteratormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebTextIterator.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebTextIterator.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/mac/WebView/WebTextIterator.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (const unichar *)currentTextPointer
</span><span class="cx"> {
</span><del>-    return _private-&gt;_textIterator-&gt;characters();
</del><ins>+    return _private-&gt;_textIterator-&gt;deprecatedTextIteratorCharacters();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSUInteger)currentTextLength
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSString *)currentText
</span><span class="cx"> {
</span><del>-    return [NSString stringWithCharacters:_private-&gt;_textIterator-&gt;characters() length:_private-&gt;_textIterator-&gt;length()];
</del><ins>+    return [[_private-&gt;_textIterator-&gt;text().createNSString().get() retain] autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/win/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::checkSpellingOfString): Use StringView.
+        (WebEditorClient::checkGrammarOfString): Ditto.
+        * WebCoreSupport/WebEditorClient.h: Ditto.
+
</ins><span class="cx"> 2014-02-06  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add Console support to JSContext Inspection
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -657,7 +657,7 @@
</span><span class="cx">     ed-&gt;learnWord(BString(word));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
</del><ins>+void WebEditorClient::checkSpellingOfString(StringView text, int* misspellingLocation, int* misspellingLength)
</ins><span class="cx"> {
</span><span class="cx">     *misspellingLocation = -1;
</span><span class="cx">     *misspellingLength = 0;
</span><span class="lines">@@ -667,7 +667,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     initViewSpecificSpelling(m_webView);
</span><del>-    ed-&gt;checkSpellingOfString(m_webView, text, length, misspellingLocation, misspellingLength);
</del><ins>+    ed-&gt;checkSpellingOfString(m_webView, text.toStringWithoutCopying().deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&amp; inputWord)
</span><span class="lines">@@ -677,7 +677,7 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector&lt;GrammarDetail&gt;&amp; details, int* badGrammarLocation, int* badGrammarLength)
</del><ins>+void WebEditorClient::checkGrammarOfString(StringView text, Vector&lt;GrammarDetail&gt;&amp; details, int* badGrammarLocation, int* badGrammarLength)
</ins><span class="cx"> {
</span><span class="cx">     details.clear();
</span><span class="cx">     *badGrammarLocation = -1;
</span><span class="lines">@@ -689,7 +689,7 @@
</span><span class="cx"> 
</span><span class="cx">     initViewSpecificSpelling(m_webView);
</span><span class="cx">     COMPtr&lt;IEnumWebGrammarDetails&gt; enumDetailsObj;
</span><del>-    if (FAILED(ed-&gt;checkGrammarOfString(m_webView, text, length, &amp;enumDetailsObj, badGrammarLocation, badGrammarLength)))
</del><ins>+    if (FAILED(ed-&gt;checkGrammarOfString(m_webView, text.toStringWithoutCopying().deprecatedCharacters(), text.length(), &amp;enumDetailsObj, badGrammarLocation, badGrammarLength)))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     while (true) {
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -86,34 +86,34 @@
</span><span class="cx">     void undo();
</span><span class="cx">     void redo();    
</span><span class="cx">     
</span><del>-    virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting);
-    virtual void textFieldDidBeginEditing(WebCore::Element*);
-    virtual void textFieldDidEndEditing(WebCore::Element*);
-    virtual void textDidChangeInTextField(WebCore::Element*);
-    virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*);
-    virtual void textWillBeDeletedInTextField(WebCore::Element* input);
-    virtual void textDidChangeInTextArea(WebCore::Element*);
</del><ins>+    virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) override;
+    virtual void textFieldDidBeginEditing(WebCore::Element*) override;
+    virtual void textFieldDidEndEditing(WebCore::Element*) override;
+    virtual void textDidChangeInTextField(WebCore::Element*) override;
+    virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) override;
+    virtual void textWillBeDeletedInTextField(WebCore::Element* input) override;
+    virtual void textDidChangeInTextArea(WebCore::Element*) override;
</ins><span class="cx"> 
</span><span class="cx">     void handleKeyboardEvent(WebCore::KeyboardEvent*);
</span><span class="cx">     void handleInputMethodKeydown(WebCore::KeyboardEvent*);
</span><span class="cx"> 
</span><del>-    virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const;
-    virtual void ignoreWordInSpellDocument(const WTF::String&amp;);
-    virtual void learnWord(const WTF::String&amp;);
-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
-    virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;);
-    virtual void checkGrammarOfString(const UChar*, int length, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength);
-    virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp; detail);
-    virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;);
-    virtual void showSpellingUI(bool show);
-    virtual bool spellingUIIsShowing();
-    virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses);
</del><ins>+    virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
+    virtual void ignoreWordInSpellDocument(const WTF::String&amp;) override;
+    virtual void learnWord(const WTF::String&amp;) override;
+    virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) override;
+    virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) override;
+    virtual void checkGrammarOfString(StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
+    virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp;) override;
+    virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;) override;
+    virtual void showSpellingUI(bool show) override;
+    virtual bool spellingUIIsShowing() override;
+    virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses) override;
</ins><span class="cx"> 
</span><del>-    virtual void willSetInputMethodState();
-    virtual void setInputMethodState(bool);
-    virtual void requestCheckingOfString(WTF::PassRefPtr&lt;WebCore::TextCheckingRequest&gt;) { }
</del><ins>+    virtual void willSetInputMethodState() override;
+    virtual void setInputMethodState(bool) override;
+    virtual void requestCheckingOfString(WTF::PassRefPtr&lt;WebCore::TextCheckingRequest&gt;) override { }
</ins><span class="cx"> 
</span><del>-    virtual WebCore::TextCheckerClient* textChecker() { return this; }
</del><ins>+    virtual WebCore::TextCheckerClient* textChecker() override { return this; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WebView* m_webView;
</span></span></pre></div>
<a id="trunkSourceWebKitwinceChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/wince/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/wince/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/wince/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/EditorClientWinCE.cpp:
+        (WebKit::EditorClientWinCE::checkSpellingOfString): Use StringView.
+        (WebKit::EditorClientWinCE::checkGrammarOfString): Ditto.
+        * WebCoreSupport/EditorClientWinCE.h: Ditto.
+
</ins><span class="cx"> 2014-02-06  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add Console support to JSContext Inspection
</span></span></pre></div>
<a id="trunkSourceWebKitwinceWebCoreSupportEditorClientWinCEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -466,7 +466,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EditorClientWinCE::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
</del><ins>+void EditorClientWinCE::checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -478,7 +478,7 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EditorClientWinCE::checkGrammarOfString(const UChar*, int, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</del><ins>+void EditorClientWinCE::checkGrammarOfString(StringVIew, Vector&lt;GrammarDetail&gt;&amp;, int*, int*)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinceWebCoreSupportEditorClientWinCEh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -90,9 +90,9 @@
</span><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
</span><span class="cx">     virtual void ignoreWordInSpellDocument(const WTF::String&amp;) override;
</span><span class="cx">     virtual void learnWord(const WTF::String&amp;) override;
</span><del>-    virtual void checkSpellingOfString(const UChar*, int, int*, int*) override;
</del><ins>+    virtual void checkSpellingOfString(StringView, int*, int*) override;
</ins><span class="cx">     virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) override;
</span><del>-    virtual void checkGrammarOfString(const UChar*, int, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int*, int*) override;
</del><ins>+    virtual void checkGrammarOfString(StringView, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int*, int*) override;
</ins><span class="cx">     virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp;) override;
</span><span class="cx">     virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;) override;
</span><span class="cx">     virtual void showSpellingUI(bool) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-02-08  Darin Adler  &lt;darin@apple.com&gt;
+
+        Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=128233
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
+        (-[WKDOMTextIterator currentTextPointer]): Call TextIterator::deprecatedTextIteratorCharacters.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::checkSpellingOfString): Use StringView.
+        (WebKit::WebEditorClient::checkGrammarOfString): Ditto.
+        * WebProcess/WebCoreSupport/WebEditorClient.h: Ditto.
+
</ins><span class="cx"> 2014-02-08  Piotr Grad  &lt;p.grad@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Build break in WebKitWebViewBase.cpp::webkitWebViewBaseCreateWebPage
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKDOMTextIteratormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (const unichar *)currentTextPointer
</span><span class="cx"> {
</span><del>-    return _textIterator-&gt;characters();
</del><ins>+    return _textIterator-&gt;deprecatedTextIteratorCharacters();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSUInteger)currentTextLength
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -414,12 +414,11 @@
</span><span class="cx">     m_page-&gt;send(Messages::WebPageProxy::LearnWord(word));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
</del><ins>+void WebEditorClient::checkSpellingOfString(StringView text, int* misspellingLocation, int* misspellingLength)
</ins><span class="cx"> {
</span><span class="cx">     int32_t resultLocation = -1;
</span><span class="cx">     int32_t resultLength = 0;
</span><del>-    // FIXME: It would be nice if we wouldn't have to copy the text here.
-    m_page-&gt;sendSync(Messages::WebPageProxy::CheckSpellingOfString(String(text, length)),
</del><ins>+    m_page-&gt;sendSync(Messages::WebPageProxy::CheckSpellingOfString(text.toStringWithoutCopying()),
</ins><span class="cx">         Messages::WebPageProxy::CheckSpellingOfString::Reply(resultLocation, resultLength));
</span><span class="cx">     *misspellingLocation = resultLocation;
</span><span class="cx">     *misspellingLength = resultLength;
</span><span class="lines">@@ -431,12 +430,11 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector&lt;WebCore::GrammarDetail&gt;&amp; grammarDetails, int* badGrammarLocation, int* badGrammarLength)
</del><ins>+void WebEditorClient::checkGrammarOfString(StringView text, Vector&lt;WebCore::GrammarDetail&gt;&amp; grammarDetails, int* badGrammarLocation, int* badGrammarLength)
</ins><span class="cx"> {
</span><span class="cx">     int32_t resultLocation = -1;
</span><span class="cx">     int32_t resultLength = 0;
</span><del>-    // FIXME: It would be nice if we wouldn't have to copy the text here.
-    m_page-&gt;sendSync(Messages::WebPageProxy::CheckGrammarOfString(String(text, length)),
</del><ins>+    m_page-&gt;sendSync(Messages::WebPageProxy::CheckGrammarOfString(text.toStringWithoutCopying()),
</ins><span class="cx">         Messages::WebPageProxy::CheckGrammarOfString::Reply(grammarDetails, resultLocation, resultLength));
</span><span class="cx">     *badGrammarLocation = resultLocation;
</span><span class="cx">     *badGrammarLength = resultLength;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (163711 => 163712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-02-08 16:14:53 UTC (rev 163711)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-02-08 16:32:05 UTC (rev 163712)
</span><span class="lines">@@ -135,9 +135,9 @@
</span><span class="cx">     virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
</span><span class="cx">     virtual void ignoreWordInSpellDocument(const String&amp;) override;
</span><span class="cx">     virtual void learnWord(const String&amp;) override;
</span><del>-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) override;
</del><ins>+    virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) override;
</ins><span class="cx">     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&amp; misspelledWord) override;
</span><del>-    virtual void checkGrammarOfString(const UChar*, int length, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
</del><ins>+    virtual void checkGrammarOfString(StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) override;
</ins><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx">     virtual Vector&lt;WebCore::TextCheckingResult&gt; checkTextOfParagraph(StringView, WebCore::TextCheckingTypeMask checkingTypes) override;
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>