<!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>[167169] 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/167169">167169</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-04-11 16:31:27 -0700 (Fri, 11 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS WebKit2] Find-in-page indicator
https://bugs.webkit.org/show_bug.cgi?id=131510
<rdar://problem/16547777>
Reviewed by Simon Fraser and Enrica Casucci.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindUIAfterPageScroll):
WebKit2 will clear the selection if we reveal it while not enabling selection painting.
So, avoid revealing it.
(WebKit::FindController::findString):
(WebKit::FindController::hideFindIndicator):
(WebKit::FindController::willFindString):
(WebKit::FindController::didFailToFindString):
(WebKit::FindController::didHideFindIndicator):
#if out the cross-platform find indicator code on iOS; it will be replaced
by the code in FindControllerIOS.
* WebProcess/WebPage/FindController.h:
* WebProcess/WebPage/ios/FindControllerIOS.mm: Added.
(highlightColor):
(WebKit::FindIndicatorOverlayClientIOS::drawRect):
Paint the selection (with black text forced on), and the yellow rounded rect
into the indicator page overlay.
(WebKit::FindController::updateFindIndicator):
Create or update a small document-relative page overlay in the selection rect.
(WebKit::FindController::hideFindIndicator):
(WebKit::FindController::willFindString):
(WebKit::FindController::didFailToFindString):
(WebKit::FindController::didHideFindIndicator):
Add willFindString, didFailToFindString, and didHideFindIndicator functions.
They do nothing, except on iOS where they are used to prevent selection change
messages from being dispatched while using find-in-page, and to force
WebCore to compute a selection rect (via updateAppearance) despite the selection not being painted.
* WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h:
(WebKit::FindIndicatorOverlayClientIOS::setFrame):
* editing/Editor.cpp:
(WebCore::Editor::findString):
* editing/FindOptions.h:
Add a find option which prevents WebCore from revealing the selection
after selecting a successful find match.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingFindOptionsh">trunk/Source/WebCore/editing/FindOptions.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageFindControllercpp">trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageFindControllerh">trunk/Source/WebKit2/WebProcess/WebPage/FindController.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosFindControllerIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosFindIndicatorOverlayClientIOSh">trunk/Source/WebKit2/WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebCore/ChangeLog        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-04-11 Tim Horton <timothy_horton@apple.com>
+
+ [iOS WebKit2] Find-in-page indicator
+ https://bugs.webkit.org/show_bug.cgi?id=131510
+ <rdar://problem/16547777>
+
+ Reviewed by Simon Fraser and Enrica Casucci.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::findString):
+ * editing/FindOptions.h:
+ Add a find option which prevents WebCore from revealing the selection
+ after selecting a successful find match.
+
</ins><span class="cx"> 2014-04-11 Owen Taylor <otaylor@redhat.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Add HighDPI support for non-accelerated compositing contents
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -3127,7 +3127,10 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> m_frame.selection().setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
</span><del>- m_frame.selection().revealSelection();
</del><ins>+
+ if (!(options & DoNotRevealSelection))
+ m_frame.selection().revealSelection();
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFindOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FindOptions.h (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FindOptions.h        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebCore/editing/FindOptions.h        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -36,7 +36,8 @@
</span><span class="cx"> TreatMedialCapitalAsWordStart = 1 << 2,
</span><span class="cx"> Backwards = 1 << 3,
</span><span class="cx"> WrapAround = 1 << 4,
</span><del>- StartInSelection = 1 << 5
</del><ins>+ StartInSelection = 1 << 5,
+ DoNotRevealSelection = 1 << 6
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef unsigned char FindOptions;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebKit2/ChangeLog        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-04-11 Tim Horton <timothy_horton@apple.com>
+
+ [iOS WebKit2] Find-in-page indicator
+ https://bugs.webkit.org/show_bug.cgi?id=131510
+ <rdar://problem/16547777>
+
+ Reviewed by Simon Fraser and Enrica Casucci.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::updateFindUIAfterPageScroll):
+ WebKit2 will clear the selection if we reveal it while not enabling selection painting.
+ So, avoid revealing it.
+
+ (WebKit::FindController::findString):
+ (WebKit::FindController::hideFindIndicator):
+ (WebKit::FindController::willFindString):
+ (WebKit::FindController::didFailToFindString):
+ (WebKit::FindController::didHideFindIndicator):
+ #if out the cross-platform find indicator code on iOS; it will be replaced
+ by the code in FindControllerIOS.
+
+ * WebProcess/WebPage/FindController.h:
+
+ * WebProcess/WebPage/ios/FindControllerIOS.mm: Added.
+ (highlightColor):
+ (WebKit::FindIndicatorOverlayClientIOS::drawRect):
+ Paint the selection (with black text forced on), and the yellow rounded rect
+ into the indicator page overlay.
+
+ (WebKit::FindController::updateFindIndicator):
+ Create or update a small document-relative page overlay in the selection rect.
+
+ (WebKit::FindController::hideFindIndicator):
+ (WebKit::FindController::willFindString):
+ (WebKit::FindController::didFailToFindString):
+ (WebKit::FindController::didHideFindIndicator):
+ Add willFindString, didFailToFindString, and didHideFindIndicator functions.
+ They do nothing, except on iOS where they are used to prevent selection change
+ messages from being dispatched while using find-in-page, and to force
+ WebCore to compute a selection rect (via updateAppearance) despite the selection not being painted.
+
+ * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h:
+ (WebKit::FindIndicatorOverlayClientIOS::setFrame):
+
</ins><span class="cx"> 2014-04-11 Owen Taylor <otaylor@redhat.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Add HighDPI support for non-accelerated compositing contents
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -562,6 +562,7 @@
</span><span class="cx">                 2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */; };
</span><span class="cx">                 2DC6D9C318C44A610043BAD4 /* WKWebViewContentProviderRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */; };
</span><span class="cx">                 2DC6D9C418C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */; };
</span><ins>+                2DD13BD518F7DADD00E130A1 /* FindControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */; };
</ins><span class="cx">                 2DDE0AFA18298CC900F97EAA /* RemoteLayerTreePropertyApplier.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */; };
</span><span class="cx">                 2DDE0AFB18298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */; };
</span><span class="cx">                 2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDF731318E95060004F5A66 /* RemoteLayerBackingStoreCollection.h */; };
</span><span class="lines">@@ -2357,6 +2358,7 @@
</span><span class="cx">                 2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerCARemote.h; sourceTree = "<group>"; };
</span><span class="cx">                 2DA1E4FC18C02B6A00DBC929 /* WKPDFView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKPDFView.h; path = ios/WKPDFView.h; sourceTree = "<group>"; };
</span><span class="cx">                 2DA1E4FD18C02B6A00DBC929 /* WKPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFView.mm; path = ios/WKPDFView.mm; sourceTree = "<group>"; };
</span><ins>+                2DA7FDCB18F88625008DDED0 /* FindIndicatorOverlayClientIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FindIndicatorOverlayClientIOS.h; path = ios/FindIndicatorOverlayClientIOS.h; sourceTree = "<group>"; };
</ins><span class="cx">                 2DA944861884E3B500ED86DB /* WKViewIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKViewIOS.mm; path = ios/WKViewIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944971884E4F000ED86DB /* NativeWebKeyboardEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NativeWebKeyboardEventIOS.mm; path = ios/NativeWebKeyboardEventIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944981884E4F000ED86DB /* NativeWebTouchEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NativeWebTouchEventIOS.mm; path = ios/NativeWebTouchEventIOS.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -2379,6 +2381,7 @@
</span><span class="cx">                 2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; };
</span><span class="cx">                 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProviderRegistry.h; sourceTree = "<group>"; };
</span><span class="cx">                 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewContentProviderRegistry.mm; sourceTree = "<group>"; };
</span><ins>+                2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FindControllerIOS.mm; path = ios/FindControllerIOS.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreePropertyApplier.h; sourceTree = "<group>"; };
</span><span class="cx">                 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreePropertyApplier.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DDF731318E95060004F5A66 /* RemoteLayerBackingStoreCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerBackingStoreCollection.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4548,6 +4551,8 @@
</span><span class="cx">                                 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */,
</span><span class="cx">                                 29232DF518B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.h */,
</span><span class="cx">                                 29232DF618B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.mm */,
</span><ins>+                                2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */,
+                                2DA7FDCB18F88625008DDED0 /* FindIndicatorOverlayClientIOS.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -8333,6 +8338,7 @@
</span><span class="cx">                                 1A1B0EB518A424950038481A /* WKNavigationResponse.mm in Sources */,
</span><span class="cx">                                 1A0EC907124C0AB8007EF4A5 /* PluginProcessConnection.cpp in Sources */,
</span><span class="cx">                                 1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */,
</span><ins>+                                2DD13BD518F7DADD00E130A1 /* FindControllerIOS.mm in Sources */,
</ins><span class="cx">                                 1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageFindControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -122,6 +122,7 @@
</span><span class="cx"> selectedFrame->selection().clear();
</span><span class="cx">
</span><span class="cx"> hideFindIndicator();
</span><ins>+ didFailToFindString();
</ins><span class="cx">
</span><span class="cx"> m_webPage->send(Messages::WebPageProxy::DidFailToFindString(string));
</span><span class="cx"> } else {
</span><span class="lines">@@ -150,7 +151,7 @@
</span><span class="cx">
</span><span class="cx"> m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount));
</span><span class="cx">
</span><del>- if (!(options & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay))
</del><ins>+ if (!(options & FindOptionsShowFindIndicator) || !selectedFrame || !updateFindIndicator(*selectedFrame, shouldShowOverlay))
</ins><span class="cx"> hideFindIndicator();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -170,13 +171,23 @@
</span><span class="cx"> void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
</span><span class="cx"> {
</span><span class="cx"> PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame());
</span><del>-
</del><ins>+
+ WebCore::FindOptions coreOptions = core(options);
+
+ // iOS will reveal the selection through a different mechanism, and
+ // we need to avoid sending the non-painted selection change to the UI process
+ // so that it does not clear the selection out from under us.
+#if PLATFORM(IOS)
+ coreOptions = static_cast<FindOptions>(coreOptions | DoNotRevealSelection);
+#endif
+
+ willFindString();
+
</ins><span class="cx"> bool found;
</span><del>-
</del><span class="cx"> if (pluginView)
</span><del>- found = pluginView->findString(string, core(options), maxMatchCount);
</del><ins>+ found = pluginView->findString(string, coreOptions, maxMatchCount);
</ins><span class="cx"> else
</span><del>- found = m_webPage->corePage()->findString(string, core(options));
</del><ins>+ found = m_webPage->corePage()->findString(string, coreOptions);
</ins><span class="cx">
</span><span class="cx"> m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(WTF::bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount));
</span><span class="cx"> }
</span><span class="lines">@@ -198,9 +209,9 @@
</span><span class="cx"> m_webPage->send(Messages::WebPageProxy::DidFindStringMatches(string, matchRects, indexForSelection));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool FindController::getFindIndicatorBitmapAndRect(Frame* frame, ShareableBitmap::Handle& handle, IntRect& selectionRect)
</del><ins>+bool FindController::getFindIndicatorBitmapAndRect(Frame& frame, ShareableBitmap::Handle& handle, IntRect& selectionRect)
</ins><span class="cx"> {
</span><del>- selectionRect = enclosingIntRect(frame->selection().selectionBounds());
</del><ins>+ selectionRect = enclosingIntRect(frame.selection().selectionBounds());
</ins><span class="cx">
</span><span class="cx"> // Selection rect can be empty for matches that are currently obscured from view.
</span><span class="cx"> if (selectionRect.isEmpty())
</span><span class="lines">@@ -219,15 +230,15 @@
</span><span class="cx"> graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
</span><span class="cx">
</span><span class="cx"> IntRect paintRect = selectionRect;
</span><del>- paintRect.move(frame->view()->frameRect().x(), frame->view()->frameRect().y());
- paintRect.move(-frame->view()->scrollOffset());
</del><ins>+ paintRect.move(frame.view()->frameRect().x(), frame.view()->frameRect().y());
+ paintRect.move(-frame.view()->scrollOffset());
</ins><span class="cx">
</span><span class="cx"> graphicsContext->translate(-paintRect.x(), -paintRect.y());
</span><del>- frame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
- frame->document()->updateLayout();
</del><ins>+ frame.view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
+ frame.document()->updateLayout();
</ins><span class="cx">
</span><del>- frame->view()->paint(graphicsContext.get(), paintRect);
- frame->view()->setPaintBehavior(PaintBehaviorNormal);
</del><ins>+ frame.view()->paint(graphicsContext.get(), paintRect);
+ frame.view()->setPaintBehavior(PaintBehaviorNormal);
</ins><span class="cx">
</span><span class="cx"> if (!findIndicatorTextBackingStore->createHandle(handle))
</span><span class="cx"> return false;
</span><span class="lines">@@ -247,7 +258,7 @@
</span><span class="cx">
</span><span class="cx"> IntRect selectionRect;
</span><span class="cx"> ShareableBitmap::Handle handle;
</span><del>- getFindIndicatorBitmapAndRect(frame, handle, selectionRect);
</del><ins>+ getFindIndicatorBitmapAndRect(*frame, handle, selectionRect);
</ins><span class="cx">
</span><span class="cx"> frame->selection().setSelection(oldSelection);
</span><span class="cx">
</span><span class="lines">@@ -283,11 +294,9 @@
</span><span class="cx"> hideFindIndicator();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate)
</del><ins>+#if !PLATFORM(IOS)
+bool FindController::updateFindIndicator(Frame& selectedFrame, bool isShowingOverlay, bool shouldAnimate)
</ins><span class="cx"> {
</span><del>- if (!selectedFrame)
- return false;
-
</del><span class="cx"> IntRect selectionRect;
</span><span class="cx"> ShareableBitmap::Handle handle;
</span><span class="cx"> if (!getFindIndicatorBitmapAndRect(selectedFrame, handle, selectionRect))
</span><span class="lines">@@ -324,12 +333,26 @@
</span><span class="cx"> ShareableBitmap::Handle handle;
</span><span class="cx"> m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false, true));
</span><span class="cx"> m_isShowingFindIndicator = false;
</span><ins>+ didHideFindIndicator();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void FindController::willFindString()
+{
+}
+
+void FindController::didFailToFindString()
+{
+}
+
+void FindController::didHideFindIndicator()
+{
+}
+#endif
+
</ins><span class="cx"> void FindController::showFindIndicatorInSelection()
</span><span class="cx"> {
</span><span class="cx"> Frame& selectedFrame = m_webPage->corePage()->focusController().focusedOrMainFrame();
</span><del>- updateFindIndicator(&selectedFrame, false);
</del><ins>+ updateFindIndicator(selectedFrame, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void FindController::deviceScaleFactorDidChange()
</span><span class="lines">@@ -340,7 +363,7 @@
</span><span class="cx"> if (!selectedFrame)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- updateFindIndicator(selectedFrame, true, false);
</del><ins>+ updateFindIndicator(*selectedFrame, true, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<IntRect> FindController::rectsForTextMatches()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageFindControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.h (167168 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.h        2014-04-11 23:20:27 UTC (rev 167168)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.h        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -34,13 +34,18 @@
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "FindIndicatorOverlayClientIOS.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><del>- class Frame;
- class Range;
</del><ins>+class Frame;
+class Range;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class PageOverlay;
</ins><span class="cx"> class WebPage;
</span><span class="cx">
</span><span class="cx"> class FindController : private PageOverlay::Client {
</span><span class="lines">@@ -73,11 +78,15 @@
</span><span class="cx"> virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
</span><span class="cx">
</span><span class="cx"> Vector<WebCore::IntRect> rectsForTextMatches();
</span><del>- bool getFindIndicatorBitmapAndRect(WebCore::Frame*, ShareableBitmap::Handle&, WebCore::IntRect& selectionRect);
- bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate = true);
</del><ins>+ bool getFindIndicatorBitmapAndRect(WebCore::Frame&, ShareableBitmap::Handle&, WebCore::IntRect& selectionRect);
+ bool updateFindIndicator(WebCore::Frame& selectedFrame, bool isShowingOverlay, bool shouldAnimate = true);
</ins><span class="cx">
</span><span class="cx"> void updateFindUIAfterPageScroll(bool found, const String&, FindOptions, unsigned maxMatchCount);
</span><span class="cx">
</span><ins>+ void willFindString();
+ void didFailToFindString();
+ void didHideFindIndicator();
+
</ins><span class="cx"> WebPage* m_webPage;
</span><span class="cx"> PageOverlay* m_findPageOverlay;
</span><span class="cx">
</span><span class="lines">@@ -86,6 +95,11 @@
</span><span class="cx"> bool m_isShowingFindIndicator;
</span><span class="cx"> WebCore::IntRect m_findIndicatorRect;
</span><span class="cx"> Vector<RefPtr<WebCore::Range>> m_findMatches;
</span><ins>+
+#if PLATFORM(IOS)
+ RefPtr<PageOverlay> m_findIndicatorOverlay;
+ std::unique_ptr<FindIndicatorOverlayClientIOS> m_findIndicatorOverlayClient;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosFindControllerIOSmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm (0 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <config.h>
+
+#if PLATFORM(IOS)
+
+#import "FindController.h"
+#import "FindIndicatorOverlayClientIOS.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebPage.h"
+#import "WebPageProxyMessages.h"
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/MainFrame.h>
+#import <WebCore/Page.h>
+
+using namespace WebCore;
+
+const int cornerRadius = 3;
+const int totalHorizontalMargin = 2;
+const int totalVerticalMargin = 1;
+
+const double maximumFindIndicatorZoom = 1.6;
+
+static Color highlightColor()
+{
+ return Color(255, 228, 56, 255);
+}
+
+namespace WebKit {
+
+void FindIndicatorOverlayClientIOS::drawRect(PageOverlay* overlay, WebCore::GraphicsContext& context, const WebCore::IntRect& dirtyRect)
+{
+ // FIXME: Support multiple text rects.
+
+ IntRect overlayFrame = overlay->frame();
+ IntRect overlayBounds = overlay->bounds();
+
+ {
+ GraphicsContextStateSaver stateSaver(context);
+ Path clipPath;
+ clipPath.addRoundedRect(overlayBounds, FloatSize(cornerRadius, cornerRadius));
+ context.clip(clipPath);
+ context.setFillColor(highlightColor(), ColorSpaceDeviceRGB);
+ context.fillRect(overlayBounds);
+ }
+
+ {
+ GraphicsContextStateSaver stateSaver(context);
+ context.translate(-overlayFrame.x(), -overlayFrame.y());
+ m_frame.view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
+ m_frame.view()->paintContents(&context, overlayFrame);
+ m_frame.view()->setPaintBehavior(PaintBehaviorNormal);
+ }
+}
+
+bool FindController::updateFindIndicator(Frame& selectedFrame, bool isShowingOverlay, bool shouldAnimate)
+{
+ IntRect matchRect = enclosingIntRect(selectedFrame.selection().selectionBounds(false));
+ matchRect = selectedFrame.view()->contentsToRootView(matchRect);
+ matchRect.inflateX(totalHorizontalMargin);
+ matchRect.inflateY(totalVerticalMargin);
+
+ if (m_findIndicatorOverlay)
+ m_webPage->uninstallPageOverlay(m_findIndicatorOverlay.get());
+
+ m_findIndicatorOverlayClient = std::make_unique<FindIndicatorOverlayClientIOS>(selectedFrame);
+ m_findIndicatorOverlay = PageOverlay::create(m_findIndicatorOverlayClient.get(), PageOverlay::OverlayType::Document);
+ m_webPage->installPageOverlay(m_findIndicatorOverlay);
+
+ m_findIndicatorOverlay->setFrame(matchRect);
+ m_findIndicatorOverlay->setNeedsDisplay();
+
+ m_webPage->zoomToRect(matchRect, m_webPage->minimumPageScaleFactor(), std::min(m_webPage->maximumPageScaleFactor(), maximumFindIndicatorZoom));
+ m_findIndicatorRect = matchRect;
+ m_isShowingFindIndicator = true;
+
+ return true;
+}
+
+void FindController::hideFindIndicator()
+{
+ if (!m_isShowingFindIndicator)
+ return;
+
+ m_webPage->uninstallPageOverlay(m_findIndicatorOverlay.get());
+ m_findIndicatorOverlay = nullptr;
+ m_isShowingFindIndicator = false;
+
+ didHideFindIndicator();
+}
+
+// FIXME: These should likely affect the frame owning the selection, not the main frame.
+void FindController::willFindString()
+{
+ m_webPage->mainFrame()->editor().setIgnoreCompositionSelectionChange(true);
+ m_webPage->mainFrame()->selection().setUpdateAppearanceEnabled(true);
+}
+
+void FindController::didFailToFindString()
+{
+ m_webPage->mainFrame()->selection().setUpdateAppearanceEnabled(false);
+ m_webPage->mainFrame()->editor().setIgnoreCompositionSelectionChange(false);
+}
+
+void FindController::didHideFindIndicator()
+{
+ m_webPage->mainFrame()->selection().setUpdateAppearanceEnabled(false);
+ m_webPage->mainFrame()->editor().setIgnoreCompositionSelectionChange(false);
+}
+
+} // namespace WebKit
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosFindIndicatorOverlayClientIOSh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h (0 => 167169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h        2014-04-11 23:31:27 UTC (rev 167169)
</span><span class="lines">@@ -0,0 +1,54 @@
</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 FindIndicatorOverlayClientIOS_h
+#define FindIndicatorOverlayClientIOS_h
+
+#import "PageOverlay.h"
+#import <WebCore/Frame.h>
+#import <WebCore/GraphicsContext.h>
+
+namespace WebKit {
+
+class FindIndicatorOverlayClientIOS : public PageOverlay::Client {
+public:
+ FindIndicatorOverlayClientIOS(WebCore::Frame& frame)
+ : m_frame(frame)
+ {
+ }
+
+private:
+ virtual void pageOverlayDestroyed(PageOverlay*) override { }
+ virtual void willMoveToWebPage(PageOverlay*, WebPage*) override { }
+ virtual void didMoveToWebPage(PageOverlay*, WebPage*) override { }
+ virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) override;
+ virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&) override { return false; }
+
+ WebCore::Frame& m_frame;
+};
+
+} // namespace WebKit
+
+#endif // FindIndicatorOverlayClientIOS_h
</ins></span></pre>
</div>
</div>
</body>
</html>