<!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>[210482] trunk/Tools</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/210482">210482</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2017-01-07 13:09:41 -0800 (Sat, 07 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement find-in-page in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=166799

Reviewed by Andy Estes.

* MiniBrowser/mac/BrowserWindow.xib:
* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController find:]): Deleted.
* MiniBrowser/mac/MainMenu.xib:
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController toggleShrinkToFit:]):
(-[WK1BrowserWindowController find:]): Deleted.
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController awakeFromNib]):
(-[WK2BrowserWindowController dealloc]):
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController performTextFinderAction:]):
(-[WK2BrowserWindowController findBarView]):
(-[WK2BrowserWindowController setFindBarView:]):
(-[WK2BrowserWindowController isFindBarVisible]):
(-[WK2BrowserWindowController setFindBarVisible:]):
(-[WK2BrowserWindowController contentView]):
(-[WK2BrowserWindowController findBarViewDidChangeHeight]):
(-[WK2BrowserWindowController performFindPanelAction:]): Deleted.
(-[WK2BrowserWindowController find:]): Deleted.
Implement find-in-page using WKWebView's conformance to the NSTextFinderClient
protocol. At first glance, it's pretty broken, but vaguely works.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowxib">trunk/Tools/MiniBrowser/mac/BrowserWindow.xib</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowControllerh">trunk/Tools/MiniBrowser/mac/BrowserWindowController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/BrowserWindowController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacMainMenuxib">trunk/Tools/MiniBrowser/mac/MainMenu.xib</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK1BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK2BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/ChangeLog        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2017-01-07  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Implement find-in-page in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=166799
+
+        Reviewed by Andy Estes.
+
+        * MiniBrowser/mac/BrowserWindow.xib:
+        * MiniBrowser/mac/BrowserWindowController.h:
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController find:]): Deleted.
+        * MiniBrowser/mac/MainMenu.xib:
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController toggleShrinkToFit:]):
+        (-[WK1BrowserWindowController find:]): Deleted.
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController awakeFromNib]):
+        (-[WK2BrowserWindowController dealloc]):
+        (-[WK2BrowserWindowController validateMenuItem:]):
+        (-[WK2BrowserWindowController performTextFinderAction:]):
+        (-[WK2BrowserWindowController findBarView]):
+        (-[WK2BrowserWindowController setFindBarView:]):
+        (-[WK2BrowserWindowController isFindBarVisible]):
+        (-[WK2BrowserWindowController setFindBarVisible:]):
+        (-[WK2BrowserWindowController contentView]):
+        (-[WK2BrowserWindowController findBarViewDidChangeHeight]):
+        (-[WK2BrowserWindowController performFindPanelAction:]): Deleted.
+        (-[WK2BrowserWindowController find:]): Deleted.
+        Implement find-in-page using WKWebView's conformance to the NSTextFinderClient
+        protocol. At first glance, it's pretty broken, but vaguely works.
+
+2017-01-07  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
</ins><span class="cx">         Share the implementation of MiniBrowser view hiding functionality
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=166800
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowxib"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindow.xib (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindow.xib        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindow.xib        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
</span><del>-&lt;document type=&quot;com.apple.InterfaceBuilder3.Cocoa.XIB&quot; version=&quot;3.0&quot; toolsVersion=&quot;11085&quot; systemVersion=&quot;16A167&quot; targetRuntime=&quot;MacOSX.Cocoa&quot; propertyAccessControl=&quot;none&quot;&gt;
</del><ins>+&lt;document type=&quot;com.apple.InterfaceBuilder3.Cocoa.XIB&quot; version=&quot;3.0&quot; toolsVersion=&quot;11191&quot; systemVersion=&quot;16D17a&quot; targetRuntime=&quot;MacOSX.Cocoa&quot; propertyAccessControl=&quot;none&quot;&gt;
</ins><span class="cx">     &lt;dependencies&gt;
</span><span class="cx">         &lt;deployment identifier=&quot;macosx&quot;/&gt;
</span><del>-        &lt;plugIn identifier=&quot;com.apple.InterfaceBuilder.CocoaPlugin&quot; version=&quot;11085&quot;/&gt;
</del><ins>+        &lt;plugIn identifier=&quot;com.apple.InterfaceBuilder.CocoaPlugin&quot; version=&quot;11191&quot;/&gt;
</ins><span class="cx">     &lt;/dependencies&gt;
</span><span class="cx">     &lt;objects&gt;
</span><span class="cx">         &lt;customObject id=&quot;-2&quot; userLabel=&quot;File's Owner&quot; customClass=&quot;BrowserWindowController&quot;&gt;
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx">             &lt;connections&gt;
</span><span class="cx">                 &lt;outlet property=&quot;backButton&quot; destination=&quot;40&quot; id=&quot;46&quot;/&gt;
</span><span class="cx">                 &lt;outlet property=&quot;containerView&quot; destination=&quot;9&quot; id=&quot;37&quot;/&gt;
</span><del>-                &lt;outlet property=&quot;findPanelWindow&quot; destination=&quot;70&quot; id=&quot;77&quot;/&gt;
</del><span class="cx">                 &lt;outlet property=&quot;forwardButton&quot; destination=&quot;42&quot; id=&quot;47&quot;/&gt;
</span><span class="cx">                 &lt;outlet property=&quot;progressIndicator&quot; destination=&quot;21&quot; id=&quot;33&quot;/&gt;
</span><span class="cx">                 &lt;outlet property=&quot;reloadButton&quot; destination=&quot;23&quot; id=&quot;34&quot;/&gt;
</span><span class="lines">@@ -159,30 +158,6 @@
</span><span class="cx">                 &lt;outlet property=&quot;delegate&quot; destination=&quot;-2&quot; id=&quot;4&quot;/&gt;
</span><span class="cx">             &lt;/connections&gt;
</span><span class="cx">         &lt;/window&gt;
</span><del>-        &lt;window title=&quot;Find&quot; allowsToolTipsWhenApplicationIsInactive=&quot;NO&quot; autorecalculatesKeyViewLoop=&quot;NO&quot; hidesOnDeactivate=&quot;YES&quot; oneShot=&quot;NO&quot; releasedWhenClosed=&quot;NO&quot; visibleAtLaunch=&quot;NO&quot; animationBehavior=&quot;default&quot; id=&quot;70&quot; customClass=&quot;NSPanel&quot;&gt;
-            &lt;windowStyleMask key=&quot;styleMask&quot; titled=&quot;YES&quot; closable=&quot;YES&quot; utility=&quot;YES&quot; nonactivatingPanel=&quot;YES&quot;/&gt;
-            &lt;windowPositionMask key=&quot;initialPositionMask&quot; leftStrut=&quot;YES&quot; rightStrut=&quot;YES&quot; topStrut=&quot;YES&quot; bottomStrut=&quot;YES&quot;/&gt;
-            &lt;rect key=&quot;contentRect&quot; x=&quot;230&quot; y=&quot;479&quot; width=&quot;452&quot; height=&quot;62&quot;/&gt;
-            &lt;rect key=&quot;screenRect&quot; x=&quot;0.0&quot; y=&quot;0.0&quot; width=&quot;1920&quot; height=&quot;1177&quot;/&gt;
-            &lt;view key=&quot;contentView&quot; id=&quot;71&quot;&gt;
-                &lt;rect key=&quot;frame&quot; x=&quot;0.0&quot; y=&quot;0.0&quot; width=&quot;452&quot; height=&quot;62&quot;/&gt;
-                &lt;autoresizingMask key=&quot;autoresizingMask&quot;/&gt;
-                &lt;subviews&gt;
-                    &lt;searchField verticalHuggingPriority=&quot;750&quot; id=&quot;74&quot;&gt;
-                        &lt;rect key=&quot;frame&quot; x=&quot;20&quot; y=&quot;20&quot; width=&quot;412&quot; height=&quot;22&quot;/&gt;
-                        &lt;autoresizingMask key=&quot;autoresizingMask&quot; flexibleMaxX=&quot;YES&quot; flexibleMinY=&quot;YES&quot;/&gt;
-                        &lt;searchFieldCell key=&quot;cell&quot; scrollable=&quot;YES&quot; lineBreakMode=&quot;clipping&quot; selectable=&quot;YES&quot; editable=&quot;YES&quot; borderStyle=&quot;bezel&quot; usesSingleLineMode=&quot;YES&quot; bezelStyle=&quot;round&quot; id=&quot;75&quot;&gt;
-                            &lt;font key=&quot;font&quot; metaFont=&quot;system&quot;/&gt;
-                            &lt;color key=&quot;textColor&quot; name=&quot;controlTextColor&quot; catalog=&quot;System&quot; colorSpace=&quot;catalog&quot;/&gt;
-                            &lt;color key=&quot;backgroundColor&quot; name=&quot;textBackgroundColor&quot; catalog=&quot;System&quot; colorSpace=&quot;catalog&quot;/&gt;
-                        &lt;/searchFieldCell&gt;
-                        &lt;connections&gt;
-                            &lt;action selector=&quot;find:&quot; target=&quot;-2&quot; id=&quot;76&quot;/&gt;
-                        &lt;/connections&gt;
-                    &lt;/searchField&gt;
-                &lt;/subviews&gt;
-            &lt;/view&gt;
-        &lt;/window&gt;
</del><span class="cx">     &lt;/objects&gt;
</span><span class="cx">     &lt;resources&gt;
</span><span class="cx">         &lt;image name=&quot;NSEnterFullScreenTemplate&quot; width=&quot;15&quot; height=&quot;15&quot;/&gt;
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.h (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.h        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.h        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -35,8 +35,6 @@
</span><span class="cx">     IBOutlet NSTextField *urlText;
</span><span class="cx">     IBOutlet NSView *containerView;
</span><span class="cx">     IBOutlet NSButton *toggleUseShrinkToFitButton;
</span><del>-    
-    IBOutlet NSWindow *findPanelWindow;
</del><span class="cx"> 
</span><span class="cx">     BOOL _zoomTextOnly;
</span><span class="cx"> }
</span><span class="lines">@@ -73,7 +71,6 @@
</span><span class="cx"> - (IBAction)toggleShrinkToFit:(id)sender;
</span><span class="cx"> 
</span><span class="cx"> - (IBAction)dumpSourceToConsole:(id)sender;
</span><del>-- (IBAction)find:(id)sender;
</del><span class="cx"> 
</span><span class="cx"> - (void)didChangeSettings;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -194,11 +194,6 @@
</span><span class="cx">     [self doesNotRecognizeSelector:_cmd];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (IBAction)find:(id)sender
-{
-    [self doesNotRecognizeSelector:_cmd];
-}
-
</del><span class="cx"> - (void)didChangeSettings
</span><span class="cx"> {
</span><span class="cx">     [self doesNotRecognizeSelector:_cmd];
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacMainMenuxib"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/MainMenu.xib (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/MainMenu.xib        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/MainMenu.xib        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -202,23 +202,23 @@
</span><span class="cx">                                     &lt;items&gt;
</span><span class="cx">                                         &lt;menuItem title=&quot;Find…&quot; tag=&quot;1&quot; keyEquivalent=&quot;f&quot; id=&quot;209&quot;&gt;
</span><span class="cx">                                             &lt;connections&gt;
</span><del>-                                                &lt;action selector=&quot;performFindPanelAction:&quot; target=&quot;-1&quot; id=&quot;241&quot;/&gt;
</del><ins>+                                                &lt;action selector=&quot;performTextFinderAction:&quot; target=&quot;-1&quot; id=&quot;241&quot;/&gt;
</ins><span class="cx">                                             &lt;/connections&gt;
</span><span class="cx">                                         &lt;/menuItem&gt;
</span><span class="cx">                                         &lt;menuItem title=&quot;Find Next&quot; tag=&quot;2&quot; keyEquivalent=&quot;g&quot; id=&quot;208&quot;&gt;
</span><span class="cx">                                             &lt;connections&gt;
</span><del>-                                                &lt;action selector=&quot;performFindPanelAction:&quot; target=&quot;-1&quot; id=&quot;487&quot;/&gt;
</del><ins>+                                                &lt;action selector=&quot;performTextFinderAction:&quot; target=&quot;-1&quot; id=&quot;487&quot;/&gt;
</ins><span class="cx">                                             &lt;/connections&gt;
</span><span class="cx">                                         &lt;/menuItem&gt;
</span><span class="cx">                                         &lt;menuItem title=&quot;Find Previous&quot; tag=&quot;3&quot; keyEquivalent=&quot;G&quot; id=&quot;213&quot;&gt;
</span><span class="cx">                                             &lt;modifierMask key=&quot;keyEquivalentModifierMask&quot; shift=&quot;YES&quot; command=&quot;YES&quot;/&gt;
</span><span class="cx">                                             &lt;connections&gt;
</span><del>-                                                &lt;action selector=&quot;performFindPanelAction:&quot; target=&quot;-1&quot; id=&quot;488&quot;/&gt;
</del><ins>+                                                &lt;action selector=&quot;performTextFinderAction:&quot; target=&quot;-1&quot; id=&quot;488&quot;/&gt;
</ins><span class="cx">                                             &lt;/connections&gt;
</span><span class="cx">                                         &lt;/menuItem&gt;
</span><span class="cx">                                         &lt;menuItem title=&quot;Use Selection for Find&quot; tag=&quot;7&quot; keyEquivalent=&quot;e&quot; id=&quot;221&quot;&gt;
</span><span class="cx">                                             &lt;connections&gt;
</span><del>-                                                &lt;action selector=&quot;performFindPanelAction:&quot; target=&quot;-1&quot; id=&quot;489&quot;/&gt;
</del><ins>+                                                &lt;action selector=&quot;performTextFinderAction:&quot; target=&quot;-1&quot; id=&quot;489&quot;/&gt;
</ins><span class="cx">                                             &lt;/connections&gt;
</span><span class="cx">                                         &lt;/menuItem&gt;
</span><span class="cx">                                         &lt;menuItem title=&quot;Jump to Selection&quot; keyEquivalent=&quot;j&quot; id=&quot;210&quot;&gt;
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK1BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -231,13 +231,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (IBAction)toggleShrinkToFit:(id)sender
</span><span class="cx"> {
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (IBAction)find:(id)sender
-{
-}
-
</del><span class="cx"> - (IBAction)dumpSourceToConsole:(id)sender
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK2BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (210481 => 210482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2017-01-07 21:08:43 UTC (rev 210481)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2017-01-07 21:09:41 UTC (rev 210482)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> static const int testHeaderBannerHeight = 42;
</span><span class="cx"> static const int testFooterBannerHeight = 58;
</span><span class="cx"> 
</span><del>-@interface WK2BrowserWindowController () &lt;WKNavigationDelegate, WKUIDelegate, _WKIconLoadingDelegate&gt;
</del><ins>+@interface WK2BrowserWindowController () &lt;NSTextFinderBarContainer, WKNavigationDelegate, WKUIDelegate, _WKIconLoadingDelegate&gt;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WK2BrowserWindowController {
</span><span class="lines">@@ -56,6 +56,10 @@
</span><span class="cx">     BOOL _isPrivateBrowsingWindow;
</span><span class="cx"> 
</span><span class="cx">     BOOL _useShrinkToFit;
</span><ins>+
+    NSTextFinder *_textFinder;
+    NSView *_textFindBarView;
+    BOOL _findBarVisible;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)awakeFromNib
</span><span class="lines">@@ -90,6 +94,12 @@
</span><span class="cx">         | _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering;
</span><span class="cx"> 
</span><span class="cx">     _zoomTextOnly = NO;
</span><ins>+
+    _textFinder = [[NSTextFinder alloc] init];
+    _textFinder.incrementalSearchingEnabled = YES;
+    _textFinder.incrementalSearchingShouldDimContentView = YES;
+    _textFinder.client = _webView;
+    _textFinder.findBarContainer = self;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration
</span><span class="lines">@@ -111,6 +121,8 @@
</span><span class="cx">     [progressIndicator unbind:NSHiddenBinding];
</span><span class="cx">     [progressIndicator unbind:NSValueBinding];
</span><span class="cx"> 
</span><ins>+    [_textFinder release];
+
</ins><span class="cx">     [_webView release];
</span><span class="cx">     [_configuration release];
</span><span class="cx"> 
</span><span class="lines">@@ -169,7 +181,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
</span><span class="cx"> {
</span><del>-    SEL action = [menuItem action];
</del><ins>+    SEL action = menuItem.action;
</ins><span class="cx"> 
</span><span class="cx">     if (action == @selector(zoomIn:))
</span><span class="cx">         return [self canZoomIn];
</span><span class="lines">@@ -180,7 +192,6 @@
</span><span class="cx">     
</span><span class="cx">     // Disabled until missing WK2 functionality is exposed via API/SPI.
</span><span class="cx">     if (action == @selector(dumpSourceToConsole:)
</span><del>-        || action == @selector(find:)
</del><span class="cx">         || action == @selector(forceRepaint:))
</span><span class="cx">         return NO;
</span><span class="cx">     
</span><span class="lines">@@ -514,15 +525,6 @@
</span><span class="cx">     [self fetch:nil];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (IBAction)performFindPanelAction:(id)sender
-{
-    [findPanelWindow makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)find:(id)sender
-{
-}
-
</del><span class="cx"> static NSSet *dataTypes()
</span><span class="cx"> {
</span><span class="cx">     return [WKWebsiteDataStore allWebsiteDataTypes];
</span><span class="lines">@@ -657,6 +659,51 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Find in Page
+
+- (IBAction)performTextFinderAction:(id)sender
+{
+    [_textFinder performAction:[sender tag]];
+}
+
+- (NSView *)findBarView
+{
+    return _textFindBarView;
+}
+
+- (void)setFindBarView:(NSView *)findBarView
+{
+    if (_textFindBarView)
+        [_textFindBarView removeFromSuperview];
+    _textFindBarView = findBarView;
+    _findBarVisible = YES;
+    [containerView addSubview:_textFindBarView];
+    [_textFindBarView setFrame:NSMakeRect(0, 0, containerView.bounds.size.width, _textFindBarView.frame.size.height)];
+}
+
+- (BOOL)isFindBarVisible
+{
+    return _findBarVisible;
+}
+
+- (void)setFindBarVisible:(BOOL)findBarVisible
+{
+    _findBarVisible = findBarVisible;
+    if (findBarVisible)
+        [containerView addSubview:_textFindBarView];
+    else
+        [_textFindBarView removeFromSuperview];
+}
+
+- (NSView *)contentView
+{
+    return _webView;
+}
+
+- (void)findBarViewDidChangeHeight
+{
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre>
</div>
</div>

</body>
</html>