<!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>[178290] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/178290">178290</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-01-12 12:22:10 -0800 (Mon, 12 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Multi-rect TextIndicators are vertically flipped in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=140350
&lt;rdar://problem/19441243&gt;

Reviewed by Beth Dakin.

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithSelectionInFrame):
(WebCore::TextIndicator::TextIndicator):
* page/TextIndicator.h:
(WebCore::TextIndicator::selectionRectInRootViewCoordinates):
(WebCore::TextIndicator::textBoundingRectInRootViewCoordinates):
(WebCore::TextIndicator::selectionRectInWindowCoordinates): Deleted.
(WebCore::TextIndicator::textBoundingRectInWindowCoordinates): Deleted.
* page/mac/TextIndicatorWindow.mm:
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
(WebCore::TextIndicatorWindow::setTextIndicator):
Compute, store, and use TextIndicator's selectionRect and textBoundingRect
in root view coordinates instead of window coordinates; this way, each
WebKit can do the conversion itself, and the rootView vs. window flipping
isn't wrongly factored into textRectsInBoundingRectCoordinates.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder&lt;TextIndicatorData&gt;::encode):
(IPC::ArgumentCoder&lt;TextIndicatorData&gt;::decode):
Adjust to the field name changes.

* UIProcess/API/mac/WKView.mm:
(-[WKView _setTextIndicator:fadeOut:]):
Convert the textBoundingRect from root view to screen coordinates.

* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):
(WebKit::FindController::drawRect):
Adjust to the new name, and use contentsToRootView when comparing against
the stored m_findIndicatorRect.

