<!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>[164601] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/164601">164601</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-02-24 12:53:02 -0800 (Mon, 24 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move non-API files out of WebKit2/UIProcess/API/mac
https://bugs.webkit.org/show_bug.cgi?id=129267
Reviewed by Anders Carlsson.
* UIProcess/mac/FindIndicatorWindow.h: Renamed from Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h.
* UIProcess/mac/FindIndicatorWindow.mm: Renamed from Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm.
* UIProcess/mac/PDFViewController.h: Renamed from Source/WebKit2/UIProcess/API/mac/PDFViewController.h.
* UIProcess/mac/PDFViewController.mm: Renamed from Source/WebKit2/UIProcess/API/mac/PDFViewController.mm.
* UIProcess/mac/WKPrintingView.h: Renamed from Source/WebKit2/UIProcess/API/mac/WKPrintingView.h.
* UIProcess/mac/WKPrintingView.mm: Renamed from Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm.
* UIProcess/mac/WKTextInputWindowController.h: Renamed from Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h.
* UIProcess/mac/WKTextInputWindowController.mm: Renamed from Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm.
* WebKit2.xcodeproj/project.pbxproj:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessmacFindIndicatorWindowh">trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacFindIndicatorWindowmm">trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPDFViewControllerh">trunk/Source/WebKit2/UIProcess/mac/PDFViewController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPDFViewControllermm">trunk/Source/WebKit2/UIProcess/mac/PDFViewController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKPrintingViewh">trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKPrintingViewmm">trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKTextInputWindowControllerh">trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKTextInputWindowControllermm">trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowh">trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowmm">trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPDFViewControllerh">trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPDFViewControllermm">trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPageClientImplh">trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPageClientImplmm">trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKPrintingViewh">trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKPrintingViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllerh">trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllermm">trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2014-02-24 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><ins>+ Move non-API files out of WebKit2/UIProcess/API/mac
+ https://bugs.webkit.org/show_bug.cgi?id=129267
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/mac/FindIndicatorWindow.h: Renamed from Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h.
+ * UIProcess/mac/FindIndicatorWindow.mm: Renamed from Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm.
+ * UIProcess/mac/PDFViewController.h: Renamed from Source/WebKit2/UIProcess/API/mac/PDFViewController.h.
+ * UIProcess/mac/PDFViewController.mm: Renamed from Source/WebKit2/UIProcess/API/mac/PDFViewController.mm.
+ * UIProcess/mac/WKPrintingView.h: Renamed from Source/WebKit2/UIProcess/API/mac/WKPrintingView.h.
+ * UIProcess/mac/WKPrintingView.mm: Renamed from Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm.
+ * UIProcess/mac/WKTextInputWindowController.h: Renamed from Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h.
+ * UIProcess/mac/WKTextInputWindowController.mm: Renamed from Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm.
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2014-02-24 Simon Fraser <simon.fraser@apple.com>
+
</ins><span class="cx"> Move non-API files in the API/ios directory out to UIProcess/ios
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=129264
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,75 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 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 FindIndicatorWindow_h
-#define FindIndicatorWindow_h
-
-#import "WebKitSystemInterface.h"
-#import <wtf/Noncopyable.h>
-#import <wtf/RefPtr.h>
-#import <wtf/RetainPtr.h>
-#import <wtf/RunLoop.h>
-
-@class WKFindIndicatorWindowAnimation;
-@class WKView;
-
-namespace WebKit {
-
-class FindIndicator;
-
-class FindIndicatorWindow {
- WTF_MAKE_NONCOPYABLE(FindIndicatorWindow);
-
-public:
- explicit FindIndicatorWindow(WKView *);
- ~FindIndicatorWindow();
-
- void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
-
-private:
- void closeWindow();
-
- void startFadeOutTimerFired();
-
- void fadeOutAnimationCallback(double);
- void fadeOutAnimationDidEnd();
-
- void bounceAnimationCallback(double);
- void bounceAnimationDidEnd();
-
- WKView* m_wkView;
- RefPtr<FindIndicator> m_findIndicator;
- RetainPtr<NSWindow> m_findIndicatorWindow;
-
- WKWindowBounceAnimationContextRef m_bounceAnimationContext;
- RetainPtr<WKFindIndicatorWindowAnimation> m_bounceAnimation;
-
- RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
- RetainPtr<WKFindIndicatorWindowAnimation> m_fadeOutAnimation;
-};
-
-} // namespace WebKit
-
-#endif // FindIndicatorWindow_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,246 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 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"
-#import "FindIndicatorWindow.h"
-
-#import "FindIndicator.h"
-#import "WKView.h"
-#import <WebCore/GraphicsContext.h>
-
-static const double bounceAnimationDuration = 0.12;
-static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
-static const double fadeOutAnimationDuration = 0.3;
-
-using namespace WebCore;
-
-@interface WKFindIndicatorView : NSView {
- RefPtr<WebKit::FindIndicator> _findIndicator;
-}
-
-- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator;
-@end
-
-@implementation WKFindIndicatorView
-
-- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator
-{
- if ((self = [super initWithFrame:NSZeroRect]))
- _findIndicator = findIndicator;
-
- return self;
-}
-
-- (void)drawRect:(NSRect)rect
-{
- GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]));
-
- _findIndicator->draw(graphicsContext, enclosingIntRect(rect));
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-@end
-
-@interface WKFindIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> {
- WebKit::FindIndicatorWindow* _findIndicatorWindow;
- void (WebKit::FindIndicatorWindow::*_animationProgressCallback)(double progress);
- void (WebKit::FindIndicatorWindow::*_animationDidEndCallback)();
-}
-
-- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
- animationDuration:(CFTimeInterval)duration
- animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
- animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback;
-@end
-
-@implementation WKFindIndicatorWindowAnimation
-
-- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
- animationDuration:(CFTimeInterval)animationDuration
- animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
- animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback
-{
- if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) {
- _findIndicatorWindow = findIndicatorWindow;
- _animationProgressCallback = animationProgressCallback;
- _animationDidEndCallback = animationDidEndCallback;
- [self setDelegate:self];
- [self setAnimationBlockingMode:NSAnimationNonblocking];
- }
- return self;
-}
-
-- (void)setCurrentProgress:(NSAnimationProgress)progress
-{
- (_findIndicatorWindow->*_animationProgressCallback)(progress);
-}
-
-- (void)animationDidEnd:(NSAnimation *)animation
-{
- ASSERT(animation == self);
-
- (_findIndicatorWindow->*_animationDidEndCallback)();
-}
-
-@end
-
-namespace WebKit {
-
-FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
- : m_wkView(wkView)
- , m_bounceAnimationContext(0)
- , m_startFadeOutTimer(RunLoop::main(), this, &FindIndicatorWindow::startFadeOutTimerFired)
-{
-}
-
-FindIndicatorWindow::~FindIndicatorWindow()
-{
- closeWindow();
-}
-
-void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
-{
- if (m_findIndicator == findIndicator)
- return;
-
- m_findIndicator = findIndicator;
-
- // Get rid of the old window.
- closeWindow();
-
- if (!m_findIndicator)
- return;
-
- NSRect contentRect = m_findIndicator->frameRect();
- NSRect windowFrameRect = NSIntegralRect([m_wkView convertRect:contentRect toView:nil]);
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- windowFrameRect.origin = [[m_wkView window] convertBaseToScreen:windowFrameRect.origin];
-#pragma clang diagnostic pop
- NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask];
-
- m_findIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
-
- [m_findIndicatorWindow setBackgroundColor:[NSColor clearColor]];
- [m_findIndicatorWindow setOpaque:NO];
- [m_findIndicatorWindow setIgnoresMouseEvents:YES];
-
- RetainPtr<WKFindIndicatorView> findIndicatorView = adoptNS([[WKFindIndicatorView alloc] _initWithFindIndicator:m_findIndicator]);
- [m_findIndicatorWindow setContentView:findIndicatorView.get()];
-
- [[m_wkView window] addChildWindow:m_findIndicatorWindow.get() ordered:NSWindowAbove];
- [m_findIndicatorWindow setReleasedWhenClosed:NO];
-
- if (animate) {
- // Start the bounce animation.
- m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
- m_bounceAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
- animationDuration:bounceAnimationDuration
- animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
- animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
- [m_bounceAnimation startAnimation];
- }
-
- if (fadeOut)
- m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
-}
-
-void FindIndicatorWindow::closeWindow()
-{
- if (!m_findIndicatorWindow)
- return;
-
- m_startFadeOutTimer.stop();
-
- if (m_fadeOutAnimation) {
- [m_fadeOutAnimation stopAnimation];
- m_fadeOutAnimation = nullptr;
- }
-
- if (m_bounceAnimation) {
- [m_bounceAnimation stopAnimation];
- m_bounceAnimation = nullptr;
- }
-
- if (m_bounceAnimationContext)
- WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
-
- [[m_findIndicatorWindow parentWindow] removeChildWindow:m_findIndicatorWindow.get()];
- [m_findIndicatorWindow close];
- m_findIndicatorWindow = nullptr;
-}
-
-void FindIndicatorWindow::startFadeOutTimerFired()
-{
- ASSERT(!m_fadeOutAnimation);
-
- m_fadeOutAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
- animationDuration:fadeOutAnimationDuration
- animationProgressCallback:&FindIndicatorWindow::fadeOutAnimationCallback
- animationDidEndCallback:&FindIndicatorWindow::fadeOutAnimationDidEnd]);
- [m_fadeOutAnimation startAnimation];
-}
-
-void FindIndicatorWindow::fadeOutAnimationCallback(double progress)
-{
- ASSERT(m_fadeOutAnimation);
-
- [m_findIndicatorWindow setAlphaValue:1.0 - progress];
-}
-
-void FindIndicatorWindow::fadeOutAnimationDidEnd()
-{
- ASSERT(m_fadeOutAnimation);
- ASSERT(m_findIndicatorWindow);
-
- closeWindow();
-}
-
-void FindIndicatorWindow::bounceAnimationCallback(double progress)
-{
- ASSERT(m_bounceAnimation);
- ASSERT(m_bounceAnimationContext);
-
- WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress);
-}
-
-void FindIndicatorWindow::bounceAnimationDidEnd()
-{
- ASSERT(m_bounceAnimation);
- ASSERT(m_bounceAnimationContext);
- ASSERT(m_findIndicatorWindow);
-
- WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
- m_bounceAnimationContext = 0;
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPDFViewControllerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.h (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.h        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,96 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 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 PDFViewController_h
-#define PDFViewController_h
-
-#include "WebFindOptions.h"
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/text/WTFString.h>
-
-@class PDFView;
-@class WKView;
-@class WKPDFView;
-
-namespace IPC {
- class DataReference;
-}
-
-namespace WebKit {
-
-class WebPageProxy;
-
-class PDFViewController {
- WTF_MAKE_NONCOPYABLE(PDFViewController);
-
-public:
- static PassOwnPtr<PDFViewController> create(WKView *);
- ~PDFViewController();
-
- WKView* wkView() const { return m_wkView; }
- WebPageProxy* page() const;
- NSView* pdfView() const;
-
- void setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const IPC::DataReference&);
-
- double zoomFactor() const;
- void setZoomFactor(double);
-
- static Class pdfPreviewViewClass();
-
- bool forwardScrollWheelEvent(NSEvent *);
-
- NSPrintOperation *makePrintOperation(NSPrintInfo *);
- void openPDFInFinder();
- void savePDFToDownloadsFolder();
- void linkClicked(const String& url);
- void print();
-
- void findString(const String&, FindOptions, unsigned maxMatchCount);
- void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
-
-private:
- explicit PDFViewController(WKView *wkView);
-
- static Class pdfDocumentClass();
- static NSBundle* pdfKitBundle();
-
- WKView* m_wkView;
-
- RetainPtr<WKPDFView> m_wkPDFView;
- PDFView* m_pdfView;
-
- RetainPtr<NSString> m_suggestedFilename;
- RetainPtr<CFDataRef> m_pdfData;
-
- String m_temporaryPDFUUID;
-};
-
-} // namespace WebKit
-
-#endif // PDFViewController_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPDFViewControllermm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,678 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 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"
-#import "PDFViewController.h"
-
-#import "DataReference.h"
-#import "WKAPICast.h"
-#import "WKViewPrivate.h"
-#import "WebData.h"
-#import "WebEventFactory.h"
-#import "WebPageGroup.h"
-#import "WebPageProxy.h"
-#import "WebPreferences.h"
-#import <PDFKit/PDFKit.h>
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/UUID.h>
-#import <wtf/ObjcRuntimeExtras.h>
-#import <wtf/text/CString.h>
-#import <wtf/text/WTFString.h>
-
-// Redeclarations of PDFKit notifications. We can't use the API since we use a weak link to the framework.
-#define _webkit_PDFViewDisplayModeChangedNotification @"PDFViewDisplayModeChanged"
-#define _webkit_PDFViewScaleChangedNotification @"PDFViewScaleChanged"
-#define _webkit_PDFViewPageChangedNotification @"PDFViewChangedPage"
-
-using namespace WebCore;
-using namespace WebKit;
-
-@class PDFDocument;
-@class PDFView;
-
-@interface PDFDocument (PDFDocumentDetails)
-- (NSPrintOperation *)getPrintOperationForPrintInfo:(NSPrintInfo *)printInfo autoRotate:(BOOL)doRotate;
-@end
-
-extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
-
-// MARK: C UTILITY FUNCTIONS
-
-static void _applicationInfoForMIMEType(NSString *type, NSString **name, NSImage **image)
-{
- ASSERT(name);
- ASSERT(image);
-
- CFURLRef appURL = 0;
-
- OSStatus error = LSCopyApplicationForMIMEType((CFStringRef)type, kLSRolesAll, &appURL);
- if (error != noErr)
- return;
-
- NSString *appPath = [(NSURL *)appURL path];
- if (appURL)
- CFRelease(appURL);
-
- *image = [[NSWorkspace sharedWorkspace] iconForFile:appPath];
- [*image setSize:NSMakeSize(16, 16)];
-
- *name = [[NSFileManager defaultManager] displayNameAtPath:appPath];
-}
-
-// FIXME 4182876: We can eliminate this function in favor if -isEqual: if [PDFSelection isEqual:] is overridden
-// to compare contents.
-static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selectionB)
-{
- NSArray *aPages = [selectionA pages];
- NSArray *bPages = [selectionB pages];
-
- if (![aPages isEqual:bPages])
- return NO;
-
- NSUInteger count = [aPages count];
- for (NSUInteger i = 0; i < count; ++i) {
- NSRect aBounds = [selectionA boundsForPage:[aPages objectAtIndex:i]];
- NSRect bBounds = [selectionB boundsForPage:[bPages objectAtIndex:i]];
- if (!NSEqualRects(aBounds, bBounds))
- return NO;
- }
-
- return YES;
-}
-
-@interface WKPDFView : NSView
-{
- PDFViewController* _pdfViewController;
-
- RetainPtr<NSView> _pdfPreviewView;
- PDFView *_pdfView;
- BOOL _ignoreScaleAndDisplayModeAndPageNotifications;
- BOOL _willUpdatePreferencesSoon;
-}
-
-- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController;
-- (void)invalidate;
-- (PDFView *)pdfView;
-- (void)setDocument:(PDFDocument *)pdfDocument;
-
-- (BOOL)forwardScrollWheelEvent:(NSEvent *)wheelEvent;
-- (void)_applyPDFPreferences;
-- (PDFSelection *)_nextMatchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag fromSelection:(PDFSelection *)initialSelection startInSelection:(BOOL)startInSelection;
-@end
-
-@implementation WKPDFView
-
-- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController
-{
- if ((self = [super initWithFrame:frame])) {
- _pdfViewController = pdfViewController;
-
- [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-
- Class previewViewClass = PDFViewController::pdfPreviewViewClass();
- ASSERT(previewViewClass);
-
- _pdfPreviewView = adoptNS([[previewViewClass alloc] initWithFrame:frame]);
- [_pdfPreviewView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [self addSubview:_pdfPreviewView.get()];
-
- _pdfView = [_pdfPreviewView.get() performSelector:@selector(pdfView)];
- [_pdfView setDelegate:self];
- }
-
- return self;
-}
-
-- (void)invalidate
-{
- _pdfViewController = 0;
-}
-
-- (PDFView *)pdfView
-{
- return _pdfView;
-}
-
-- (void)setDocument:(PDFDocument *)pdfDocument
-{
- _ignoreScaleAndDisplayModeAndPageNotifications = YES;
- [_pdfView setDocument:pdfDocument];
- [self _applyPDFPreferences];
- _ignoreScaleAndDisplayModeAndPageNotifications = NO;
-}
-
-- (void)_applyPDFPreferences
-{
- if (!_pdfViewController)
- return;
-
- WebPreferences *preferences = _pdfViewController->page()->pageGroup()->preferences();
-
- CGFloat scaleFactor = preferences->pdfScaleFactor();
- if (!scaleFactor)
- [_pdfView setAutoScales:YES];
- else {
- [_pdfView setAutoScales:NO];
- [_pdfView setScaleFactor:scaleFactor];
- }
- [_pdfView setDisplayMode:preferences->pdfDisplayMode()];
-}
-
-- (void)_updatePreferences:(id)ignored
-{
- _willUpdatePreferencesSoon = NO;
-
- if (!_pdfViewController)
- return;
-
- WebPreferences* preferences = _pdfViewController->page()->pageGroup()->preferences();
-
- CGFloat scaleFactor = [_pdfView autoScales] ? 0 : [_pdfView scaleFactor];
- preferences->setPDFScaleFactor(scaleFactor);
- preferences->setPDFDisplayMode([_pdfView displayMode]);
-}
-
-- (void)_updatePreferencesSoon
-{
- if (_willUpdatePreferencesSoon)
- return;
-
- [self performSelector:@selector(_updatePreferences:) withObject:nil afterDelay:0];
- _willUpdatePreferencesSoon = YES;
-}
-
-- (void)_scaleOrDisplayModeOrPageChanged:(NSNotification *)notification
-{
- ASSERT_ARG(notification, [notification object] == _pdfView);
- if (!_ignoreScaleAndDisplayModeAndPageNotifications)
- [self _updatePreferencesSoon];
-}
-
-- (void)_openWithFinder:(id)sender
-{
- _pdfViewController->openPDFInFinder();
-}
-
-- (PDFSelection *)_nextMatchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag fromSelection:(PDFSelection *)initialSelection startInSelection:(BOOL)startInSelection
-{
- if (![string length])
- return nil;
-
- int options = 0;
- if (!forward)
- options |= NSBackwardsSearch;
-
- if (!caseFlag)
- options |= NSCaseInsensitiveSearch;
-
- PDFDocument *document = [_pdfView document];
-
- PDFSelection *selectionForInitialSearch = [initialSelection copy];
- if (startInSelection) {
- // Initially we want to include the selected text in the search. So we must modify the starting search
- // selection to fit PDFDocument's search requirements: selection must have a length >= 1, begin before
- // the current selection (if searching forwards) or after (if searching backwards).
- int initialSelectionLength = [[initialSelection string] length];
- if (forward) {
- [selectionForInitialSearch extendSelectionAtStart:1];
- [selectionForInitialSearch extendSelectionAtEnd:-initialSelectionLength];
- } else {
- [selectionForInitialSearch extendSelectionAtEnd:1];
- [selectionForInitialSearch extendSelectionAtStart:-initialSelectionLength];
- }
- }
- PDFSelection *foundSelection = [document findString:string fromSelection:selectionForInitialSearch withOptions:options];
- [selectionForInitialSearch release];
-
- // If we first searched in the selection, and we found the selection, search again from just past the selection
- if (startInSelection && _PDFSelectionsAreEqual(foundSelection, initialSelection))
- foundSelection = [document findString:string fromSelection:initialSelection withOptions:options];
-
- if (!foundSelection && wrapFlag)
- foundSelection = [document findString:string fromSelection:nil withOptions:options];
-
- return foundSelection;
-}
-
-- (NSUInteger)_countMatches:(NSString *)string caseSensitive:(BOOL)caseFlag
-{
- if (![string length])
- return 0;
-
- int options = caseFlag ? 0 : NSCaseInsensitiveSearch;
-
- return [[[_pdfView document] findString:string withOptions:options] count];
-}
-
-// MARK: NSView overrides
-
-- (void)viewDidMoveToWindow
-{
- if (![self window])
- return;
-
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
- [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewScaleChangedNotification object:_pdfView];
- [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView];
- [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewPageChangedNotification object:_pdfView];
-}
-
-- (void)viewWillMoveToWindow:(NSWindow *)newWindow
-{
- if (![self window])
- return;
-
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
- [notificationCenter removeObserver:self name:_webkit_PDFViewScaleChangedNotification object:_pdfView];
- [notificationCenter removeObserver:self name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView];
- [notificationCenter removeObserver:self name:_webkit_PDFViewPageChangedNotification object:_pdfView];
-}
-
-- (NSView *)hitTest:(NSPoint)point
-{
- // Override hitTest so we can override menuForEvent.
- NSEvent *event = [NSApp currentEvent];
- NSEventType type = [event type];
- if (type == NSRightMouseDown || (type == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask)))
- return self;
-
- return [super hitTest:point];
-}
-
-static void insertOpenWithDefaultPDFMenuItem(NSMenu *menu, NSUInteger index)
-{
- // Add in an "Open with <default PDF viewer>" item
- NSString *appName = nil;
- NSImage *appIcon = nil;
-
- _applicationInfoForMIMEType(@"application/pdf", &appName, &appIcon);
- if (!appName)
- appName = WEB_UI_STRING("Finder", "Default application name for Open With context menu");
-
- // To match the PDFKit style, we'll add Open with Preview even when there's no document yet to view, and
- // disable it using validateUserInterfaceItem.
- NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Open with %@", "context menu item for PDF"), appName];
-
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:title action:@selector(_openWithFinder:) keyEquivalent:@""];
- if (appIcon)
- [item setImage:appIcon];
- [menu insertItem:item atIndex:index];
- [item release];
-}
-
-- (NSMenu *)menuForEvent:(NSEvent *)theEvent
-{
- NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
-
- bool insertedOpenWithItem = false;
-
- NSEnumerator *menuItemEnumerator = [[[_pdfView menuForEvent:theEvent] itemArray] objectEnumerator];
- while (NSMenuItem *item = [menuItemEnumerator nextObject]) {
- NSMenuItem *itemCopy = [item copy];
- [menu addItem:itemCopy];
- [itemCopy release];
-
- if (insertedOpenWithItem)
- continue;
-
- // If a "Copy" item is present, place the "Open With" item just after it, with an intervening separator.
- if ([item action] != @selector(copy:))
- continue;
-
- [menu addItem:[NSMenuItem separatorItem]];
- insertOpenWithDefaultPDFMenuItem(menu, [menu numberOfItems]);
- insertedOpenWithItem = true;
- }
-
- if (!insertedOpenWithItem) {
- // No "Copy" item was found; place the "Open With" item at the top of the menu, with a trailing separator.
- insertOpenWithDefaultPDFMenuItem(menu, 0);
- [menu insertItem:[NSMenuItem separatorItem] atIndex:1];
- }
-
- return [menu autorelease];
-}
-
-// MARK: NSUserInterfaceValidations PROTOCOL IMPLEMENTATION
-
-- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
-{
- SEL action = [item action];
- if (action == @selector(_openWithFinder:))
- return [_pdfView document] != nil;
- return YES;
-}
-
-// MARK: PDFView delegate methods
-
-- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL
-{
- _pdfViewController->linkClicked([URL absoluteString]);
-}
-
-- (void)PDFViewOpenPDFInNativeApplication:(PDFView *)sender
-{
- _pdfViewController->openPDFInFinder();
-}
-
-- (void)PDFViewSavePDFToDownloadFolder:(PDFView *)sender
-{
- _pdfViewController->savePDFToDownloadsFolder();
-}
-
-- (void)PDFViewPerformPrint:(PDFView *)sender
-{
- _pdfViewController->print();
-}
-
-- (BOOL)forwardScrollWheelEvent:(NSEvent *)wheelEvent
-{
- return _pdfViewController->forwardScrollWheelEvent(wheelEvent);
-}
-
-@end
-
-namespace WebKit {
-
-PassOwnPtr<PDFViewController> PDFViewController::create(WKView *wkView)
-{
- return adoptPtr(new PDFViewController(wkView));
-}
-
-PDFViewController::PDFViewController(WKView *wkView)
- : m_wkView(wkView)
- , m_wkPDFView(adoptNS([[WKPDFView alloc] initWithFrame:[m_wkView bounds] PDFViewController:this]))
- , m_pdfView([m_wkPDFView.get() pdfView])
-{
- [m_wkView addSubview:m_wkPDFView.get()];
-}
-
-PDFViewController::~PDFViewController()
-{
- [m_wkPDFView.get() removeFromSuperview];
- [m_wkPDFView.get() invalidate];
- m_wkPDFView = nullptr;
-}
-
-WebPageProxy* PDFViewController::page() const
-{
- return toImpl([m_wkView pageRef]);
-}
-
-NSView* PDFViewController::pdfView() const
-{
- return m_wkPDFView.get();
-}
-
-static RetainPtr<CFDataRef> convertPostScriptDataSourceToPDF(const IPC::DataReference& dataReference)
-{
- // Convert PostScript to PDF using Quartz 2D API
- // http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_ps_convert/chapter_16_section_1.html
-
- CGPSConverterCallbacks callbacks = { 0, 0, 0, 0, 0, 0, 0, 0 };
- RetainPtr<CGPSConverterRef> converter = adoptCF(CGPSConverterCreate(0, &callbacks, 0));
- ASSERT(converter);
-
- RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<uint8_t*>(dataReference.data()) length:dataReference.size() freeWhenDone:NO]);
-
- RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithCFData((CFDataRef)nsData.get()));
- ASSERT(provider);
-
- RetainPtr<CFMutableDataRef> result = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
- ASSERT(result);
-
- RetainPtr<CGDataConsumerRef> consumer = adoptCF(CGDataConsumerCreateWithCFData(result.get()));
- ASSERT(consumer);
-
- CGPSConverterConvert(converter.get(), provider.get(), consumer.get(), 0);
-
- if (!result)
- return 0;
-
- return result;
-}
-
-void PDFViewController::setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const IPC::DataReference& dataReference)
-{
- if (equalIgnoringCase(mimeType, "application/postscript")) {
- m_pdfData = convertPostScriptDataSourceToPDF(dataReference);
- if (!m_pdfData)
- return;
- m_suggestedFilename = String(suggestedFilename + ".pdf");
- } else {
- // Make sure to copy the data.
- m_pdfData = adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size()));
- m_suggestedFilename = suggestedFilename;
- }
-
- RetainPtr<PDFDocument> pdfDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:(NSData *)m_pdfData.get()]);
- [m_wkPDFView.get() setDocument:pdfDocument.get()];
-}
-
-double PDFViewController::zoomFactor() const
-{
- return [m_pdfView scaleFactor];
-}
-
-void PDFViewController::setZoomFactor(double zoomFactor)
-{
- [m_pdfView setScaleFactor:zoomFactor];
-}
-
-Class PDFViewController::pdfDocumentClass()
-{
- static Class pdfDocumentClass = [pdfKitBundle() classNamed:@"PDFDocument"];
-
- return pdfDocumentClass;
-}
-
-Class PDFViewController::pdfPreviewViewClass()
-{
- static Class pdfPreviewViewClass = [pdfKitBundle() classNamed:@"PDFPreviewView"];
-
- return pdfPreviewViewClass;
-}
-
-bool PDFViewController::forwardScrollWheelEvent(NSEvent *wheelEvent)
-{
- CGFloat deltaX = [wheelEvent deltaX];
- if ((deltaX > 0 && !page()->canGoBack()) || (deltaX < 0 && !page()->canGoForward()))
- return false;
-
- [m_wkView scrollWheel:wheelEvent];
- return true;
-}
-
-static IMP oldPDFViewScrollView_scrollWheel;
-
-static WKPDFView *findEnclosingWKPDFView(NSView *view)
-{
- for (NSView *superview = [view superview]; superview; superview = [superview superview]) {
- if ([superview isKindOfClass:[WKPDFView class]])
- return static_cast<WKPDFView *>(superview);
- }
-
- return nil;
-}
-
-static void PDFViewScrollView_scrollWheel(NSScrollView* self, SEL _cmd, NSEvent *wheelEvent)
-{
- CGFloat deltaX = [wheelEvent deltaX];
- CGFloat deltaY = [wheelEvent deltaY];
-
- NSSize contentsSize = [[self documentView] bounds].size;
- NSRect visibleRect = [self documentVisibleRect];
-
- // We only want to forward the wheel events if the horizontal delta is non-zero,
- // and only if we're pinned to either the left or right side.
- // We also never want to forward momentum scroll events.
- if ([wheelEvent momentumPhase] == NSEventPhaseNone && deltaX && fabsf(deltaY) < fabsf(deltaX)
- && ((deltaX > 0 && visibleRect.origin.x <= 0) || (deltaX < 0 && contentsSize.width <= NSMaxX(visibleRect)))) {
-
- if (WKPDFView *pdfView = findEnclosingWKPDFView(self)) {
- if ([pdfView forwardScrollWheelEvent:wheelEvent])
- return;
- }
- }
-
- wtfCallIMP<void>(oldPDFViewScrollView_scrollWheel, self, _cmd, wheelEvent);
-}
-
-NSBundle* PDFViewController::pdfKitBundle()
-{
- static NSBundle *pdfKitBundle;
- if (pdfKitBundle)
- return pdfKitBundle;
-
- NSString *pdfKitPath = [_NSPathForSystemFramework(@"Quartz.framework") stringByAppendingString:@"/Frameworks/PDFKit.framework"];
- if (!pdfKitPath) {
- LOG_ERROR("Couldn't find PDFKit.framework");
- return nil;
- }
-
- pdfKitBundle = [NSBundle bundleWithPath:pdfKitPath];
- if (![pdfKitBundle load])
- LOG_ERROR("Couldn't load PDFKit.framework");
-
- if (Class pdfViewScrollViewClass = [pdfKitBundle classNamed:@"PDFViewScrollView"]) {
- if (Method scrollWheel = class_getInstanceMethod(pdfViewScrollViewClass, @selector(scrollWheel:)))
- oldPDFViewScrollView_scrollWheel = method_setImplementation(scrollWheel, reinterpret_cast<IMP>(PDFViewScrollView_scrollWheel));
- }
-
- return pdfKitBundle;
-}
-
-NSPrintOperation *PDFViewController::makePrintOperation(NSPrintInfo *printInfo)
-{
- return [[m_pdfView document] getPrintOperationForPrintInfo:printInfo autoRotate:YES];
-}
-
-void PDFViewController::openPDFInFinder()
-{
- // We don't want to open the PDF until we have a document to write. (see 4892525).
- if (![m_pdfView document]) {
- NSBeep();
- return;
- }
-
- if (!m_temporaryPDFUUID) {
- ASSERT(m_pdfData);
- m_temporaryPDFUUID = createCanonicalUUIDString();
- page()->savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(m_suggestedFilename.get(), page()->mainFrame()->url(), CFDataGetBytePtr(m_pdfData.get()), CFDataGetLength(m_pdfData.get()), m_temporaryPDFUUID);
- return;
- }
-
- page()->openPDFFromTemporaryFolderWithNativeApplication(m_temporaryPDFUUID);
-}
-
-static void releaseCFData(unsigned char*, const void* data)
-{
- ASSERT(CFGetTypeID(data) == CFDataGetTypeID());
-
- // Balanced by CFRetain in savePDFToDownloadsFolder.
- CFRelease(data);
-}
-
-void PDFViewController::savePDFToDownloadsFolder()
-{
- // We don't want to write the file until we have a document to write. (see 5267607).
- if (![m_pdfView document]) {
- NSBeep();
- return;
- }
-
- ASSERT(m_pdfData);
-
- // Balanced by CFRelease in releaseCFData.
- CFRetain(m_pdfData.get());
-
- RefPtr<WebData> data = WebData::createWithoutCopying(CFDataGetBytePtr(m_pdfData.get()), CFDataGetLength(m_pdfData.get()), releaseCFData, m_pdfData.get());
-
- page()->saveDataToFileInDownloadsFolder(m_suggestedFilename.get(), page()->mainFrame()->mimeType(), page()->mainFrame()->url(), data.get());
-}
-
-void PDFViewController::linkClicked(const String& url)
-{
- NSEvent* nsEvent = [NSApp currentEvent];
- WebMouseEvent event;
- switch ([nsEvent type]) {
- case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
- event = WebEventFactory::createWebMouseEvent(nsEvent, m_pdfView);
- default:
- // For non mouse-clicks or for keyboard events, pass an empty WebMouseEvent
- // through. The event is only used by the WebFrameLoaderClient to determine
- // the modifier keys and which mouse button is down. These queries will be
- // valid with an empty event.
- break;
- }
-
- page()->linkClicked(url, event);
-}
-
-void PDFViewController::print()
-{
- page()->printMainFrame();
-}
-
-void PDFViewController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
-{
- BOOL forward = !(options & FindOptionsBackwards);
- BOOL caseFlag = !(options & FindOptionsCaseInsensitive);
- BOOL wrapFlag = options & FindOptionsWrapAround;
-
- PDFSelection *selection = [m_wkPDFView.get() _nextMatchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag fromSelection:[m_pdfView currentSelection] startInSelection:NO];
- if (!selection) {
- page()->didFailToFindString(string);
- return;
- }
-
- NSUInteger matchCount;
- if (!maxMatchCount) {
- // If the max was zero, any result means we exceeded the max. We can skip computing the actual count.
- matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
- } else {
- matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
- if (matchCount > maxMatchCount)
- matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
- }
-
- [m_pdfView setCurrentSelection:selection];
- [m_pdfView scrollSelectionToVisible:nil];
- page()->didFindString(string, matchCount);
-}
-
-void PDFViewController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
-{
- BOOL caseFlag = !(options & FindOptionsCaseInsensitive);
-
- NSUInteger matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
- if (matchCount > maxMatchCount)
- matchCount = maxMatchCount;
- page()->didCountStringMatches(string, matchCount);
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPageClientImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,178 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 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 PageClientImpl_h
-#define PageClientImpl_h
-
-#include "CorrectionPanel.h"
-#include "PageClient.h"
-#include "WebFullScreenManagerProxy.h"
-#include <wtf/RetainPtr.h>
-
-@class WKEditorUndoTargetObjC;
-@class WKView;
-
-namespace WebCore {
-class AlternativeTextUIController;
-}
-
-namespace WebKit {
-class FindIndicatorWindow;
-
-class PageClientImpl final : public PageClient
-#if ENABLE(FULLSCREEN_API)
- , public WebFullScreenManagerProxyClient
-#endif
- {
-public:
- explicit PageClientImpl(WKView *);
- virtual ~PageClientImpl();
-
- void viewWillMoveToAnotherWindow();
-
-private:
- // PageClient
- virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy();
- virtual void setViewNeedsDisplay(const WebCore::IntRect&);
- virtual void displayView();
- virtual bool canScrollView();
- virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
-
- virtual WebCore::IntSize viewSize();
- virtual bool isViewWindowActive();
- virtual bool isViewFocused();
- virtual bool isViewVisible();
- virtual bool isViewVisibleOrOccluded();
- virtual bool isViewInWindow();
- virtual bool isVisuallyIdle();
- virtual LayerHostingMode viewLayerHostingMode() override;
- virtual ColorSpaceData colorSpace() override;
- virtual void setAcceleratedCompositingRootLayer(CALayer *) override;
- virtual CALayer *acceleratedCompositingRootLayer() const override;
-
- virtual void processDidExit();
- virtual void pageClosed();
- virtual void didRelaunchProcess();
- virtual void preferencesDidChange() override;
- virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
- virtual void didCommitLoadForMainFrame() override;
- virtual void setCursor(const WebCore::Cursor&);
- virtual void setCursorHiddenUntilMouseMoves(bool);
- virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
-
- virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
- virtual void clearAllEditCommands();
- virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
- virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
- virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&);
- virtual bool executeSavedCommandBySelector(const String& selector);
- virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
- virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
- const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer);
- virtual void updateSecureInputState() override;
- virtual void resetSecureInputState() override;
- virtual void notifyInputContextAboutDiscardedComposition() override;
-
- virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
- virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
- virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
- virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
-
- virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
-
- virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
- virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
-
-#if ENABLE(INPUT_TYPE_COLOR)
- virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
-#endif
-
- void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
-
- virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
- virtual void exitAcceleratedCompositingMode();
- virtual void updateAcceleratedCompositingMode(const LayerTreeContext&);
-
- virtual RetainPtr<CGImageRef> takeViewSnapshot() override;
- virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
- virtual void clearCustomSwipeViews() override;
-
- virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&);
-
- virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
- virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState);
-
- virtual void makeFirstResponder();
-
- virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
- virtual void dismissDictionaryLookupPanel();
-
- virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
- virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText);
- virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText);
- virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString);
-
- virtual void recommendedScrollbarStyleDidChange(int32_t newStyle);
-
- virtual WKView* wkView() const { return m_wkView; }
- virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) override;
-
-#if USE(DICTATION_ALTERNATIVES)
- virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&);
- virtual void removeDictationAlternatives(uint64_t dictationContext);
- virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
- virtual Vector<String> dictationAlternatives(uint64_t dictationContext);
-#endif
-
- // Auxiliary Client Creation
-#if ENABLE(FULLSCREEN_API)
- WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;
-#endif
-
-#if ENABLE(FULLSCREEN_API)
- // WebFullScreenManagerProxyClient
- virtual void closeFullScreenManager() override;
- virtual bool isFullScreen() override;
- virtual void enterFullScreen() override;
- virtual void exitFullScreen() override;
- virtual void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
- virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
-#endif
-
- NSView *activeView() const;
-
- WKView *m_wkView;
- RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
-#if USE(AUTOCORRECTION_PANEL)
- CorrectionPanel m_correctionPanel;
-#endif
-#if USE(DICTATION_ALTERNATIVES)
- OwnPtr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
-#endif
-};
-
-} // namespace WebKit
-
-#endif // PageClientImpl_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPageClientImplmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,640 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 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"
-#import "PageClientImpl.h"
-
-#import "AttributedString.h"
-#import "ColorSpaceData.h"
-#import "DataReference.h"
-#import "DictionaryPopupInfo.h"
-#import "FindIndicator.h"
-#import "NativeWebKeyboardEvent.h"
-#import "NativeWebWheelEvent.h"
-#import "StringUtilities.h"
-#import "WKAPICast.h"
-#import "WKFullScreenWindowController.h"
-#import "WKStringCF.h"
-#import "WKThumbnailView.h"
-#import "WKViewInternal.h"
-#import "WebColorPickerMac.h"
-#import "WebContextMenuProxyMac.h"
-#import "WebEditCommandProxy.h"
-#import "WebPopupMenuProxyMac.h"
-#import "WindowServerConnection.h"
-#import <WebCore/AlternativeTextUIController.h>
-#import <WebCore/BitmapImage.h>
-#import <WebCore/Cursor.h>
-#import <WebCore/FloatRect.h>
-#import <WebCore/GraphicsContext.h>
-#import <WebCore/Image.h>
-#import <WebCore/KeyboardEvent.h>
-#import <WebCore/NotImplemented.h>
-#import <WebCore/SharedBuffer.h>
-#import <WebKitSystemInterface.h>
-#import <wtf/text/CString.h>
-#import <wtf/text/WTFString.h>
-
-#if USE(DICTATION_ALTERNATIVES)
-#import <AppKit/NSTextAlternatives.h>
-#endif
-
-@interface NSApplication (WebNSApplicationDetails)
-- (NSCursor *)_cursorRectCursor;
-@end
-
-#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-@interface NSWindow (WebNSWindowDetails)
-- (BOOL)_hostsLayersInWindowServer;
-@end
-#endif
-
-using namespace WebCore;
-using namespace WebKit;
-
-@interface WKEditCommandObjC : NSObject
-{
- RefPtr<WebEditCommandProxy> m_command;
-}
-- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command;
-- (WebEditCommandProxy*)command;
-@end
-
-@interface WKEditorUndoTargetObjC : NSObject
-- (void)undoEditing:(id)sender;
-- (void)redoEditing:(id)sender;
-@end
-
-@implementation WKEditCommandObjC
-
-- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command
-{
- self = [super init];
- if (!self)
- return nil;
-
- m_command = command;
- return self;
-}
-
-- (WebEditCommandProxy*)command
-{
- return m_command.get();
-}
-
-@end
-
-@implementation WKEditorUndoTargetObjC
-
-- (void)undoEditing:(id)sender
-{
- ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
- [sender command]->unapply();
-}
-
-- (void)redoEditing:(id)sender
-{
- ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
- [sender command]->reapply();
-}
-
-@end
-
-namespace WebKit {
-
-PageClientImpl::PageClientImpl(WKView* wkView)
- : m_wkView(wkView)
- , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
-#if USE(DICTATION_ALTERNATIVES)
- , m_alternativeTextUIController(adoptPtr(new AlternativeTextUIController))
-#endif
-{
-}
-
-PageClientImpl::~PageClientImpl()
-{
-}
-
-std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
-{
- return [m_wkView _createDrawingAreaProxy];
-}
-
-void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
-{
- ASSERT_NOT_REACHED();
-}
-
-void PageClientImpl::displayView()
-{
- ASSERT_NOT_REACHED();
-}
-
-bool PageClientImpl::canScrollView()
-{
- return false;
-}
-
-void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
-{
- ASSERT_NOT_REACHED();
-}
-
-IntSize PageClientImpl::viewSize()
-{
- return IntSize([m_wkView bounds].size);
-}
-
-NSView *PageClientImpl::activeView() const
-{
-#if WK_API_ENABLED
- return m_wkView._thumbnailView ? (NSView *)m_wkView._thumbnailView : (NSView *)m_wkView;
-#else
- return m_wkView;
-#endif
-}
-
-bool PageClientImpl::isViewWindowActive()
-{
- NSWindow *activeViewWindow = activeView().window;
- return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
-}
-
-bool PageClientImpl::isViewFocused()
-{
- return [m_wkView _isFocused];
-}
-
-void PageClientImpl::makeFirstResponder()
-{
- [[m_wkView window] makeFirstResponder:m_wkView];
-}
-
-bool PageClientImpl::isViewVisible()
-{
- NSView *activeView = this->activeView();
- NSWindow *activeViewWindow = activeView.window;
-
- if (!activeViewWindow)
- return false;
-
- if (!activeViewWindow.isVisible)
- return false;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
- // Mountain Lion and previous do not support occlusion notifications, and as such will
- // continue to report as "visible" when not on the active space.
- if (!activeViewWindow.isOnActiveSpace)
- return false;
-#endif
-
- if (activeView.isHiddenOrHasHiddenAncestor)
- return false;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
- if ([m_wkView windowOcclusionDetectionEnabled] && (activeViewWindow.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
- return false;
-#endif
-
- return true;
-}
-
-bool PageClientImpl::isViewVisibleOrOccluded()
-{
- return activeView().window.isVisible;
-}
-
-bool PageClientImpl::isViewInWindow()
-{
- return activeView().window;
-}
-
-bool PageClientImpl::isVisuallyIdle()
-{
- return WindowServerConnection::shared().applicationWindowModificationsHaveStopped() || !isViewVisible();
-}
-
-LayerHostingMode PageClientImpl::viewLayerHostingMode()
-{
-#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
- if ([activeView().window _hostsLayersInWindowServer])
- return LayerHostingMode::OutOfProcess;
-#endif
- return LayerHostingMode::InProcess;
-}
-
-void PageClientImpl::viewWillMoveToAnotherWindow()
-{
- clearAllEditCommands();
-}
-
-ColorSpaceData PageClientImpl::colorSpace()
-{
- return [m_wkView _colorSpace];
-}
-
-void PageClientImpl::processDidExit()
-{
- [m_wkView _processDidExit];
-}
-
-void PageClientImpl::pageClosed()
-{
- [m_wkView _pageClosed];
-#if USE(DICTATION_ALTERNATIVES)
- m_alternativeTextUIController->clear();
-#endif
-}
-
-void PageClientImpl::didRelaunchProcess()
-{
- [m_wkView _didRelaunchProcess];
-}
-
-void PageClientImpl::preferencesDidChange()
-{
- [m_wkView _preferencesDidChange];
-}
-
-void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
-{
- [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];
-}
-
-void PageClientImpl::didCommitLoadForMainFrame()
-{
-}
-
-void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
-{
- if (![NSApp _cursorRectCursor])
- [m_wkView _setCursor:cursor.platformCursor()];
-}
-
-void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
-{
- [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
-}
-
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
-{
-}
-
-void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
-{
- RefPtr<WebEditCommandProxy> command = prpCommand;
-
- RetainPtr<WKEditCommandObjC> commandObjC = adoptNS([[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]);
- String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
-
- NSUndoManager *undoManager = [m_wkView undoManager];
- [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
- if (!actionName.isEmpty())
- [undoManager setActionName:(NSString *)actionName];
-}
-
-void PageClientImpl::clearAllEditCommands()
-{
- [[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
-}
-
-bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
-{
- return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] canUndo] : [[m_wkView undoManager] canRedo];
-}
-
-void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
-{
- return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] undo] : [[m_wkView undoManager] redo];
-}
-
-bool PageClientImpl::interpretKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commands)
-{
- return [m_wkView _interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands];
-}
-
-void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
-{
- RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
- RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
-
- [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
-}
-
-void PageClientImpl::setPromisedData(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, PassRefPtr<SharedBuffer> archiveBuffer)
-{
- RefPtr<Image> image = BitmapImage::create();
- image->setData(imageBuffer.get(), true);
- [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
-}
-
-void PageClientImpl::updateSecureInputState()
-{
- [m_wkView _updateSecureInputState];
-}
-
-void PageClientImpl::resetSecureInputState()
-{
- [m_wkView _resetSecureInputState];
-}
-
-void PageClientImpl::notifyInputContextAboutDiscardedComposition()
-{
- [m_wkView _notifyInputContextAboutDiscardedComposition];
-}
-
-FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
-{
- return [m_wkView _convertToDeviceSpace:rect];
-}
-
-FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
-{
- return [m_wkView _convertToUserSpace:rect];
-}
-
-IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- NSPoint windowCoord = [[m_wkView window] convertScreenToBase:point];
-#pragma clang diagnostic pop
- return IntPoint([m_wkView convertPoint:windowCoord fromView:nil]);
-}
-
-IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
-{
- NSRect tempRect = rect;
- tempRect = [m_wkView convertRect:tempRect toView:nil];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- tempRect.origin = [[m_wkView window] convertBaseToScreen:tempRect.origin];
-#pragma clang diagnostic pop
- return enclosingIntRect(tempRect);
-}
-
-void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
-{
- [m_wkView _doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled];
-}
-
-PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
-{
- return WebPopupMenuProxyMac::create(m_wkView, page);
-}
-
-PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
-{
- return WebContextMenuProxyMac::create(m_wkView, page);
-}
-
-#if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor, const WebCore::IntRect& rect)
-{
- return WebColorPickerMac::create(page, initialColor, rect, wkView());
-}
-#endif
-
-void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
-{
- [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
-}
-
-void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
-{
- NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
- [m_wkView _setAccessibilityWebProcessToken:remoteToken];
-}
-
-void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
-{
- ASSERT(!layerTreeContext.isEmpty());
-
- CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
- [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
-}
-
-void PageClientImpl::exitAcceleratedCompositingMode()
-{
- [m_wkView _setAcceleratedCompositingModeRootLayer:nil];
-}
-
-void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
-{
- ASSERT(!layerTreeContext.isEmpty());
-
- CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
- [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
-}
-
-void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
-{
- [m_wkView _setAcceleratedCompositingModeRootLayer:rootLayer];
-}
-
-CALayer *PageClientImpl::acceleratedCompositingRootLayer() const
-{
- return m_wkView._acceleratedCompositingModeRootLayer;
-}
-
-RetainPtr<CGImageRef> PageClientImpl::takeViewSnapshot()
-{
- return [m_wkView _takeViewSnapshot];
-}
-
-void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
-{
- [m_wkView _wheelEventWasNotHandledByWebCore:event.nativeEvent()];
-}
-
-void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus)
-{
- [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
-}
-
-void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState)
-{
- [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
-}
-
-void PageClientImpl::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
-{
- RetainPtr<NSAttributedString> attributedString = text.string;
- NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
-
- // Convert to screen coordinates.
- textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
- textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
-
- WKShowWordDefinitionWindow(attributedString.get(), textBaselineOrigin, (NSDictionary *)dictionaryPopupInfo.options.get());
-}
-
-void PageClientImpl::dismissDictionaryLookupPanel()
-{
- // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
- WKHideWordDefinitionWindow();
-}
-
-void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
-{
-#if USE(AUTOCORRECTION_PANEL)
- if (!isViewVisible() || !isViewInWindow())
- return;
- m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
-#endif
-}
-
-void PageClientImpl::dismissCorrectionPanel(ReasonForDismissingAlternativeText reason)
-{
-#if USE(AUTOCORRECTION_PANEL)
- m_correctionPanel.dismiss(reason);
-#endif
-}
-
-String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText reason)
-{
-#if USE(AUTOCORRECTION_PANEL)
- return m_correctionPanel.dismiss(reason);
-#else
- return String();
-#endif
-}
-
-void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
-{
- NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
- CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
-}
-
-void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
-{
- NSArray *trackingAreas = [m_wkView trackingAreas];
- NSUInteger count = [trackingAreas count];
- ASSERT(count == 1);
-
- for (NSUInteger i = 0; i < count; ++i)
- [m_wkView removeTrackingArea:[trackingAreas objectAtIndex:i]];
-
- // Now re-create a tracking area with the appropriate options given the new scrollbar style
- NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
- if (newStyle == NSScrollerStyleLegacy)
- options |= NSTrackingActiveAlways;
- else
- options |= NSTrackingActiveInKeyWindow;
-
- NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:[m_wkView frame]
- options:options
- owner:m_wkView
- userInfo:nil];
- [m_wkView addTrackingArea:trackingArea];
- [trackingArea release];
-}
-
-void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize)
-{
- [m_wkView _setIntrinsicContentSize:intrinsicContentSize];
-}
-
-bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString)
-{
- return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)];
-}
-
-void PageClientImpl::clearCustomSwipeViews()
-{
- return [m_wkView _setCustomSwipeViews:@[]];
-}
-
-#if USE(DICTATION_ALTERNATIVES)
-uint64_t PageClientImpl::addDictationAlternatives(const RetainPtr<NSTextAlternatives>& alternatives)
-{
- return m_alternativeTextUIController->addAlternatives(alternatives);
-}
-
-void PageClientImpl::removeDictationAlternatives(uint64_t dictationContext)
-{
- m_alternativeTextUIController->removeAlternatives(dictationContext);
-}
-
-void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
-{
- if (!isViewVisible() || !isViewInWindow())
- return;
- m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
- [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
- });
-}
-
-Vector<String> PageClientImpl::dictationAlternatives(uint64_t dictationContext)
-{
- return m_alternativeTextUIController->alternativesForContext(dictationContext);
-}
-#endif
-
-#if ENABLE(FULLSCREEN_API)
-
-WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
-{
- return *this;
-}
-
-// WebFullScreenManagerProxyClient
-
-void PageClientImpl::closeFullScreenManager()
-{
- [m_wkView _closeFullScreenWindowController];
-}
-
-bool PageClientImpl::isFullScreen()
-{
- if (!m_wkView._hasFullScreenWindowController)
- return false;
-
- return m_wkView._fullScreenWindowController.isFullScreen;
-}
-
-void PageClientImpl::enterFullScreen()
-{
- [m_wkView._fullScreenWindowController enterFullScreen:nil];
-}
-
-void PageClientImpl::exitFullScreen()
-{
- [m_wkView._fullScreenWindowController exitFullScreen];
-}
-
-void PageClientImpl::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
-{
- [m_wkView._fullScreenWindowController beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
-}
-
-void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
-{
- [m_wkView._fullScreenWindowController beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
-}
-
-#endif // ENABLE(FULLSCREEN_API)
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKPrintingViewh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 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 <WebCore/IntRectHash.h>
-#import <condition_variable>
-#import <wtf/RetainPtr.h>
-
-@class WKPrintingViewData;
-@class PDFDocument;
-
-namespace WebKit {
- class ShareableBitmap;
- class WebFrameProxy;
-}
-
-@interface WKPrintingView : NSView {
-@public
- NSPrintOperation *_printOperation; // WKPrintingView is owned by the operation.
- RetainPtr<NSView> _wkView;
-
- RefPtr<WebKit::WebFrameProxy> _webFrame;
- Vector<WebCore::IntRect> _printingPageRects;
- double _totalScaleFactorForPrinting;
- HashMap<WebCore::IntRect, RefPtr<WebKit::ShareableBitmap>> _pagePreviews;
-
- Vector<uint8_t> _printedPagesData;
- RetainPtr<PDFDocument> _printedPagesPDFDocument;
-
- uint64_t _expectedComputedPagesCallback;
- HashMap<uint64_t, WebCore::IntRect> _expectedPreviewCallbacks;
- uint64_t _latestExpectedPreviewCallback;
- uint64_t _expectedPrintCallback;
-
- BOOL _isPrintingFromSecondaryThread;
- std::mutex _printingCallbackMutex;
- std::condition_variable _printingCallbackCondition;
-
- NSTimer *_autodisplayResumeTimer;
-}
-
-- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView;
-
-@end
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKPrintingViewmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,677 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 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"
-#import "WKPrintingView.h"
-
-#import "APIData.h"
-#import "Logging.h"
-#import "PDFKitImports.h"
-#import "PrintInfo.h"
-#import "ShareableBitmap.h"
-#import "WebPageProxy.h"
-#import <PDFKit/PDFKit.h>
-#import <WebCore/GraphicsContext.h>
-#import <WebCore/WebCoreObjCExtras.h>
-#import <wtf/RunLoop.h>
-
-using namespace WebKit;
-using namespace WebCore;
-
-NSString * const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin";
-NSString * const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin";
-
-NSString * const NSPrintInfoDidChangeNotification = @"NSPrintInfoDidChange";
-
-static BOOL isForcingPreviewUpdate;
-
-@implementation WKPrintingView
-
-- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView
-{
- self = [super init]; // No frame rect to pass to NSView.
- if (!self)
- return nil;
-
- _webFrame = frame;
- _wkView = wkView;
-
- return self;
-}
-
-- (void)dealloc
-{
- if (WebCoreObjCScheduleDeallocateOnMainThread([WKPrintingView class], self))
- return;
-
- [super dealloc];
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-- (void)_setAutodisplay:(BOOL)newState
-{
- if (!newState && [[_wkView window] isAutodisplay])
- [_wkView displayIfNeeded];
-
- [[_wkView window] setAutodisplay:newState];
-
- // For some reason, painting doesn't happen for a long time without this call, <rdar://problem/8975229>.
- if (newState)
- [_wkView displayIfNeeded];
-}
-
-
-- (void)_suspendAutodisplay
-{
- // A drawRect: call on WKView causes a switch to screen mode, which is slow due to relayout, and we want to avoid that.
- // Disabling autodisplay will prevent random updates from causing this, but resizing the window will still work.
- if (_autodisplayResumeTimer) {
- [_autodisplayResumeTimer invalidate];
- _autodisplayResumeTimer = nil;
- } else
- [self _setAutodisplay:NO];
-}
-
-- (void)_delayedResumeAutodisplayTimerFired
-{
- ASSERT(RunLoop::isMain());
-
- _autodisplayResumeTimer = nil;
- [self _setAutodisplay:YES];
-
- // Enabling autodisplay normally implicitly calls endPrinting() via -[WKView drawRect:], but not when content is in accelerated compositing mode.
- if (_webFrame->page())
- _webFrame->page()->endPrinting();
-}
-
-- (void)_delayedResumeAutodisplay
-{
- // AppKit calls endDocument/beginDocument when print option change. We don't want to switch between print and screen mode just for that,
- // and enabling autodisplay may result in switching into screen mode. So, autodisplay is only resumed on next run loop iteration.
- if (!_autodisplayResumeTimer) {
- _autodisplayResumeTimer = [NSTimer timerWithTimeInterval:0 target:self selector:@selector(_delayedResumeAutodisplayTimerFired) userInfo:nil repeats:NO];
- // The timer must be scheduled on main thread, because printing thread may finish before it fires.
- [[NSRunLoop mainRunLoop] addTimer:_autodisplayResumeTimer forMode:NSDefaultRunLoopMode];
- }
-}
-
-- (void)_adjustPrintingMarginsForHeaderAndFooter
-{
- ASSERT(RunLoop::isMain()); // This function calls the client, which should only be done on main thread.
-
- NSPrintInfo *info = [_printOperation printInfo];
- NSMutableDictionary *infoDictionary = [info dictionary];
-
- // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the
- // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087),
- // we stash away the unmodified top and bottom margins the first time this method is called, and we read from
- // those stashed-away values on subsequent calls.
- double originalTopMargin;
- double originalBottomMargin;
- NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey];
- if (!originalTopMarginNumber) {
- ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]);
- originalTopMargin = [info topMargin];
- originalBottomMargin = [info bottomMargin];
- [infoDictionary setObject:[NSNumber numberWithDouble:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey];
- [infoDictionary setObject:[NSNumber numberWithDouble:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey];
- } else {
- ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]);
- ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]);
- originalTopMargin = [originalTopMarginNumber doubleValue];
- originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] doubleValue];
- }
-
- CGFloat scale = [info scalingFactor];
- [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(_webFrame.get()) * scale];
- [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(_webFrame.get()) * scale];
-}
-
-- (BOOL)_isPrintingPreview
-{
- // <rdar://problem/8901041> Please add an API returning whether the current print operation is for preview.
- // Assuming that if NSPrintOperation is allowed to spawn a thread for printing, it will. Print preview doesn't spawn a thread.
- return !_isPrintingFromSecondaryThread;
-}
-
-- (void)_updatePreview
-{
- // <rdar://problem/8900923> Please add an API to force print preview update.
- ASSERT(!isForcingPreviewUpdate);
- isForcingPreviewUpdate = YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:NSPrintInfoDidChangeNotification object:nil];
- isForcingPreviewUpdate = NO;
-}
-
-- (BOOL)_hasPageRects
-{
- // WebCore always prints at least one page.
- return !_printingPageRects.isEmpty();
-}
-
-- (NSUInteger)_firstPrintedPageNumber
-{
- // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
- return [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
-}
-
-- (NSUInteger)_lastPrintedPageNumber
-{
- ASSERT([self _hasPageRects]);
-
- // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
- NSUInteger firstPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
- NSUInteger lastPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintLastPage] unsignedIntegerValue];
- if (lastPage - firstPage >= _printingPageRects.size())
- return _printingPageRects.size();
- return lastPage;
-}
-
-- (uint64_t)_expectedPreviewCallbackForRect:(const IntRect&)rect
-{
- for (HashMap<uint64_t, WebCore::IntRect>::iterator iter = _expectedPreviewCallbacks.begin(); iter != _expectedPreviewCallbacks.end(); ++iter) {
- if (iter->value == rect)
- return iter->key;
- }
- return 0;
-}
-
-struct IPCCallbackContext {
- RetainPtr<WKPrintingView> view;
- uint64_t callbackID;
-};
-
-static void pageDidDrawToImage(const ShareableBitmap::Handle& imageHandle, IPCCallbackContext* context)
-{
- ASSERT(RunLoop::isMain());
-
- WKPrintingView *view = context->view.get();
-
- // If the user has already changed print setup, then this response is obsolete. And if this callback is not in response to the latest request,
- // then the user has already moved to another page - we'll cache the response, but won't draw it.
- HashMap<uint64_t, WebCore::IntRect>::iterator iter = view->_expectedPreviewCallbacks.find(context->callbackID);
- if (iter != view->_expectedPreviewCallbacks.end()) {
- ASSERT([view _isPrintingPreview]);
-
- if (!imageHandle.isNull()) {
- RefPtr<ShareableBitmap> image = ShareableBitmap::create(imageHandle, SharedMemory::ReadOnly);
-
- if (image)
- view->_pagePreviews.add(iter->value, image);
- }
-
- view->_expectedPreviewCallbacks.remove(context->callbackID);
- bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID;
- if (receivedResponseToLatestRequest) {
- view->_latestExpectedPreviewCallback = 0;
- [view _updatePreview];
- }
- }
-}
-
-- (void)_preparePDFDataForPrintingOnSecondaryThread
-{
- ASSERT(RunLoop::isMain());
-
- if (!_webFrame->page()) {
- _printingCallbackCondition.notify_one();
- return;
- }
-
- std::lock_guard<std::mutex> lock(_printingCallbackMutex);
-
- ASSERT([self _hasPageRects]);
- ASSERT(_printedPagesData.isEmpty());
- ASSERT(!_printedPagesPDFDocument);
- ASSERT(!_expectedPrintCallback);
-
- NSUInteger firstPage = [self _firstPrintedPageNumber];
- NSUInteger lastPage = [self _lastPrintedPageNumber];
-
- ASSERT(firstPage > 0);
- ASSERT(firstPage <= lastPage);
- LOG(View, "WKPrintingView requesting PDF data for pages %u...%u", firstPage, lastPage);
-
- PrintInfo printInfo([_printOperation printInfo]);
- // Return to printing mode if we're already back to screen (e.g. due to window resizing).
- _webFrame->page()->beginPrinting(_webFrame.get(), printInfo);
-
- IPCCallbackContext* context = new IPCCallbackContext;
- RefPtr<DataCallback> callback = DataCallback::create([context](bool, API::Data* data) {
- ASSERT(RunLoop::isMain());
-
- OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
- WKPrintingView *view = context->view.get();
-
- if (context->callbackID == view->_expectedPrintCallback) {
- ASSERT(![view _isPrintingPreview]);
- ASSERT(view->_printedPagesData.isEmpty());
- ASSERT(!view->_printedPagesPDFDocument);
- if (data)
- view->_printedPagesData.append(data->bytes(), data->size());
- view->_expectedPrintCallback = 0;
- view->_printingCallbackCondition.notify_one();
- }
- });
- _expectedPrintCallback = callback->callbackID();
-
- context->view = self;
- context->callbackID = callback->callbackID();
-
- _webFrame->page()->drawPagesToPDF(_webFrame.get(), printInfo, firstPage - 1, lastPage - firstPage + 1, callback.get());
-}
-
-static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, IPCCallbackContext* context)
-{
- ASSERT(RunLoop::isMain());
-
- WKPrintingView *view = context->view.get();
-
- // If the user has already changed print setup, then this response is obsolete.
- if (context->callbackID == view->_expectedComputedPagesCallback) {
- ASSERT(RunLoop::isMain());
- ASSERT(view->_expectedPreviewCallbacks.isEmpty());
- ASSERT(!view->_latestExpectedPreviewCallback);
- ASSERT(!view->_expectedPrintCallback);
- ASSERT(view->_pagePreviews.isEmpty());
- view->_expectedComputedPagesCallback = 0;
-
- view->_printingPageRects = pageRects;
- view->_totalScaleFactorForPrinting = totalScaleFactorForPrinting;
-
- // Sanitize a response coming from the Web process.
- if (view->_printingPageRects.isEmpty())
- view->_printingPageRects.append(IntRect(0, 0, 1, 1));
- if (view->_totalScaleFactorForPrinting <= 0)
- view->_totalScaleFactorForPrinting = 1;
-
- const IntRect& lastPrintingPageRect = view->_printingPageRects[view->_printingPageRects.size() - 1];
- NSRect newFrameSize = NSMakeRect(0, 0,
- ceil(lastPrintingPageRect.maxX() * view->_totalScaleFactorForPrinting),
- ceil(lastPrintingPageRect.maxY() * view->_totalScaleFactorForPrinting));
- LOG(View, "WKPrintingView setting frame size to x:%g y:%g width:%g height:%g", newFrameSize.origin.x, newFrameSize.origin.y, newFrameSize.size.width, newFrameSize.size.height);
- [view setFrame:newFrameSize];
-
- if ([view _isPrintingPreview]) {
- // Show page count, and ask for an actual image to replace placeholder.
- [view _updatePreview];
- } else {
- // When printing, request everything we'll need beforehand.
- [view _preparePDFDataForPrintingOnSecondaryThread];
- }
- }
-}
-
-- (BOOL)_askPageToComputePageRects
-{
- ASSERT(RunLoop::isMain());
-
- if (!_webFrame->page())
- return NO;
-
- ASSERT(!_expectedComputedPagesCallback);
-
- IPCCallbackContext* context = new IPCCallbackContext;
- RefPtr<ComputedPagesCallback> callback = ComputedPagesCallback::create([context](bool, const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting) {
- OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
- pageDidComputePageRects(pageRects, totalScaleFactorForPrinting, context);
- });
- _expectedComputedPagesCallback = callback->callbackID();
- context->view = self;
- context->callbackID = _expectedComputedPagesCallback;
-
- _webFrame->page()->computePagesForPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]), callback.release());
- return YES;
-}
-
-static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
-{
- ASSERT(RunLoop::isMain());
-
- WKPrintingView *view = static_cast<WKPrintingView *>(untypedContext);
- std::lock_guard<std::mutex> lock(view->_printingCallbackMutex);
-
- // We may have received page rects while a message to call this function traveled from secondary thread to main one.
- if ([view _hasPageRects]) {
- [view _preparePDFDataForPrintingOnSecondaryThread];
- return;
- }
-
- // A request for pages has already been made, just wait for it to finish.
- if (view->_expectedComputedPagesCallback)
- return;
-
- [view _askPageToComputePageRects];
-}
-
-- (BOOL)knowsPageRange:(NSRangePointer)range
-{
- LOG(View, "-[WKPrintingView %p knowsPageRange:], %s, %s", self, [self _hasPageRects] ? "print data is available" : "print data is not available yet", RunLoop::isMain() ? "on main thread" : "on secondary thread");
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
-
- // Assuming that once we switch to printing from a secondary thread, we don't go back.
- ASSERT(!_isPrintingFromSecondaryThread || !RunLoop::isMain());
- if (!RunLoop::isMain())
- _isPrintingFromSecondaryThread = YES;
-
- if (!_webFrame->page()) {
- *range = NSMakeRange(1, NSIntegerMax);
- return YES;
- }
-
- [self _suspendAutodisplay];
-
- [self performSelectorOnMainThread:@selector(_adjustPrintingMarginsForHeaderAndFooter) withObject:nil waitUntilDone:YES];
-
- if ([self _hasPageRects])
- *range = NSMakeRange(1, _printingPageRects.size());
- else if (!RunLoop::isMain()) {
- ASSERT(![self _isPrintingPreview]);
- std::unique_lock<std::mutex> lock(_printingCallbackMutex);
- callOnMainThread(prepareDataForPrintingOnSecondaryThread, self);
- _printingCallbackCondition.wait(lock);
- *range = NSMakeRange(1, _printingPageRects.size());
- } else {
- ASSERT([self _isPrintingPreview]);
-
- // If a request for pages hasn't already been made, make it now.
- if (!_expectedComputedPagesCallback)
- [self _askPageToComputePageRects];
-
- *range = NSMakeRange(1, NSIntegerMax);
- }
- return YES;
-}
-
-- (unsigned)_pageForRect:(NSRect)rect
-{
- // Assuming that rect exactly matches one of the pages.
- for (size_t i = 0; i < _printingPageRects.size(); ++i) {
- IntRect currentRect(_printingPageRects[i]);
- currentRect.scale(_totalScaleFactorForPrinting);
- if (rect.origin.y == currentRect.y() && rect.origin.x == currentRect.x())
- return i + 1;
- }
- ASSERT_NOT_REACHED();
- return 0; // Invalid page number.
-}
-
-- (void)_drawPDFDocument:(PDFDocument *)pdfDocument page:(unsigned)page atPoint:(NSPoint)point
-{
- if (!pdfDocument) {
- LOG_ERROR("Couldn't create a PDF document with data passed for preview");
- return;
- }
-
- PDFPage *pdfPage;
- @try {
- pdfPage = [pdfDocument pageAtIndex:page];
- } @catch (id exception) {
- LOG_ERROR("Preview data doesn't have page %d: %@", page, exception);
- return;
- }
-
- NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
- CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]);
-
- CGContextSaveGState(context);
- CGContextTranslateCTM(context, point.x, point.y);
- CGContextScaleCTM(context, _totalScaleFactorForPrinting, -_totalScaleFactorForPrinting);
- CGContextTranslateCTM(context, 0, -[pdfPage boundsForBox:kPDFDisplayBoxMediaBox].size.height);
- [pdfPage drawWithBox:kPDFDisplayBoxMediaBox];
-
- CGAffineTransform transform = CGContextGetCTM(context);
-
- for (PDFAnnotation *annotation in [pdfPage annotations]) {
- if (![annotation isKindOfClass:pdfAnnotationLinkClass()])
- continue;
-
- PDFAnnotationLink *linkAnnotation = (PDFAnnotationLink *)annotation;
- NSURL *url = [linkAnnotation URL];
- if (!url)
- continue;
-
- CGRect urlRect = NSRectToCGRect([linkAnnotation bounds]);
- CGRect transformedRect = CGRectApplyAffineTransform(urlRect, transform);
- CGPDFContextSetURLForRect(context, (CFURLRef)url, transformedRect);
- }
-
- CGContextRestoreGState(context);
-}
-
-- (void)_drawPreview:(NSRect)nsRect
-{
- ASSERT(RunLoop::isMain());
-
- IntRect scaledPrintingRect(nsRect);
- scaledPrintingRect.scale(1 / _totalScaleFactorForPrinting);
- IntSize imageSize(nsRect.size);
- imageSize.scale(_webFrame->page()->deviceScaleFactor());
- HashMap<WebCore::IntRect, RefPtr<ShareableBitmap>>::iterator pagePreviewIterator = _pagePreviews.find(scaledPrintingRect);
- if (pagePreviewIterator == _pagePreviews.end()) {
- // It's too early to ask for page preview if we don't even know page size and scale.
- if ([self _hasPageRects]) {
- if (uint64_t existingCallback = [self _expectedPreviewCallbackForRect:scaledPrintingRect]) {
- // We've already asked for a preview of this page, and are waiting for response.
- // There is no need to ask again.
- _latestExpectedPreviewCallback = existingCallback;
- } else {
- // Preview isn't available yet, request it asynchronously.
- if (!_webFrame->page())
- return;
-
- // Return to printing mode if we're already back to screen (e.g. due to window resizing).
- _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]));
-
- IPCCallbackContext* context = new IPCCallbackContext;
- RefPtr<ImageCallback> callback = ImageCallback::create([context](bool, const ShareableBitmap::Handle& imageHandle) {
- OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
- pageDidDrawToImage(imageHandle, context);
- });
- _latestExpectedPreviewCallback = callback->callbackID();
- _expectedPreviewCallbacks.add(_latestExpectedPreviewCallback, scaledPrintingRect);
-
- context->view = self;
- context->callbackID = callback->callbackID();
-
- _webFrame->page()->drawRectToImage(_webFrame.get(), PrintInfo([_printOperation printInfo]), scaledPrintingRect, imageSize, callback.get());
- return;
- }
- }
-
- // FIXME: Draw a placeholder
- return;
- }
-
- RefPtr<ShareableBitmap> bitmap = pagePreviewIterator->value;
- CGContextRef cgContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
-
- GraphicsContext context(cgContext);
- GraphicsContextStateSaver stateSaver(context);
-
- bitmap->paint(context, _webFrame->page()->deviceScaleFactor(), IntPoint(nsRect.origin), bitmap->bounds());
-}
-
-- (void)drawRect:(NSRect)nsRect
-{
- LOG(View, "WKPrintingView %p printing rect x:%g, y:%g, width:%g, height:%g%s", self, nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height, [self _isPrintingPreview] ? " for preview" : "");
-
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
-
- if (!_webFrame->page())
- return;
-
- if ([self _isPrintingPreview]) {
- [self _drawPreview:nsRect];
- return;
- }
-
- ASSERT(!RunLoop::isMain());
- ASSERT(!_printedPagesData.isEmpty()); // Prepared by knowsPageRange:
-
- if (!_printedPagesPDFDocument) {
- RetainPtr<NSData> pdfData = adoptNS([[NSData alloc] initWithBytes:_printedPagesData.data() length:_printedPagesData.size()]);
- _printedPagesPDFDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:pdfData.get()]);
- }
-
- unsigned printedPageNumber = [self _pageForRect:nsRect] - [self _firstPrintedPageNumber];
- [self _drawPDFDocument:_printedPagesPDFDocument.get() page:printedPageNumber atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)];
-}
-
-- (void)_drawPageBorderWithSizeOnMainThread:(NSSize)borderSize
-{
- ASSERT(RunLoop::isMain());
-
- // When printing from a secondary thread, the main thread doesn't have graphics context and printing operation set up.
- NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
- [NSGraphicsContext setCurrentContext:[_printOperation context]];
-
- ASSERT(![NSPrintOperation currentOperation]);
- [NSPrintOperation setCurrentOperation:_printOperation];
-
- [self drawPageBorderWithSize:borderSize];
-
- [NSPrintOperation setCurrentOperation:nil];
- [NSGraphicsContext setCurrentContext:currentContext];
-}
-
-- (void)drawPageBorderWithSize:(NSSize)borderSize
-{
- ASSERT(NSEqualSizes(borderSize, [[_printOperation printInfo] paperSize]));
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
-
- if (!RunLoop::isMain()) {
- // Don't call the client from a secondary thread.
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[WKPrintingView instanceMethodSignatureForSelector:@selector(_drawPageBorderWithSizeOnMainThread:)]];
- [invocation setSelector:@selector(_drawPageBorderWithSizeOnMainThread:)];
- [invocation setArgument:&borderSize atIndex:2];
- [invocation performSelectorOnMainThread:@selector(invokeWithTarget:) withObject:self waitUntilDone:YES];
- return;
- }
-
- if (!_webFrame->page())
- return;
-
- // The header and footer rect height scales with the page, but the width is always
- // all the way across the printed page (inset by printing margins).
- NSPrintInfo *printInfo = [_printOperation printInfo];
- CGFloat scale = [printInfo scalingFactor];
- NSSize paperSize = [printInfo paperSize];
- CGFloat headerFooterLeft = [printInfo leftMargin] / scale;
- CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
- NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(_webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get()));
- NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(_webFrame.get()));
-
- NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
- [currentContext saveGraphicsState];
- NSRectClip(headerRect);
- _webFrame->page()->drawHeader(_webFrame.get(), headerRect);
- [currentContext restoreGraphicsState];
-
- [currentContext saveGraphicsState];
- NSRectClip(footerRect);
- _webFrame->page()->drawFooter(_webFrame.get(), footerRect);
- [currentContext restoreGraphicsState];
-}
-
-- (NSRect)rectForPage:(NSInteger)page
-{
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
- if (![self _hasPageRects]) {
- LOG(View, "-[WKPrintingView %p rectForPage:%d] - data is not yet available", self, (int)page);
- if (!_webFrame->page()) {
- // We may have not told AppKit how many pages there are, so it will try to print until a null rect is returned.
- return NSMakeRect(0, 0, 0, 0);
- }
- // We must be still calculating the page range.
- ASSERT(_expectedComputedPagesCallback);
- return NSMakeRect(0, 0, 1, 1);
- }
-
- // If Web process crashes while computing page rects, we never tell AppKit how many pages there are.
- // Returning a null rect prevents selecting non-existent pages in preview dialog.
- if (static_cast<unsigned>(page) > _printingPageRects.size()) {
- ASSERT(!_webFrame->page());
- return NSMakeRect(0, 0, 0, 0);
- }
-
- IntRect rect = _printingPageRects[page - 1];
- rect.scale(_totalScaleFactorForPrinting);
- LOG(View, "-[WKPrintingView %p rectForPage:%d] -> x %d, y %d, width %d, height %d", self, (int)page, rect.x(), rect.y(), rect.width(), rect.height());
- return rect;
-}
-
-// Temporary workaround for <rdar://problem/8944535>. Force correct printout positioning.
-- (NSPoint)locationOfPrintRect:(NSRect)aRect
-{
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
- return NSMakePoint([[_printOperation printInfo] leftMargin], [[_printOperation printInfo] bottomMargin]);
-}
-
-- (void)beginDocument
-{
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
-
- // Forcing preview update gets us here, but page setup hasn't actually changed.
- if (isForcingPreviewUpdate)
- return;
-
- LOG(View, "-[WKPrintingView %p beginDocument]", self);
-
- [super beginDocument];
-
- [self _suspendAutodisplay];
-}
-
-- (void)endDocument
-{
- ASSERT(_printOperation == [NSPrintOperation currentOperation]);
-
- // Forcing preview update gets us here, but page setup hasn't actually changed.
- if (isForcingPreviewUpdate)
- return;
-
- LOG(View, "-[WKPrintingView %p endDocument] - clearing cached data", self);
-
- // Both existing data and pending responses are now obsolete.
- _printingPageRects.clear();
- _totalScaleFactorForPrinting = 1;
- _pagePreviews.clear();
- _printedPagesData.clear();
- _printedPagesPDFDocument = nullptr;
- _expectedComputedPagesCallback = 0;
- _expectedPreviewCallbacks.clear();
- _latestExpectedPreviewCallback = 0;
- _expectedPrintCallback = 0;
-
- [self _delayedResumeAutodisplay];
-
- [super endDocument];
-}
-@end
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009, 2010 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. ``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
- * 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 WKTextInputWindowController_h
-#define WKTextInputWindowController_h
-
-#if USE(APPKIT)
-
-@class WKTextInputPanel;
-
-@interface WKTextInputWindowController : NSObject {
- WKTextInputPanel *_panel;
-}
-
-+ (WKTextInputWindowController *)sharedTextInputWindowController;
-
-- (NSTextInputContext *)inputContext;
-- (BOOL)interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string;
-
-- (BOOL)hasMarkedText;
-- (void)unmarkText;
-
-@end
-
-#endif // USE(APPKIT)
-
-#endif // WKTextInputWindowController_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllermm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -1,214 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 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"
-#import "WKTextInputWindowController.h"
-
-#if USE(APPKIT)
-
-#import <WebKitSystemInterface.h>
-
-@interface WKTextInputView : NSTextView {
-}
-@end
-
-@implementation WKTextInputView
-
-- (NSArray *)validAttributesForMarkedText
-{
- // Let TSM know that a bottom input window would be created for marked text.
- NSArray *regularAttributes = [super validAttributesForMarkedText];
- NSMutableArray *floatingWindowAttributes = [NSMutableArray arrayWithArray:regularAttributes];
- [floatingWindowAttributes addObject:@"__NSUsesFloatingInputWindow"];
- return floatingWindowAttributes;
-}
-
-@end
-
-@interface WKTextInputPanel : NSPanel {
- NSTextView *_inputTextView;
-}
-
-- (NSTextInputContext *)_inputContext;
-- (BOOL)_interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string;
-
-- (BOOL)_hasMarkedText;
-- (void)_unmarkText;
-
-@end
-
-#define inputWindowHeight 20
-
-@implementation WKTextInputPanel
-
-- (void)dealloc
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [_inputTextView release];
-
- [super dealloc];
-}
-
-- (id)init
-{
- self = [super initWithContentRect:NSZeroRect styleMask:WKGetInputPanelWindowStyle() backing:NSBackingStoreBuffered defer:YES];
- if (!self)
- return nil;
-
- // Set the frame size.
- NSRect visibleFrame = [[NSScreen mainScreen] visibleFrame];
- NSRect frame = NSMakeRect(visibleFrame.origin.x, visibleFrame.origin.y, visibleFrame.size.width, inputWindowHeight);
-
- [self setFrame:frame display:NO];
-
- _inputTextView = [[WKTextInputView alloc] initWithFrame:[(NSView *)self.contentView frame]];
- _inputTextView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable | NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin;
-
- NSScrollView* scrollView = [[NSScrollView alloc] initWithFrame:[(NSView *)self.contentView frame]];
- scrollView.documentView = _inputTextView;
- self.contentView = scrollView;
- [scrollView release];
-
- [self setFloatingPanel:YES];
-
- return self;
-}
-
-- (void)_unmarkText
-{
- [_inputTextView setString:@""];
- [self orderOut:nil];
-}
-
-- (BOOL)_interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- BOOL hadMarkedText = [_inputTextView hasMarkedText];
-#pragma clang diagnostic pop
-
- *string = nil;
-
- // Let TSM know that a bottom input window would be created for marked text.
- // FIXME: Can be removed once we can rely on __NSUsesFloatingInputWindow (or a better API) being available everywhere.
- EventRef carbonEvent = static_cast<EventRef>(const_cast<void*>([event eventRef]));
- if (carbonEvent) {
- Boolean ignorePAH = true;
- SetEventParameter(carbonEvent, 'iPAH', typeBoolean, sizeof(ignorePAH), &ignorePAH);
- }
-
- if (![[_inputTextView inputContext] handleEvent:event])
- return NO;
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- if ([_inputTextView hasMarkedText]) {
-#pragma clang diagnostic pop
- // Don't show the input method window for dead keys
- if ([[event characters] length] > 0)
- [self orderFront:nil];
-
- return YES;
- }
-
- bool shouldReturnTextString = hadMarkedText;
-
- // In the updated Cocoa text input model spec, we always want to return the text even if the text view didn't have marked text.
- if (!usingLegacyCocoaTextInput)
- shouldReturnTextString = true;
-
- if (shouldReturnTextString) {
- [self orderOut:nil];
-
- NSString *text = [[_inputTextView textStorage] string];
- if ([text length] > 0)
- *string = [[text copy] autorelease];
- }
-
- [_inputTextView setString:@""];
- return hadMarkedText;
-}
-
-- (NSTextInputContext *)_inputContext
-{
- return [_inputTextView inputContext];
-}
-
-- (BOOL)_hasMarkedText
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- return [_inputTextView hasMarkedText];
-#pragma clang diagnostic pop
-}
-
-@end
-
-@implementation WKTextInputWindowController
-
-+ (WKTextInputWindowController *)sharedTextInputWindowController
-{
- static WKTextInputWindowController *textInputWindowController;
- if (!textInputWindowController)
- textInputWindowController = [[WKTextInputWindowController alloc] init];
-
- return textInputWindowController;
-}
-
-- (id)init
-{
- self = [super init];
- if (!self)
- return nil;
-
- _panel = [[WKTextInputPanel alloc] init];
-
- return self;
-}
-
-- (NSTextInputContext *)inputContext
-{
- return [_panel _inputContext];
-}
-
-- (BOOL)hasMarkedText
-{
- return [_panel _hasMarkedText];
-}
-
-- (BOOL)interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string
-{
- return [_panel _interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:string];
-}
-
-- (void)unmarkText
-{
- [_panel _unmarkText];
-}
-
-@end
-
-#endif // USE(APPKIT)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacFindIndicatorWindowhfromrev164600trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2010 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 FindIndicatorWindow_h
+#define FindIndicatorWindow_h
+
+#import "WebKitSystemInterface.h"
+#import <wtf/Noncopyable.h>
+#import <wtf/RefPtr.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/RunLoop.h>
+
+@class WKFindIndicatorWindowAnimation;
+@class WKView;
+
+namespace WebKit {
+
+class FindIndicator;
+
+class FindIndicatorWindow {
+ WTF_MAKE_NONCOPYABLE(FindIndicatorWindow);
+
+public:
+ explicit FindIndicatorWindow(WKView *);
+ ~FindIndicatorWindow();
+
+ void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
+
+private:
+ void closeWindow();
+
+ void startFadeOutTimerFired();
+
+ void fadeOutAnimationCallback(double);
+ void fadeOutAnimationDidEnd();
+
+ void bounceAnimationCallback(double);
+ void bounceAnimationDidEnd();
+
+ WKView* m_wkView;
+ RefPtr<FindIndicator> m_findIndicator;
+ RetainPtr<NSWindow> m_findIndicatorWindow;
+
+ WKWindowBounceAnimationContextRef m_bounceAnimationContext;
+ RetainPtr<WKFindIndicatorWindowAnimation> m_bounceAnimation;
+
+ RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
+ RetainPtr<WKFindIndicatorWindowAnimation> m_fadeOutAnimation;
+};
+
+} // namespace WebKit
+
+#endif // FindIndicatorWindow_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacFindIndicatorWindowh"></a>
<div class="propset"><h4>Property changes: trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessmacFindIndicatorWindowmmfromrev164600trunkSourceWebKit2UIProcessAPImacFindIndicatorWindowmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,246 @@
</span><ins>+/*
+ * Copyright (C) 2010 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"
+#import "FindIndicatorWindow.h"
+
+#import "FindIndicator.h"
+#import "WKView.h"
+#import <WebCore/GraphicsContext.h>
+
+static const double bounceAnimationDuration = 0.12;
+static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
+static const double fadeOutAnimationDuration = 0.3;
+
+using namespace WebCore;
+
+@interface WKFindIndicatorView : NSView {
+ RefPtr<WebKit::FindIndicator> _findIndicator;
+}
+
+- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator;
+@end
+
+@implementation WKFindIndicatorView
+
+- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator
+{
+ if ((self = [super initWithFrame:NSZeroRect]))
+ _findIndicator = findIndicator;
+
+ return self;
+}
+
+- (void)drawRect:(NSRect)rect
+{
+ GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]));
+
+ _findIndicator->draw(graphicsContext, enclosingIntRect(rect));
+}
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
+@end
+
+@interface WKFindIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> {
+ WebKit::FindIndicatorWindow* _findIndicatorWindow;
+ void (WebKit::FindIndicatorWindow::*_animationProgressCallback)(double progress);
+ void (WebKit::FindIndicatorWindow::*_animationDidEndCallback)();
+}
+
+- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
+ animationDuration:(CFTimeInterval)duration
+ animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
+ animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback;
+@end
+
+@implementation WKFindIndicatorWindowAnimation
+
+- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow
+ animationDuration:(CFTimeInterval)animationDuration
+ animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
+ animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback
+{
+ if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) {
+ _findIndicatorWindow = findIndicatorWindow;
+ _animationProgressCallback = animationProgressCallback;
+ _animationDidEndCallback = animationDidEndCallback;
+ [self setDelegate:self];
+ [self setAnimationBlockingMode:NSAnimationNonblocking];
+ }
+ return self;
+}
+
+- (void)setCurrentProgress:(NSAnimationProgress)progress
+{
+ (_findIndicatorWindow->*_animationProgressCallback)(progress);
+}
+
+- (void)animationDidEnd:(NSAnimation *)animation
+{
+ ASSERT(animation == self);
+
+ (_findIndicatorWindow->*_animationDidEndCallback)();
+}
+
+@end
+
+namespace WebKit {
+
+FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
+ : m_wkView(wkView)
+ , m_bounceAnimationContext(0)
+ , m_startFadeOutTimer(RunLoop::main(), this, &FindIndicatorWindow::startFadeOutTimerFired)
+{
+}
+
+FindIndicatorWindow::~FindIndicatorWindow()
+{
+ closeWindow();
+}
+
+void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
+{
+ if (m_findIndicator == findIndicator)
+ return;
+
+ m_findIndicator = findIndicator;
+
+ // Get rid of the old window.
+ closeWindow();
+
+ if (!m_findIndicator)
+ return;
+
+ NSRect contentRect = m_findIndicator->frameRect();
+ NSRect windowFrameRect = NSIntegralRect([m_wkView convertRect:contentRect toView:nil]);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ windowFrameRect.origin = [[m_wkView window] convertBaseToScreen:windowFrameRect.origin];
+#pragma clang diagnostic pop
+ NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask];
+
+ m_findIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO]);
+
+ [m_findIndicatorWindow setBackgroundColor:[NSColor clearColor]];
+ [m_findIndicatorWindow setOpaque:NO];
+ [m_findIndicatorWindow setIgnoresMouseEvents:YES];
+
+ RetainPtr<WKFindIndicatorView> findIndicatorView = adoptNS([[WKFindIndicatorView alloc] _initWithFindIndicator:m_findIndicator]);
+ [m_findIndicatorWindow setContentView:findIndicatorView.get()];
+
+ [[m_wkView window] addChildWindow:m_findIndicatorWindow.get() ordered:NSWindowAbove];
+ [m_findIndicatorWindow setReleasedWhenClosed:NO];
+
+ if (animate) {
+ // Start the bounce animation.
+ m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
+ m_bounceAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
+ animationDuration:bounceAnimationDuration
+ animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
+ animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
+ [m_bounceAnimation startAnimation];
+ }
+
+ if (fadeOut)
+ m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
+}
+
+void FindIndicatorWindow::closeWindow()
+{
+ if (!m_findIndicatorWindow)
+ return;
+
+ m_startFadeOutTimer.stop();
+
+ if (m_fadeOutAnimation) {
+ [m_fadeOutAnimation stopAnimation];
+ m_fadeOutAnimation = nullptr;
+ }
+
+ if (m_bounceAnimation) {
+ [m_bounceAnimation stopAnimation];
+ m_bounceAnimation = nullptr;
+ }
+
+ if (m_bounceAnimationContext)
+ WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
+
+ [[m_findIndicatorWindow parentWindow] removeChildWindow:m_findIndicatorWindow.get()];
+ [m_findIndicatorWindow close];
+ m_findIndicatorWindow = nullptr;
+}
+
+void FindIndicatorWindow::startFadeOutTimerFired()
+{
+ ASSERT(!m_fadeOutAnimation);
+
+ m_fadeOutAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
+ animationDuration:fadeOutAnimationDuration
+ animationProgressCallback:&FindIndicatorWindow::fadeOutAnimationCallback
+ animationDidEndCallback:&FindIndicatorWindow::fadeOutAnimationDidEnd]);
+ [m_fadeOutAnimation startAnimation];
+}
+
+void FindIndicatorWindow::fadeOutAnimationCallback(double progress)
+{
+ ASSERT(m_fadeOutAnimation);
+
+ [m_findIndicatorWindow setAlphaValue:1.0 - progress];
+}
+
+void FindIndicatorWindow::fadeOutAnimationDidEnd()
+{
+ ASSERT(m_fadeOutAnimation);
+ ASSERT(m_findIndicatorWindow);
+
+ closeWindow();
+}
+
+void FindIndicatorWindow::bounceAnimationCallback(double progress)
+{
+ ASSERT(m_bounceAnimation);
+ ASSERT(m_bounceAnimationContext);
+
+ WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress);
+}
+
+void FindIndicatorWindow::bounceAnimationDidEnd()
+{
+ ASSERT(m_bounceAnimation);
+ ASSERT(m_bounceAnimationContext);
+ ASSERT(m_findIndicatorWindow);
+
+ WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
+ m_bounceAnimationContext = 0;
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPDFViewControllerhfromrev164600trunkSourceWebKit2UIProcessAPImacPDFViewControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/PDFViewController.h (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.h) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PDFViewController.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/PDFViewController.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2011 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 PDFViewController_h
+#define PDFViewController_h
+
+#include "WebFindOptions.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
+
+@class PDFView;
+@class WKView;
+@class WKPDFView;
+
+namespace IPC {
+class DataReference;
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class PDFViewController {
+ WTF_MAKE_NONCOPYABLE(PDFViewController);
+
+public:
+ static PassOwnPtr<PDFViewController> create(WKView *);
+ ~PDFViewController();
+
+ WKView* wkView() const { return m_wkView; }
+ WebPageProxy* page() const;
+ NSView* pdfView() const;
+
+ void setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const IPC::DataReference&);
+
+ double zoomFactor() const;
+ void setZoomFactor(double);
+
+ static Class pdfPreviewViewClass();
+
+ bool forwardScrollWheelEvent(NSEvent *);
+
+ NSPrintOperation *makePrintOperation(NSPrintInfo *);
+ void openPDFInFinder();
+ void savePDFToDownloadsFolder();
+ void linkClicked(const String& url);
+ void print();
+
+ void findString(const String&, FindOptions, unsigned maxMatchCount);
+ void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
+
+private:
+ explicit PDFViewController(WKView *);
+
+ static Class pdfDocumentClass();
+ static NSBundle* pdfKitBundle();
+
+ WKView* m_wkView;
+
+ RetainPtr<WKPDFView> m_wkPDFView;
+ PDFView* m_pdfView;
+
+ RetainPtr<NSString> m_suggestedFilename;
+ RetainPtr<CFDataRef> m_pdfData;
+
+ String m_temporaryPDFUUID;
+};
+
+} // namespace WebKit
+
+#endif // PDFViewController_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPDFViewControllerh"></a>
<div class="propset"><h4>Property changes: trunk/Source/WebKit2/UIProcess/mac/PDFViewController.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessmacPDFViewControllermmfromrev164600trunkSourceWebKit2UIProcessAPImacPDFViewControllermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/PDFViewController.mm (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PDFViewController.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/PDFViewController.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,678 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2011 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"
+#import "PDFViewController.h"
+
+#import "DataReference.h"
+#import "WKAPICast.h"
+#import "WKViewPrivate.h"
+#import "WebData.h"
+#import "WebEventFactory.h"
+#import "WebPageGroup.h"
+#import "WebPageProxy.h"
+#import "WebPreferences.h"
+#import <PDFKit/PDFKit.h>
+#import <WebCore/LocalizedStrings.h>
+#import <WebCore/UUID.h>
+#import <wtf/ObjcRuntimeExtras.h>
+#import <wtf/text/CString.h>
+#import <wtf/text/WTFString.h>
+
+// Redeclarations of PDFKit notifications. We can't use the API since we use a weak link to the framework.
+#define _webkit_PDFViewDisplayModeChangedNotification @"PDFViewDisplayModeChanged"
+#define _webkit_PDFViewScaleChangedNotification @"PDFViewScaleChanged"
+#define _webkit_PDFViewPageChangedNotification @"PDFViewChangedPage"
+
+using namespace WebCore;
+using namespace WebKit;
+
+@class PDFDocument;
+@class PDFView;
+
+@interface PDFDocument (PDFDocumentDetails)
+- (NSPrintOperation *)getPrintOperationForPrintInfo:(NSPrintInfo *)printInfo autoRotate:(BOOL)doRotate;
+@end
+
+extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
+
+// MARK: C UTILITY FUNCTIONS
+
+static void _applicationInfoForMIMEType(NSString *type, NSString **name, NSImage **image)
+{
+ ASSERT(name);
+ ASSERT(image);
+
+ CFURLRef appURL = 0;
+
+ OSStatus error = LSCopyApplicationForMIMEType((CFStringRef)type, kLSRolesAll, &appURL);
+ if (error != noErr)
+ return;
+
+ NSString *appPath = [(NSURL *)appURL path];
+ if (appURL)
+ CFRelease(appURL);
+
+ *image = [[NSWorkspace sharedWorkspace] iconForFile:appPath];
+ [*image setSize:NSMakeSize(16, 16)];
+
+ *name = [[NSFileManager defaultManager] displayNameAtPath:appPath];
+}
+
+// FIXME 4182876: We can eliminate this function in favor if -isEqual: if [PDFSelection isEqual:] is overridden
+// to compare contents.
+static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selectionB)
+{
+ NSArray *aPages = [selectionA pages];
+ NSArray *bPages = [selectionB pages];
+
+ if (![aPages isEqual:bPages])
+ return NO;
+
+ NSUInteger count = [aPages count];
+ for (NSUInteger i = 0; i < count; ++i) {
+ NSRect aBounds = [selectionA boundsForPage:[aPages objectAtIndex:i]];
+ NSRect bBounds = [selectionB boundsForPage:[bPages objectAtIndex:i]];
+ if (!NSEqualRects(aBounds, bBounds))
+ return NO;
+ }
+
+ return YES;
+}
+
+@interface WKPDFView : NSView
+{
+ PDFViewController* _pdfViewController;
+
+ RetainPtr<NSView> _pdfPreviewView;
+ PDFView *_pdfView;
+ BOOL _ignoreScaleAndDisplayModeAndPageNotifications;
+ BOOL _willUpdatePreferencesSoon;
+}
+
+- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController;
+- (void)invalidate;
+- (PDFView *)pdfView;
+- (void)setDocument:(PDFDocument *)pdfDocument;
+
+- (BOOL)forwardScrollWheelEvent:(NSEvent *)wheelEvent;
+- (void)_applyPDFPreferences;
+- (PDFSelection *)_nextMatchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag fromSelection:(PDFSelection *)initialSelection startInSelection:(BOOL)startInSelection;
+@end
+
+@implementation WKPDFView
+
+- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController
+{
+ if ((self = [super initWithFrame:frame])) {
+ _pdfViewController = pdfViewController;
+
+ [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+ Class previewViewClass = PDFViewController::pdfPreviewViewClass();
+ ASSERT(previewViewClass);
+
+ _pdfPreviewView = adoptNS([[previewViewClass alloc] initWithFrame:frame]);
+ [_pdfPreviewView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [self addSubview:_pdfPreviewView.get()];
+
+ _pdfView = [_pdfPreviewView.get() performSelector:@selector(pdfView)];
+ [_pdfView setDelegate:self];
+ }
+
+ return self;
+}
+
+- (void)invalidate
+{
+ _pdfViewController = 0;
+}
+
+- (PDFView *)pdfView
+{
+ return _pdfView;
+}
+
+- (void)setDocument:(PDFDocument *)pdfDocument
+{
+ _ignoreScaleAndDisplayModeAndPageNotifications = YES;
+ [_pdfView setDocument:pdfDocument];
+ [self _applyPDFPreferences];
+ _ignoreScaleAndDisplayModeAndPageNotifications = NO;
+}
+
+- (void)_applyPDFPreferences
+{
+ if (!_pdfViewController)
+ return;
+
+ WebPreferences *preferences = _pdfViewController->page()->pageGroup()->preferences();
+
+ CGFloat scaleFactor = preferences->pdfScaleFactor();
+ if (!scaleFactor)
+ [_pdfView setAutoScales:YES];
+ else {
+ [_pdfView setAutoScales:NO];
+ [_pdfView setScaleFactor:scaleFactor];
+ }
+ [_pdfView setDisplayMode:preferences->pdfDisplayMode()];
+}
+
+- (void)_updatePreferences:(id)ignored
+{
+ _willUpdatePreferencesSoon = NO;
+
+ if (!_pdfViewController)
+ return;
+
+ WebPreferences* preferences = _pdfViewController->page()->pageGroup()->preferences();
+
+ CGFloat scaleFactor = [_pdfView autoScales] ? 0 : [_pdfView scaleFactor];
+ preferences->setPDFScaleFactor(scaleFactor);
+ preferences->setPDFDisplayMode([_pdfView displayMode]);
+}
+
+- (void)_updatePreferencesSoon
+{
+ if (_willUpdatePreferencesSoon)
+ return;
+
+ [self performSelector:@selector(_updatePreferences:) withObject:nil afterDelay:0];
+ _willUpdatePreferencesSoon = YES;
+}
+
+- (void)_scaleOrDisplayModeOrPageChanged:(NSNotification *)notification
+{
+ ASSERT_ARG(notification, [notification object] == _pdfView);
+ if (!_ignoreScaleAndDisplayModeAndPageNotifications)
+ [self _updatePreferencesSoon];
+}
+
+- (void)_openWithFinder:(id)sender
+{
+ _pdfViewController->openPDFInFinder();
+}
+
+- (PDFSelection *)_nextMatchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag fromSelection:(PDFSelection *)initialSelection startInSelection:(BOOL)startInSelection
+{
+ if (![string length])
+ return nil;
+
+ int options = 0;
+ if (!forward)
+ options |= NSBackwardsSearch;
+
+ if (!caseFlag)
+ options |= NSCaseInsensitiveSearch;
+
+ PDFDocument *document = [_pdfView document];
+
+ PDFSelection *selectionForInitialSearch = [initialSelection copy];
+ if (startInSelection) {
+ // Initially we want to include the selected text in the search. So we must modify the starting search
+ // selection to fit PDFDocument's search requirements: selection must have a length >= 1, begin before
+ // the current selection (if searching forwards) or after (if searching backwards).
+ int initialSelectionLength = [[initialSelection string] length];
+ if (forward) {
+ [selectionForInitialSearch extendSelectionAtStart:1];
+ [selectionForInitialSearch extendSelectionAtEnd:-initialSelectionLength];
+ } else {
+ [selectionForInitialSearch extendSelectionAtEnd:1];
+ [selectionForInitialSearch extendSelectionAtStart:-initialSelectionLength];
+ }
+ }
+ PDFSelection *foundSelection = [document findString:string fromSelection:selectionForInitialSearch withOptions:options];
+ [selectionForInitialSearch release];
+
+ // If we first searched in the selection, and we found the selection, search again from just past the selection
+ if (startInSelection && _PDFSelectionsAreEqual(foundSelection, initialSelection))
+ foundSelection = [document findString:string fromSelection:initialSelection withOptions:options];
+
+ if (!foundSelection && wrapFlag)
+ foundSelection = [document findString:string fromSelection:nil withOptions:options];
+
+ return foundSelection;
+}
+
+- (NSUInteger)_countMatches:(NSString *)string caseSensitive:(BOOL)caseFlag
+{
+ if (![string length])
+ return 0;
+
+ int options = caseFlag ? 0 : NSCaseInsensitiveSearch;
+
+ return [[[_pdfView document] findString:string withOptions:options] count];
+}
+
+// MARK: NSView overrides
+
+- (void)viewDidMoveToWindow
+{
+ if (![self window])
+ return;
+
+ NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+ [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewScaleChangedNotification object:_pdfView];
+ [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView];
+ [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewPageChangedNotification object:_pdfView];
+}
+
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+ if (![self window])
+ return;
+
+ NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+ [notificationCenter removeObserver:self name:_webkit_PDFViewScaleChangedNotification object:_pdfView];
+ [notificationCenter removeObserver:self name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView];
+ [notificationCenter removeObserver:self name:_webkit_PDFViewPageChangedNotification object:_pdfView];
+}
+
+- (NSView *)hitTest:(NSPoint)point
+{
+ // Override hitTest so we can override menuForEvent.
+ NSEvent *event = [NSApp currentEvent];
+ NSEventType type = [event type];
+ if (type == NSRightMouseDown || (type == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask)))
+ return self;
+
+ return [super hitTest:point];
+}
+
+static void insertOpenWithDefaultPDFMenuItem(NSMenu *menu, NSUInteger index)
+{
+ // Add in an "Open with <default PDF viewer>" item
+ NSString *appName = nil;
+ NSImage *appIcon = nil;
+
+ _applicationInfoForMIMEType(@"application/pdf", &appName, &appIcon);
+ if (!appName)
+ appName = WEB_UI_STRING("Finder", "Default application name for Open With context menu");
+
+ // To match the PDFKit style, we'll add Open with Preview even when there's no document yet to view, and
+ // disable it using validateUserInterfaceItem.
+ NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Open with %@", "context menu item for PDF"), appName];
+
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:title action:@selector(_openWithFinder:) keyEquivalent:@""];
+ if (appIcon)
+ [item setImage:appIcon];
+ [menu insertItem:item atIndex:index];
+ [item release];
+}
+
+- (NSMenu *)menuForEvent:(NSEvent *)theEvent
+{
+ NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
+
+ bool insertedOpenWithItem = false;
+
+ NSEnumerator *menuItemEnumerator = [[[_pdfView menuForEvent:theEvent] itemArray] objectEnumerator];
+ while (NSMenuItem *item = [menuItemEnumerator nextObject]) {
+ NSMenuItem *itemCopy = [item copy];
+ [menu addItem:itemCopy];
+ [itemCopy release];
+
+ if (insertedOpenWithItem)
+ continue;
+
+ // If a "Copy" item is present, place the "Open With" item just after it, with an intervening separator.
+ if ([item action] != @selector(copy:))
+ continue;
+
+ [menu addItem:[NSMenuItem separatorItem]];
+ insertOpenWithDefaultPDFMenuItem(menu, [menu numberOfItems]);
+ insertedOpenWithItem = true;
+ }
+
+ if (!insertedOpenWithItem) {
+ // No "Copy" item was found; place the "Open With" item at the top of the menu, with a trailing separator.
+ insertOpenWithDefaultPDFMenuItem(menu, 0);
+ [menu insertItem:[NSMenuItem separatorItem] atIndex:1];
+ }
+
+ return [menu autorelease];
+}
+
+// MARK: NSUserInterfaceValidations PROTOCOL IMPLEMENTATION
+
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
+{
+ SEL action = [item action];
+ if (action == @selector(_openWithFinder:))
+ return [_pdfView document] != nil;
+ return YES;
+}
+
+// MARK: PDFView delegate methods
+
+- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL
+{
+ _pdfViewController->linkClicked([URL absoluteString]);
+}
+
+- (void)PDFViewOpenPDFInNativeApplication:(PDFView *)sender
+{
+ _pdfViewController->openPDFInFinder();
+}
+
+- (void)PDFViewSavePDFToDownloadFolder:(PDFView *)sender
+{
+ _pdfViewController->savePDFToDownloadsFolder();
+}
+
+- (void)PDFViewPerformPrint:(PDFView *)sender
+{
+ _pdfViewController->print();
+}
+
+- (BOOL)forwardScrollWheelEvent:(NSEvent *)wheelEvent
+{
+ return _pdfViewController->forwardScrollWheelEvent(wheelEvent);
+}
+
+@end
+
+namespace WebKit {
+
+PassOwnPtr<PDFViewController> PDFViewController::create(WKView *wkView)
+{
+ return adoptPtr(new PDFViewController(wkView));
+}
+
+PDFViewController::PDFViewController(WKView *wkView)
+ : m_wkView(wkView)
+ , m_wkPDFView(adoptNS([[WKPDFView alloc] initWithFrame:[m_wkView bounds] PDFViewController:this]))
+ , m_pdfView([m_wkPDFView.get() pdfView])
+{
+ [m_wkView addSubview:m_wkPDFView.get()];
+}
+
+PDFViewController::~PDFViewController()
+{
+ [m_wkPDFView.get() removeFromSuperview];
+ [m_wkPDFView.get() invalidate];
+ m_wkPDFView = nullptr;
+}
+
+WebPageProxy* PDFViewController::page() const
+{
+ return toImpl([m_wkView pageRef]);
+}
+
+NSView* PDFViewController::pdfView() const
+{
+ return m_wkPDFView.get();
+}
+
+static RetainPtr<CFDataRef> convertPostScriptDataSourceToPDF(const IPC::DataReference& dataReference)
+{
+ // Convert PostScript to PDF using Quartz 2D API
+ // http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_ps_convert/chapter_16_section_1.html
+
+ CGPSConverterCallbacks callbacks = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ RetainPtr<CGPSConverterRef> converter = adoptCF(CGPSConverterCreate(0, &callbacks, 0));
+ ASSERT(converter);
+
+ RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<uint8_t*>(dataReference.data()) length:dataReference.size() freeWhenDone:NO]);
+
+ RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithCFData((CFDataRef)nsData.get()));
+ ASSERT(provider);
+
+ RetainPtr<CFMutableDataRef> result = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
+ ASSERT(result);
+
+ RetainPtr<CGDataConsumerRef> consumer = adoptCF(CGDataConsumerCreateWithCFData(result.get()));
+ ASSERT(consumer);
+
+ CGPSConverterConvert(converter.get(), provider.get(), consumer.get(), 0);
+
+ if (!result)
+ return 0;
+
+ return result;
+}
+
+void PDFViewController::setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const IPC::DataReference& dataReference)
+{
+ if (equalIgnoringCase(mimeType, "application/postscript")) {
+ m_pdfData = convertPostScriptDataSourceToPDF(dataReference);
+ if (!m_pdfData)
+ return;
+ m_suggestedFilename = String(suggestedFilename + ".pdf");
+ } else {
+ // Make sure to copy the data.
+ m_pdfData = adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size()));
+ m_suggestedFilename = suggestedFilename;
+ }
+
+ RetainPtr<PDFDocument> pdfDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:(NSData *)m_pdfData.get()]);
+ [m_wkPDFView.get() setDocument:pdfDocument.get()];
+}
+
+double PDFViewController::zoomFactor() const
+{
+ return [m_pdfView scaleFactor];
+}
+
+void PDFViewController::setZoomFactor(double zoomFactor)
+{
+ [m_pdfView setScaleFactor:zoomFactor];
+}
+
+Class PDFViewController::pdfDocumentClass()
+{
+ static Class pdfDocumentClass = [pdfKitBundle() classNamed:@"PDFDocument"];
+
+ return pdfDocumentClass;
+}
+
+Class PDFViewController::pdfPreviewViewClass()
+{
+ static Class pdfPreviewViewClass = [pdfKitBundle() classNamed:@"PDFPreviewView"];
+
+ return pdfPreviewViewClass;
+}
+
+bool PDFViewController::forwardScrollWheelEvent(NSEvent *wheelEvent)
+{
+ CGFloat deltaX = [wheelEvent deltaX];
+ if ((deltaX > 0 && !page()->canGoBack()) || (deltaX < 0 && !page()->canGoForward()))
+ return false;
+
+ [m_wkView scrollWheel:wheelEvent];
+ return true;
+}
+
+static IMP oldPDFViewScrollView_scrollWheel;
+
+static WKPDFView *findEnclosingWKPDFView(NSView *view)
+{
+ for (NSView *superview = [view superview]; superview; superview = [superview superview]) {
+ if ([superview isKindOfClass:[WKPDFView class]])
+ return static_cast<WKPDFView *>(superview);
+ }
+
+ return nil;
+}
+
+static void PDFViewScrollView_scrollWheel(NSScrollView* self, SEL _cmd, NSEvent *wheelEvent)
+{
+ CGFloat deltaX = [wheelEvent deltaX];
+ CGFloat deltaY = [wheelEvent deltaY];
+
+ NSSize contentsSize = [[self documentView] bounds].size;
+ NSRect visibleRect = [self documentVisibleRect];
+
+ // We only want to forward the wheel events if the horizontal delta is non-zero,
+ // and only if we're pinned to either the left or right side.
+ // We also never want to forward momentum scroll events.
+ if ([wheelEvent momentumPhase] == NSEventPhaseNone && deltaX && fabsf(deltaY) < fabsf(deltaX)
+ && ((deltaX > 0 && visibleRect.origin.x <= 0) || (deltaX < 0 && contentsSize.width <= NSMaxX(visibleRect)))) {
+
+ if (WKPDFView *pdfView = findEnclosingWKPDFView(self)) {
+ if ([pdfView forwardScrollWheelEvent:wheelEvent])
+ return;
+ }
+ }
+
+ wtfCallIMP<void>(oldPDFViewScrollView_scrollWheel, self, _cmd, wheelEvent);
+}
+
+NSBundle* PDFViewController::pdfKitBundle()
+{
+ static NSBundle *pdfKitBundle;
+ if (pdfKitBundle)
+ return pdfKitBundle;
+
+ NSString *pdfKitPath = [_NSPathForSystemFramework(@"Quartz.framework") stringByAppendingString:@"/Frameworks/PDFKit.framework"];
+ if (!pdfKitPath) {
+ LOG_ERROR("Couldn't find PDFKit.framework");
+ return nil;
+ }
+
+ pdfKitBundle = [NSBundle bundleWithPath:pdfKitPath];
+ if (![pdfKitBundle load])
+ LOG_ERROR("Couldn't load PDFKit.framework");
+
+ if (Class pdfViewScrollViewClass = [pdfKitBundle classNamed:@"PDFViewScrollView"]) {
+ if (Method scrollWheel = class_getInstanceMethod(pdfViewScrollViewClass, @selector(scrollWheel:)))
+ oldPDFViewScrollView_scrollWheel = method_setImplementation(scrollWheel, reinterpret_cast<IMP>(PDFViewScrollView_scrollWheel));
+ }
+
+ return pdfKitBundle;
+}
+
+NSPrintOperation *PDFViewController::makePrintOperation(NSPrintInfo *printInfo)
+{
+ return [[m_pdfView document] getPrintOperationForPrintInfo:printInfo autoRotate:YES];
+}
+
+void PDFViewController::openPDFInFinder()
+{
+ // We don't want to open the PDF until we have a document to write. (see 4892525).
+ if (![m_pdfView document]) {
+ NSBeep();
+ return;
+ }
+
+ if (!m_temporaryPDFUUID) {
+ ASSERT(m_pdfData);
+ m_temporaryPDFUUID = createCanonicalUUIDString();
+ page()->savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(m_suggestedFilename.get(), page()->mainFrame()->url(), CFDataGetBytePtr(m_pdfData.get()), CFDataGetLength(m_pdfData.get()), m_temporaryPDFUUID);
+ return;
+ }
+
+ page()->openPDFFromTemporaryFolderWithNativeApplication(m_temporaryPDFUUID);
+}
+
+static void releaseCFData(unsigned char*, const void* data)
+{
+ ASSERT(CFGetTypeID(data) == CFDataGetTypeID());
+
+ // Balanced by CFRetain in savePDFToDownloadsFolder.
+ CFRelease(data);
+}
+
+void PDFViewController::savePDFToDownloadsFolder()
+{
+ // We don't want to write the file until we have a document to write. (see 5267607).
+ if (![m_pdfView document]) {
+ NSBeep();
+ return;
+ }
+
+ ASSERT(m_pdfData);
+
+ // Balanced by CFRelease in releaseCFData.
+ CFRetain(m_pdfData.get());
+
+ RefPtr<WebData> data = WebData::createWithoutCopying(CFDataGetBytePtr(m_pdfData.get()), CFDataGetLength(m_pdfData.get()), releaseCFData, m_pdfData.get());
+
+ page()->saveDataToFileInDownloadsFolder(m_suggestedFilename.get(), page()->mainFrame()->mimeType(), page()->mainFrame()->url(), data.get());
+}
+
+void PDFViewController::linkClicked(const String& url)
+{
+ NSEvent* nsEvent = [NSApp currentEvent];
+ WebMouseEvent event;
+ switch ([nsEvent type]) {
+ case NSLeftMouseUp:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ event = WebEventFactory::createWebMouseEvent(nsEvent, m_pdfView);
+ default:
+ // For non mouse-clicks or for keyboard events, pass an empty WebMouseEvent
+ // through. The event is only used by the WebFrameLoaderClient to determine
+ // the modifier keys and which mouse button is down. These queries will be
+ // valid with an empty event.
+ break;
+ }
+
+ page()->linkClicked(url, event);
+}
+
+void PDFViewController::print()
+{
+ page()->printMainFrame();
+}
+
+void PDFViewController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
+{
+ BOOL forward = !(options & FindOptionsBackwards);
+ BOOL caseFlag = !(options & FindOptionsCaseInsensitive);
+ BOOL wrapFlag = options & FindOptionsWrapAround;
+
+ PDFSelection *selection = [m_wkPDFView.get() _nextMatchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag fromSelection:[m_pdfView currentSelection] startInSelection:NO];
+ if (!selection) {
+ page()->didFailToFindString(string);
+ return;
+ }
+
+ NSUInteger matchCount;
+ if (!maxMatchCount) {
+ // If the max was zero, any result means we exceeded the max. We can skip computing the actual count.
+ matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
+ } else {
+ matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
+ if (matchCount > maxMatchCount)
+ matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
+ }
+
+ [m_pdfView setCurrentSelection:selection];
+ [m_pdfView scrollSelectionToVisible:nil];
+ page()->didFindString(string, matchCount);
+}
+
+void PDFViewController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
+{
+ BOOL caseFlag = !(options & FindOptionsCaseInsensitive);
+
+ NSUInteger matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
+ if (matchCount > maxMatchCount)
+ matchCount = maxMatchCount;
+ page()->didCountStringMatches(string, matchCount);
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplhfromrev164600trunkSourceWebKit2UIProcessAPImacPageClientImplh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,178 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2011 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 PageClientImpl_h
+#define PageClientImpl_h
+
+#include "CorrectionPanel.h"
+#include "PageClient.h"
+#include "WebFullScreenManagerProxy.h"
+#include <wtf/RetainPtr.h>
+
+@class WKEditorUndoTargetObjC;
+@class WKView;
+
+namespace WebCore {
+class AlternativeTextUIController;
+}
+
+namespace WebKit {
+class FindIndicatorWindow;
+
+class PageClientImpl final : public PageClient
+#if ENABLE(FULLSCREEN_API)
+ , public WebFullScreenManagerProxyClient
+#endif
+ {
+public:
+ explicit PageClientImpl(WKView *);
+ virtual ~PageClientImpl();
+
+ void viewWillMoveToAnotherWindow();
+
+private:
+ // PageClient
+ virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy();
+ virtual void setViewNeedsDisplay(const WebCore::IntRect&);
+ virtual void displayView();
+ virtual bool canScrollView();
+ virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+
+ virtual WebCore::IntSize viewSize();
+ virtual bool isViewWindowActive();
+ virtual bool isViewFocused();
+ virtual bool isViewVisible();
+ virtual bool isViewVisibleOrOccluded();
+ virtual bool isViewInWindow();
+ virtual bool isVisuallyIdle();
+ virtual LayerHostingMode viewLayerHostingMode() override;
+ virtual ColorSpaceData colorSpace() override;
+ virtual void setAcceleratedCompositingRootLayer(CALayer *) override;
+ virtual CALayer *acceleratedCompositingRootLayer() const override;
+
+ virtual void processDidExit();
+ virtual void pageClosed();
+ virtual void didRelaunchProcess();
+ virtual void preferencesDidChange() override;
+ virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
+ virtual void didCommitLoadForMainFrame() override;
+ virtual void setCursor(const WebCore::Cursor&);
+ virtual void setCursorHiddenUntilMouseMoves(bool);
+ virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
+
+ virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
+ virtual void clearAllEditCommands();
+ virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
+ virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
+ virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&);
+ virtual bool executeSavedCommandBySelector(const String& selector);
+ virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
+ virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
+ const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer);
+ virtual void updateSecureInputState() override;
+ virtual void resetSecureInputState() override;
+ virtual void notifyInputContextAboutDiscardedComposition() override;
+
+ virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
+ virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+ virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
+ virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
+
+ virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
+
+ virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
+ virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
+
+#if ENABLE(INPUT_TYPE_COLOR)
+ virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
+#endif
+
+ void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
+
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
+ virtual void updateAcceleratedCompositingMode(const LayerTreeContext&);
+
+ virtual RetainPtr<CGImageRef> takeViewSnapshot() override;
+ virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
+ virtual void clearCustomSwipeViews() override;
+
+ virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&);
+
+ virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
+ virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState);
+
+ virtual void makeFirstResponder();
+
+ virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
+ virtual void dismissDictionaryLookupPanel();
+
+ virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
+ virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText);
+ virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText);
+ virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString);
+
+ virtual void recommendedScrollbarStyleDidChange(int32_t newStyle);
+
+ virtual WKView* wkView() const { return m_wkView; }
+ virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) override;
+
+#if USE(DICTATION_ALTERNATIVES)
+ virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&);
+ virtual void removeDictationAlternatives(uint64_t dictationContext);
+ virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
+ virtual Vector<String> dictationAlternatives(uint64_t dictationContext);
+#endif
+
+ // Auxiliary Client Creation
+#if ENABLE(FULLSCREEN_API)
+ WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;
+#endif
+
+#if ENABLE(FULLSCREEN_API)
+ // WebFullScreenManagerProxyClient
+ virtual void closeFullScreenManager() override;
+ virtual bool isFullScreen() override;
+ virtual void enterFullScreen() override;
+ virtual void exitFullScreen() override;
+ virtual void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
+ virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
+#endif
+
+ NSView *activeView() const;
+
+ WKView *m_wkView;
+ RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
+#if USE(AUTOCORRECTION_PANEL)
+ CorrectionPanel m_correctionPanel;
+#endif
+#if USE(DICTATION_ALTERNATIVES)
+ OwnPtr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // PageClientImpl_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="propset"><h4>Property changes: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmmfromrev164600trunkSourceWebKit2UIProcessAPImacPageClientImplmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,640 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2011 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"
+#import "PageClientImpl.h"
+
+#import "AttributedString.h"
+#import "ColorSpaceData.h"
+#import "DataReference.h"
+#import "DictionaryPopupInfo.h"
+#import "FindIndicator.h"
+#import "NativeWebKeyboardEvent.h"
+#import "NativeWebWheelEvent.h"
+#import "StringUtilities.h"
+#import "WKAPICast.h"
+#import "WKFullScreenWindowController.h"
+#import "WKStringCF.h"
+#import "WKThumbnailView.h"
+#import "WKViewInternal.h"
+#import "WebColorPickerMac.h"
+#import "WebContextMenuProxyMac.h"
+#import "WebEditCommandProxy.h"
+#import "WebPopupMenuProxyMac.h"
+#import "WindowServerConnection.h"
+#import <WebCore/AlternativeTextUIController.h>
+#import <WebCore/BitmapImage.h>
+#import <WebCore/Cursor.h>
+#import <WebCore/FloatRect.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/Image.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/NotImplemented.h>
+#import <WebCore/SharedBuffer.h>
+#import <WebKitSystemInterface.h>
+#import <wtf/text/CString.h>
+#import <wtf/text/WTFString.h>
+
+#if USE(DICTATION_ALTERNATIVES)
+#import <AppKit/NSTextAlternatives.h>
+#endif
+
+@interface NSApplication (WebNSApplicationDetails)
+- (NSCursor *)_cursorRectCursor;
+@end
+
+#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+@interface NSWindow (WebNSWindowDetails)
+- (BOOL)_hostsLayersInWindowServer;
+@end
+#endif
+
+using namespace WebCore;
+using namespace WebKit;
+
+@interface WKEditCommandObjC : NSObject
+{
+ RefPtr<WebEditCommandProxy> m_command;
+}
+- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command;
+- (WebEditCommandProxy*)command;
+@end
+
+@interface WKEditorUndoTargetObjC : NSObject
+- (void)undoEditing:(id)sender;
+- (void)redoEditing:(id)sender;
+@end
+
+@implementation WKEditCommandObjC
+
+- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ m_command = command;
+ return self;
+}
+
+- (WebEditCommandProxy*)command
+{
+ return m_command.get();
+}
+
+@end
+
+@implementation WKEditorUndoTargetObjC
+
+- (void)undoEditing:(id)sender
+{
+ ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
+ [sender command]->unapply();
+}
+
+- (void)redoEditing:(id)sender
+{
+ ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
+ [sender command]->reapply();
+}
+
+@end
+
+namespace WebKit {
+
+PageClientImpl::PageClientImpl(WKView* wkView)
+ : m_wkView(wkView)
+ , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
+#if USE(DICTATION_ALTERNATIVES)
+ , m_alternativeTextUIController(adoptPtr(new AlternativeTextUIController))
+#endif
+{
+}
+
+PageClientImpl::~PageClientImpl()
+{
+}
+
+std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
+{
+ return [m_wkView _createDrawingAreaProxy];
+}
+
+void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void PageClientImpl::displayView()
+{
+ ASSERT_NOT_REACHED();
+}
+
+bool PageClientImpl::canScrollView()
+{
+ return false;
+}
+
+void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ ASSERT_NOT_REACHED();
+}
+
+IntSize PageClientImpl::viewSize()
+{
+ return IntSize([m_wkView bounds].size);
+}
+
+NSView *PageClientImpl::activeView() const
+{
+#if WK_API_ENABLED
+ return m_wkView._thumbnailView ? (NSView *)m_wkView._thumbnailView : (NSView *)m_wkView;
+#else
+ return m_wkView;
+#endif
+}
+
+bool PageClientImpl::isViewWindowActive()
+{
+ NSWindow *activeViewWindow = activeView().window;
+ return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
+}
+
+bool PageClientImpl::isViewFocused()
+{
+ return [m_wkView _isFocused];
+}
+
+void PageClientImpl::makeFirstResponder()
+{
+ [[m_wkView window] makeFirstResponder:m_wkView];
+}
+
+bool PageClientImpl::isViewVisible()
+{
+ NSView *activeView = this->activeView();
+ NSWindow *activeViewWindow = activeView.window;
+
+ if (!activeViewWindow)
+ return false;
+
+ if (!activeViewWindow.isVisible)
+ return false;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
+ // Mountain Lion and previous do not support occlusion notifications, and as such will
+ // continue to report as "visible" when not on the active space.
+ if (!activeViewWindow.isOnActiveSpace)
+ return false;
+#endif
+
+ if (activeView.isHiddenOrHasHiddenAncestor)
+ return false;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+ if ([m_wkView windowOcclusionDetectionEnabled] && (activeViewWindow.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
+ return false;
+#endif
+
+ return true;
+}
+
+bool PageClientImpl::isViewVisibleOrOccluded()
+{
+ return activeView().window.isVisible;
+}
+
+bool PageClientImpl::isViewInWindow()
+{
+ return activeView().window;
+}
+
+bool PageClientImpl::isVisuallyIdle()
+{
+ return WindowServerConnection::shared().applicationWindowModificationsHaveStopped() || !isViewVisible();
+}
+
+LayerHostingMode PageClientImpl::viewLayerHostingMode()
+{
+#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+ if ([activeView().window _hostsLayersInWindowServer])
+ return LayerHostingMode::OutOfProcess;
+#endif
+ return LayerHostingMode::InProcess;
+}
+
+void PageClientImpl::viewWillMoveToAnotherWindow()
+{
+ clearAllEditCommands();
+}
+
+ColorSpaceData PageClientImpl::colorSpace()
+{
+ return [m_wkView _colorSpace];
+}
+
+void PageClientImpl::processDidExit()
+{
+ [m_wkView _processDidExit];
+}
+
+void PageClientImpl::pageClosed()
+{
+ [m_wkView _pageClosed];
+#if USE(DICTATION_ALTERNATIVES)
+ m_alternativeTextUIController->clear();
+#endif
+}
+
+void PageClientImpl::didRelaunchProcess()
+{
+ [m_wkView _didRelaunchProcess];
+}
+
+void PageClientImpl::preferencesDidChange()
+{
+ [m_wkView _preferencesDidChange];
+}
+
+void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
+{
+ [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];
+}
+
+void PageClientImpl::didCommitLoadForMainFrame()
+{
+}
+
+void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
+{
+ if (![NSApp _cursorRectCursor])
+ [m_wkView _setCursor:cursor.platformCursor()];
+}
+
+void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
+{
+ [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
+}
+
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
+{
+}
+
+void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ RefPtr<WebEditCommandProxy> command = prpCommand;
+
+ RetainPtr<WKEditCommandObjC> commandObjC = adoptNS([[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]);
+ String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
+
+ NSUndoManager *undoManager = [m_wkView undoManager];
+ [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
+ if (!actionName.isEmpty())
+ [undoManager setActionName:(NSString *)actionName];
+}
+
+void PageClientImpl::clearAllEditCommands()
+{
+ [[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
+}
+
+bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] canUndo] : [[m_wkView undoManager] canRedo];
+}
+
+void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] undo] : [[m_wkView undoManager] redo];
+}
+
+bool PageClientImpl::interpretKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commands)
+{
+ return [m_wkView _interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands];
+}
+
+void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
+{
+ RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
+ RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
+
+ [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
+}
+
+void PageClientImpl::setPromisedData(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, PassRefPtr<SharedBuffer> archiveBuffer)
+{
+ RefPtr<Image> image = BitmapImage::create();
+ image->setData(imageBuffer.get(), true);
+ [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
+}
+
+void PageClientImpl::updateSecureInputState()
+{
+ [m_wkView _updateSecureInputState];
+}
+
+void PageClientImpl::resetSecureInputState()
+{
+ [m_wkView _resetSecureInputState];
+}
+
+void PageClientImpl::notifyInputContextAboutDiscardedComposition()
+{
+ [m_wkView _notifyInputContextAboutDiscardedComposition];
+}
+
+FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
+{
+ return [m_wkView _convertToDeviceSpace:rect];
+}
+
+FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
+{
+ return [m_wkView _convertToUserSpace:rect];
+}
+
+IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ NSPoint windowCoord = [[m_wkView window] convertScreenToBase:point];
+#pragma clang diagnostic pop
+ return IntPoint([m_wkView convertPoint:windowCoord fromView:nil]);
+}
+
+IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
+{
+ NSRect tempRect = rect;
+ tempRect = [m_wkView convertRect:tempRect toView:nil];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ tempRect.origin = [[m_wkView window] convertBaseToScreen:tempRect.origin];
+#pragma clang diagnostic pop
+ return enclosingIntRect(tempRect);
+}
+
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
+{
+ [m_wkView _doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled];
+}
+
+PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
+{
+ return WebPopupMenuProxyMac::create(m_wkView, page);
+}
+
+PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
+{
+ return WebContextMenuProxyMac::create(m_wkView, page);
+}
+
+#if ENABLE(INPUT_TYPE_COLOR)
+PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor, const WebCore::IntRect& rect)
+{
+ return WebColorPickerMac::create(page, initialColor, rect, wkView());
+}
+#endif
+
+void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
+{
+ [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
+}
+
+void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
+{
+ NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
+ [m_wkView _setAccessibilityWebProcessToken:remoteToken];
+}
+
+void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+ ASSERT(!layerTreeContext.isEmpty());
+
+ CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+ [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
+}
+
+void PageClientImpl::exitAcceleratedCompositingMode()
+{
+ [m_wkView _setAcceleratedCompositingModeRootLayer:nil];
+}
+
+void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+ ASSERT(!layerTreeContext.isEmpty());
+
+ CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+ [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
+}
+
+void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
+{
+ [m_wkView _setAcceleratedCompositingModeRootLayer:rootLayer];
+}
+
+CALayer *PageClientImpl::acceleratedCompositingRootLayer() const
+{
+ return m_wkView._acceleratedCompositingModeRootLayer;
+}
+
+RetainPtr<CGImageRef> PageClientImpl::takeViewSnapshot()
+{
+ return [m_wkView _takeViewSnapshot];
+}
+
+void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
+{
+ [m_wkView _wheelEventWasNotHandledByWebCore:event.nativeEvent()];
+}
+
+void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus)
+{
+ [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
+}
+
+void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState)
+{
+ [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
+}
+
+void PageClientImpl::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+{
+ RetainPtr<NSAttributedString> attributedString = text.string;
+ NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+
+ // Convert to screen coordinates.
+ textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
+ textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+ WKShowWordDefinitionWindow(attributedString.get(), textBaselineOrigin, (NSDictionary *)dictionaryPopupInfo.options.get());
+}
+
+void PageClientImpl::dismissDictionaryLookupPanel()
+{
+ // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
+ WKHideWordDefinitionWindow();
+}
+
+void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+#if USE(AUTOCORRECTION_PANEL)
+ if (!isViewVisible() || !isViewInWindow())
+ return;
+ m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
+#endif
+}
+
+void PageClientImpl::dismissCorrectionPanel(ReasonForDismissingAlternativeText reason)
+{
+#if USE(AUTOCORRECTION_PANEL)
+ m_correctionPanel.dismiss(reason);
+#endif
+}
+
+String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText reason)
+{
+#if USE(AUTOCORRECTION_PANEL)
+ return m_correctionPanel.dismiss(reason);
+#else
+ return String();
+#endif
+}
+
+void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
+{
+ NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
+ CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
+}
+
+void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
+{
+ NSArray *trackingAreas = [m_wkView trackingAreas];
+ NSUInteger count = [trackingAreas count];
+ ASSERT(count == 1);
+
+ for (NSUInteger i = 0; i < count; ++i)
+ [m_wkView removeTrackingArea:[trackingAreas objectAtIndex:i]];
+
+ // Now re-create a tracking area with the appropriate options given the new scrollbar style
+ NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
+ if (newStyle == NSScrollerStyleLegacy)
+ options |= NSTrackingActiveAlways;
+ else
+ options |= NSTrackingActiveInKeyWindow;
+
+ NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:[m_wkView frame]
+ options:options
+ owner:m_wkView
+ userInfo:nil];
+ [m_wkView addTrackingArea:trackingArea];
+ [trackingArea release];
+}
+
+void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize)
+{
+ [m_wkView _setIntrinsicContentSize:intrinsicContentSize];
+}
+
+bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString)
+{
+ return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)];
+}
+
+void PageClientImpl::clearCustomSwipeViews()
+{
+ return [m_wkView _setCustomSwipeViews:@[]];
+}
+
+#if USE(DICTATION_ALTERNATIVES)
+uint64_t PageClientImpl::addDictationAlternatives(const RetainPtr<NSTextAlternatives>& alternatives)
+{
+ return m_alternativeTextUIController->addAlternatives(alternatives);
+}
+
+void PageClientImpl::removeDictationAlternatives(uint64_t dictationContext)
+{
+ m_alternativeTextUIController->removeAlternatives(dictationContext);
+}
+
+void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
+{
+ if (!isViewVisible() || !isViewInWindow())
+ return;
+ m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
+ [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
+ });
+}
+
+Vector<String> PageClientImpl::dictationAlternatives(uint64_t dictationContext)
+{
+ return m_alternativeTextUIController->alternativesForContext(dictationContext);
+}
+#endif
+
+#if ENABLE(FULLSCREEN_API)
+
+WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
+{
+ return *this;
+}
+
+// WebFullScreenManagerProxyClient
+
+void PageClientImpl::closeFullScreenManager()
+{
+ [m_wkView _closeFullScreenWindowController];
+}
+
+bool PageClientImpl::isFullScreen()
+{
+ if (!m_wkView._hasFullScreenWindowController)
+ return false;
+
+ return m_wkView._fullScreenWindowController.isFullScreen;
+}
+
+void PageClientImpl::enterFullScreen()
+{
+ [m_wkView._fullScreenWindowController enterFullScreen:nil];
+}
+
+void PageClientImpl::exitFullScreen()
+{
+ [m_wkView._fullScreenWindowController exitFullScreen];
+}
+
+void PageClientImpl::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
+{
+ [m_wkView._fullScreenWindowController beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
+}
+
+void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
+{
+ [m_wkView._fullScreenWindowController beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
+}
+
+#endif // ENABLE(FULLSCREEN_API)
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKPrintingViewhfromrev164600trunkSourceWebKit2UIProcessAPImacWKPrintingViewh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.h (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2011 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 <WebCore/IntRectHash.h>
+#import <condition_variable>
+#import <wtf/RetainPtr.h>
+
+@class WKPrintingViewData;
+@class PDFDocument;
+
+namespace WebKit {
+class ShareableBitmap;
+class WebFrameProxy;
+}
+
+@interface WKPrintingView : NSView {
+@public
+ NSPrintOperation *_printOperation; // WKPrintingView is owned by the operation.
+ RetainPtr<NSView> _wkView;
+
+ RefPtr<WebKit::WebFrameProxy> _webFrame;
+ Vector<WebCore::IntRect> _printingPageRects;
+ double _totalScaleFactorForPrinting;
+ HashMap<WebCore::IntRect, RefPtr<WebKit::ShareableBitmap>> _pagePreviews;
+
+ Vector<uint8_t> _printedPagesData;
+ RetainPtr<PDFDocument> _printedPagesPDFDocument;
+
+ uint64_t _expectedComputedPagesCallback;
+ HashMap<uint64_t, WebCore::IntRect> _expectedPreviewCallbacks;
+ uint64_t _latestExpectedPreviewCallback;
+ uint64_t _expectedPrintCallback;
+
+ BOOL _isPrintingFromSecondaryThread;
+ std::mutex _printingCallbackMutex;
+ std::condition_variable _printingCallbackCondition;
+
+ NSTimer *_autodisplayResumeTimer;
+}
+
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView;
+
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKPrintingViewh"></a>
<div class="propset"><h4>Property changes: trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessmacWKPrintingViewmmfromrev164600trunkSourceWebKit2UIProcessAPImacWKPrintingViewmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,677 @@
</span><ins>+/*
+ * Copyright (C) 2011 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"
+#import "WKPrintingView.h"
+
+#import "APIData.h"
+#import "Logging.h"
+#import "PDFKitImports.h"
+#import "PrintInfo.h"
+#import "ShareableBitmap.h"
+#import "WebPageProxy.h"
+#import <PDFKit/PDFKit.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/WebCoreObjCExtras.h>
+#import <wtf/RunLoop.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+NSString * const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin";
+NSString * const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin";
+
+NSString * const NSPrintInfoDidChangeNotification = @"NSPrintInfoDidChange";
+
+static BOOL isForcingPreviewUpdate;
+
+@implementation WKPrintingView
+
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView
+{
+ self = [super init]; // No frame rect to pass to NSView.
+ if (!self)
+ return nil;
+
+ _webFrame = frame;
+ _wkView = wkView;
+
+ return self;
+}
+
+- (void)dealloc
+{
+ if (WebCoreObjCScheduleDeallocateOnMainThread([WKPrintingView class], self))
+ return;
+
+ [super dealloc];
+}
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
+- (void)_setAutodisplay:(BOOL)newState
+{
+ if (!newState && [[_wkView window] isAutodisplay])
+ [_wkView displayIfNeeded];
+
+ [[_wkView window] setAutodisplay:newState];
+
+ // For some reason, painting doesn't happen for a long time without this call, <rdar://problem/8975229>.
+ if (newState)
+ [_wkView displayIfNeeded];
+}
+
+
+- (void)_suspendAutodisplay
+{
+ // A drawRect: call on WKView causes a switch to screen mode, which is slow due to relayout, and we want to avoid that.
+ // Disabling autodisplay will prevent random updates from causing this, but resizing the window will still work.
+ if (_autodisplayResumeTimer) {
+ [_autodisplayResumeTimer invalidate];
+ _autodisplayResumeTimer = nil;
+ } else
+ [self _setAutodisplay:NO];
+}
+
+- (void)_delayedResumeAutodisplayTimerFired
+{
+ ASSERT(RunLoop::isMain());
+
+ _autodisplayResumeTimer = nil;
+ [self _setAutodisplay:YES];
+
+ // Enabling autodisplay normally implicitly calls endPrinting() via -[WKView drawRect:], but not when content is in accelerated compositing mode.
+ if (_webFrame->page())
+ _webFrame->page()->endPrinting();
+}
+
+- (void)_delayedResumeAutodisplay
+{
+ // AppKit calls endDocument/beginDocument when print option change. We don't want to switch between print and screen mode just for that,
+ // and enabling autodisplay may result in switching into screen mode. So, autodisplay is only resumed on next run loop iteration.
+ if (!_autodisplayResumeTimer) {
+ _autodisplayResumeTimer = [NSTimer timerWithTimeInterval:0 target:self selector:@selector(_delayedResumeAutodisplayTimerFired) userInfo:nil repeats:NO];
+ // The timer must be scheduled on main thread, because printing thread may finish before it fires.
+ [[NSRunLoop mainRunLoop] addTimer:_autodisplayResumeTimer forMode:NSDefaultRunLoopMode];
+ }
+}
+
+- (void)_adjustPrintingMarginsForHeaderAndFooter
+{
+ ASSERT(RunLoop::isMain()); // This function calls the client, which should only be done on main thread.
+
+ NSPrintInfo *info = [_printOperation printInfo];
+ NSMutableDictionary *infoDictionary = [info dictionary];
+
+ // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the
+ // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087),
+ // we stash away the unmodified top and bottom margins the first time this method is called, and we read from
+ // those stashed-away values on subsequent calls.
+ double originalTopMargin;
+ double originalBottomMargin;
+ NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey];
+ if (!originalTopMarginNumber) {
+ ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]);
+ originalTopMargin = [info topMargin];
+ originalBottomMargin = [info bottomMargin];
+ [infoDictionary setObject:[NSNumber numberWithDouble:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey];
+ [infoDictionary setObject:[NSNumber numberWithDouble:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey];
+ } else {
+ ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]);
+ ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]);
+ originalTopMargin = [originalTopMarginNumber doubleValue];
+ originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] doubleValue];
+ }
+
+ CGFloat scale = [info scalingFactor];
+ [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(_webFrame.get()) * scale];
+ [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(_webFrame.get()) * scale];
+}
+
+- (BOOL)_isPrintingPreview
+{
+ // <rdar://problem/8901041> Please add an API returning whether the current print operation is for preview.
+ // Assuming that if NSPrintOperation is allowed to spawn a thread for printing, it will. Print preview doesn't spawn a thread.
+ return !_isPrintingFromSecondaryThread;
+}
+
+- (void)_updatePreview
+{
+ // <rdar://problem/8900923> Please add an API to force print preview update.
+ ASSERT(!isForcingPreviewUpdate);
+ isForcingPreviewUpdate = YES;
+ [[NSNotificationCenter defaultCenter] postNotificationName:NSPrintInfoDidChangeNotification object:nil];
+ isForcingPreviewUpdate = NO;
+}
+
+- (BOOL)_hasPageRects
+{
+ // WebCore always prints at least one page.
+ return !_printingPageRects.isEmpty();
+}
+
+- (NSUInteger)_firstPrintedPageNumber
+{
+ // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
+ return [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
+}
+
+- (NSUInteger)_lastPrintedPageNumber
+{
+ ASSERT([self _hasPageRects]);
+
+ // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
+ NSUInteger firstPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
+ NSUInteger lastPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintLastPage] unsignedIntegerValue];
+ if (lastPage - firstPage >= _printingPageRects.size())
+ return _printingPageRects.size();
+ return lastPage;
+}
+
+- (uint64_t)_expectedPreviewCallbackForRect:(const IntRect&)rect
+{
+ for (HashMap<uint64_t, WebCore::IntRect>::iterator iter = _expectedPreviewCallbacks.begin(); iter != _expectedPreviewCallbacks.end(); ++iter) {
+ if (iter->value == rect)
+ return iter->key;
+ }
+ return 0;
+}
+
+struct IPCCallbackContext {
+ RetainPtr<WKPrintingView> view;
+ uint64_t callbackID;
+};
+
+static void pageDidDrawToImage(const ShareableBitmap::Handle& imageHandle, IPCCallbackContext* context)
+{
+ ASSERT(RunLoop::isMain());
+
+ WKPrintingView *view = context->view.get();
+
+ // If the user has already changed print setup, then this response is obsolete. And if this callback is not in response to the latest request,
+ // then the user has already moved to another page - we'll cache the response, but won't draw it.
+ HashMap<uint64_t, WebCore::IntRect>::iterator iter = view->_expectedPreviewCallbacks.find(context->callbackID);
+ if (iter != view->_expectedPreviewCallbacks.end()) {
+ ASSERT([view _isPrintingPreview]);
+
+ if (!imageHandle.isNull()) {
+ RefPtr<ShareableBitmap> image = ShareableBitmap::create(imageHandle, SharedMemory::ReadOnly);
+
+ if (image)
+ view->_pagePreviews.add(iter->value, image);
+ }
+
+ view->_expectedPreviewCallbacks.remove(context->callbackID);
+ bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID;
+ if (receivedResponseToLatestRequest) {
+ view->_latestExpectedPreviewCallback = 0;
+ [view _updatePreview];
+ }
+ }
+}
+
+- (void)_preparePDFDataForPrintingOnSecondaryThread
+{
+ ASSERT(RunLoop::isMain());
+
+ if (!_webFrame->page()) {
+ _printingCallbackCondition.notify_one();
+ return;
+ }
+
+ std::lock_guard<std::mutex> lock(_printingCallbackMutex);
+
+ ASSERT([self _hasPageRects]);
+ ASSERT(_printedPagesData.isEmpty());
+ ASSERT(!_printedPagesPDFDocument);
+ ASSERT(!_expectedPrintCallback);
+
+ NSUInteger firstPage = [self _firstPrintedPageNumber];
+ NSUInteger lastPage = [self _lastPrintedPageNumber];
+
+ ASSERT(firstPage > 0);
+ ASSERT(firstPage <= lastPage);
+ LOG(View, "WKPrintingView requesting PDF data for pages %u...%u", firstPage, lastPage);
+
+ PrintInfo printInfo([_printOperation printInfo]);
+ // Return to printing mode if we're already back to screen (e.g. due to window resizing).
+ _webFrame->page()->beginPrinting(_webFrame.get(), printInfo);
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<DataCallback> callback = DataCallback::create([context](bool, API::Data* data) {
+ ASSERT(RunLoop::isMain());
+
+ OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
+ WKPrintingView *view = context->view.get();
+
+ if (context->callbackID == view->_expectedPrintCallback) {
+ ASSERT(![view _isPrintingPreview]);
+ ASSERT(view->_printedPagesData.isEmpty());
+ ASSERT(!view->_printedPagesPDFDocument);
+ if (data)
+ view->_printedPagesData.append(data->bytes(), data->size());
+ view->_expectedPrintCallback = 0;
+ view->_printingCallbackCondition.notify_one();
+ }
+ });
+ _expectedPrintCallback = callback->callbackID();
+
+ context->view = self;
+ context->callbackID = callback->callbackID();
+
+ _webFrame->page()->drawPagesToPDF(_webFrame.get(), printInfo, firstPage - 1, lastPage - firstPage + 1, callback.get());
+}
+
+static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, IPCCallbackContext* context)
+{
+ ASSERT(RunLoop::isMain());
+
+ WKPrintingView *view = context->view.get();
+
+ // If the user has already changed print setup, then this response is obsolete.
+ if (context->callbackID == view->_expectedComputedPagesCallback) {
+ ASSERT(RunLoop::isMain());
+ ASSERT(view->_expectedPreviewCallbacks.isEmpty());
+ ASSERT(!view->_latestExpectedPreviewCallback);
+ ASSERT(!view->_expectedPrintCallback);
+ ASSERT(view->_pagePreviews.isEmpty());
+ view->_expectedComputedPagesCallback = 0;
+
+ view->_printingPageRects = pageRects;
+ view->_totalScaleFactorForPrinting = totalScaleFactorForPrinting;
+
+ // Sanitize a response coming from the Web process.
+ if (view->_printingPageRects.isEmpty())
+ view->_printingPageRects.append(IntRect(0, 0, 1, 1));
+ if (view->_totalScaleFactorForPrinting <= 0)
+ view->_totalScaleFactorForPrinting = 1;
+
+ const IntRect& lastPrintingPageRect = view->_printingPageRects[view->_printingPageRects.size() - 1];
+ NSRect newFrameSize = NSMakeRect(0, 0,
+ ceil(lastPrintingPageRect.maxX() * view->_totalScaleFactorForPrinting),
+ ceil(lastPrintingPageRect.maxY() * view->_totalScaleFactorForPrinting));
+ LOG(View, "WKPrintingView setting frame size to x:%g y:%g width:%g height:%g", newFrameSize.origin.x, newFrameSize.origin.y, newFrameSize.size.width, newFrameSize.size.height);
+ [view setFrame:newFrameSize];
+
+ if ([view _isPrintingPreview]) {
+ // Show page count, and ask for an actual image to replace placeholder.
+ [view _updatePreview];
+ } else {
+ // When printing, request everything we'll need beforehand.
+ [view _preparePDFDataForPrintingOnSecondaryThread];
+ }
+ }
+}
+
+- (BOOL)_askPageToComputePageRects
+{
+ ASSERT(RunLoop::isMain());
+
+ if (!_webFrame->page())
+ return NO;
+
+ ASSERT(!_expectedComputedPagesCallback);
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<ComputedPagesCallback> callback = ComputedPagesCallback::create([context](bool, const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting) {
+ OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
+ pageDidComputePageRects(pageRects, totalScaleFactorForPrinting, context);
+ });
+ _expectedComputedPagesCallback = callback->callbackID();
+ context->view = self;
+ context->callbackID = _expectedComputedPagesCallback;
+
+ _webFrame->page()->computePagesForPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]), callback.release());
+ return YES;
+}
+
+static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
+{
+ ASSERT(RunLoop::isMain());
+
+ WKPrintingView *view = static_cast<WKPrintingView *>(untypedContext);
+ std::lock_guard<std::mutex> lock(view->_printingCallbackMutex);
+
+ // We may have received page rects while a message to call this function traveled from secondary thread to main one.
+ if ([view _hasPageRects]) {
+ [view _preparePDFDataForPrintingOnSecondaryThread];
+ return;
+ }
+
+ // A request for pages has already been made, just wait for it to finish.
+ if (view->_expectedComputedPagesCallback)
+ return;
+
+ [view _askPageToComputePageRects];
+}
+
+- (BOOL)knowsPageRange:(NSRangePointer)range
+{
+ LOG(View, "-[WKPrintingView %p knowsPageRange:], %s, %s", self, [self _hasPageRects] ? "print data is available" : "print data is not available yet", RunLoop::isMain() ? "on main thread" : "on secondary thread");
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Assuming that once we switch to printing from a secondary thread, we don't go back.
+ ASSERT(!_isPrintingFromSecondaryThread || !RunLoop::isMain());
+ if (!RunLoop::isMain())
+ _isPrintingFromSecondaryThread = YES;
+
+ if (!_webFrame->page()) {
+ *range = NSMakeRange(1, NSIntegerMax);
+ return YES;
+ }
+
+ [self _suspendAutodisplay];
+
+ [self performSelectorOnMainThread:@selector(_adjustPrintingMarginsForHeaderAndFooter) withObject:nil waitUntilDone:YES];
+
+ if ([self _hasPageRects])
+ *range = NSMakeRange(1, _printingPageRects.size());
+ else if (!RunLoop::isMain()) {
+ ASSERT(![self _isPrintingPreview]);
+ std::unique_lock<std::mutex> lock(_printingCallbackMutex);
+ callOnMainThread(prepareDataForPrintingOnSecondaryThread, self);
+ _printingCallbackCondition.wait(lock);
+ *range = NSMakeRange(1, _printingPageRects.size());
+ } else {
+ ASSERT([self _isPrintingPreview]);
+
+ // If a request for pages hasn't already been made, make it now.
+ if (!_expectedComputedPagesCallback)
+ [self _askPageToComputePageRects];
+
+ *range = NSMakeRange(1, NSIntegerMax);
+ }
+ return YES;
+}
+
+- (unsigned)_pageForRect:(NSRect)rect
+{
+ // Assuming that rect exactly matches one of the pages.
+ for (size_t i = 0; i < _printingPageRects.size(); ++i) {
+ IntRect currentRect(_printingPageRects[i]);
+ currentRect.scale(_totalScaleFactorForPrinting);
+ if (rect.origin.y == currentRect.y() && rect.origin.x == currentRect.x())
+ return i + 1;
+ }
+ ASSERT_NOT_REACHED();
+ return 0; // Invalid page number.
+}
+
+- (void)_drawPDFDocument:(PDFDocument *)pdfDocument page:(unsigned)page atPoint:(NSPoint)point
+{
+ if (!pdfDocument) {
+ LOG_ERROR("Couldn't create a PDF document with data passed for preview");
+ return;
+ }
+
+ PDFPage *pdfPage;
+ @try {
+ pdfPage = [pdfDocument pageAtIndex:page];
+ } @catch (id exception) {
+ LOG_ERROR("Preview data doesn't have page %d: %@", page, exception);
+ return;
+ }
+
+ NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
+ CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]);
+
+ CGContextSaveGState(context);
+ CGContextTranslateCTM(context, point.x, point.y);
+ CGContextScaleCTM(context, _totalScaleFactorForPrinting, -_totalScaleFactorForPrinting);
+ CGContextTranslateCTM(context, 0, -[pdfPage boundsForBox:kPDFDisplayBoxMediaBox].size.height);
+ [pdfPage drawWithBox:kPDFDisplayBoxMediaBox];
+
+ CGAffineTransform transform = CGContextGetCTM(context);
+
+ for (PDFAnnotation *annotation in [pdfPage annotations]) {
+ if (![annotation isKindOfClass:pdfAnnotationLinkClass()])
+ continue;
+
+ PDFAnnotationLink *linkAnnotation = (PDFAnnotationLink *)annotation;
+ NSURL *url = [linkAnnotation URL];
+ if (!url)
+ continue;
+
+ CGRect urlRect = NSRectToCGRect([linkAnnotation bounds]);
+ CGRect transformedRect = CGRectApplyAffineTransform(urlRect, transform);
+ CGPDFContextSetURLForRect(context, (CFURLRef)url, transformedRect);
+ }
+
+ CGContextRestoreGState(context);
+}
+
+- (void)_drawPreview:(NSRect)nsRect
+{
+ ASSERT(RunLoop::isMain());
+
+ IntRect scaledPrintingRect(nsRect);
+ scaledPrintingRect.scale(1 / _totalScaleFactorForPrinting);
+ IntSize imageSize(nsRect.size);
+ imageSize.scale(_webFrame->page()->deviceScaleFactor());
+ HashMap<WebCore::IntRect, RefPtr<ShareableBitmap>>::iterator pagePreviewIterator = _pagePreviews.find(scaledPrintingRect);
+ if (pagePreviewIterator == _pagePreviews.end()) {
+ // It's too early to ask for page preview if we don't even know page size and scale.
+ if ([self _hasPageRects]) {
+ if (uint64_t existingCallback = [self _expectedPreviewCallbackForRect:scaledPrintingRect]) {
+ // We've already asked for a preview of this page, and are waiting for response.
+ // There is no need to ask again.
+ _latestExpectedPreviewCallback = existingCallback;
+ } else {
+ // Preview isn't available yet, request it asynchronously.
+ if (!_webFrame->page())
+ return;
+
+ // Return to printing mode if we're already back to screen (e.g. due to window resizing).
+ _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]));
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<ImageCallback> callback = ImageCallback::create([context](bool, const ShareableBitmap::Handle& imageHandle) {
+ OwnPtr<IPCCallbackContext> contextDeleter = adoptPtr(context);
+ pageDidDrawToImage(imageHandle, context);
+ });
+ _latestExpectedPreviewCallback = callback->callbackID();
+ _expectedPreviewCallbacks.add(_latestExpectedPreviewCallback, scaledPrintingRect);
+
+ context->view = self;
+ context->callbackID = callback->callbackID();
+
+ _webFrame->page()->drawRectToImage(_webFrame.get(), PrintInfo([_printOperation printInfo]), scaledPrintingRect, imageSize, callback.get());
+ return;
+ }
+ }
+
+ // FIXME: Draw a placeholder
+ return;
+ }
+
+ RefPtr<ShareableBitmap> bitmap = pagePreviewIterator->value;
+ CGContextRef cgContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+
+ GraphicsContext context(cgContext);
+ GraphicsContextStateSaver stateSaver(context);
+
+ bitmap->paint(context, _webFrame->page()->deviceScaleFactor(), IntPoint(nsRect.origin), bitmap->bounds());
+}
+
+- (void)drawRect:(NSRect)nsRect
+{
+ LOG(View, "WKPrintingView %p printing rect x:%g, y:%g, width:%g, height:%g%s", self, nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height, [self _isPrintingPreview] ? " for preview" : "");
+
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ if (!_webFrame->page())
+ return;
+
+ if ([self _isPrintingPreview]) {
+ [self _drawPreview:nsRect];
+ return;
+ }
+
+ ASSERT(!RunLoop::isMain());
+ ASSERT(!_printedPagesData.isEmpty()); // Prepared by knowsPageRange:
+
+ if (!_printedPagesPDFDocument) {
+ RetainPtr<NSData> pdfData = adoptNS([[NSData alloc] initWithBytes:_printedPagesData.data() length:_printedPagesData.size()]);
+ _printedPagesPDFDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:pdfData.get()]);
+ }
+
+ unsigned printedPageNumber = [self _pageForRect:nsRect] - [self _firstPrintedPageNumber];
+ [self _drawPDFDocument:_printedPagesPDFDocument.get() page:printedPageNumber atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)];
+}
+
+- (void)_drawPageBorderWithSizeOnMainThread:(NSSize)borderSize
+{
+ ASSERT(RunLoop::isMain());
+
+ // When printing from a secondary thread, the main thread doesn't have graphics context and printing operation set up.
+ NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
+ [NSGraphicsContext setCurrentContext:[_printOperation context]];
+
+ ASSERT(![NSPrintOperation currentOperation]);
+ [NSPrintOperation setCurrentOperation:_printOperation];
+
+ [self drawPageBorderWithSize:borderSize];
+
+ [NSPrintOperation setCurrentOperation:nil];
+ [NSGraphicsContext setCurrentContext:currentContext];
+}
+
+- (void)drawPageBorderWithSize:(NSSize)borderSize
+{
+ ASSERT(NSEqualSizes(borderSize, [[_printOperation printInfo] paperSize]));
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ if (!RunLoop::isMain()) {
+ // Don't call the client from a secondary thread.
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[WKPrintingView instanceMethodSignatureForSelector:@selector(_drawPageBorderWithSizeOnMainThread:)]];
+ [invocation setSelector:@selector(_drawPageBorderWithSizeOnMainThread:)];
+ [invocation setArgument:&borderSize atIndex:2];
+ [invocation performSelectorOnMainThread:@selector(invokeWithTarget:) withObject:self waitUntilDone:YES];
+ return;
+ }
+
+ if (!_webFrame->page())
+ return;
+
+ // The header and footer rect height scales with the page, but the width is always
+ // all the way across the printed page (inset by printing margins).
+ NSPrintInfo *printInfo = [_printOperation printInfo];
+ CGFloat scale = [printInfo scalingFactor];
+ NSSize paperSize = [printInfo paperSize];
+ CGFloat headerFooterLeft = [printInfo leftMargin] / scale;
+ CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
+ NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(_webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get()));
+ NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(_webFrame.get()));
+
+ NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
+ [currentContext saveGraphicsState];
+ NSRectClip(headerRect);
+ _webFrame->page()->drawHeader(_webFrame.get(), headerRect);
+ [currentContext restoreGraphicsState];
+
+ [currentContext saveGraphicsState];
+ NSRectClip(footerRect);
+ _webFrame->page()->drawFooter(_webFrame.get(), footerRect);
+ [currentContext restoreGraphicsState];
+}
+
+- (NSRect)rectForPage:(NSInteger)page
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+ if (![self _hasPageRects]) {
+ LOG(View, "-[WKPrintingView %p rectForPage:%d] - data is not yet available", self, (int)page);
+ if (!_webFrame->page()) {
+ // We may have not told AppKit how many pages there are, so it will try to print until a null rect is returned.
+ return NSMakeRect(0, 0, 0, 0);
+ }
+ // We must be still calculating the page range.
+ ASSERT(_expectedComputedPagesCallback);
+ return NSMakeRect(0, 0, 1, 1);
+ }
+
+ // If Web process crashes while computing page rects, we never tell AppKit how many pages there are.
+ // Returning a null rect prevents selecting non-existent pages in preview dialog.
+ if (static_cast<unsigned>(page) > _printingPageRects.size()) {
+ ASSERT(!_webFrame->page());
+ return NSMakeRect(0, 0, 0, 0);
+ }
+
+ IntRect rect = _printingPageRects[page - 1];
+ rect.scale(_totalScaleFactorForPrinting);
+ LOG(View, "-[WKPrintingView %p rectForPage:%d] -> x %d, y %d, width %d, height %d", self, (int)page, rect.x(), rect.y(), rect.width(), rect.height());
+ return rect;
+}
+
+// Temporary workaround for <rdar://problem/8944535>. Force correct printout positioning.
+- (NSPoint)locationOfPrintRect:(NSRect)aRect
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+ return NSMakePoint([[_printOperation printInfo] leftMargin], [[_printOperation printInfo] bottomMargin]);
+}
+
+- (void)beginDocument
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Forcing preview update gets us here, but page setup hasn't actually changed.
+ if (isForcingPreviewUpdate)
+ return;
+
+ LOG(View, "-[WKPrintingView %p beginDocument]", self);
+
+ [super beginDocument];
+
+ [self _suspendAutodisplay];
+}
+
+- (void)endDocument
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Forcing preview update gets us here, but page setup hasn't actually changed.
+ if (isForcingPreviewUpdate)
+ return;
+
+ LOG(View, "-[WKPrintingView %p endDocument] - clearing cached data", self);
+
+ // Both existing data and pending responses are now obsolete.
+ _printingPageRects.clear();
+ _totalScaleFactorForPrinting = 1;
+ _pagePreviews.clear();
+ _printedPagesData.clear();
+ _printedPagesPDFDocument = nullptr;
+ _expectedComputedPagesCallback = 0;
+ _expectedPreviewCallbacks.clear();
+ _latestExpectedPreviewCallback = 0;
+ _expectedPrintCallback = 0;
+
+ [self _delayedResumeAutodisplay];
+
+ [super endDocument];
+}
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKTextInputWindowControllerhfromrev164600trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.h (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.h        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2009, 2010 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. ``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
+ * 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 WKTextInputWindowController_h
+#define WKTextInputWindowController_h
+
+#if USE(APPKIT)
+
+@class WKTextInputPanel;
+
+@interface WKTextInputWindowController : NSObject {
+ WKTextInputPanel *_panel;
+}
+
++ (WKTextInputWindowController *)sharedTextInputWindowController;
+
+- (NSTextInputContext *)inputContext;
+- (BOOL)interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string;
+
+- (BOOL)hasMarkedText;
+- (void)unmarkText;
+
+@end
+
+#endif // USE(APPKIT)
+
+#endif // WKTextInputWindowController_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKTextInputWindowControllerh"></a>
<div class="propset"><h4>Property changes: trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2UIProcessmacWKTextInputWindowControllermmfromrev164600trunkSourceWebKit2UIProcessAPImacWKTextInputWindowControllermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm (from rev 164600, trunk/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm) (0 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -0,0 +1,214 @@
</span><ins>+/*
+ * Copyright (C) 2010 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"
+#import "WKTextInputWindowController.h"
+
+#if USE(APPKIT)
+
+#import <WebKitSystemInterface.h>
+
+@interface WKTextInputView : NSTextView {
+}
+@end
+
+@implementation WKTextInputView
+
+- (NSArray *)validAttributesForMarkedText
+{
+ // Let TSM know that a bottom input window would be created for marked text.
+ NSArray *regularAttributes = [super validAttributesForMarkedText];
+ NSMutableArray *floatingWindowAttributes = [NSMutableArray arrayWithArray:regularAttributes];
+ [floatingWindowAttributes addObject:@"__NSUsesFloatingInputWindow"];
+ return floatingWindowAttributes;
+}
+
+@end
+
+@interface WKTextInputPanel : NSPanel {
+ NSTextView *_inputTextView;
+}
+
+- (NSTextInputContext *)_inputContext;
+- (BOOL)_interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string;
+
+- (BOOL)_hasMarkedText;
+- (void)_unmarkText;
+
+@end
+
+#define inputWindowHeight 20
+
+@implementation WKTextInputPanel
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [_inputTextView release];
+
+ [super dealloc];
+}
+
+- (id)init
+{
+ self = [super initWithContentRect:NSZeroRect styleMask:WKGetInputPanelWindowStyle() backing:NSBackingStoreBuffered defer:YES];
+ if (!self)
+ return nil;
+
+ // Set the frame size.
+ NSRect visibleFrame = [[NSScreen mainScreen] visibleFrame];
+ NSRect frame = NSMakeRect(visibleFrame.origin.x, visibleFrame.origin.y, visibleFrame.size.width, inputWindowHeight);
+
+ [self setFrame:frame display:NO];
+
+ _inputTextView = [[WKTextInputView alloc] initWithFrame:[(NSView *)self.contentView frame]];
+ _inputTextView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable | NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin;
+
+ NSScrollView* scrollView = [[NSScrollView alloc] initWithFrame:[(NSView *)self.contentView frame]];
+ scrollView.documentView = _inputTextView;
+ self.contentView = scrollView;
+ [scrollView release];
+
+ [self setFloatingPanel:YES];
+
+ return self;
+}
+
+- (void)_unmarkText
+{
+ [_inputTextView setString:@""];
+ [self orderOut:nil];
+}
+
+- (BOOL)_interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ BOOL hadMarkedText = [_inputTextView hasMarkedText];
+#pragma clang diagnostic pop
+
+ *string = nil;
+
+ // Let TSM know that a bottom input window would be created for marked text.
+ // FIXME: Can be removed once we can rely on __NSUsesFloatingInputWindow (or a better API) being available everywhere.
+ EventRef carbonEvent = static_cast<EventRef>(const_cast<void*>([event eventRef]));
+ if (carbonEvent) {
+ Boolean ignorePAH = true;
+ SetEventParameter(carbonEvent, 'iPAH', typeBoolean, sizeof(ignorePAH), &ignorePAH);
+ }
+
+ if (![[_inputTextView inputContext] handleEvent:event])
+ return NO;
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ if ([_inputTextView hasMarkedText]) {
+#pragma clang diagnostic pop
+ // Don't show the input method window for dead keys
+ if ([[event characters] length] > 0)
+ [self orderFront:nil];
+
+ return YES;
+ }
+
+ bool shouldReturnTextString = hadMarkedText;
+
+ // In the updated Cocoa text input model spec, we always want to return the text even if the text view didn't have marked text.
+ if (!usingLegacyCocoaTextInput)
+ shouldReturnTextString = true;
+
+ if (shouldReturnTextString) {
+ [self orderOut:nil];
+
+ NSString *text = [[_inputTextView textStorage] string];
+ if ([text length] > 0)
+ *string = [[text copy] autorelease];
+ }
+
+ [_inputTextView setString:@""];
+ return hadMarkedText;
+}
+
+- (NSTextInputContext *)_inputContext
+{
+ return [_inputTextView inputContext];
+}
+
+- (BOOL)_hasMarkedText
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return [_inputTextView hasMarkedText];
+#pragma clang diagnostic pop
+}
+
+@end
+
+@implementation WKTextInputWindowController
+
++ (WKTextInputWindowController *)sharedTextInputWindowController
+{
+ static WKTextInputWindowController *textInputWindowController;
+ if (!textInputWindowController)
+ textInputWindowController = [[WKTextInputWindowController alloc] init];
+
+ return textInputWindowController;
+}
+
+- (id)init
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _panel = [[WKTextInputPanel alloc] init];
+
+ return self;
+}
+
+- (NSTextInputContext *)inputContext
+{
+ return [_panel _inputContext];
+}
+
+- (BOOL)hasMarkedText
+{
+ return [_panel _hasMarkedText];
+}
+
+- (BOOL)interpretKeyEvent:(NSEvent *)event usingLegacyCocoaTextInput:(BOOL)usingLegacyCocoaTextInput string:(NSString **)string
+{
+ return [_panel _interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:string];
+}
+
+- (void)unmarkText
+{
+ [_panel _unmarkText];
+}
+
+@end
+
+#endif // USE(APPKIT)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (164600 => 164601)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-24 20:51:05 UTC (rev 164600)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-24 20:53:02 UTC (rev 164601)
</span><span class="lines">@@ -80,6 +80,14 @@
</span><span class="cx">                 0FCB4E5318BBE044000FCFC9 /* WKInteractionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4318BBE044000FCFC9 /* WKInteractionView.mm */; };
</span><span class="cx">                 0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */; };
</span><span class="cx">                 0FCB4E5518BBE044000FCFC9 /* WKScrollView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */; };
</span><ins>+                0FCB4E6018BBE3D9000FCFC9 /* FindIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */; };
+                0FCB4E6118BBE3D9000FCFC9 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */; };
+                0FCB4E6218BBE3D9000FCFC9 /* PageClientImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */; };
+                0FCB4E6318BBE3D9000FCFC9 /* PageClientImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */; };
+                0FCB4E6618BBE3D9000FCFC9 /* WKPrintingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */; };
+                0FCB4E6718BBE3D9000FCFC9 /* WKPrintingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5D18BBE3D9000FCFC9 /* WKPrintingView.mm */; };
+                0FCB4E6818BBE3D9000FCFC9 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */; };
+                0FCB4E6918BBE3D9000FCFC9 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */; };
</ins><span class="cx">                 0FF24A2D1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF24A2B1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp */; };
</span><span class="cx">                 0FF24A2E1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF24A2C1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h */; };
</span><span class="cx">                 1A043976124D034800FFBFB5 /* PluginProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043974124D034800FFBFB5 /* PluginProcess.h */; };
</span><span class="lines">@@ -194,8 +202,6 @@
</span><span class="cx">                 1A44B95716B737AA00B7BBD8 /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A17635416B1D5D000D88FD6 /* StorageNamespaceImpl.cpp */; };
</span><span class="cx">                 1A44B95B16B73F9F00B7BBD8 /* StorageManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A44B95916B73F9F00B7BBD8 /* StorageManager.cpp */; };
</span><span class="cx">                 1A44B95C16B73F9F00B7BBD8 /* StorageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A44B95A16B73F9F00B7BBD8 /* StorageManager.h */; };
</span><del>-                1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */; };
-                1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */; };
</del><span class="cx">                 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
</span><span class="cx">                 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */; };
</span><span class="cx">                 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */; };
</span><span class="lines">@@ -250,8 +256,6 @@
</span><span class="cx">                 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C23612650717003E44D4 /* PageOverlay.cpp */; };
</span><span class="cx">                 1A910071126675C4001842F5 /* FindIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A91006F126675C3001842F5 /* FindIndicator.h */; };
</span><span class="cx">                 1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A910070126675C4001842F5 /* FindIndicator.cpp */; };
</span><del>-                1A91010A1268C8CA001842F5 /* FindIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */; };
-                1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */; };
</del><span class="cx">                 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */; };
</span><span class="cx">                 1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */; };
</span><span class="cx">                 1A9E32891821636900F5D04C /* WKRemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9E32871821636900F5D04C /* WKRemoteObjectRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1011,8 +1015,6 @@
</span><span class="cx">                 BC111B0F112F5E4F00337BAB /* WebPageProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */; };
</span><span class="cx">                 BC111B11112F5E4F00337BAB /* WebProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */; };
</span><span class="cx">                 BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */; };
</span><del>-                BC111B50112F619200337BAB /* PageClientImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B4B112F619200337BAB /* PageClientImpl.h */; };
-                BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B4C112F619200337BAB /* PageClientImpl.mm */; };
</del><span class="cx">                 BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B5B112F629800337BAB /* WebEventFactory.h */; };
</span><span class="cx">                 BC111B5E112F629800337BAB /* WebEventFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B5C112F629800337BAB /* WebEventFactory.mm */; };
</span><span class="cx">                 BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14DF75120B5B7900826C0C /* InjectedBundleScriptWorld.h */; };
</span><span class="lines">@@ -1400,8 +1402,6 @@
</span><span class="cx">                 DF58C6361371ACA000F9A37C /* NativeWebWheelEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */; };
</span><span class="cx">                 E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; };
</span><span class="cx">                 E133FD8A1423DD7F00FC7BFB /* WebKit.icns in Resources */ = {isa = PBXBuildFile; fileRef = E133FD891423DD7F00FC7BFB /* WebKit.icns */; };
</span><del>-                E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */ = {isa = PBXBuildFile; fileRef = E134F01512EA5D11004EC58D /* WKPrintingView.h */; };
-                E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E134F01912EA5D99004EC58D /* WKPrintingView.mm */; };
</del><span class="cx">                 E13833EC189C33C8001E2350 /* LocalStorageDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = E13833EB189C33C8001E2350 /* LocalStorageDetails.h */; };
</span><span class="cx">                 E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */; };
</span><span class="cx">                 E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */; };
</span><span class="lines">@@ -1737,6 +1737,14 @@
</span><span class="cx">                 0FCB4E4318BBE044000FCFC9 /* WKInteractionView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKInteractionView.mm; path = ios/WKInteractionView.mm; sourceTree = "<group>"; };
</span><span class="cx">                 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKScrollView.h; path = ios/WKScrollView.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollView.mm; path = ios/WKScrollView.mm; sourceTree = "<group>"; };
</span><ins>+                0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicatorWindow.h; sourceTree = "<group>"; };
+                0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindIndicatorWindow.mm; sourceTree = "<group>"; };
+                0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImpl.h; sourceTree = "<group>"; };
+                0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImpl.mm; sourceTree = "<group>"; };
+                0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; };
+                0FCB4E5D18BBE3D9000FCFC9 /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; };
+                0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextInputWindowController.h; sourceTree = "<group>"; };
+                0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 0FF24A2B1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 0FF24A2C1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingAreaProxyMessages.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FF24A2F1879E4FE003ABF0C /* RemoteLayerTreeDrawingAreaProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = RemoteLayerTreeDrawingAreaProxy.messages.in; sourceTree = "<group>"; };
</span><span class="lines">@@ -1864,8 +1872,6 @@
</span><span class="cx">                 1A445BA4184D5FDA004B3414 /* WKContextConnectionClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextConnectionClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A44B95916B73F9F00B7BBD8 /* StorageManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageManager.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1A44B95A16B73F9F00B7BBD8 /* StorageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageManager.h; sourceTree = "<group>"; };
</span><del>-                1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextInputWindowController.h; sourceTree = "<group>"; };
-                1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; };
</del><span class="cx">                 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginModuleMac.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1929,8 +1935,6 @@
</span><span class="cx">                 1A90C23612650717003E44D4 /* PageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlay.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1A91006F126675C3001842F5 /* FindIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicator.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A910070126675C4001842F5 /* FindIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindIndicator.cpp; sourceTree = "<group>"; };
</span><del>-                1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicatorWindow.h; sourceTree = "<group>"; };
-                1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindIndicatorWindow.mm; sourceTree = "<group>"; };
</del><span class="cx">                 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeContext.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerTreeContextMac.mm; sourceTree = "<group>"; };
</span><span class="cx">                 1A9E32871821636900F5D04C /* WKRemoteObjectRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRemoteObjectRegistry.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -2772,8 +2776,6 @@
</span><span class="cx">                 BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = WebPageProxy.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessProxy.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessLauncherMac.mm; sourceTree = "<group>"; };
</span><del>-                BC111B4B112F619200337BAB /* PageClientImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImpl.h; sourceTree = "<group>"; };
-                BC111B4C112F619200337BAB /* PageClientImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImpl.mm; sourceTree = "<group>"; };
</del><span class="cx">                 BC111B5B112F629800337BAB /* WebEventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEventFactory.h; sourceTree = "<group>"; };
</span><span class="cx">                 BC111B5C112F629800337BAB /* WebEventFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEventFactory.mm; sourceTree = "<group>"; };
</span><span class="cx">                 BC122FA3132707F300F7EAC1 /* PluginProcess.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = PluginProcess.xcconfig; sourceTree = "<group>"; };
</span><span class="lines">@@ -3196,8 +3198,6 @@
</span><span class="cx">                 DF58C6311371AC5800F9A37C /* NativeWebWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebWheelEvent.h; sourceTree = "<group>"; };
</span><span class="cx">                 DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebWheelEventMac.mm; sourceTree = "<group>"; };
</span><span class="cx">                 E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = Resources/WebKit.icns; sourceTree = "<group>"; };
</span><del>-                E134F01512EA5D11004EC58D /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; };
-                E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; };
</del><span class="cx">                 E13833EB189C33C8001E2350 /* LocalStorageDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageDetails.h; sourceTree = "<group>"; };
</span><span class="cx">                 E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessPlatformStrategies.cpp; path = NetworkProcess/NetworkProcessPlatformStrategies.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessPlatformStrategies.h; path = NetworkProcess/NetworkProcessPlatformStrategies.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -5353,7 +5353,6 @@
</span><span class="cx">                 BC111B47112F616900337BAB /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                BCBAAC58144E38B90053F82F /* WKView Details */,
</del><span class="cx">                                 BC8699B3116AADAA002A925B /* WKView.mm */,
</span><span class="cx">                                 BC8699B4116AADAA002A925B /* WKViewInternal.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -5824,21 +5823,6 @@
</span><span class="cx">                         path = WebContentService.Development;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><del>-                BCBAAC58144E38B90053F82F /* WKView Details */ = {
-                        isa = PBXGroup;
-                        children = (
-                                1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */,
-                                1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */,
-                                BC111B4B112F619200337BAB /* PageClientImpl.h */,
-                                BC111B4C112F619200337BAB /* PageClientImpl.mm */,
-                                E134F01512EA5D11004EC58D /* WKPrintingView.h */,
-                                E134F01912EA5D99004EC58D /* WKPrintingView.mm */,
-                                1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */,
-                                1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */,
-                        );
-                        name = "WKView Details";
-                        sourceTree = "<group>";
-                };
</del><span class="cx">                 BCBECDBF16B5CE0D00047A1A /* PluginService.Development */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5860,12 +5844,14 @@
</span><span class="cx">                 BCCF085C113F3B7500C650C5 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                868160CF187645370021E79D /* WindowServerConnection.mm */,
-                                868160CD18763D4B0021E79D /* WindowServerConnection.h */,
</del><span class="cx">                                 B878B613133428DC006888E9 /* CorrectionPanel.h */,
</span><span class="cx">                                 B878B614133428DC006888E9 /* CorrectionPanel.mm */,
</span><del>-                                0FF24A2F1879E4FE003ABF0C /* RemoteLayerTreeDrawingAreaProxy.messages.in */,
</del><ins>+                                0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */,
+                                0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */,
+                                0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */,
+                                0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */,
</ins><span class="cx">                                 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */,
</span><ins>+                                0FF24A2F1879E4FE003ABF0C /* RemoteLayerTreeDrawingAreaProxy.messages.in */,
</ins><span class="cx">                                 1AB16ADF1648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm */,
</span><span class="cx">                                 1AA3D75A1651B44F008713D0 /* RemoteLayerTreeHost.h */,
</span><span class="cx">                                 1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */,
</span><span class="lines">@@ -5876,8 +5862,8 @@
</span><span class="cx">                                 1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */,
</span><span class="cx">                                 1AF05D8414688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm */,
</span><span class="cx">                                 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */,
</span><del>-                                2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */,
</del><span class="cx">                                 2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */,
</span><ins>+                                2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */,
</ins><span class="cx">                                 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */,
</span><span class="cx">                                 2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */,
</span><span class="cx">                                 728E86EF1795188C0087879E /* WebColorPickerMac.h */,
</span><span class="lines">@@ -5892,10 +5878,16 @@
</span><span class="cx">                                 BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */,
</span><span class="cx">                                 BC84EB1712A7100C0083F2DA /* WebPreferencesMac.mm */,
</span><span class="cx">                                 51D130571382F10500351EDD /* WebProcessProxyMac.mm */,
</span><ins>+                                868160CD18763D4B0021E79D /* WindowServerConnection.h */,
+                                868160CF187645370021E79D /* WindowServerConnection.mm */,
</ins><span class="cx">                                 E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
</span><span class="cx">                                 E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
</span><span class="cx">                                 CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */,
</span><span class="cx">                                 CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */,
</span><ins>+                                0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */,
+                                0FCB4E5D18BBE3D9000FCFC9 /* WKPrintingView.mm */,
+                                0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */,
+                                0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -6302,6 +6294,7 @@
</span><span class="cx">                                 BCA284D71492F2C7001F9042 /* WKConnection.h in Headers */,
</span><span class="cx">                                 BC017D0716260FF4007054F5 /* WKDOMDocument.h in Headers */,
</span><span class="cx">                                 BC017D0916260FF4007054F5 /* WKDOMElement.h in Headers */,
</span><ins>+                                0FCB4E6218BBE3D9000FCFC9 /* PageClientImpl.h in Headers */,
</ins><span class="cx">                                 BC017D0D16260FF4007054F5 /* WKDOMNode.h in Headers */,
</span><span class="cx">                                 BC39C4361626366F008BC689 /* WKDOMRange.h in Headers */,
</span><span class="cx">                                 293EBEAB1627D9C9005F89F1 /* WKDOMText.h in Headers */,
</span><span class="lines">@@ -6362,7 +6355,6 @@
</span><span class="cx">                                 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
</span><span class="cx">                                 1A910071126675C4001842F5 /* FindIndicator.h in Headers */,
</span><span class="cx">                                 515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
</span><del>-                                1A91010A1268C8CA001842F5 /* FindIndicatorWindow.h in Headers */,
</del><span class="cx">                                 BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
</span><span class="cx">                                 1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.h in Headers */,
</span><span class="cx">                                 BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */,
</span><span class="lines">@@ -6400,6 +6392,7 @@
</span><span class="cx">                                 1A9E32891821636900F5D04C /* WKRemoteObjectRegistry.h in Headers */,
</span><span class="cx">                                 51654EFE184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.h in Headers */,
</span><span class="cx">                                 BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */,
</span><ins>+                                0FCB4E6018BBE3D9000FCFC9 /* FindIndicatorWindow.h in Headers */,
</ins><span class="cx">                                 BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */,
</span><span class="cx">                                 BCB0B0DE12305A8C00B1341E /* InjectedBundleUserMessageCoders.h in Headers */,
</span><span class="cx">                                 1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */,
</span><span class="lines">@@ -6471,7 +6464,6 @@
</span><span class="cx">                                 1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */,
</span><span class="cx">                                 7CF47FFB17275C57008ACB91 /* PageBanner.h in Headers */,
</span><span class="cx">                                 BC6EDAA6111271C600E7678B /* PageClient.h in Headers */,
</span><del>-                                BC111B50112F619200337BAB /* PageClientImpl.h in Headers */,
</del><span class="cx">                                 1A90C23712650717003E44D4 /* PageOverlay.h in Headers */,
</span><span class="cx">                                 C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */,
</span><span class="cx">                                 E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */,
</span><span class="lines">@@ -6499,6 +6491,7 @@
</span><span class="cx">                                 1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */,
</span><span class="cx">                                 1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */,
</span><span class="cx">                                 1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */,
</span><ins>+                                0FCB4E6618BBE3D9000FCFC9 /* WKPrintingView.h in Headers */,
</ins><span class="cx">                                 1A1EC69E1872092100B951F0 /* ImportanceAssertion.h in Headers */,
</span><span class="cx">                                 1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */,
</span><span class="cx">                                 1A0EC75E124BC7B2007EF4A5 /* PluginProcessProxy.h in Headers */,
</span><span class="lines">@@ -6900,7 +6893,6 @@
</span><span class="cx">                                 762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */,
</span><span class="cx">                                 37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */,
</span><span class="cx">                                 51D0D437183B353D0097041D /* DatabaseProcessIDBConnectionMessages.h in Headers */,
</span><del>-                                E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */,
</del><span class="cx">                                 BCBAACED145225E30053F82F /* WKProcessGroupPrivate.h in Headers */,
</span><span class="cx">                                 512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,
</span><span class="cx">                                 518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */,
</span><span class="lines">@@ -6923,7 +6915,6 @@
</span><span class="cx">                                 BC40761A124FF0370068F20A /* WKStringCF.h in Headers */,
</span><span class="cx">                                 759CCD591808F1690078E8A8 /* WebOriginDataManagerProxyChangeClient.h in Headers */,
</span><span class="cx">                                 BC9099801256A98200083756 /* WKStringPrivate.h in Headers */,
</span><del>-                                1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */,
</del><span class="cx">                                 5175095A1897249700408FAC /* IDBIdentifier.h in Headers */,
</span><span class="cx">                                 1A3C888018A5ABAE00C4C962 /* WKPreferencesInternal.h in Headers */,
</span><span class="cx">                                 BC407608124FF0270068F20A /* WKType.h in Headers */,
</span><span class="lines">@@ -6944,6 +6935,7 @@
</span><span class="cx">                                 C5E1AFE916B20B75006CC1F2 /* WKWebArchive.h in Headers */,
</span><span class="cx">                                 C5E1AFEB16B20B7E006CC1F2 /* WKWebArchiveResource.h in Headers */,
</span><span class="cx">                                 BC989D82161A7E5D000D46D3 /* WKWebProcessPlugIn.h in Headers */,
</span><ins>+                                0FCB4E6818BBE3D9000FCFC9 /* WKTextInputWindowController.h in Headers */,
</ins><span class="cx">                                 BC8F2F2E16273ACC005FACB5 /* WKWebProcessPlugInBrowserContextControllerInternal.h in Headers */,
</span><span class="cx">                                 29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */,
</span><span class="cx">                                 1F7506B61859165700EC0FF7 /* WKWebProcessPlugInNodeHandleInternal.h in Headers */,
</span><span class="lines">@@ -7752,7 +7744,6 @@
</span><span class="cx">                                 1A1E093318861D3800D2DC49 /* WebProgressTrackerClient.cpp in Sources */,
</span><span class="cx">                                 1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */,
</span><span class="cx">                                 1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */,
</span><del>-                                1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */,
</del><span class="cx">                                 BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
</span><span class="cx">                                 378E1A4918208CD60031007A /* WKNSString.mm in Sources */,
</span><span class="cx">                                 BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */,
</span><span class="lines">@@ -7777,10 +7768,12 @@
</span><span class="cx">                                 CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */,
</span><span class="cx">                                 E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */,
</span><span class="cx">                                 BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */,
</span><ins>+                                0FCB4E6918BBE3D9000FCFC9 /* WKTextInputWindowController.mm in Sources */,
</ins><span class="cx">                                 37D0B5C81845232700F6CE7D /* WKErrorRecoveryAttempting.m in Sources */,
</span><span class="cx">                                 CD5C66A0134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.cpp in Sources */,
</span><span class="cx">                                 755422CB180650020046F6A8 /* WebOriginDataManager.cpp in Sources */,
</span><span class="cx">                                 BCA8C6A811E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp in Sources */,
</span><ins>+                                0FCB4E6718BBE3D9000FCFC9 /* WKPrintingView.mm in Sources */,
</ins><span class="cx">                                 1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
</span><span class="cx">                                 BC8147AA12F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp in Sources */,
</span><span class="cx">                                 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */,
</span><span class="lines">@@ -7861,7 +7854,6 @@
</span><span class="cx">                                 51E351F5180F5C7500E53BE9 /* WebIDBFactoryBackend.cpp in Sources */,
</span><span class="cx">                                 7C387434172F5615001BD88A /* PageBanner.cpp in Sources */,
</span><span class="cx">                                 7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */,
</span><del>-                                BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */,
</del><span class="cx">                                 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */,
</span><span class="cx">                                 C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */,
</span><span class="cx">                                 E19582D6153CC05400B60875 /* PDFKitImports.mm in Sources */,
</span><span class="lines">@@ -8189,6 +8181,7 @@
</span><span class="cx">                                 BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */,
</span><span class="cx">                                 BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */,
</span><span class="cx">                                 51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,
</span><ins>+                                0FCB4E6118BBE3D9000FCFC9 /* FindIndicatorWindow.mm in Sources */,
</ins><span class="cx">                                 BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */,
</span><span class="cx">                                 7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */,
</span><span class="cx">                                 935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */,
</span><span class="lines">@@ -8281,7 +8274,6 @@
</span><span class="cx">                                 7C135AA8173B0BCA00586AE2 /* WKPluginInformation.cpp in Sources */,
</span><span class="cx">                                 1AC86FF3130B46D3002C1257 /* WKPluginSiteDataManager.cpp in Sources */,
</span><span class="cx">                                 BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */,
</span><del>-                                E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */,
</del><span class="cx">                                 BCBAACEC145225E30053F82F /* WKProcessGroup.mm in Sources */,
</span><span class="cx">                                 512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */,
</span><span class="cx">                                 37948408150C4B9700E52CE9 /* WKRenderLayer.cpp in Sources */,
</span><span class="lines">@@ -8293,7 +8285,6 @@
</span><span class="cx">                                 1AC1337118566C7C00F3EC05 /* APIFrameHandle.cpp in Sources */,
</span><span class="cx">                                 BC407605124FF0270068F20A /* WKString.cpp in Sources */,
</span><span class="cx">                                 BC407619124FF0370068F20A /* WKStringCF.mm in Sources */,
</span><del>-                                1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */,
</del><span class="cx">                                 1AC7537B183A9FDB0072CB15 /* PageLoadState.cpp in Sources */,
</span><span class="cx">                                 BC407607124FF0270068F20A /* WKType.cpp in Sources */,
</span><span class="cx">                                 7CD5EBBE1746B04C000C1C45 /* WKTypeRefWrapper.mm in Sources */,
</span><span class="lines">@@ -8306,6 +8297,7 @@
</span><span class="cx">                                 BC40762A124FF0400068F20A /* WKURLRequestNS.mm in Sources */,
</span><span class="cx">                                 512A9760180E031D0039A149 /* DatabaseProcessMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BC40760D124FF0270068F20A /* WKURLResponse.cpp in Sources */,
</span><ins>+                                0FCB4E6318BBE3D9000FCFC9 /* PageClientImpl.mm in Sources */,
</ins><span class="cx">                                 1ADCB86A189831B30022EE5A /* NavigationActionData.cpp in Sources */,
</span><span class="cx">                                 BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */,
</span><span class="cx">                                 2D819B9E18627EE9001F03D1 /* ViewGestureGeometryCollector.cpp in Sources */,
</span></span></pre>
</div>
</div>
</body>
</html>