<!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>[165823] 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/165823">165823</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-03-18 11:13:44 -0700 (Tue, 18 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Pass ranges over IPC in a cross-platform manner
https://bugs.webkit.org/show_bug.cgi?id=130376

Reviewed by Anders Carlsson.

Added an EditingRange class for IPC, which automatically converts to and from
NSRanges, knowing the difference between notFound and NSNotFound.

Manually applied the same fix to characterIndexForPoint.

* Scripts/webkit2/messages.py:
(struct_or_class):
* Shared/EditingRange.h: Added.
(WebKit::EditingRange::EditingRange):
(WebKit::EditingRange::isValid):
(WebKit::EditingRange::operator NSRange):
* UIProcess/API/mac/WKView.mm:
(-[WKView insertText:replacementRange:]):
(-[WKView selectedRange]):
(-[WKView hasMarkedText]):
(-[WKView setMarkedText:selectedRange:replacementRange:]):
(-[WKView markedRange]):
(-[WKView attributedSubstringForProposedRange:actualRange:]):
(-[WKView characterIndexForPoint:]):
(-[WKView firstRectForCharacterRange:actualRange:]):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setMarkedText:selectedRange:]):
(-[WKContentView insertText:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::insertDictatedText):
(WebKit::WebPageProxy::getMarkedRange):
(WebKit::WebPageProxy::getSelectedRange):
(WebKit::WebPageProxy::getAttributedSubstringFromRange):
(WebKit::WebPageProxy::firstRectForCharacterRange):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::insertDictatedText):
(WebKit::WebPageProxy::getMarkedRange):
(WebKit::WebPageProxy::getSelectedRange):
(WebKit::WebPageProxy::getAttributedSubstringFromRange):
(WebKit::WebPageProxy::firstRectForCharacterRange):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::rangeFromEditingRange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getMarkedRange):
(WebKit::WebPage::getSelectedRange):
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::WebPage::firstRectForCharacterRange):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getMarkedRange):
(WebKit::WebPage::getSelectedRange):
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::WebPage::characterIndexForPoint):
(WebKit::WebPage::firstRectForCharacterRange):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2Scriptswebkit2messagespy">trunk/Source/WebKit2/Scripts/webkit2/messages.py</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</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="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</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>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedEditingRangeh">trunk/Source/WebKit2/Shared/EditingRange.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -1,3 +1,73 @@
</span><ins>+2014-03-17  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [WK2] Pass ranges over IPC in a cross-platform manner
+        https://bugs.webkit.org/show_bug.cgi?id=130376
+
+        Reviewed by Anders Carlsson.
+
+        Added an EditingRange class for IPC, which automatically converts to and from
+        NSRanges, knowing the difference between notFound and NSNotFound.
+
+        Manually applied the same fix to characterIndexForPoint.
+
+        * Scripts/webkit2/messages.py:
+        (struct_or_class):
+        * Shared/EditingRange.h: Added.
+        (WebKit::EditingRange::EditingRange):
+        (WebKit::EditingRange::isValid):
+        (WebKit::EditingRange::operator NSRange):
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView insertText:replacementRange:]):
+        (-[WKView selectedRange]):
+        (-[WKView hasMarkedText]):
+        (-[WKView setMarkedText:selectedRange:replacementRange:]):
+        (-[WKView markedRange]):
+        (-[WKView attributedSubstringForProposedRange:actualRange:]):
+        (-[WKView characterIndexForPoint:]):
+        (-[WKView firstRectForCharacterRange:actualRange:]):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setMarkedText:selectedRange:]):
+        (-[WKContentView insertText:]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::setComposition):
+        (WebKit::WebPageProxy::insertText):
+        (WebKit::WebPageProxy::insertDictatedText):
+        (WebKit::WebPageProxy::getMarkedRange):
+        (WebKit::WebPageProxy::getSelectedRange):
+        (WebKit::WebPageProxy::getAttributedSubstringFromRange):
+        (WebKit::WebPageProxy::firstRectForCharacterRange):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setComposition):
+        (WebKit::WebPageProxy::insertText):
+        (WebKit::WebPageProxy::insertDictatedText):
+        (WebKit::WebPageProxy::getMarkedRange):
+        (WebKit::WebPageProxy::getSelectedRange):
+        (WebKit::WebPageProxy::getAttributedSubstringFromRange):
+        (WebKit::WebPageProxy::firstRectForCharacterRange):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::rangeFromEditingRange):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::setComposition):
+        (WebKit::WebPage::insertText):
+        (WebKit::WebPage::insertDictatedText):
+        (WebKit::WebPage::getMarkedRange):
+        (WebKit::WebPage::getSelectedRange):
+        (WebKit::WebPage::getAttributedSubstringFromRange):
+        (WebKit::WebPage::firstRectForCharacterRange):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::setComposition):
+        (WebKit::WebPage::insertText):
+        (WebKit::WebPage::insertDictatedText):
+        (WebKit::WebPage::getMarkedRange):
+        (WebKit::WebPage::getSelectedRange):
+        (WebKit::WebPage::getAttributedSubstringFromRange):
+        (WebKit::WebPage::characterIndexForPoint):
+        (WebKit::WebPage::firstRectForCharacterRange):
+
</ins><span class="cx"> 2014-03-17  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         More FTL enabling.
</span></span></pre></div>
<a id="trunkSourceWebKit2Scriptswebkit2messagespy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Scripts/webkit2/messages.py        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -211,6 +211,7 @@
</span><span class="cx">         'WebKit::DatabaseProcessCreationParameters',
</span><span class="cx">         'WebKit::DictionaryPopupInfo',
</span><span class="cx">         'WebKit::DrawingAreaInfo',
</span><ins>+        'WebKit::EditingRange',
</ins><span class="cx">         'WebKit::EditorState',
</span><span class="cx">         'WebKit::InteractionInformationAtPosition',
</span><span class="cx">         'WebKit::NavigationActionData',
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEditingRangeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/EditingRange.h (0 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EditingRange.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/EditingRange.h        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -0,0 +1,80 @@
</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.
+ */
+
+#ifndef EditingRange_h
+#define EditingRange_h
+
+#include &quot;ArgumentCoders.h&quot;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebKit {
+
+struct EditingRange {
+    EditingRange()
+        : location(notFound)
+        , length(0)
+    {
+    }
+
+    EditingRange(uint64_t location, uint64_t length)
+        : location(location)
+        , length(length)
+    {
+    }
+
+    // (notFound, 0) is notably valid.
+    bool isValid() const { return location + length &gt;= location; }
+
+#if defined(__OBJC__)
+    EditingRange(NSRange range)
+    {
+        if (range.location != NSNotFound) {
+            location = range.location;
+            length = range.length;
+        } else {
+            location = notFound;
+            length = 0;
+        }
+    }
+
+    operator NSRange() const
+    {
+        if (location == notFound)
+            return NSMakeRange(NSNotFound, 0);
+        return NSMakeRange(location, length);
+    }
+#endif
+
+    uint64_t location;
+    uint64_t length;
+};
+
+}
+
+namespace IPC {
+template&lt;&gt; struct ArgumentCoder&lt;WebKit::EditingRange&gt; : SimpleArgumentCoder&lt;WebKit::EditingRange&gt; { };
+}
+
+#endif // EditingRange_h
</ins><span class="cx">Property changes on: trunk/Source/WebKit2/Shared/EditingRange.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import &quot;AttributedString.h&quot;
</span><span class="cx"> #import &quot;ColorSpaceData.h&quot;
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;EditorState.h&quot;
</span><span class="cx"> #import &quot;FindIndicator.h&quot;
</span><span class="cx"> #import &quot;FindIndicatorWindow.h&quot;
</span><span class="lines">@@ -1289,9 +1290,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, replacementRange.length, dictationAlternatives);
</del><ins>+        eventHandled = _data-&gt;_page-&gt;insertDictatedText(eventText, replacementRange, dictationAlternatives);
</ins><span class="cx">     else
</span><del>-        eventHandled = _data-&gt;_page-&gt;insertText(eventText, replacementRange.location, replacementRange.length);
</del><ins>+        eventHandled = _data-&gt;_page-&gt;insertText(eventText, replacementRange);
</ins><span class="cx"> 
</span><span class="cx">     if (parameters)
</span><span class="cx">         parameters-&gt;eventInterpretationHadSideEffects |= eventHandled;
</span><span class="lines">@@ -1480,11 +1481,10 @@
</span><span class="cx"> {
</span><span class="cx">     [self _executeSavedKeypressCommands];
</span><span class="cx"> 
</span><del>-    uint64_t selectionStart;
-    uint64_t selectionLength;
-    _data-&gt;_page-&gt;getSelectedRange(selectionStart, selectionLength);
</del><ins>+    EditingRange selectedRange;
+    _data-&gt;_page-&gt;getSelectedRange(selectedRange);
</ins><span class="cx"> 
</span><del>-    NSRange result = NSMakeRange(selectionStart, selectionLength);
</del><ins>+    NSRange result = selectedRange;
</ins><span class="cx">     if (result.location == NSNotFound)
</span><span class="cx">         LOG(TextInput, &quot;selectedRange -&gt; (NSNotFound, %u)&quot;, result.length);
</span><span class="cx">     else
</span><span class="lines">@@ -1506,10 +1506,9 @@
</span><span class="cx">             result = _data-&gt;_page-&gt;editorState().hasComposition;
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><del>-        uint64_t location;
-        uint64_t length;
-        _data-&gt;_page-&gt;getMarkedRange(location, length);
-        result = location != NSNotFound;
</del><ins>+        EditingRange markedRange;
+        _data-&gt;_page-&gt;getMarkedRange(markedRange);
+        result = markedRange.location != notFound;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LOG(TextInput, &quot;hasMarkedText -&gt; %u&quot;, result);
</span><span class="lines">@@ -1575,14 +1574,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange replacementRange:(NSRange)replacementRange
</del><ins>+- (void)setMarkedText:(id)string selectedRange:(NSRange)newSelectedRange replacementRange:(NSRange)replacementRange
</ins><span class="cx"> {
</span><span class="cx">     [self _executeSavedKeypressCommands];
</span><span class="cx"> 
</span><span class="cx">     BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
</span><span class="cx">     ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]);
</span><span class="cx"> 
</span><del>-    LOG(TextInput, &quot;setMarkedText:\&quot;%@\&quot; selectedRange:(%u, %u)&quot;, isAttributedString ? [string string] : string, newSelRange.location, newSelRange.length);
</del><ins>+    LOG(TextInput, &quot;setMarkedText:\&quot;%@\&quot; selectedRange:(%u, %u)&quot;, isAttributedString ? [string string] : string, newSelectedRange.location, newSelectedRange.length);
</ins><span class="cx"> 
</span><span class="cx">     // Use pointer to get parameters passed to us by the caller of interpretKeyEvents.
</span><span class="cx">     WKViewInterpretKeyEventsParameters* parameters = _data-&gt;_interpretKeyEventsParameters;
</span><span class="lines">@@ -1608,25 +1607,29 @@
</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, replacementRange.length);
</del><ins>+            _data-&gt;_page-&gt;insertText(text, replacementRange);
</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, newSelRange.length, replacementRange.location, replacementRange.length);
</del><ins>+    _data-&gt;_page-&gt;setComposition(text, underlines, newSelectedRange, replacementRange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSRange)markedRange
</span><span class="cx"> {
</span><span class="cx">     [self _executeSavedKeypressCommands];
</span><span class="cx"> 
</span><del>-    uint64_t location;
-    uint64_t length;
-    _data-&gt;_page-&gt;getMarkedRange(location, length);
</del><ins>+    EditingRange markedRange;
+    _data-&gt;_page-&gt;getMarkedRange(markedRange);
</ins><span class="cx"> 
</span><del>-    LOG(TextInput, &quot;markedRange -&gt; (%u, %u)&quot;, location, length);
-    return NSMakeRange(location, length);
</del><ins>+    NSRange result = markedRange;
+    if (result.location == NSNotFound)
+        LOG(TextInput, &quot;markedRange -&gt; (NSNotFound, %u)&quot;, result.length);
+    else
+        LOG(TextInput, &quot;markedRange -&gt; (%u, %u)&quot;, result.location, result.length);
+
+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)nsRange actualRange:(NSRangePointer)actualRange
</span><span class="lines">@@ -1642,7 +1645,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, nsRange.length, result);
</del><ins>+    _data-&gt;_page-&gt;getAttributedSubstringFromRange(nsRange, result);
</ins><span class="cx"> 
</span><span class="cx">     if (actualRange) {
</span><span class="cx">         *actualRange = nsRange;
</span><span class="lines">@@ -1667,6 +1670,8 @@
</span><span class="cx">     thePoint = [self convertPoint:thePoint fromView:nil];  // the point is relative to the main frame
</span><span class="cx">     
</span><span class="cx">     uint64_t result = _data-&gt;_page-&gt;characterIndexForPoint(IntPoint(thePoint));
</span><ins>+    if (result == notFound)
+        result = NSNotFound;
</ins><span class="cx">     LOG(TextInput, &quot;characterIndexForPoint:(%f, %f) -&gt; %u&quot;, thePoint.x, thePoint.y, result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -1681,7 +1686,7 @@
</span><span class="cx">     if ((theRange.location + theRange.length &lt; theRange.location) &amp;&amp; (theRange.location + theRange.length != 0))
</span><span class="cx">         theRange.length = 0;
</span><span class="cx">     
</span><del>-    NSRect resultRect = _data-&gt;_page-&gt;firstRectForCharacterRange(theRange.location, theRange.length);
</del><ins>+    NSRect resultRect = _data-&gt;_page-&gt;firstRectForCharacterRange(theRange);
</ins><span class="cx">     resultRect = [self convertRect:resultRect toView:nil];
</span><span class="cx">     resultRect = [self.window convertRectToScreen:resultRect];
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -160,6 +160,7 @@
</span><span class="cx"> struct AttributedString;
</span><span class="cx"> struct ColorSpaceData;
</span><span class="cx"> struct DictionaryPopupInfo;
</span><ins>+struct EditingRange;
</ins><span class="cx"> struct EditorState;
</span><span class="cx"> struct PlatformPopupMenuData;
</span><span class="cx"> struct PrintInfo;
</span><span class="lines">@@ -525,16 +526,16 @@
</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 selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
</del><ins>+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange, const EditingRange&amp; replacementRange);
</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 replacementRangeLength);
-    bool insertDictatedText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp; dictationAlternatives);
-    void getMarkedRange(uint64_t&amp; location, uint64_t&amp; length);
-    void getSelectedRange(uint64_t&amp; location, uint64_t&amp; length);
-    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp;);
</del><ins>+    bool insertText(const String&amp; text, const EditingRange&amp; replacementRange);
+    bool insertDictatedText(const String&amp; text, const EditingRange&amp; replacementRange, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp; dictationAlternatives);
+    void getMarkedRange(EditingRange&amp;);
+    void getSelectedRange(EditingRange&amp;);
+    void getAttributedSubstringFromRange(const EditingRange&amp;, AttributedString&amp;);
</ins><span class="cx">     uint64_t characterIndexForPoint(const WebCore::IntPoint);
</span><del>-    WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
</del><ins>+    WebCore::IntRect firstRectForCharacterRange(const EditingRange&amp;);
</ins><span class="cx">     bool executeKeypressCommands(const Vector&lt;WebCore::KeypressCommand&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx">     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String&amp; textInput);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;NativeWebTouchEvent.h&quot;
</span><span class="cx"> #import &quot;SmartMagnificationController.h&quot;
</span><span class="lines">@@ -1409,7 +1410,7 @@
</span><span class="cx"> - (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange
</span><span class="cx"> {
</span><span class="cx">     _markedText = markedText;
</span><del>-    _page-&gt;setComposition(markedText, Vector&lt;WebCore::CompositionUnderline&gt;(), selectedRange.location, selectedRange.length, 0, 0);
</del><ins>+    _page-&gt;setComposition(markedText, Vector&lt;WebCore::CompositionUnderline&gt;(), selectedRange, EditingRange());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)unmarkText
</span><span class="lines">@@ -1506,7 +1507,7 @@
</span><span class="cx"> // Inserts the given string, replacing any selected or marked text.
</span><span class="cx"> - (void)insertText:(NSString *)aStringValue
</span><span class="cx"> {
</span><del>-    _page-&gt;insertText(aStringValue, NSNotFound, 0);
</del><ins>+    _page-&gt;insertText(aStringValue, EditingRange());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)hasText
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;PageClient.h&quot;
</span><span class="cx"> #import &quot;RemoteLayerTreeTransaction.h&quot;
</span><span class="lines">@@ -98,12 +99,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 selectionLength, uint64_t, uint64_t)
</del><ins>+void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underline, const EditingRange&amp; selectionRange, const EditingRange&amp;)
</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, selectionLength), m_pageID);
</del><ins>+    process().send(Messages::WebPage::SetComposition(text, underline, selectionRange), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::confirmComposition()
</span><span class="lines">@@ -120,32 +121,32 @@
</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 replacementRangeLength)
</del><ins>+bool WebPageProxy::insertText(const String&amp; text, const EditingRange&amp; replacementRange)
</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, replacementRangeLength), m_pageID);
</del><ins>+    process().send(Messages::WebPage::InsertText(text, replacementRange), m_pageID);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPageProxy::insertDictatedText(const String&amp;, uint64_t, uint64_t, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp;)
</del><ins>+bool WebPageProxy::insertDictatedText(const String&amp;, const EditingRange&amp;, const Vector&lt;WebCore::TextAlternativeWithRange&gt;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getMarkedRange(uint64_t&amp;, uint64_t&amp;)
</del><ins>+void WebPageProxy::getMarkedRange(EditingRange&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getSelectedRange(uint64_t&amp;, uint64_t&amp;)
</del><ins>+void WebPageProxy::getSelectedRange(EditingRange&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getAttributedSubstringFromRange(uint64_t, uint64_t, AttributedString&amp;)
</del><ins>+void WebPageProxy::getAttributedSubstringFromRange(const EditingRange&amp;, AttributedString&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -156,7 +157,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect WebPageProxy::firstRectForCharacterRange(uint64_t, uint64_t)
</del><ins>+IntRect WebPageProxy::firstRectForCharacterRange(const EditingRange&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx">     return IntRect();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import &quot;ColorSpaceData.h&quot;
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><span class="cx"> #import &quot;DictionaryPopupInfo.h&quot;
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;EditorState.h&quot;
</span><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;PageClient.h&quot;
</span><span class="lines">@@ -151,7 +152,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 selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</del><ins>+void WebPageProxy::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange, const EditingRange&amp; replacementRange)
</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 +160,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    process().sendSync(Messages::WebPage::SetComposition(text, underlines, selectionStart, selectionLength, replacementRangeStart, replacementRangeLength), Messages::WebPage::SetComposition::Reply(m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::SetComposition(text, underlines, selectionRange, replacementRange), 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 +179,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 replacementRangeLength)
</del><ins>+bool WebPageProxy::insertText(const String&amp; text, const EditingRange&amp; replacementRange)
</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, replacementRangeLength), Messages::WebPage::InsertText::Reply(handled, m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::InsertText(text, replacementRange), 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 replacementRangeLength, const Vector&lt;TextAlternativeWithRange&gt;&amp; dictationAlternativesWithRange)
</del><ins>+bool WebPageProxy::insertDictatedText(const String&amp; text, const EditingRange&amp; replacementRange, 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, replacementRangeLength);
</del><ins>+        return insertText(text, replacementRange);
</ins><span class="cx"> 
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return true;
</span><span class="lines">@@ -209,43 +210,43 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (dictationAlternatives.isEmpty())
</span><del>-        return insertText(text, replacementRangeStart, replacementRangeLength);
</del><ins>+        return insertText(text, replacementRange);
</ins><span class="cx"> 
</span><span class="cx">     bool handled = true;
</span><del>-    process().sendSync(Messages::WebPage::InsertDictatedText(text, replacementRangeStart, replacementRangeLength, dictationAlternatives), Messages::WebPage::InsertDictatedText::Reply(handled, m_editorState), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::InsertDictatedText(text, replacementRange, 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, replacementRangeLength);
</del><ins>+    return insertText(text, replacementRange);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getMarkedRange(uint64_t&amp; location, uint64_t&amp; length)
</del><ins>+void WebPageProxy::getMarkedRange(EditingRange&amp; result)
</ins><span class="cx"> {
</span><del>-    location = NSNotFound;
-    length = 0;
</del><ins>+    result = EditingRange();
</ins><span class="cx"> 
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    process().sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(result), m_pageID);
+    MESSAGE_CHECK(result.isValid());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getSelectedRange(uint64_t&amp; location, uint64_t&amp; length)
</del><ins>+void WebPageProxy::getSelectedRange(EditingRange&amp; result)
</ins><span class="cx"> {
</span><del>-    location = NSNotFound;
-    length = 0;
</del><ins>+    result = EditingRange();
</ins><span class="cx"> 
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    process().sendSync(Messages::WebPage::GetSelectedRange(), Messages::WebPage::GetSelectedRange::Reply(location, length), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::GetSelectedRange(), Messages::WebPage::GetSelectedRange::Reply(result), m_pageID);
+    MESSAGE_CHECK(result.isValid());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp; result)
</del><ins>+void WebPageProxy::getAttributedSubstringFromRange(const EditingRange&amp; range, 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, rangeLength), Messages::WebPage::GetAttributedSubstringFromRange::Reply(result), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::GetAttributedSubstringFromRange(range), 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 class="lines">@@ -258,13 +259,13 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length)
</del><ins>+IntRect WebPageProxy::firstRectForCharacterRange(const EditingRange&amp; range)
</ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><span class="cx">     IntRect resultRect;
</span><del>-    process().sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
</del><ins>+    process().sendSync(Messages::WebPage::FirstRectForCharacterRange(range), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
</ins><span class="cx">     return resultRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -1460,6 +1460,7 @@
</span><span class="cx">                 D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */; };
</span><span class="cx">                 D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; };
</span><span class="cx">                 DF58C6361371ACA000F9A37C /* NativeWebWheelEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */; };
</span><ins>+                E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E105FE5318D7B9DE008F57A8 /* EditingRange.h */; };
</ins><span class="cx">                 E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; };
</span><span class="cx">                 E133FD8A1423DD7F00FC7BFB /* WebKit.icns in Resources */ = {isa = PBXBuildFile; fileRef = E133FD891423DD7F00FC7BFB /* WebKit.icns */; };
</span><span class="cx">                 E13833EC189C33C8001E2350 /* LocalStorageDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = E13833EB189C33C8001E2350 /* LocalStorageDetails.h */; };
</span><span class="lines">@@ -3322,6 +3323,7 @@
</span><span class="cx">                 D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSearchPopupMenu.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DF58C6311371AC5800F9A37C /* NativeWebWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebWheelEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebWheelEventMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E105FE5318D7B9DE008F57A8 /* EditingRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingRange.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = Resources/WebKit.icns; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E13833EB189C33C8001E2350 /* LocalStorageDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageDetails.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessPlatformStrategies.cpp; path = NetworkProcess/NetworkProcessPlatformStrategies.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3994,6 +3996,7 @@
</span><span class="cx">                                 BCE81D97131AE02100241910 /* DictionaryPopupInfo.h */,
</span><span class="cx">                                 C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
</span><span class="cx">                                 0FB659221208B4DB0044816C /* DrawingAreaInfo.h */,
</span><ins>+                                E105FE5318D7B9DE008F57A8 /* EditingRange.h */,
</ins><span class="cx">                                 8CFECE931490F140002AAA32 /* EditorState.cpp */,
</span><span class="cx">                                 1AA41AB412C02EC4002BE67B /* EditorState.h */,
</span><span class="cx">                                 BCE81D8A1319F7EF00241910 /* FontInfo.cpp */,
</span><span class="lines">@@ -6567,6 +6570,7 @@
</span><span class="cx">                                 515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
</span><span class="cx">                                 BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
</span><span class="cx">                                 1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.h in Headers */,
</span><ins>+                                E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */,
</ins><span class="cx">                                 BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */,
</span><span class="cx">                                 379A873618BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h in Headers */,
</span><span class="cx">                                 BC06F42F12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &quot;DragControllerAction.h&quot;
</span><span class="cx"> #include &quot;DrawingArea.h&quot;
</span><span class="cx"> #include &quot;DrawingAreaMessages.h&quot;
</span><ins>+#include &quot;EditingRange.h&quot;
</ins><span class="cx"> #include &quot;EditorState.h&quot;
</span><span class="cx"> #include &quot;EventDispatcher.h&quot;
</span><span class="cx"> #include &quot;InjectedBundle.h&quot;
</span><span class="lines">@@ -4336,13 +4337,18 @@
</span><span class="cx">     send(Messages::WebPageProxy::StringCallback(result, callbackID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Range&gt; WebPage::rangeFromEditingLocationAndLength(Frame&amp; frame, uint64_t location, uint64_t length)
</del><ins>+PassRefPtr&lt;WebCore::Range&gt; WebPage::rangeFromEditingRange(WebCore::Frame&amp; frame, const EditingRange&amp; range)
</ins><span class="cx"> {
</span><ins>+    ASSERT(range.location != notFound);
+
</ins><span class="cx">     // Sanitize the input, because TextIterator::rangeFromLocationAndLength takes signed integers.
</span><del>-    if (location &gt; INT_MAX)
</del><ins>+    if (range.location &gt; INT_MAX)
</ins><span class="cx">         return 0;
</span><del>-    if (length &gt; INT_MAX || location + length &gt; INT_MAX)
-        length = INT_MAX - location;
</del><ins>+    int length;
+    if (range.length &lt;= INT_MAX &amp;&amp; range.location + range.length &lt;= INT_MAX)
+        length = static_cast&lt;int&gt;(range.length);
+    else
+        length = INT_MAX - range.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">@@ -4350,7 +4356,8 @@
</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.selection().rootEditableElementOrDocumentElement(), location, length);
</del><ins>+    return TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), static_cast&lt;int&gt;(range.location), length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -163,6 +163,7 @@
</span><span class="cx"> class WebWheelEvent;
</span><span class="cx"> struct AssistedNodeInformation;
</span><span class="cx"> struct AttributedString;
</span><ins>+struct EditingRange;
</ins><span class="cx"> struct EditorState;
</span><span class="cx"> struct InteractionInformationAtPosition;
</span><span class="cx"> struct PrintInfo;
</span><span class="lines">@@ -455,8 +456,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 replacementRangeLength);
-    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength);
</del><ins>+    void insertText(const String&amp; text, const EditingRange&amp; replacementRange);
+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange);
</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">@@ -538,15 +539,15 @@
</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 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);
</del><ins>+    void insertText(const String&amp; text, const EditingRange&amp; replacementRange, bool&amp; handled, EditorState&amp; newState);
+    void setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange, const EditingRange&amp; replacementRange, EditorState&amp; newState);
</ins><span class="cx">     void confirmComposition(EditorState&amp; newState);
</span><span class="cx"> #endif
</span><del>-    void getMarkedRange(uint64_t&amp; location, uint64_t&amp; length);
-    void getSelectedRange(uint64_t&amp; location, uint64_t&amp; length);
-    void getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp;);
</del><ins>+    void getMarkedRange(EditingRange&amp;);
+    void getSelectedRange(EditingRange&amp;);
+    void getAttributedSubstringFromRange(const EditingRange&amp;, AttributedString&amp;);
</ins><span class="cx">     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t&amp; result);
</span><del>-    void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect&amp; resultRect);
</del><ins>+    void firstRectForCharacterRange(const EditingRange&amp;, WebCore::IntRect&amp; resultRect);
</ins><span class="cx">     void executeKeypressCommands(const Vector&lt;WebCore::KeypressCommand&gt;&amp;, bool&amp; handled, EditorState&amp; newState);
</span><span class="cx">     void readSelectionFromPasteboard(const WTF::String&amp; pasteboardName, bool&amp; result);
</span><span class="cx">     void getStringSelectionForPasteboard(WTF::String&amp; stringValue);
</span><span class="lines">@@ -554,7 +555,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 replacementRangeLength, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState);
</del><ins>+    void insertDictatedText(const String&amp; text, const EditingRange&amp; replacementRange, 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 class="lines">@@ -927,7 +928,7 @@
</span><span class="cx">     static PluginView* focusedPluginViewForFrame(WebCore::Frame&amp;);
</span><span class="cx">     static PluginView* pluginViewForFrame(WebCore::Frame*);
</span><span class="cx"> 
</span><del>-    PassRefPtr&lt;WebCore::Range&gt; rangeFromEditingLocationAndLength(WebCore::Frame&amp;, uint64_t location, uint64_t length);
</del><ins>+    static PassRefPtr&lt;WebCore::Range&gt; rangeFromEditingRange(WebCore::Frame&amp;, const EditingRange&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void reportUsedFeatures();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-03-18 18:13:44 UTC (rev 165823)
</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 replacementRangeLength)
-    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, uint64_t selectionStart, uint64_t selectionLength)
</del><ins>+    InsertText(String text, WebKit::EditingRange replacementRange)
+    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, WebKit::EditingRange selectionRange)
</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">@@ -292,19 +292,19 @@
</span><span class="cx"> 
</span><span class="cx">     # Text input.
</span><span class="cx">     CancelComposition() -&gt; (WebKit::EditorState newState)
</span><del>-    GetMarkedRange() -&gt; (uint64_t location, uint64_t length)
-    GetSelectedRange() -&gt; (uint64_t location, uint64_t length)
-    GetAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength) -&gt; (WebKit::AttributedString result)
</del><ins>+    GetMarkedRange() -&gt; (WebKit::EditingRange range)
+    GetSelectedRange() -&gt; (WebKit::EditingRange range)
+    GetAttributedSubstringFromRange(WebKit::EditingRange range) -&gt; (WebKit::AttributedString result)
</ins><span class="cx">     CharacterIndexForPoint(WebCore::IntPoint point) -&gt; (uint64_t result)
</span><del>-    FirstRectForCharacterRange(uint64_t location, uint64_t length) -&gt; (WebCore::IntRect resultRect)
</del><ins>+    FirstRectForCharacterRange(WebKit::EditingRange range) -&gt; (WebCore::IntRect resultRect)
</ins><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 replacementRangeLength, Vector&lt;WebCore::DictationAlternative&gt; dictationAlternatives) -&gt; (bool handled, WebKit::EditorState newState)
</del><ins>+    InsertDictatedText(String text, WebKit::EditingRange replacementRange, 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 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)
</del><ins>+    InsertText(String text, WebKit::EditingRange replacementRange) -&gt; (bool handled, WebKit::EditorState newState)
+    SetComposition(String text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, WebKit::EditingRange selectionRange, WebKit::EditingRange replacementRange) -&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 (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;AssistedNodeInformation.h&quot;
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;EditorState.h&quot;
</span><span class="cx"> #import &quot;InteractionInformationAtPosition.h&quot;
</span><span class="cx"> #import &quot;PluginView.h&quot;
</span><span class="lines">@@ -166,12 +167,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 selectionLength)
</del><ins>+void WebPage::setComposition(const String&amp; text, Vector&lt;WebCore::CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange)
</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, selectionStart + selectionLength);
</del><ins>+        frame.editor().setComposition(text, underlines, selectionRange.location, selectionRange.location + selectionRange.length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::confirmComposition()
</span><span class="lines">@@ -185,12 +186,12 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::insertText(const String&amp; text, uint64_t replacementRangeStart, uint64_t replacementRangeLength)
</del><ins>+void WebPage::insertText(const String&amp; text, const EditingRange&amp; replacementEditingRange)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx">     
</span><del>-    if (replacementRangeStart != NSNotFound) {
-        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingLocationAndLength(frame, replacementRangeStart, replacementRangeLength);
</del><ins>+    if (replacementEditingRange.location != notFound) {
+        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
</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">@@ -203,22 +204,22 @@
</span><span class="cx">         frame.editor().confirmComposition(text);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::insertDictatedText(const String&amp;, uint64_t, uint64_t, const Vector&lt;WebCore::DictationAlternative&gt;&amp;, bool&amp;, EditorState&amp;)
</del><ins>+void WebPage::insertDictatedText(const String&amp;, const EditingRange&amp;, const Vector&lt;WebCore::DictationAlternative&gt;&amp;, bool&amp;, EditorState&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getMarkedRange(uint64_t&amp;, uint64_t&amp;)
</del><ins>+void WebPage::getMarkedRange(EditingRange&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getSelectedRange(uint64_t&amp;, uint64_t&amp;)
</del><ins>+void WebPage::getSelectedRange(EditingRange&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getAttributedSubstringFromRange(uint64_t, uint64_t, AttributedString&amp;)
</del><ins>+void WebPage::getAttributedSubstringFromRange(const EditingRange&amp;, AttributedString&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -228,7 +229,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::firstRectForCharacterRange(uint64_t, uint64_t, WebCore::IntRect&amp;)
</del><ins>+void WebPage::firstRectForCharacterRange(const EditingRange&amp;, WebCore::IntRect&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</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 (165822 => 165823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-03-18 18:11:46 UTC (rev 165822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-03-18 18:13:44 UTC (rev 165823)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;AttributedString.h&quot;
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><ins>+#import &quot;EditingRange.h&quot;
</ins><span class="cx"> #import &quot;EditorState.h&quot;
</span><span class="cx"> #import &quot;PDFKitImports.h&quot;
</span><span class="cx"> #import &quot;PageBanner.h&quot;
</span><span class="lines">@@ -245,18 +246,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 selectionLength, uint64_t replacementRangeStart, uint64_t replacementRangeLength, EditorState&amp; newState)
</del><ins>+void WebPage::setComposition(const String&amp; text, Vector&lt;CompositionUnderline&gt; underlines, const EditingRange&amp; selectionRange, const EditingRange&amp; replacementEditingRange, 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><del>-        if (replacementRangeStart != NSNotFound) {
-            replacementRange = rangeFromEditingLocationAndLength(frame, replacementRangeStart, replacementRangeLength);
</del><ins>+        if (replacementEditingRange.location != notFound) {
+            replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
</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, selectionStart + selectionLength);
</del><ins>+        frame.editor().setComposition(text, underlines, selectionRange.location, selectionRange.location + selectionRange.length);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     newState = editorState();
</span><span class="lines">@@ -276,12 +277,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 replacementRangeLength, bool&amp; handled, EditorState&amp; newState)
</del><ins>+void WebPage::insertText(const String&amp; text, const EditingRange&amp; replacementEditingRange, 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><del>-    if (replacementRangeStart != NSNotFound) {
-        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingLocationAndLength(frame, replacementRangeStart, replacementRangeLength);
</del><ins>+    if (replacementEditingRange.location != notFound) {
+        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
</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">@@ -298,12 +299,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 replacementRangeLength, const Vector&lt;WebCore::DictationAlternative&gt;&amp; dictationAlternativeLocations, bool&amp; handled, EditorState&amp; newState)
</del><ins>+void WebPage::insertDictatedText(const String&amp; text, const EditingRange&amp; replacementEditingRange, 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><del>-    if (replacementRangeStart != NSNotFound) {
-        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingLocationAndLength(frame, replacementRangeStart, replacementRangeLength);
</del><ins>+    if (replacementEditingRange.location != notFound) {
+        RefPtr&lt;Range&gt; replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
</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">@@ -313,39 +314,33 @@
</span><span class="cx">     newState = editorState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getMarkedRange(uint64_t&amp; location, uint64_t&amp; length)
</del><ins>+void WebPage::getMarkedRange(EditingRange&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="cx">     RefPtr&lt;Range&gt; range = frame.editor().compositionRange();
</span><span class="cx">     size_t locationSize;
</span><span class="cx">     size_t lengthSize;
</span><del>-    if (range &amp;&amp; TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {
-        location = static_cast&lt;uint64_t&gt;(locationSize);
-        length = static_cast&lt;uint64_t&gt;(lengthSize);
-    } else {
-        location = NSNotFound;
-        length = 0;
-    }
</del><ins>+    if (range &amp;&amp; TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize))
+        result = EditingRange(static_cast&lt;uint64_t&gt;(locationSize), static_cast&lt;uint64_t&gt;(lengthSize));
+    else
+        result = EditingRange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getSelectedRange(uint64_t&amp; location, uint64_t&amp; length)
</del><ins>+void WebPage::getSelectedRange(EditingRange&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="cx">     size_t locationSize;
</span><span class="cx">     size_t lengthSize;
</span><span class="cx">     RefPtr&lt;Range&gt; range = frame.selection().toNormalizedRange();
</span><del>-    if (range &amp;&amp; TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {
-        location = static_cast&lt;uint64_t&gt;(locationSize);
-        length = static_cast&lt;uint64_t&gt;(lengthSize);
-    } else {
-        location = NSNotFound;
-        length = 0;
-    }
</del><ins>+    if (range &amp;&amp; TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize))
+        result = EditingRange(static_cast&lt;uint64_t&gt;(locationSize), static_cast&lt;uint64_t&gt;(lengthSize));
+    else
+        result = EditingRange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::getAttributedSubstringFromRange(uint64_t rangeStart, uint64_t rangeLength, AttributedString&amp; result)
</del><ins>+void WebPage::getAttributedSubstringFromRange(const EditingRange&amp; editingRange, 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">@@ -353,7 +348,7 @@
</span><span class="cx">     if (selection.isNone() || !selection.isContentEditable() || selection.isInPasswordField())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Range&gt; range = rangeFromEditingLocationAndLength(frame, rangeStart, rangeLength);
</del><ins>+    RefPtr&lt;Range&gt; range = rangeFromEditingRange(frame, editingRange);
</ins><span class="cx">     if (!range)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -363,16 +358,16 @@
</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; rangeLength) {
-        ASSERT([attributedString length] == rangeLength + 1);
-        ASSERT([[attributedString string] characterAtIndex:rangeLength] == '\n' || [[attributedString string] characterAtIndex:rangeLength] == ' ');
-        result.string = [attributedString attributedSubstringFromRange:NSMakeRange(0, rangeLength)];
</del><ins>+    if ([attributedString length] &gt; editingRange.length) {
+        ASSERT([attributedString length] == editingRange.length + 1);
+        ASSERT([[attributedString string] characterAtIndex:editingRange.length] == '\n' || [[attributedString string] characterAtIndex:editingRange.length] == ' ');
+        result.string = [attributedString attributedSubstringFromRange:NSMakeRange(0, editingRange.length)];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::characterIndexForPoint(IntPoint point, uint64_t&amp; index)
</span><span class="cx"> {
</span><del>-    index = NSNotFound;
</del><ins>+    index = notFound;
</ins><span class="cx"> 
</span><span class="cx">     HitTestResult result = m_page-&gt;mainFrame().eventHandler().hitTestResultAtPoint(point);
</span><span class="cx">     Frame* frame = result.innerNonSharedNode() ? result.innerNodeFrame() : &amp;m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="lines">@@ -387,13 +382,13 @@
</span><span class="cx">         index = static_cast&lt;uint64_t&gt;(location);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect&amp; resultRect)
</del><ins>+void WebPage::firstRectForCharacterRange(const EditingRange&amp; editingRange, WebCore::IntRect&amp; resultRect)
</ins><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</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 = rangeFromEditingLocationAndLength(frame, location, length);
</del><ins>+    RefPtr&lt;Range&gt; range = rangeFromEditingRange(frame, editingRange);
</ins><span class="cx">     if (!range)
</span><span class="cx">         return;
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>