* WebView/WebView.mm:
(-[WebView _setTextIndicator:fadeOut:]):
Convert the textBoundingRect from root view to screen coordinates.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorh">trunk/Source/WebCore/page/TextIndicator.h</a></li>
<li><a href="#trunkSourceWebCorepagemacTextIndicatorWindowmm">trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageFindControllercpp">trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebCore/ChangeLog        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-01-12  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Multi-rect TextIndicators are vertically flipped in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=140350
+        &lt;rdar://problem/19441243&gt;
+
+        Reviewed by Beth Dakin.
+
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithSelectionInFrame):
+        (WebCore::TextIndicator::TextIndicator):
+        * page/TextIndicator.h:
+        (WebCore::TextIndicator::selectionRectInRootViewCoordinates):
+        (WebCore::TextIndicator::textBoundingRectInRootViewCoordinates):
+        (WebCore::TextIndicator::selectionRectInWindowCoordinates): Deleted.
+        (WebCore::TextIndicator::textBoundingRectInWindowCoordinates): Deleted.
+        * page/mac/TextIndicatorWindow.mm:
+        (-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
+        (WebCore::TextIndicatorWindow::setTextIndicator):
+        Compute, store, and use TextIndicator's selectionRect and textBoundingRect
+        in root view coordinates instead of window coordinates; this way, each
+        WebKit can do the conversion itself, and the rootView vs. window flipping
+        isn't wrongly factored into textRectsInBoundingRectCoordinates.
+
</ins><span class="cx"> 2015-01-12  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r178281.
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Store the selection rect in window coordinates, to be used subsequently
</span><span class="cx">     // to determine if the indicator and selection still precisely overlap.
</span><del>-    IntRect selectionRectInWindowCoordinates = frame.view()-&gt;contentsToWindow(selectionRect);
</del><ins>+    IntRect selectionRectInRootViewCoordinates = frame.view()-&gt;contentsToRootView(selectionRect);
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;FloatRect&gt; textRects;
</span><span class="cx">     frame.selection().getClippedVisibleTextRectangles(textRects);
</span><span class="lines">@@ -154,23 +154,23 @@
</span><span class="cx">     // The bounding rect of all the text rects can be different than the selection
</span><span class="cx">     // rect when the selection spans multiple lines; the indicator doesn't actually
</span><span class="cx">     // care where the selection highlight goes, just where the text actually is.
</span><del>-    FloatRect textBoundingRectInWindowCoordinates;
-    Vector&lt;FloatRect&gt; textRectsInWindowCoordinates;
</del><ins>+    FloatRect textBoundingRectInRootViewCoordinates;
+    Vector&lt;FloatRect&gt; textRectsInRootViewCoordinates;
</ins><span class="cx">     for (const FloatRect&amp; textRect : textRects) {
</span><del>-        FloatRect textRectInWindowCoordinates = frame.view()-&gt;contentsToWindow(enclosingIntRect(textRect));
-        textRectsInWindowCoordinates.append(textRectInWindowCoordinates);
-        textBoundingRectInWindowCoordinates.unite(textRectInWindowCoordinates);
</del><ins>+        FloatRect textRectInRootViewCoordinates = frame.view()-&gt;contentsToRootView(enclosingIntRect(textRect));
+        textRectsInRootViewCoordinates.append(textRectInRootViewCoordinates);
+        textBoundingRectInRootViewCoordinates.unite(textRectInRootViewCoordinates);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;FloatRect&gt; textRectsInBoundingRectCoordinates;
</span><del>-    for (auto rect : textRectsInWindowCoordinates) {
-        rect.moveBy(-textBoundingRectInWindowCoordinates.location());
</del><ins>+    for (auto rect : textRectsInRootViewCoordinates) {
+        rect.moveBy(-textBoundingRectInRootViewCoordinates.location());
</ins><span class="cx">         textRectsInBoundingRectCoordinates.append(rect);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     TextIndicatorData data;
</span><del>-    data.selectionRectInWindowCoordinates = selectionRectInWindowCoordinates;
-    data.textBoundingRectInWindowCoordinates = textBoundingRectInWindowCoordinates;
</del><ins>+    data.selectionRectInRootViewCoordinates = selectionRectInRootViewCoordinates;
+    data.textBoundingRectInRootViewCoordinates = textBoundingRectInRootViewCoordinates;
</ins><span class="cx">     data.textRectsInBoundingRectCoordinates = textRectsInBoundingRectCoordinates;
</span><span class="cx">     data.contentImageScaleFactor = frame.page()-&gt;deviceScaleFactor();
</span><span class="cx">     data.contentImage = indicatorBitmap;
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx"> TextIndicator::TextIndicator(const TextIndicatorData&amp; data)
</span><span class="cx">     : m_data(data)
</span><span class="cx"> {
</span><del>-    ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage-&gt;size() == enclosingIntRect(m_data.selectionRectInWindowCoordinates).size());
</del><ins>+    ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage-&gt;size() == enclosingIntRect(m_data.selectionRectInRootViewCoordinates).size());
</ins><span class="cx"> 
</span><span class="cx">     if (textIndicatorsForTextRectsOverlap(m_data.textRectsInBoundingRectCoordinates)) {
</span><span class="cx">         m_data.textRectsInBoundingRectCoordinates[0] = unionRect(m_data.textRectsInBoundingRectCoordinates);
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.h (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.h        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebCore/page/TextIndicator.h        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct TextIndicatorData {
</span><del>-    FloatRect selectionRectInWindowCoordinates;
-    FloatRect textBoundingRectInWindowCoordinates;
</del><ins>+    FloatRect selectionRectInRootViewCoordinates;
+    FloatRect textBoundingRectInRootViewCoordinates;
</ins><span class="cx">     Vector&lt;FloatRect&gt; textRectsInBoundingRectCoordinates;
</span><span class="cx">     float contentImageScaleFactor;
</span><span class="cx">     RefPtr&lt;Image&gt; contentImageWithHighlight;
</span><span class="lines">@@ -74,8 +74,8 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT ~TextIndicator();
</span><span class="cx"> 
</span><del>-    FloatRect selectionRectInWindowCoordinates() const { return m_data.selectionRectInWindowCoordinates; }
-    FloatRect textBoundingRectInWindowCoordinates() const { return m_data.textBoundingRectInWindowCoordinates; }
</del><ins>+    FloatRect selectionRectInRootViewCoordinates() const { return m_data.selectionRectInRootViewCoordinates; }
+    FloatRect textBoundingRectInRootViewCoordinates() const { return m_data.textBoundingRectInRootViewCoordinates; }
</ins><span class="cx">     const Vector&lt;FloatRect&gt;&amp; textRectsInBoundingRectCoordinates() const { return m_data.textRectsInBoundingRectCoordinates; }
</span><span class="cx">     float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
</span><span class="cx">     Image *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacTextIndicatorWindowmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -116,7 +116,7 @@
</span><span class="cx">     RetainPtr&lt;CGColorRef&gt; gradientDarkColor = [NSColor colorWithDeviceRed:.929 green:.8 blue:0 alpha:1].CGColor;
</span><span class="cx">     RetainPtr&lt;CGColorRef&gt; gradientLightColor = [NSColor colorWithDeviceRed:.949 green:.937 blue:0 alpha:1].CGColor;
</span><span class="cx"> 
</span><del>-    for (auto&amp; textRect : _textIndicator-&gt;textRectsInBoundingRectCoordinates()) {
</del><ins>+    for (const auto&amp; textRect : _textIndicator-&gt;textRectsInBoundingRectCoordinates()) {
</ins><span class="cx">         FloatRect bounceLayerRect = textRect;
</span><span class="cx">         bounceLayerRect.move(_margin.width, _margin.height);
</span><span class="cx">         bounceLayerRect.inflateX(horizontalBorder);
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx">         [textLayer setContents:(id)contentsImage.get()];
</span><span class="cx"> 
</span><span class="cx">         FloatRect imageRect = textRect;
</span><del>-        imageRect.move(_textIndicator-&gt;textBoundingRectInWindowCoordinates().location() - _textIndicator-&gt;selectionRectInWindowCoordinates().location());
</del><ins>+        imageRect.move(_textIndicator-&gt;textBoundingRectInRootViewCoordinates().location() - _textIndicator-&gt;selectionRectInRootViewCoordinates().location());
</ins><span class="cx">         [textLayer setContentsRect:CGRectMake(imageRect.x() / contentsImageLogicalSize.width(), imageRect.y() / contentsImageLogicalSize.height(), imageRect.width() / contentsImageLogicalSize.width(), imageRect.height() / contentsImageLogicalSize.height())];
</span><span class="cx">         [textLayer setContentsGravity:kCAGravityCenter];
</span><span class="cx">         [textLayer setContentsScale:_textIndicator-&gt;contentImageScaleFactor()];
</span><span class="lines">@@ -369,14 +369,13 @@
</span><span class="cx">     [m_textIndicatorView setAnimationProgress:progress];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextIndicatorWindow::setTextIndicator(PassRefPtr&lt;TextIndicator&gt; textIndicator, CGRect contentRect, bool fadeOut)
</del><ins>+void TextIndicatorWindow::setTextIndicator(PassRefPtr&lt;TextIndicator&gt; textIndicator, CGRect textBoundingRectInScreenCoordinates, bool fadeOut)
</ins><span class="cx"> {
</span><span class="cx">     if (m_textIndicator == textIndicator)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_textIndicator = textIndicator;
</span><span class="cx"> 
</span><del>-    // Get rid of the old window.
</del><span class="cx">     closeWindow();
</span><span class="cx"> 
</span><span class="cx">     if (!m_textIndicator)
</span><span class="lines">@@ -386,11 +385,11 @@
</span><span class="cx">     CGFloat verticalMargin = dropShadowBlurRadius * 2 + verticalBorder;
</span><span class="cx">     
</span><span class="cx">     if (m_textIndicator-&gt;wantsBounce()) {
</span><del>-        horizontalMargin = std::max(horizontalMargin, contentRect.size.width * (midBounceScale - 1) + horizontalMargin);
-        verticalMargin = std::max(verticalMargin, contentRect.size.height * (midBounceScale - 1) + verticalMargin);
</del><ins>+        horizontalMargin = std::max(horizontalMargin, textBoundingRectInScreenCoordinates.size.width * (midBounceScale - 1) + horizontalMargin);
+        verticalMargin = std::max(verticalMargin, textBoundingRectInScreenCoordinates.size.height * (midBounceScale - 1) + verticalMargin);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    contentRect = CGRectInset(contentRect, -horizontalMargin, -verticalMargin);
</del><ins>+    CGRect contentRect = CGRectInset(textBoundingRectInScreenCoordinates, -horizontalMargin, -verticalMargin);
</ins><span class="cx">     NSRect windowContentRect = [NSWindow contentRectForFrameRect:NSIntegralRect(NSRectFromCGRect(contentRect)) styleMask:NSBorderlessWindowMask];
</span><span class="cx">     m_textIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-01-12  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Multi-rect TextIndicators are vertically flipped in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=140350
+        &lt;rdar://problem/19441243&gt;
+
+        Reviewed by Beth Dakin.
+
+        * WebView/WebView.mm:
+        (-[WebView _setTextIndicator:fadeOut:]):
+        Convert the textBoundingRect from root view to screen coordinates.
+
</ins><span class="cx"> 2015-01-12  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make WebResourceDelegate a formal protocol as well
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -8653,8 +8653,9 @@
</span><span class="cx">     if (!_private-&gt;textIndicatorWindow)
</span><span class="cx">         _private-&gt;textIndicatorWindow = std::make_unique&lt;TextIndicatorWindow&gt;(self);
</span><span class="cx"> 
</span><del>-    NSRect contentRect = [self.window convertRectToScreen:textIndicator-&gt;textBoundingRectInWindowCoordinates()];
-    _private-&gt;textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut);
</del><ins>+    NSRect textBoundingRectInWindowCoordinates = [self convertRect:[self _convertRectFromRootView:textIndicator-&gt;textBoundingRectInRootViewCoordinates()] toView:nil];
+    NSRect textBoundingRectInScreenCoordinates = [self.window convertRectToScreen:textBoundingRectInWindowCoordinates];
+    _private-&gt;textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), fadeOut);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_clearTextIndicator
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit2/ChangeLog        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-01-12  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Multi-rect TextIndicators are vertically flipped in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=140350
+        &lt;rdar://problem/19441243&gt;
+
+        Reviewed by Beth Dakin.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder&lt;TextIndicatorData&gt;::encode):
+        (IPC::ArgumentCoder&lt;TextIndicatorData&gt;::decode):
+        Adjust to the field name changes.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setTextIndicator:fadeOut:]):
+        Convert the textBoundingRect from root view to screen coordinates.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::updateFindIndicator):
+        (WebKit::FindController::drawRect):
+        Adjust to the new name, and use contentsToRootView when comparing against
+        the stored m_findIndicatorRect.
+
</ins><span class="cx"> 2015-01-11  Ryuan Choi  &lt;ryuan.choi@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CoordinatedGraphics] Suspend or resume when visibility is changed
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -1963,8 +1963,8 @@
</span><span class="cx"> 
</span><span class="cx"> void ArgumentCoder&lt;TextIndicatorData&gt;::encode(ArgumentEncoder&amp; encoder, const TextIndicatorData&amp; textIndicatorData)
</span><span class="cx"> {
</span><del>-    encoder &lt;&lt; textIndicatorData.selectionRectInWindowCoordinates;
-    encoder &lt;&lt; textIndicatorData.textBoundingRectInWindowCoordinates;
</del><ins>+    encoder &lt;&lt; textIndicatorData.selectionRectInRootViewCoordinates;
+    encoder &lt;&lt; textIndicatorData.textBoundingRectInRootViewCoordinates;
</ins><span class="cx">     encoder &lt;&lt; textIndicatorData.textRectsInBoundingRectCoordinates;
</span><span class="cx">     encoder &lt;&lt; textIndicatorData.contentImageScaleFactor;
</span><span class="cx">     encoder.encodeEnum(textIndicatorData.presentationTransition);
</span><span class="lines">@@ -1982,10 +1982,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool ArgumentCoder&lt;TextIndicatorData&gt;::decode(ArgumentDecoder&amp; decoder, TextIndicatorData&amp; textIndicatorData)
</span><span class="cx"> {
</span><del>-    if (!decoder.decode(textIndicatorData.selectionRectInWindowCoordinates))
</del><ins>+    if (!decoder.decode(textIndicatorData.selectionRectInRootViewCoordinates))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!decoder.decode(textIndicatorData.textBoundingRectInWindowCoordinates))
</del><ins>+    if (!decoder.decode(textIndicatorData.textBoundingRectInRootViewCoordinates))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -3107,8 +3107,8 @@
</span><span class="cx">     if (!_data-&gt;_textIndicatorWindow)
</span><span class="cx">         _data-&gt;_textIndicatorWindow = std::make_unique&lt;TextIndicatorWindow&gt;(self);
</span><span class="cx"> 
</span><del>-    NSRect contentRect = [self.window convertRectToScreen:[self convertRect:textIndicator-&gt;textBoundingRectInWindowCoordinates() toView:nil]];
-    _data-&gt;_textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut);
</del><ins>+    NSRect textBoundingRectInScreenCoordinates = [self.window convertRectToScreen:[self convertRect:textIndicator-&gt;textBoundingRectInRootViewCoordinates() toView:nil]];
+    _data-&gt;_textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), fadeOut);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_setTextIndicatorAnimationProgress:(float)progress
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageFindControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (178289 => 178290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2015-01-12 20:02:32 UTC (rev 178289)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2015-01-12 20:22:10 UTC (rev 178290)
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx">     if (!indicator)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    m_findIndicatorRect = enclosingIntRect(indicator-&gt;selectionRectInWindowCoordinates());
</del><ins>+    m_findIndicatorRect = enclosingIntRect(indicator-&gt;selectionRectInRootViewCoordinates());
</ins><span class="cx">     m_webPage-&gt;send(Messages::WebPageProxy::SetTextIndicator(indicator-&gt;data(), !isShowingOverlay));
</span><span class="cx">     m_isShowingFindIndicator = true;
</span><span class="cx"> 
</span><span class="lines">@@ -453,7 +453,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (Frame* selectedFrame = frameWithSelection(m_webPage-&gt;corePage())) {
</span><del>-        IntRect findIndicatorRect = selectedFrame-&gt;view()-&gt;contentsToWindow(enclosingIntRect(selectedFrame-&gt;selection().selectionBounds()));
</del><ins>+        IntRect findIndicatorRect = selectedFrame-&gt;view()-&gt;contentsToRootView(enclosingIntRect(selectedFrame-&gt;selection().selectionBounds()));
</ins><span class="cx"> 
</span><span class="cx">         if (findIndicatorRect != m_findIndicatorRect)
</span><span class="cx">             hideFindIndicator();
</span></span></pre>
</div>
</div>

</body>
</html>