<!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>[165759] trunk/Source/WebKit2</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/165759">165759</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-03-17 14:31:33 -0700 (Mon, 17 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Standardize on start/length in text input IPC methods
https://bugs.webkit.org/show_bug.cgi?id=130359

Reviewed by Anders Carlsson.

Some IPC methods used start/length, and others use start/end. This was confusing.

While here, changed WebPageMac.mm to not use NSMakeRange where we don't need it
(I want to move this code to WebPage.cpp, where it could be shared with iOS and
other platforms, as it doesn't depend on Foundation much).

* UIProcess/API/mac/WKView.mm:
(-[WKView insertText:replacementRange:]):
(-[WKView setMarkedText:selectedRange:replacementRange:]):
(-[WKView attributedSubstringForProposedRange:actualRange:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::internalShowContextMenu):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::insertDictatedText):
(WebKit::WebPageProxy::getAttributedSubstringFromRange):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setComposition):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::convertToRange):
(WebKit::WebPage::firstRectForCharacterRange):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-03-17  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Standardize on start/length in text input IPC methods
+        https://bugs.webkit.org/show_bug.cgi?id=130359
+
+        Reviewed by Anders Carlsson.
+
+        Some IPC methods used start/length, and others use start/end. This was confusing.
+
+        While here, changed WebPageMac.mm to not use NSMakeRange where we don't need it
+        (I want to move this code to WebPage.cpp, where it could be shared with iOS and
+        other platforms, as it doesn't depend on Foundation much).
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView insertText:replacementRange:]):
+        (-[WKView setMarkedText:selectedRange:replacementRange:]):
+        (-[WKView attributedSubstringForProposedRange:actualRange:]):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::internalShowContextMenu):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::setComposition):
+        (WebKit::WebPageProxy::insertText):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setComposition):
+        (WebKit::WebPageProxy::insertText):
+        (WebKit::WebPageProxy::insertDictatedText):
+        (WebKit::WebPageProxy::getAttributedSubstringFromRange):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setComposition):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::setComposition):
+        (WebKit::WebPage::insertText):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::setComposition):
+        (WebKit::WebPage::insertText):
+        (WebKit::WebPage::insertDictatedText):
+        (WebKit::WebPage::getAttributedSubstringFromRange):
+        (WebKit::convertToRange):
+        (WebKit::WebPage::firstRectForCharacterRange):
+
</ins><span class="cx"> 2014-03-17  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename WKThumbnailView to _WKThumbnailView
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -1289,9 +1289,9 @@
</span><span class="cx">     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
</span><span class="cx">     bool eventHandled;
</span><span class="cx">     if (!dictationAlternatives.isEmpty())
</span><del>-        eventHandled = _data-&gt;_page-&gt;insertDictatedText(eventText, replacementRange.location, NSMaxRange(replacementRange), dictationAlternatives);
</del><ins>+        eventHandled = _data-&gt;_page-&gt;insertDictatedText(eventText, replacementRange.location, replacementRange.length, dictationAlternatives);
</ins><span class="cx">     else
</span><del>-        eventHandled = _data-&gt;_page-&gt;insertText(eventText, replacementRange.location, NSMaxRange(replacementRange));
</del><ins>+        eventHandled = _data-&gt;_page-&gt;insertText(eventText, replacementRange.location, replacementRange.length);
</ins><span class="cx"> 
</span><span class="cx">     if (parameters)
</span><span class="cx">         parameters-&gt;eventInterpretationHadSideEffects |= eventHandled;
</span><span class="lines">@@ -1608,13 +1608,13 @@
</span><span class="cx">         ASSERT(!_data-&gt;_page-&gt;editorState().hasComposition);
</span><span class="cx">         [self _notifyInputContextAboutDiscardedComposition];
</span><span class="cx">         if ([text length] == 1 &amp;&amp; [[text decomposedStringWithCanonicalMapping] characterAtIndex:0] &lt; 0x80) {
</span><del>-            _data-&gt;_page-&gt;insertText(text, replacementRange.location, NSMaxRange(replacementRange));
</del><ins>+            _data-&gt;_page-&gt;insertText(text, replacementRange.location, replacementRange.length);
</ins><span class="cx">         } else
</span><span class="cx">             NSBeep();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _data-&gt;_page-&gt;setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange), replacementRange.location, NSMaxRange(replacementRange));
</del><ins>+    _data-&gt;_page-&gt;setComposition(text, underlines, newSelRange.location, newSelRange.length, replacementRange.location, replacementRange.length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSRange)markedRange
</span><span class="lines">@@ -1642,7 +1642,7 @@
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><span class="cx">     AttributedString result;
</span><del>-    _data-&gt;_page-&gt;getAttributedSubstringFromRange(nsRange.location, NSMaxRange(nsRange), result);
</del><ins>+    _data-&gt;_page-&gt;getAttributedSubstringFromRange(nsRange.location, nsRange.length, result);
</ins><span class="cx"> 
</span><span class="cx">     if (actualRange) {
</span><span class="cx">         *actualRange = nsRange;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -4482,7 +4482,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRange)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: We need to find out how to proper handle the crashes case.
</span><span class="cx">     if (!isValid())
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -525,14 +525,14 @@
</span><span class="cx">     void windowAndViewFramesChanged(const WebCore::FloatRect&amp; viewFrameInWindowCoordinates, const WebCore::FloatPoint&amp; accessibilityViewCoordinates);
</span><span class="cx">     void setMainFrameIsScrollable(bool);
</span><span class="cx"> 
</span><del>-    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
</del><ins>+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
</ins><span class="cx">     void confirmComposition();
</span><span class="cx">     void cancelComposition();
</span><del>-    bool insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
-    bool insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp; dictationAlternatives);
</del><ins>+    bool insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
+    bool insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp; dictationAlternatives);
</ins><span class="cx">     void getMarkedRange(uint64_t&amp; location, uint64_t&amp; length);
</span><span class="cx">     void getSelectedRange(uint64_t&amp; location, uint64_t&amp; length);
</span><del>-    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeEnd, AttributedString&amp;);
</del><ins>+    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp;);
</ins><span class="cx">     uint64_t characterIndexForPoint(const WebCore::IntPoint);
</span><span class="cx">     WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
</span><span class="cx">     bool executeKeypressCommands(const Vector&lt;WebCore::KeypressCommand&gt;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -98,12 +98,12 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underline, uint64_t selectionStart, uint64_t selectionEnd, uint64_t, uint64_t)
</del><ins>+void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underline, uint64_t selectionStart, uint64_t selectionLength, uint64_t, uint64_t)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    process().send(Messages::WebPage::SetComposition(text, underline, selectionStart, selectionEnd), m_pageID);
</del><ins>+    process().send(Messages::WebPage::SetComposition(text, underline, selectionStart, selectionLength), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::confirmComposition()
</span><span class="lines">@@ -120,12 +120,12 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPageProxy::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+bool WebPageProxy::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return true;
</span><span class="cx">     
</span><del>-    process().send(Messages::WebPage::InsertText(text, replacementRangeStart, replacementRangeEnd), m_pageID);
</del><ins>+    process().send(Messages::WebPage::InsertText(text, replacementRangeStart, replacementRangeLength), m_pageID);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx">     process().send(Messages::WebPage::SetMainFrameIsScrollable(isScrollable), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid()) {
</span><span class="cx">         // If this fails, we should call -discardMarkedText on input context to notify the input method.
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    process().sendSync(Messages::WebPage::SetComposition(text, underlines, selectionStart, selectionEnd, replacementRangeStart, replacementRangeEnd), Messages::WebPage::SetComposition::Reply(m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::SetComposition(text, underlines, selectionStart, selectionLength, replacementRangeStart, replacementRangeLength), Messages::WebPage::SetComposition::Reply(m_editorState), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::confirmComposition()
</span><span class="lines">@@ -178,23 +178,23 @@
</span><span class="cx">     process().sendSync(Messages::WebPage::CancelComposition(), Messages::WebPage::ConfirmComposition::Reply(m_editorState), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPageProxy::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+bool WebPageProxy::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     bool handled = true;
</span><del>-    process().sendSync(Messages::WebPage::InsertText(text, replacementRangeStart, replacementRangeEnd), Messages::WebPage::InsertText::Reply(handled, m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::InsertText(text, replacementRangeStart, replacementRangeLength), Messages::WebPage::InsertText::Reply(handled, m_editorState), m_pageID);
</ins><span class="cx">     m_temporarilyClosedComposition = false;
</span><span class="cx"> 
</span><span class="cx">     return handled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPageProxy::insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector&lt;TextAlternativeWithRange&gt;&amp; dictationAlternativesWithRange)
</del><ins>+bool WebPageProxy::insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, const Vector&lt;TextAlternativeWithRange&gt;&amp; dictationAlternativesWithRange)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx">     if (dictationAlternativesWithRange.isEmpty())
</span><del>-        return insertText(text, replacementRangeStart, replacementRangeEnd);
</del><ins>+        return insertText(text, replacementRangeStart, replacementRangeLength);
</ins><span class="cx"> 
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return true;
</span><span class="lines">@@ -209,13 +209,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (dictationAlternatives.isEmpty())
</span><del>-        return insertText(text, replacementRangeStart, replacementRangeEnd);
</del><ins>+        return insertText(text, replacementRangeStart, replacementRangeLength);
</ins><span class="cx"> 
</span><span class="cx">     bool handled = true;
</span><del>-    process().sendSync(Messages::WebPage::InsertDictatedText(text, replacementRangeStart, replacementRangeEnd, dictationAlternatives), Messages::WebPage::InsertDictatedText::Reply(handled, m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::InsertDictatedText(text, replacementRangeStart, replacementRangeLength, dictationAlternatives), Messages::WebPage::InsertDictatedText::Reply(handled, m_editorState), m_pageID);
</ins><span class="cx">     return handled;
</span><span class="cx"> #else
</span><del>-    return insertText(text, replacementRangeStart, replacementRangeEnd);
</del><ins>+    return insertText(text, replacementRangeStart, replacementRangeLength);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -241,11 +241,11 @@
</span><span class="cx">     process().sendSync(Messages::WebPage::GetSelectedRange(), Messages::WebPage::GetSelectedRange::Reply(location, length), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeEnd, AttributedString&amp; result)
</del><ins>+void WebPageProxy::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp; result)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><del>-    process().sendSync(Messages::WebPage::GetAttributedSubstringFromRange(rangeStart, rangeEnd), Messages::WebPage::GetAttributedSubstringFromRange::Reply(result), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::GetAttributedSubstringFromRange(rangeStart, rangeLength), Messages::WebPage::GetAttributedSubstringFromRange::Reply(result), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -3909,7 +3909,7 @@
</span><span class="cx">     send(Messages::WebPageProxy::EditorStateChanged(editorState()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementStart, uint64_t replacementLength)
</del><ins>+void WebPage::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementStart, uint64_t replacementLength)
</ins><span class="cx"> {
</span><span class="cx">     Frame* targetFrame = targetFrameForEditing(this);
</span><span class="cx">     if (!targetFrame || !targetFrame-&gt;selection().selection().isContentEditable()) {
</span><span class="lines">@@ -3928,7 +3928,7 @@
</span><span class="cx">         targetFrame-&gt;editor().setIgnoreCompositionSelectionChange(false);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    targetFrame-&gt;editor().setComposition(text, underlines, selectionStart, selectionEnd);
</del><ins>+    targetFrame-&gt;editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
</ins><span class="cx">     send(Messages::WebPageProxy::EditorStateChanged(editorState()));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -455,8 +455,8 @@
</span><span class="cx">     void syncApplyAutocorrection(const String&amp; correction, const String&amp; originalText, bool&amp; correctionApplied);
</span><span class="cx">     void requestAutocorrectionContext(uint64_t callbackID);
</span><span class="cx">     void getAutocorrectionContext(String&amp; beforeText, String&amp; markedText, String&amp; selectedText, String&amp; afterText, uint64_t&amp; location, uint64_t&amp; length);
</span><del>-    void insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
-    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd);
</del><ins>+    void insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength);
</ins><span class="cx">     void confirmComposition();
</span><span class="cx">     void getPositionInformation(const WebCore::IntPoint&amp;, InteractionInformationAtPosition&amp;);
</span><span class="cx">     void requestPositionInformation(const WebCore::IntPoint&amp;);
</span><span class="lines">@@ -521,7 +521,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
</del><ins>+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
</ins><span class="cx">     void confirmComposition(const String&amp; text, int64_t selectionStart, int64_t selectionLength);
</span><span class="cx">     void cancelComposition();
</span><span class="cx"> #endif
</span><span class="lines">@@ -538,13 +538,13 @@
</span><span class="cx"> 
</span><span class="cx">     void cancelComposition(EditorState&amp; newState);
</span><span class="cx"> #if !PLATFORM(IOS)
</span><del>-    void insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool&amp; handled, EditorState&amp; newState);
-    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState&amp; newState);
</del><ins>+    void insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, bool&amp; handled, EditorState&amp; newState);
+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength, EditorState&amp; newState);
</ins><span class="cx">     void confirmComposition(EditorState&amp; newState);
</span><span class="cx"> #endif
</span><span class="cx">     void getMarkedRange(uint64_t&amp; location, uint64_t&amp; length);
</span><span class="cx">     void getSelectedRange(uint64_t&amp; location, uint64_t&amp; length);
</span><del>-    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeEnd, AttributedString&amp;);
</del><ins>+    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp;);
</ins><span class="cx">     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t&amp; result);
</span><span class="cx">     void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect&amp; resultRect);
</span><span class="cx">     void executeKeypressCommands(const Vector&lt;WebCore::KeypressCommand&gt;&amp;, bool&amp; handled, EditorState&amp; newState);
</span><span class="lines">@@ -554,7 +554,7 @@
</span><span class="cx">     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&amp;, bool&amp; result);
</span><span class="cx">     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&amp;, bool&amp; result);
</span><span class="cx">     bool performNonEditingBehaviorForSelector(const String&amp;, WebCore::KeyboardEvent*);
</span><del>-    void insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState);
</del><ins>+    void insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState);
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx">     void confirmComposition(const String&amp; compositionString);
</span><span class="cx">     void setComposition(const WTF::String&amp; compositionString, const WTF::Vector&lt;WebCore::CompositionUnderline&gt;&amp; underlines, uint64_t cursorPosition);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -56,8 +56,8 @@
</span><span class="cx">     SyncApplyAutocorrection(String correction, String originalText) -&gt; (bool autocorrectionApplied)
</span><span class="cx">     RequestAutocorrectionContext(uint64_t callbackID)
</span><span class="cx">     GetAutocorrectionContext() -&gt; (String beforeContext, String markedText, String selectedText, String afterContext, uint64_t location, uint64_t length) 
</span><del>-    InsertText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
-    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd)
</del><ins>+    InsertText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
+    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength)
</ins><span class="cx">     ConfirmComposition()
</span><span class="cx">     GetPositionInformation(WebCore::IntPoint point) -&gt; (WebKit::InteractionInformationAtPosition information)
</span><span class="cx">     RequestPositionInformation(WebCore::IntPoint point)
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</ins><span class="cx">     ConfirmComposition(String text, int64_t selectionStart, int64_t selectionLength)
</span><span class="cx">     CancelComposition()
</span><span class="cx"> #endif
</span><span class="lines">@@ -294,17 +294,17 @@
</span><span class="cx">     CancelComposition() -&gt; (WebKit::EditorState newState)
</span><span class="cx">     GetMarkedRange() -&gt; (uint64_t location, uint64_t length)
</span><span class="cx">     GetSelectedRange() -&gt; (uint64_t location, uint64_t length)
</span><del>-    GetAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeEnd) -&gt; (WebKit::AttributedString result)
</del><ins>+    GetAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength) -&gt; (WebKit::AttributedString result)
</ins><span class="cx">     CharacterIndexForPoint(WebCore::IntPoint point) -&gt; (uint64_t result)
</span><span class="cx">     FirstRectForCharacterRange(uint64_t location, uint64_t length) -&gt; (WebCore::IntRect resultRect)
</span><span class="cx">     ExecuteKeypressCommands(Vector&lt;WebCore::KeypressCommand&gt; savedCommands) -&gt; (bool handled, WebKit::EditorState newState)
</span><span class="cx">     ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -&gt; (bool result)
</span><span class="cx">     AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -&gt; (bool result)
</span><del>-    InsertDictatedText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, Vector&lt;WebCore::DictationAlternative&gt; dictationAlternatives) -&gt; (bool handled, WebKit::EditorState newState)
</del><ins>+    InsertDictatedText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, Vector&lt;WebCore::DictationAlternative&gt; dictationAlternatives) -&gt; (bool handled, WebKit::EditorState newState)
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    InsertText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd) -&gt; (bool handled, WebKit::EditorState newState)
-    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd) -&gt; (WebKit::EditorState newState)
</del><ins>+    InsertText(String text, uint64_t replacementRangeStart, uint64_t replacementRangeLength) -&gt; (bool handled, WebKit::EditorState newState)
+    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength) -&gt; (WebKit::EditorState newState)
</ins><span class="cx">     ConfirmComposition() -&gt; (WebKit::EditorState newState)
</span><span class="cx"> #endif
</span><span class="cx">     SetMinimumLayoutSize(WebCore::IntSize minimumLayoutSize)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -166,12 +166,12 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd)
</del><ins>+void WebPage::setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="cx">     if (frame.selection().selection().isContentEditable())
</span><del>-        frame.editor().setComposition(text, underlines, selectionStart, selectionEnd);
</del><ins>+        frame.editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::confirmComposition()
</span><span class="lines">@@ -201,12 +201,12 @@
</span><span class="cx">     return TextIterator::rangeFromLocationAndLength(frame-&gt;selection().rootEditableElementOrDocumentElement(), nsrange.location, nsrange.length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
</del><ins>+void WebPage::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx">     
</span><span class="cx">     if (replacementRangeStart != NSNotFound) {
</span><del>-        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));
</del><ins>+        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, NSMakeRange(replacementRangeStart, replacementRangeLength));
</ins><span class="cx">         if (replacementRange)
</span><span class="cx">             frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (165758 => 165759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-03-17 21:29:11 UTC (rev 165758)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-03-17 21:31:33 UTC (rev 165759)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static PassRefPtr&lt;Range&gt; convertToRange(Frame*, NSRange);
</del><ins>+static PassRefPtr&lt;Range&gt; convertToRange(Frame*, uint64_t location, uint64_t length);
</ins><span class="cx"> 
</span><span class="cx"> void WebPage::platformInitialize()
</span><span class="cx"> {
</span><span class="lines">@@ -247,18 +247,18 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState&amp; newState)
</del><ins>+void WebPage::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength, EditorState&amp; newState)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="cx">     if (frame.selection().selection().isContentEditable()) {
</span><span class="cx">         RefPtr&lt;Range&gt; replacementRange;
</span><span class="cx">         if (replacementRangeStart != NSNotFound) {
</span><del>-            replacementRange = convertToRange(&amp;frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));
</del><ins>+            replacementRange = convertToRange(&amp;frame, replacementRangeStart, replacementRangeLength);
</ins><span class="cx">             frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        frame.editor().setComposition(text, underlines, selectionStart, selectionEnd);
</del><ins>+        frame.editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     newState = editorState();
</span><span class="lines">@@ -278,12 +278,12 @@
</span><span class="cx">     newState = editorState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool&amp; handled, EditorState&amp; newState)
</del><ins>+void WebPage::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, bool&amp; handled, EditorState&amp; newState)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="cx">     if (replacementRangeStart != NSNotFound) {
</span><del>-        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));
</del><ins>+        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, replacementRangeStart, replacementRangeLength);
</ins><span class="cx">         if (replacementRange)
</span><span class="cx">             frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
</span><span class="cx">     }
</span><span class="lines">@@ -300,12 +300,12 @@
</span><span class="cx">     newState = editorState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState)
</del><ins>+void WebPage::insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="cx">     if (replacementRangeStart != NSNotFound) {
</span><del>-        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));
</del><ins>+        RefPtr&lt;Range&gt; replacementRange = convertToRange(&amp;frame, replacementRangeStart, replacementRangeLength);
</ins><span class="cx">         if (replacementRange)
</span><span class="cx">             frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
</span><span class="cx">     }
</span><span class="lines">@@ -347,7 +347,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeEnd, AttributedString&amp; result)
</del><ins>+void WebPage::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp; result)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="lines">@@ -355,8 +355,7 @@
</span><span class="cx">     if (selection.isNone() || !selection.isContentEditable() || selection.isInPasswordField())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    NSRange nsRange = NSMakeRange(rangeStart, rangeEnd - rangeStart);
-    RefPtr&lt;Range&gt; range = convertToRange(&amp;frame, nsRange);
</del><ins>+    RefPtr&lt;Range&gt; range = convertToRange(&amp;frame, rangeStart, rangeLength);
</ins><span class="cx">     if (!range)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -366,10 +365,10 @@
</span><span class="cx">     // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing 
</span><span class="cx">     // whitespace at the end of the string which breaks the ATOK input method.  &lt;rdar://problem/5400551&gt;
</span><span class="cx">     // To work around this we truncate the resultant string to the correct length.
</span><del>-    if ([attributedString length] &gt; nsRange.length) {
-        ASSERT([attributedString length] == nsRange.length + 1);
-        ASSERT([[attributedString string] characterAtIndex:nsRange.length] == '\n' || [[attributedString string] characterAtIndex:nsRange.length] == ' ');
-        result.string = [attributedString attributedSubstringFromRange:NSMakeRange(0, nsRange.length)];
</del><ins>+    if ([attributedString length] &gt; rangeLength) {
+        ASSERT([attributedString length] == rangeLength + 1);
+        ASSERT([[attributedString string] characterAtIndex:rangeLength] == '\n' || [[attributedString string] characterAtIndex:rangeLength] == ' ');
+        result.string = [attributedString attributedSubstringFromRange:NSMakeRange(0, rangeLength)];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -390,12 +389,12 @@
</span><span class="cx">         index = static_cast&lt;uint64_t&gt;(location);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Range&gt; convertToRange(Frame* frame, NSRange nsrange)
</del><ins>+PassRefPtr&lt;Range&gt; convertToRange(Frame* frame, uint64_t location, uint64_t length)
</ins><span class="cx"> {
</span><del>-    if (nsrange.location &gt; INT_MAX)
</del><ins>+    if (location &gt; INT_MAX)
</ins><span class="cx">         return 0;
</span><del>-    if (nsrange.length &gt; INT_MAX || nsrange.location + nsrange.length &gt; INT_MAX)
-        nsrange.length = INT_MAX - nsrange.location;
</del><ins>+    if (length &gt; INT_MAX || location + length &gt; INT_MAX)
+        length = INT_MAX - location;
</ins><span class="cx">         
</span><span class="cx">     // our critical assumption is that we are only called by input methods that
</span><span class="cx">     // concentrate on a given area containing the selection
</span><span class="lines">@@ -403,7 +402,7 @@
</span><span class="cx">     // directly in the document DOM, so serialization is problematic. Our solution is
</span><span class="cx">     // to use the root editable element of the selection start as the positional base.
</span><span class="cx">     // That fits with AppKit's idea of an input context.
</span><del>-    return TextIterator::rangeFromLocationAndLength(frame-&gt;selection().rootEditableElementOrDocumentElement(), nsrange.location, nsrange.length);
</del><ins>+    return TextIterator::rangeFromLocationAndLength(frame-&gt;selection().rootEditableElementOrDocumentElement(), location, length);
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect&amp; resultRect)
</span><span class="lines">@@ -412,7 +411,7 @@
</span><span class="cx">     resultRect.setLocation(IntPoint(0, 0));
</span><span class="cx">     resultRect.setSize(IntSize(0, 0));
</span><span class="cx">     
</span><del>-    RefPtr&lt;Range&gt; range = convertToRange(&amp;frame, NSMakeRange(location, length));
</del><ins>+    RefPtr&lt;Range&gt; range = convertToRange(&amp;frame, location, length);
</ins><span class="cx">     if (!range)
</span><span class="cx">         return;
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>