<!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>[161043] trunk/Source/WebKit</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/161043">161043</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2013-12-23 18:07:30 -0800 (Mon, 23 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
https://bugs.webkit.org/show_bug.cgi?id=125746
Reviewed by David Kilzer.
Source/WebKit:
* WebKit.xcodeproj/project.pbxproj: Added WebDatabaseManagerInternal.h
and iOS.xcconfig.
Source/WebKit/ios:
* WebCoreSupport/WebVisiblePosition.mm:
(-[WebVisiblePosition positionAtStartOrEndOfWord]): Changed a comment
to mention iOS rather than iPhone.
Source/WebKit/mac:
This is a straight upstreaming of the various PLATFORM(IOS) changes
made to Source/WebKit/ with the following modifications:
- Includes of <Cocoa/Cocoa.h> were generally replaced with an include
of <Foundation/Foundation.h> followed by an include of
<AppKit/AppKit.h> on non-iOS platforms. This assumes that nobody was
relying on <Cocoa/Cocoa.h>'s inclusion of <CoreData/CoreData.h>.
- Includes of <Cocoa/Cocoa.h> and <Foundation/Foundation.h> were
removed from files that include WebKitPrefix.h.
- Instances of 'iPhone (OS)' in comments were replaced with 'iOS', and
other sensitive terms were elided.
- Various PLATFORM(IOS) blocks were simplified. For instance:
#if !PLATFORM(IOS)
...
#endif
#if PLATFORM(IOS)
...
#endif
Was simplified to:
#if !PLATFORM(IOS)
...
#else
...
#endif
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
* Configurations/WebKit.xcconfig:
* Configurations/iOS.xcconfig: Added.
* DOM/WebDOMOperations.mm:
* DefaultDelegates/WebDefaultContextMenuDelegate.mm:
* DefaultDelegates/WebDefaultEditingDelegate.m:
* DefaultDelegates/WebDefaultPolicyDelegate.m:
* DefaultDelegates/WebDefaultUIDelegate.h:
* DefaultDelegates/WebDefaultUIDelegate.m:
* History/WebBackForwardList.mm:
* History/WebHistory.mm:
* History/WebHistoryItem.mm:
* History/WebURLsWithTitles.m:
* Misc/WebCache.mm:
* Misc/WebDownload.mm:
* Misc/WebElementDictionary.mm:
* Misc/WebIconDatabase.mm:
* Misc/WebIconDatabaseInternal.h:
* Misc/WebKitNSStringExtras.mm:
* Misc/WebKitSystemBits.m:
* Misc/WebKitVersionChecks.h:
* Misc/WebKitVersionChecks.m:
* Misc/WebLocalizableStrings.mm:
* Misc/WebNSArrayExtras.h:
* Misc/WebNSArrayExtras.m:
* Misc/WebNSControlExtras.h:
* Misc/WebNSControlExtras.m:
* Misc/WebNSDictionaryExtras.h:
* Misc/WebNSDictionaryExtras.m:
* Misc/WebNSEventExtras.m:
* Misc/WebNSFileManagerExtras.mm:
* Misc/WebNSImageExtras.h:
* Misc/WebNSImageExtras.m:
* Misc/WebNSPasteboardExtras.mm:
* Misc/WebNSPrintOperationExtras.h:
* Misc/WebNSPrintOperationExtras.m:
* Misc/WebNSURLExtras.mm:
* Misc/WebNSViewExtras.m:
* Misc/WebNSWindowExtras.m:
* Panels/WebAuthenticationPanel.h:
* Panels/WebAuthenticationPanel.m:
* Panels/WebPanelAuthenticationHandler.m:
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
* Plugins/WebBasePluginPackage.h:
* Plugins/WebBasePluginPackage.mm:
* Plugins/WebJavaPlugIn.h:
* Plugins/WebPluginContainerCheck.mm:
* Plugins/WebPluginController.h:
* Plugins/WebPluginController.mm:
* Plugins/WebPluginDatabase.mm:
* Plugins/WebPluginPackage.mm:
* Plugins/WebPluginsPrivate.m:
* Storage/WebDatabaseManager.mm:
* Storage/WebDatabaseManagerClient.h:
* Storage/WebDatabaseManagerClient.mm:
* Storage/WebDatabaseManagerInternal.h: Added.
* Storage/WebStorageManager.mm:
* WebCoreSupport/CorrectionPanel.h:
* WebCoreSupport/WebAlternativeTextClient.h:
* WebCoreSupport/WebApplicationCache.mm:
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
* WebCoreSupport/WebContextMenuClient.mm:
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
* WebCoreSupport/WebFrameNetworkingContext.h:
* WebCoreSupport/WebFrameNetworkingContext.mm:
* WebCoreSupport/WebGeolocationClient.h:
* WebCoreSupport/WebGeolocationClient.mm:
* WebCoreSupport/WebJavaScriptTextInputPanel.m:
* WebCoreSupport/WebKeyGenerator.mm:
* WebCoreSupport/WebNotificationClient.mm:
* WebCoreSupport/WebOpenPanelResultListener.mm:
* WebCoreSupport/WebSecurityOrigin.mm:
* WebCoreSupport/WebSystemInterface.mm:
* WebKitPrefix.h:
* WebView/WebArchive.mm:
* WebView/WebClipView.h:
* WebView/WebDataSource.mm:
* WebView/WebDelegateImplementationCaching.h:
* WebView/WebDelegateImplementationCaching.mm:
* WebView/WebDeviceOrientation.mm:
* WebView/WebDocumentInternal.h:
* WebView/WebDocumentLoaderMac.mm:
* WebView/WebDynamicScrollBarsViewInternal.h:
* WebView/WebFormDelegate.m:
* WebView/WebFrame.mm:
* WebView/WebFrameInternal.h:
* WebView/WebFrameView.mm:
* WebView/WebFullScreenController.h:
* WebView/WebFullScreenController.mm:
* WebView/WebHTMLRepresentation.mm:
* WebView/WebHTMLView.mm:
* WebView/WebHTMLViewInternal.h:
* WebView/WebPDFDocumentExtras.h:
* WebView/WebPDFDocumentExtras.mm:
* WebView/WebPDFRepresentation.h:
* WebView/WebPDFRepresentation.mm:
* WebView/WebPDFView.h:
* WebView/WebPDFView.mm:
* WebView/WebPreferences.mm:
* WebView/WebResource.mm:
* WebView/WebTextCompletionController.h:
* WebView/WebTextIterator.mm:
* WebView/WebView.mm:
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
* WebView/WebViewInternal.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebVisiblePositionmm">trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacConfigurationsBasexcconfig">trunk/Source/WebKit/mac/Configurations/Base.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacConfigurationsDebugReleasexcconfig">trunk/Source/WebKit/mac/Configurations/DebugRelease.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacConfigurationsVersionxcconfig">trunk/Source/WebKit/mac/Configurations/Version.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacConfigurationsWebKitxcconfig">trunk/Source/WebKit/mac/Configurations/WebKit.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacDOMWebDOMOperationsmm">trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm</a></li>
<li><a href="#trunkSourceWebKitmacDefaultDelegatesWebDefaultContextMenuDelegatemm">trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm</a></li>
<li><a href="#trunkSourceWebKitmacDefaultDelegatesWebDefaultEditingDelegatem">trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultEditingDelegate.m</a></li>
<li><a href="#trunkSourceWebKitmacDefaultDelegatesWebDefaultPolicyDelegatem">trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m</a></li>
<li><a href="#trunkSourceWebKitmacDefaultDelegatesWebDefaultUIDelegateh">trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.h</a></li>
<li><a href="#trunkSourceWebKitmacDefaultDelegatesWebDefaultUIDelegatem">trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m</a></li>
<li><a href="#trunkSourceWebKitmacHistoryWebBackForwardListmm">trunk/Source/WebKit/mac/History/WebBackForwardList.mm</a></li>
<li><a href="#trunkSourceWebKitmacHistoryWebHistorymm">trunk/Source/WebKit/mac/History/WebHistory.mm</a></li>
<li><a href="#trunkSourceWebKitmacHistoryWebHistoryItemmm">trunk/Source/WebKit/mac/History/WebHistoryItem.mm</a></li>
<li><a href="#trunkSourceWebKitmacHistoryWebURLsWithTitlesm">trunk/Source/WebKit/mac/History/WebURLsWithTitles.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebCachemm">trunk/Source/WebKit/mac/Misc/WebCache.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebDownloadmm">trunk/Source/WebKit/mac/Misc/WebDownload.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebElementDictionarymm">trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebIconDatabasemm">trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebIconDatabaseInternalh">trunk/Source/WebKit/mac/Misc/WebIconDatabaseInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitNSStringExtrasmm">trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitSystemBitsm">trunk/Source/WebKit/mac/Misc/WebKitSystemBits.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitVersionChecksh">trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitVersionChecksm">trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebLocalizableStringsmm">trunk/Source/WebKit/mac/Misc/WebLocalizableStrings.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSArrayExtrash">trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSArrayExtrasm">trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSControlExtrash">trunk/Source/WebKit/mac/Misc/WebNSControlExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSControlExtrasm">trunk/Source/WebKit/mac/Misc/WebNSControlExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSDictionaryExtrash">trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSDictionaryExtrasm">trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSEventExtrasm">trunk/Source/WebKit/mac/Misc/WebNSEventExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSFileManagerExtrasmm">trunk/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSImageExtrash">trunk/Source/WebKit/mac/Misc/WebNSImageExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSImageExtrasm">trunk/Source/WebKit/mac/Misc/WebNSImageExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSPasteboardExtrasmm">trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSPrintOperationExtrash">trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSPrintOperationExtrasm">trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSURLExtrasmm">trunk/Source/WebKit/mac/Misc/WebNSURLExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSViewExtrasm">trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSWindowExtrasm">trunk/Source/WebKit/mac/Misc/WebNSWindowExtras.m</a></li>
<li><a href="#trunkSourceWebKitmacPanelsWebAuthenticationPanelh">trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.h</a></li>
<li><a href="#trunkSourceWebKitmacPanelsWebAuthenticationPanelm">trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.m</a></li>
<li><a href="#trunkSourceWebKitmacPanelsWebPanelAuthenticationHandlerm">trunk/Source/WebKit/mac/Panels/WebPanelAuthenticationHandler.m</a></li>
<li><a href="#trunkSourceWebKitmacPluginsHostedWebHostedNetscapePluginViewmm">trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebBasePluginPackageh">trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.h</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebBasePluginPackagemm">trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebJavaPlugInh">trunk/Source/WebKit/mac/Plugins/WebJavaPlugIn.h</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginContainerCheckmm">trunk/Source/WebKit/mac/Plugins/WebPluginContainerCheck.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginControllerh">trunk/Source/WebKit/mac/Plugins/WebPluginController.h</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginControllermm">trunk/Source/WebKit/mac/Plugins/WebPluginController.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginDatabasemm">trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginPackagemm">trunk/Source/WebKit/mac/Plugins/WebPluginPackage.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebPluginsPrivatem">trunk/Source/WebKit/mac/Plugins/WebPluginsPrivate.m</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebDatabaseManagermm">trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebDatabaseManagerClienth">trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebDatabaseManagerClientmm">trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebStorageManagermm">trunk/Source/WebKit/mac/Storage/WebStorageManager.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportCorrectionPanelh">trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebApplicationCachemm">trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebChromeClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebChromeClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameNetworkingContexth">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameNetworkingContextmm">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebGeolocationClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebGeolocationClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebJavaScriptTextInputPanelm">trunk/Source/WebKit/mac/WebCoreSupport/WebJavaScriptTextInputPanel.m</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebKeyGeneratormm">trunk/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebNotificationClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebOpenPanelResultListenermm">trunk/Source/WebKit/mac/WebCoreSupport/WebOpenPanelResultListener.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSecurityOriginmm">trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm">trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebKitPrefixh">trunk/Source/WebKit/mac/WebKitPrefix.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebArchivemm">trunk/Source/WebKit/mac/WebView/WebArchive.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebClipViewh">trunk/Source/WebKit/mac/WebView/WebClipView.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDataSourcemm">trunk/Source/WebKit/mac/WebView/WebDataSource.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDelegateImplementationCachingh">trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDelegateImplementationCachingmm">trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDeviceOrientationmm">trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDocumentInternalh">trunk/Source/WebKit/mac/WebView/WebDocumentInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDocumentLoaderMacmm">trunk/Source/WebKit/mac/WebView/WebDocumentLoaderMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDynamicScrollBarsViewInternalh">trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFormDelegatem">trunk/Source/WebKit/mac/WebView/WebFormDelegate.m</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramemm">trunk/Source/WebKit/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFrameInternalh">trunk/Source/WebKit/mac/WebView/WebFrameInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFrameViewmm">trunk/Source/WebKit/mac/WebView/WebFrameView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFullScreenControllerh">trunk/Source/WebKit/mac/WebView/WebFullScreenController.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFullScreenControllermm">trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLRepresentationmm">trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewInternalh">trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFDocumentExtrash">trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFDocumentExtrasmm">trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFRepresentationh">trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFRepresentationmm">trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFViewh">trunk/Source/WebKit/mac/WebView/WebPDFView.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPDFViewmm">trunk/Source/WebKit/mac/WebView/WebPDFView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebResourcemm">trunk/Source/WebKit/mac/WebView/WebResource.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebTextCompletionControllerh">trunk/Source/WebKit/mac/WebView/WebTextCompletionController.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebTextIteratormm">trunk/Source/WebKit/mac/WebView/WebTextIterator.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatah">trunk/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatamm">trunk/Source/WebKit/mac/WebView/WebViewData.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitmacConfigurationsiOSxcconfig">trunk/Source/WebKit/mac/Configurations/iOS.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebDatabaseManagerInternalh">trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/ChangeLog        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2013-12-23 Andy Estes <aestes@apple.com>
+
+ [iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
+ https://bugs.webkit.org/show_bug.cgi?id=125746
+
+ Reviewed by David Kilzer.
+
+ * WebKit.xcodeproj/project.pbxproj: Added WebDatabaseManagerInternal.h
+ and iOS.xcconfig.
+
</ins><span class="cx"> 2013-12-22 Martin Robinson <mrobinson@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK][CMake] libtool-compatible soversion calculation
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -103,6 +103,7 @@
</span><span class="cx">                 5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; };
</span><span class="cx">                 5185F62610712B80007AA393 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F62510712B80007AA393 /* WebNavigationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; };
</span><ins>+                51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; };
</ins><span class="cx">                 51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
</span><span class="cx">                 51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; };
</span><span class="cx">                 51CBFCAD0D10E6C5002DBF51 /* WebCachedFramePlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */; };
</span><span class="lines">@@ -587,6 +588,7 @@
</span><span class="cx">                 51A8B579042834F700CA2D3A /* WebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 51A8B57A042834F700CA2D3A /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><ins>+                51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = "<group>"; };
</ins><span class="cx">                 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };
</span><span class="cx">                 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = "<group>"; };
</span><span class="cx">                 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCachedFramePlatformData.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -899,6 +901,7 @@
</span><span class="cx">                 F834AAD60E64B1C700E2737C /* WebTextIterator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextIterator.mm; sourceTree = "<group>"; };
</span><span class="cx">                 F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 F8CA15B6029A39D901000122 /* WebAuthenticationPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebAuthenticationPanel.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><ins>+                FEE7D6910D99B06A005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
</ins><span class="cx"> /* End PBXFileReference section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXFrameworksBuildPhase section */
</span><span class="lines">@@ -1050,6 +1053,7 @@
</span><span class="cx">                                 1C904FD50BA9DD0F0081E9D0 /* Base.xcconfig */,
</span><span class="cx">                                 1C904FD40BA9DD0F0081E9D0 /* DebugRelease.xcconfig */,
</span><span class="cx">                                 449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */,
</span><ins>+                                FEE7D6910D99B06A005351F6 /* iOS.xcconfig */,
</ins><span class="cx">                                 1C904FD30BA9DD0F0081E9D0 /* Version.xcconfig */,
</span><span class="cx">                                 1C904FD20BA9DD0F0081E9D0 /* WebKit.xcconfig */,
</span><span class="cx">                         );
</span><span class="lines">@@ -1178,6 +1182,7 @@
</span><span class="cx">                                 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
</span><span class="cx">                                 511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */,
</span><span class="cx">                                 511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */,
</span><ins>+                                51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
</ins><span class="cx">                                 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
</span><span class="cx">                                 A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
</span><span class="cx">                                 A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
</span><span class="lines">@@ -1704,6 +1709,7 @@
</span><span class="cx">                                 939810160824BF01008DF038 /* WebCoreStatistics.h in Headers */,
</span><span class="cx">                                 93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */,
</span><span class="cx">                                 511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */,
</span><ins>+                                51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
</ins><span class="cx">                                 511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
</span><span class="cx">                                 A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
</span><span class="cx">                                 9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/ios/ChangeLog        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2013-12-23 Andy Estes <aestes@apple.com>
+
+ [iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
+ https://bugs.webkit.org/show_bug.cgi?id=125746
+
+ Reviewed by David Kilzer.
+
+ * WebCoreSupport/WebVisiblePosition.mm:
+ (-[WebVisiblePosition positionAtStartOrEndOfWord]): Changed a comment
+ to mention iOS rather than iPhone.
+
</ins><span class="cx"> 2013-12-04 Brian J. Burg <burg@cs.washington.edu>
</span><span class="cx">
</span><span class="cx"> Consolidate various frame snapshot capabilities.
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebVisiblePositionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -301,7 +301,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Ripped from WebCore::Frame::moveSelectionToStartOrEndOfCurrentWord
</span><span class="cx">
</span><del>- // Note: this is the iPhone notion, not the unicode notion.
</del><ins>+ // Note: this is the iOS notion, not the unicode notion.
</ins><span class="cx"> // Here, a word starts with non-whitespace or at the start of a line and
</span><span class="cx"> // ends at the next whitespace, or at the end of a line.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/ChangeLog        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -1,3 +1,154 @@
</span><ins>+2013-12-23 Andy Estes <aestes@apple.com>
+
+ [iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
+ https://bugs.webkit.org/show_bug.cgi?id=125746
+
+ Reviewed by David Kilzer.
+
+ This is a straight upstreaming of the various PLATFORM(IOS) changes
+ made to Source/WebKit/ with the following modifications:
+
+ - Includes of <Cocoa/Cocoa.h> were generally replaced with an include
+ of <Foundation/Foundation.h> followed by an include of
+ <AppKit/AppKit.h> on non-iOS platforms. This assumes that nobody was
+ relying on <Cocoa/Cocoa.h>'s inclusion of <CoreData/CoreData.h>.
+
+ - Includes of <Cocoa/Cocoa.h> and <Foundation/Foundation.h> were
+ removed from files that include WebKitPrefix.h.
+
+ - Instances of 'iPhone (OS)' in comments were replaced with 'iOS', and
+ other sensitive terms were elided.
+
+ - Various PLATFORM(IOS) blocks were simplified. For instance:
+
+ #if !PLATFORM(IOS)
+ ...
+ #endif
+ #if PLATFORM(IOS)
+ ...
+ #endif
+
+ Was simplified to:
+
+ #if !PLATFORM(IOS)
+ ...
+ #else
+ ...
+ #endif
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+ * Configurations/Version.xcconfig:
+ * Configurations/WebKit.xcconfig:
+ * Configurations/iOS.xcconfig: Added.
+ * DOM/WebDOMOperations.mm:
+ * DefaultDelegates/WebDefaultContextMenuDelegate.mm:
+ * DefaultDelegates/WebDefaultEditingDelegate.m:
+ * DefaultDelegates/WebDefaultPolicyDelegate.m:
+ * DefaultDelegates/WebDefaultUIDelegate.h:
+ * DefaultDelegates/WebDefaultUIDelegate.m:
+ * History/WebBackForwardList.mm:
+ * History/WebHistory.mm:
+ * History/WebHistoryItem.mm:
+ * History/WebURLsWithTitles.m:
+ * Misc/WebCache.mm:
+ * Misc/WebDownload.mm:
+ * Misc/WebElementDictionary.mm:
+ * Misc/WebIconDatabase.mm:
+ * Misc/WebIconDatabaseInternal.h:
+ * Misc/WebKitNSStringExtras.mm:
+ * Misc/WebKitSystemBits.m:
+ * Misc/WebKitVersionChecks.h:
+ * Misc/WebKitVersionChecks.m:
+ * Misc/WebLocalizableStrings.mm:
+ * Misc/WebNSArrayExtras.h:
+ * Misc/WebNSArrayExtras.m:
+ * Misc/WebNSControlExtras.h:
+ * Misc/WebNSControlExtras.m:
+ * Misc/WebNSDictionaryExtras.h:
+ * Misc/WebNSDictionaryExtras.m:
+ * Misc/WebNSEventExtras.m:
+ * Misc/WebNSFileManagerExtras.mm:
+ * Misc/WebNSImageExtras.h:
+ * Misc/WebNSImageExtras.m:
+ * Misc/WebNSPasteboardExtras.mm:
+ * Misc/WebNSPrintOperationExtras.h:
+ * Misc/WebNSPrintOperationExtras.m:
+ * Misc/WebNSURLExtras.mm:
+ * Misc/WebNSViewExtras.m:
+ * Misc/WebNSWindowExtras.m:
+ * Panels/WebAuthenticationPanel.h:
+ * Panels/WebAuthenticationPanel.m:
+ * Panels/WebPanelAuthenticationHandler.m:
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ * Plugins/WebBasePluginPackage.h:
+ * Plugins/WebBasePluginPackage.mm:
+ * Plugins/WebJavaPlugIn.h:
+ * Plugins/WebPluginContainerCheck.mm:
+ * Plugins/WebPluginController.h:
+ * Plugins/WebPluginController.mm:
+ * Plugins/WebPluginDatabase.mm:
+ * Plugins/WebPluginPackage.mm:
+ * Plugins/WebPluginsPrivate.m:
+ * Storage/WebDatabaseManager.mm:
+ * Storage/WebDatabaseManagerClient.h:
+ * Storage/WebDatabaseManagerClient.mm:
+ * Storage/WebDatabaseManagerInternal.h: Added.
+ * Storage/WebStorageManager.mm:
+ * WebCoreSupport/CorrectionPanel.h:
+ * WebCoreSupport/WebAlternativeTextClient.h:
+ * WebCoreSupport/WebApplicationCache.mm:
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ * WebCoreSupport/WebContextMenuClient.mm:
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ * WebCoreSupport/WebFrameNetworkingContext.h:
+ * WebCoreSupport/WebFrameNetworkingContext.mm:
+ * WebCoreSupport/WebGeolocationClient.h:
+ * WebCoreSupport/WebGeolocationClient.mm:
+ * WebCoreSupport/WebJavaScriptTextInputPanel.m:
+ * WebCoreSupport/WebKeyGenerator.mm:
+ * WebCoreSupport/WebNotificationClient.mm:
+ * WebCoreSupport/WebOpenPanelResultListener.mm:
+ * WebCoreSupport/WebSecurityOrigin.mm:
+ * WebCoreSupport/WebSystemInterface.mm:
+ * WebKitPrefix.h:
+ * WebView/WebArchive.mm:
+ * WebView/WebClipView.h:
+ * WebView/WebDataSource.mm:
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebDelegateImplementationCaching.mm:
+ * WebView/WebDeviceOrientation.mm:
+ * WebView/WebDocumentInternal.h:
+ * WebView/WebDocumentLoaderMac.mm:
+ * WebView/WebDynamicScrollBarsViewInternal.h:
+ * WebView/WebFormDelegate.m:
+ * WebView/WebFrame.mm:
+ * WebView/WebFrameInternal.h:
+ * WebView/WebFrameView.mm:
+ * WebView/WebFullScreenController.h:
+ * WebView/WebFullScreenController.mm:
+ * WebView/WebHTMLRepresentation.mm:
+ * WebView/WebHTMLView.mm:
+ * WebView/WebHTMLViewInternal.h:
+ * WebView/WebPDFDocumentExtras.h:
+ * WebView/WebPDFDocumentExtras.mm:
+ * WebView/WebPDFRepresentation.h:
+ * WebView/WebPDFRepresentation.mm:
+ * WebView/WebPDFView.h:
+ * WebView/WebPDFView.mm:
+ * WebView/WebPreferences.mm:
+ * WebView/WebResource.mm:
+ * WebView/WebTextCompletionController.h:
+ * WebView/WebTextIterator.mm:
+ * WebView/WebView.mm:
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ * WebView/WebViewInternal.h:
+
</ins><span class="cx"> 2013-12-23 Oliver Hunt <oliver@apple.com>
</span><span class="cx">
</span><span class="cx"> Refactor PutPropertySlot to be aware of custom properties
</span><span class="lines">@@ -42,9 +193,9 @@
</span><span class="cx"> (core):
</span><span class="cx"> (kit):
</span><span class="cx"> * WebView/WebViewPrivate.h:
</span><del>- - removed PageVisibilityStateUnloaded/WebPageVisibilityStateUnloaded
</del><ins>+ - removed PageVisibilityStateUnloaded/WebPageVisibilityStateUnloade
</ins><span class="cx">
</span><del>-2013-12-15 Andy Estes <aestes@apple.com>
</del><ins>+2013-12-14 Andy Estes <aestes@apple.com>
</ins><span class="cx">
</span><span class="cx"> [iOS] Upstream changes to WebKit Public and Private headers
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=125745
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsBasexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Configurations/Base.xcconfig (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/Base.xcconfig        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Configurations/Base.xcconfig        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -19,8 +19,10 @@
</span><span class="cx"> // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx">
</span><ins>+#include "iOS.xcconfig"
+
</ins><span class="cx"> CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
</span><span class="cx"> CLANG_CXX_LIBRARY = libc++;
</span><span class="cx"> CLANG_WARN_BOOL_CONVERSION = YES;
</span><span class="lines">@@ -78,7 +80,10 @@
</span><span class="cx"> DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
</span><span class="cx">
</span><span class="cx"> GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
</span><del>-GCC_OPTIMIZATION_LEVEL_normal = 2;
</del><ins>+GCC_OPTIMIZATION_LEVEL_normal = $(GCC_OPTIMIZATION_LEVEL_normal_$(PLATFORM_NAME));
+GCC_OPTIMIZATION_LEVEL_normal_iphoneos = 3;
+GCC_OPTIMIZATION_LEVEL_normal_iphonesimulator = 3;
+GCC_OPTIMIZATION_LEVEL_normal_macosx = 2;
</ins><span class="cx"> GCC_OPTIMIZATION_LEVEL_debug = 0;
</span><span class="cx">
</span><span class="cx"> STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
</span><span class="lines">@@ -89,10 +94,14 @@
</span><span class="cx"> // building the MiG bindings for WebKitPluginClient even when the functions that the bindings wrap are not built.
</span><span class="cx"> DEAD_CODE_STRIPPING = YES;
</span><span class="cx">
</span><del>-SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit.order;
</del><ins>+SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(PLATFORM_NAME));
+SECTORDER_FLAGS_iphoneos = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebKit.order;
+SECTORDER_FLAGS_macosx = -Wl,-order_file,mac/WebKit.order;
</ins><span class="cx">
</span><span class="cx"> SDKROOT = macosx.internal;
</span><span class="cx">
</span><ins>+SUPPORTED_PLATFORMS = iphonesimulator iphoneos macosx;
+
</ins><span class="cx"> TOOLCHAINS = $(TOOLCHAINS_$(PLATFORM_NAME));
</span><span class="cx"> TOOLCHAINS_iphoneos = $(TOOLCHAINS);
</span><span class="cx"> TOOLCHAINS_iphonesimulator = $(TOOLCHAINS);
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsDebugReleasexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Configurations/DebugRelease.xcconfig (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/DebugRelease.xcconfig        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Configurations/DebugRelease.xcconfig        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx"> ONLY_ACTIVE_ARCH = YES;
</span><span class="cx">
</span><span class="cx"> MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME));
</span><del>-MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5;
-MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5;
</del><ins>+MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.8;
+MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.8;
</ins><span class="cx"> MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
</span><span class="cx"> MACOSX_DEPLOYMENT_TARGET_macosx_1080 = 10.8;
</span><span class="cx"> MACOSX_DEPLOYMENT_TARGET_macosx_1090 = 10.9;
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsVersionxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Configurations/Version.xcconfig (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/Version.xcconfig        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Configurations/Version.xcconfig        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">
</span><span class="cx"> // The system version prefix is based on the current system version.
</span><span class="cx"> SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(PLATFORM_NAME));
</span><del>-SYSTEM_VERSION_PREFIX_iphoneos = 6; // iPhone OS is most like SnowLeopard currently.
</del><ins>+SYSTEM_VERSION_PREFIX_iphoneos = 8;
</ins><span class="cx"> SYSTEM_VERSION_PREFIX_iphonesimulator = $(SYSTEM_VERSION_PREFIX_iphoneos);
</span><span class="cx"> SYSTEM_VERSION_PREFIX_macosx = $(SYSTEM_VERSION_PREFIX_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
</span><span class="cx"> SYSTEM_VERSION_PREFIX_macosx_1080 = 8;
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsWebKitxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Configurations/WebKit.xcconfig (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/WebKit.xcconfig        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Configurations/WebKit.xcconfig        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -33,9 +33,16 @@
</span><span class="cx"> EXPORTED_SYMBOLS_FILE_ = mac/WebKit.exp;
</span><span class="cx"> EXPORTED_SYMBOLS_FILE_armv6 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
</span><span class="cx"> EXPORTED_SYMBOLS_FILE_armv7 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
</span><del>-EXPORTED_SYMBOLS_FILE_i386 = mac/WebKit.exp;
</del><ins>+EXPORTED_SYMBOLS_FILE_armv7f = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_armv7s = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_arm64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_i386 = $(EXPORTED_SYMBOLS_FILE_i386_$(PLATFORM_NAME));
+EXPORTED_SYMBOLS_FILE_i386_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_i386_macosx = mac/WebKit.exp;
</ins><span class="cx"> EXPORTED_SYMBOLS_FILE_ppc = mac/WebKit.exp;
</span><del>-EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp;
</del><ins>+EXPORTED_SYMBOLS_FILE_x86_64 = $(EXPORTED_SYMBOLS_FILE_x86_64_$(PLATFORM_NAME));
+EXPORTED_SYMBOLS_FILE_x86_64_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_x86_64_macosx = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp;
</ins><span class="cx">
</span><span class="cx"> FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(PLATFORM_NAME));
</span><span class="cx"> FRAMEWORK_SEARCH_PATHS_iphoneos = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION));
</span><span class="lines">@@ -54,7 +61,7 @@
</span><span class="cx">
</span><span class="cx"> GCC_PREFIX_HEADER = mac/WebKitPrefix.h;
</span><span class="cx"> GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS);
</span><del>-HEADER_SEARCH_PATHS = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS);
</del><ins>+HEADER_SEARCH_PATHS = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit" "$(BUILT_PRODUCTS_DIR)/usr/local/include" $(HEADER_SEARCH_PATHS);
</ins><span class="cx"> INFOPLIST_FILE = mac/Info.plist;
</span><span class="cx"> INSTALL_PATH = $(INSTALL_PATH_$(PLATFORM_NAME));
</span><span class="cx"> INSTALL_PATH_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
</span><span class="lines">@@ -73,7 +80,7 @@
</span><span class="cx">
</span><span class="cx"> OTHER_LDFLAGS_BASE = -licucore -framework JavaScriptCore -framework QuartzCore -framework WebCore;
</span><span class="cx"> OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_BASE) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
</span><del>-OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO;
</del><ins>+OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -lMobileGestalt;
</ins><span class="cx"> OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
</span><span class="cx"> OTHER_LDFLAGS_macosx = -sub_umbrella WebCore -framework Carbon -framework Cocoa -framework DiskArbitration -framework IOKit -framework OpenGL -framework Security;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsiOSxcconfig"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/mac/Configurations/iOS.xcconfig (0 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/iOS.xcconfig         (rev 0)
+++ trunk/Source/WebKit/mac/Configurations/iOS.xcconfig        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+#include "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/AspenFamily.xcconfig"
</ins></span></pre></div>
<a id="trunkSourceWebKitmacDOMWebDOMOperationsmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -91,6 +91,42 @@
</span><span class="cx"> return [webArchive autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)isHorizontalWritingMode
+{
+ Node* node = core(self);
+ if (!node)
+ return YES;
+
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return YES;
+
+ return renderer->style().isHorizontalWritingMode();
+}
+
+- (void)hidePlaceholder
+{
+ if (![self isKindOfClass:[DOMHTMLInputElement class]]
+ && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
+ return;
+
+ Node *node = core(self);
+ HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(node);
+ formControl->hidePlaceholder();
+}
+
+- (void)showPlaceholderIfNecessary
+{
+ if (![self isKindOfClass:[DOMHTMLInputElement class]]
+ && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
+ return;
+
+ HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(core(self));
+ formControl->showPlaceholderIfNecessary();
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation DOMNode (WebDOMNodeOperationsPendingPublic)
</span></span></pre></div>
<a id="trunkSourceWebKitmacDefaultDelegatesWebDefaultContextMenuDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebDefaultContextMenuDelegate.h"
</span><span class="cx">
</span><span class="cx"> #import "WebDOMOperations.h"
</span><span class="lines">@@ -186,3 +188,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacDefaultDelegatesWebDefaultEditingDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultEditingDelegate.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultEditingDelegate.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultEditingDelegate.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,8 +26,6 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#import <Cocoa/Cocoa.h>
-
</del><span class="cx"> #import <WebKit/WebDefaultEditingDelegate.h>
</span><span class="cx">
</span><span class="cx"> #import <WebKit/DOM.h>
</span><span class="lines">@@ -102,10 +100,22 @@
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)webView:(WebView *)webView didWriteSelectionToPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+#else
+- (NSArray *)supportedPasteboardTypesForCurrentSelection
+{
+ return nil;
+}
</ins><span class="cx">
</span><ins>+- (DOMDocumentFragment *)documentFragmentForPasteboardItemAtIndex:(NSInteger)index
+{
+ return nil;
+}
+#endif
+
</ins><span class="cx"> - (void)webViewDidBeginEditing:(NSNotification *)notification
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacDefaultDelegatesWebDefaultPolicyDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -91,7 +91,9 @@
</span><span class="cx"> // A file URL shouldn't fall through to here, but if it did,
</span><span class="cx"> // it would be a security risk to open it.
</span><span class="cx"> if (![[request URL] isFileURL]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSWorkspace sharedWorkspace] openURL:[request URL]];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> [listener ignore];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacDefaultDelegatesWebDefaultUIDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -30,7 +30,9 @@
</span><span class="cx">
</span><span class="cx"> @interface WebDefaultUIDelegate : NSObject
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> IBOutlet NSMenu *defaultMenu;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> + (WebDefaultUIDelegate *)sharedUIDelegate;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacDefaultDelegatesWebDefaultUIDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,20 +26,24 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#import <Cocoa/Cocoa.h>
</del><ins>+#import "WebDefaultUIDelegate.h"
</ins><span class="cx">
</span><del>-#import <Foundation/NSURLRequest.h>
-
-#import <WebKit/WebDefaultUIDelegate.h>
-#import <WebKit/WebJavaScriptTextInputPanel.h>
-#import <WebKit/WebView.h>
-#import <WebKit/WebUIDelegatePrivate.h>
-#import <WebKit/DOM.h>
</del><ins>+#import "WebJavaScriptTextInputPanel.h"
</ins><span class="cx"> #import "WebTypesInternal.h"
</span><ins>+#import "WebUIDelegatePrivate.h"
+#import "WebView.h"
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WKViewPrivate.h>
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSApplication (DeclarationStolenFromAppKit)
</span><span class="cx"> - (void)_cycleWindowsReversed:(BOOL)reversed;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @implementation WebDefaultUIDelegate
</span><span class="cx">
</span><span class="lines">@@ -67,25 +71,38 @@
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request userGesture:(BOOL)userGesture
+{
+ return nil;
+}
+#endif
+
</ins><span class="cx"> - (void)webViewShow: (WebView *)wv
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webViewClose: (WebView *)wv
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[wv window] close];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webViewFocus: (WebView *)wv
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[wv window] makeKeyAndOrderFront:wv];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webViewUnfocus: (WebView *)wv
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([[wv window] isKeyWindow] || [[[wv window] attachedSheet] isKeyWindow]) {
</span><span class="cx"> [NSApp _cycleWindowsReversed:FALSE];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSResponder *)webViewFirstResponder: (WebView *)wv
</span><span class="lines">@@ -131,19 +148,27 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)webViewIsResizable: (WebView *)wv
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return [[wv window] showsResizeIndicator];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webView: (WebView *)wv setResizable:(BOOL)resizable
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: This doesn't actually change the resizability of the window,
</span><span class="cx"> // only visibility of the indicator.
</span><span class="cx"> [[wv window] setShowsResizeIndicator:resizable];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webView: (WebView *)wv setFrame:(NSRect)frame
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[wv window] setFrame:frame display:YES];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSRect)webViewFrame: (WebView *)wv
</span><span class="lines">@@ -165,6 +190,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSString *)webView: (WebView *)wv runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebJavaScriptTextInputPanel *panel = [[WebJavaScriptTextInputPanel alloc] initWithPrompt:prompt text:defaultText];
</span><span class="cx"> [panel showWindow:nil];
</span><span class="cx"> NSString *result;
</span><span class="lines">@@ -176,6 +202,9 @@
</span><span class="cx"> [[panel window] close];
</span><span class="cx"> [panel release];
</span><span class="cx"> return result;
</span><ins>+#else
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)webView: (WebView *)wv runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
</span><span class="lines">@@ -188,6 +217,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)webView:(WebView *)webView shouldBeginDragForElement:(NSDictionary *)element dragImage:(NSImage *)dragImage mouseDownEvent:(NSEvent *)mouseDownEvent mouseDraggedEvent:(NSEvent *)mouseDraggedEvent
</span><span class="cx"> {
</span><span class="cx"> return YES;
</span><span class="lines">@@ -210,6 +240,7 @@
</span><span class="cx"> - (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)webView:(WebView *)sender didDrawRect:(NSRect)rect
</span><span class="cx"> {
</span><span class="lines">@@ -219,6 +250,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -226,6 +258,7 @@
</span><span class="cx"> - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded
</span><span class="cx"> {
</span><span class="lines">@@ -241,4 +274,10 @@
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)webViewSupportedOrientationsUpdated:(WebView *)sender
+{
+}
+#endif
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacHistoryWebBackForwardListmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/History/WebBackForwardList.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/History/WebBackForwardList.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/History/WebBackForwardList.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -103,9 +103,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -164,6 +166,54 @@
</span><span class="cx"> core(self)->removeItem(core(item));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+
+// FIXME: Move into WebCore the code that deals directly with WebCore::BackForwardList.
+
+#define WebBackForwardListDictionaryEntriesKey @"entries"
+#define WebBackForwardListDictionaryCapacityKey @"capacity"
+#define WebBackForwardListDictionaryCurrentKey @"current"
+
+- (NSDictionary *)dictionaryRepresentation
+{
+ BackForwardList *coreBFList = core(self);
+
+ HistoryItemVector historyItems = coreBFList->entries();
+ NSMutableArray *entriesArray = [[NSMutableArray alloc] init];
+ for (auto it : historyItems)
+ [entriesArray addObject:[(WebHistoryItem *)kit((*it).get()) dictionaryRepresentationIncludingChildren:NO]];
+
+ NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
+ entriesArray, WebBackForwardListDictionaryEntriesKey,
+ [NSNumber numberWithUnsignedInt:coreBFList->current()], WebBackForwardListDictionaryCurrentKey,
+ [NSNumber numberWithInt:coreBFList->capacity()], WebBackForwardListDictionaryCapacityKey,
+ nil];
+
+ [entriesArray release];
+
+ return dictionary;
+}
+
+- (void)setToMatchDictionaryRepresentation:(NSDictionary *)dictionary
+{
+ BackForwardList *coreBFList = core(self);
+
+ coreBFList->setCapacity([[dictionary objectForKey:WebBackForwardListDictionaryCapacityKey] intValue]);
+
+ for (NSDictionary *itemDictionary in [dictionary objectForKey:WebBackForwardListDictionaryEntriesKey]) {
+ WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemDictionary];
+ coreBFList->addItem(core(item));
+ [item release];
+ }
+
+ unsigned currentIndex = [[dictionary objectForKey:WebBackForwardListDictionaryCurrentKey] unsignedIntValue];
+ size_t listSize = coreBFList->entries().size();
+ if (currentIndex >= listSize)
+ currentIndex = listSize - 1;
+ coreBFList->setCurrent(currentIndex);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (BOOL)containsItem:(WebHistoryItem *)item
</span><span class="cx"> {
</span><span class="cx"> return core(self)->containsItem(core(item));
</span><span class="lines">@@ -211,10 +261,14 @@
</span><span class="cx">
</span><span class="cx"> static bool bumperCarBackForwardHackNeeded()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool hackNeeded = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.freeverse.bumpercar"] &&
</span><span class="cx"> !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_BUMPERCAR_BACK_FORWARD_QUIRK);
</span><span class="cx">
</span><span class="cx"> return hackNeeded;
</span><ins>+#else
+ return false;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSArray *)backListWithLimit:(int)limit
</span></span></pre></div>
<a id="trunkSourceWebKitmacHistoryWebHistorymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/History/WebHistory.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/History/WebHistory.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/History/WebHistory.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -36,6 +36,10 @@
</span><span class="cx"> #import <WebCore/HistoryItem.h>
</span><span class="cx"> #import <WebCore/PageGroup.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WebCoreThreadMessage.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> typedef int64_t WebHistoryDateKey;
</span><span class="lines">@@ -150,7 +154,7 @@
</span><span class="cx">
</span><span class="cx"> static void getDayBoundaries(NSTimeInterval interval, NSTimeInterval& beginningOfDay, NSTimeInterval& beginningOfNextDay)
</span><span class="cx"> {
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:interval];
</span><span class="cx">
</span><span class="cx"> NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
</span><span class="lines">@@ -335,6 +339,7 @@
</span><span class="cx">
</span><span class="cx"> NSString *URLString = [entry URLString];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebHistoryItem *oldEntry = [_entriesByURL objectForKey:URLString];
</span><span class="cx"> if (oldEntry) {
</span><span class="cx"> if (discardDuplicate)
</span><span class="lines">@@ -353,6 +358,32 @@
</span><span class="cx">
</span><span class="cx"> [self addItemToDateCaches:entry];
</span><span class="cx"> [_entriesByURL setObject:entry forKey:URLString];
</span><ins>+#else
+ WebHistoryItem *otherEntry = [_entriesByURL objectForKey:URLString];
+ if (otherEntry) {
+ if (discardDuplicate)
+ return NO;
+
+ if ([otherEntry lastVisitedTimeInterval] < [entry lastVisitedTimeInterval]) {
+ // The last reference to oldEntry might be this dictionary, so we hold onto a reference
+ // until we're done with oldEntry.
+ [otherEntry retain];
+ [self removeItemForURLString:URLString];
+
+ // If we already have an item with this URL, we need to merge info that drives the
+ // URL autocomplete heuristics from that item into the new one.
+ [entry _mergeAutoCompleteHints:otherEntry];
+ [otherEntry release];
+
+ [self addItemToDateCaches:entry];
+ [_entriesByURL setObject:entry forKey:URLString];
+ } else
+ return NO; // Special case for merges when new items may be older than pre-existing entries.
+ } else {
+ [self addItemToDateCaches:entry];
+ [_entriesByURL setObject:entry forKey:URLString];
+ }
+#endif
</ins><span class="cx">
</span><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="lines">@@ -748,8 +779,12 @@
</span><span class="cx"> - (void)_sendNotification:(NSString *)name entries:(NSArray *)entries
</span><span class="cx"> {
</span><span class="cx"> NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:entries, WebHistoryItemsKey, nil];
</span><ins>+#if PLATFORM(IOS)
+ WebThreadPostNotification(name, self, userInfo);
+#else
</ins><span class="cx"> [[NSNotificationCenter defaultCenter]
</span><span class="cx"> postNotificationName:name object:self userInfo:userInfo];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)removeItems:(NSArray *)entries
</span><span class="lines">@@ -813,9 +848,13 @@
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ WebThreadPostNotification(WebHistoryLoadedNotification, self, nil);
+#else
</ins><span class="cx"> [[NSNotificationCenter defaultCenter]
</span><span class="cx"> postNotificationName:WebHistoryLoadedNotification
</span><span class="cx"> object:self];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if ([discardedItems count])
</span><span class="cx"> [self _sendNotification:WebHistoryItemsDiscardedWhileLoadingNotification entries:discardedItems];
</span><span class="lines">@@ -828,9 +867,13 @@
</span><span class="cx"> {
</span><span class="cx"> if (![_historyPrivate saveToURL:URL error:error])
</span><span class="cx"> return NO;
</span><ins>+#if PLATFORM(IOS)
+ WebThreadPostNotification(WebHistorySavedNotification, self, nil);
+#else
</ins><span class="cx"> [[NSNotificationCenter defaultCenter]
</span><span class="cx"> postNotificationName:WebHistorySavedNotification
</span><span class="cx"> object:self];
</span><ins>+#endif
</ins><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacHistoryWebHistoryItemmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/History/WebHistoryItem.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/History/WebHistoryItem.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/History/WebHistoryItem.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -56,6 +56,26 @@
</span><span class="cx"> #import <wtf/StdLibExtras.h>
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WebCoreThreadMessage.h>
+
+NSString *WebViewportInitialScaleKey = @"initial-scale";
+NSString *WebViewportMinimumScaleKey = @"minimum-scale";
+NSString *WebViewportMaximumScaleKey = @"maximum-scale";
+NSString *WebViewportUserScalableKey = @"user-scalable";
+NSString *WebViewportWidthKey = @"width";
+NSString *WebViewportHeightKey = @"height";
+NSString *WebViewportMinimalUIKey = @"minimal-ui";
+
+static NSString *scaleKey = @"scale";
+static NSString *scaleIsInitialKey = @"scaleIsInitial";
+static NSString *scrollPointXKey = @"scrollPointX";
+static NSString *scrollPointYKey = @"scrollPointY";
+
+static NSString * const bookmarkIDKey = @"bookmarkID";
+static NSString * const sharedLinkUniqueIdentifierKey = @"sharedLinkUniqueIdentifier";
+#endif
+
</ins><span class="cx"> // Private keys used in the WebHistoryItem's dictionary representation.
</span><span class="cx"> // see 3245793 for explanation of "lastVisitedDate"
</span><span class="cx"> static NSString *lastVisitedTimeIntervalKey = @"lastVisitedDate";
</span><span class="lines">@@ -87,17 +107,23 @@
</span><span class="cx">
</span><span class="cx"> void WKNotifyHistoryItemChanged(HistoryItem*)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter]
</span><span class="cx"> postNotificationName:WebHistoryItemChangedNotification object:nil userInfo:nil];
</span><ins>+#else
+ WebThreadPostNotification(WebHistoryItemChangedNotification, nil, nil);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @implementation WebHistoryItem
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -179,10 +205,12 @@
</span><span class="cx"> return nsStringNilIfEmpty(core(_private)->alternateTitle());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSImage *)icon
</span><span class="cx"> {
</span><span class="cx"> return [[WebIconDatabase sharedIconDatabase] iconForURL:[self URLString] withSize:WebIconSmallSize];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSTimeInterval)lastVisitedTimeInterval
</span><span class="cx"> {
</span><span class="lines">@@ -390,6 +418,29 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ NSNumber *scaleValue = [dict objectForKey:scaleKey];
+ NSNumber *scaleIsInitialValue = [dict objectForKey:scaleIsInitialKey];
+ if (scaleValue && scaleIsInitialValue)
+ core(_private)->setScale([scaleValue floatValue], [scaleIsInitialValue boolValue]);
+
+ if (id viewportArguments = [dict objectForKey:@"WebViewportArguments"])
+ [self _setViewportArguments:viewportArguments];
+
+ NSNumber *scrollPointXValue = [dict objectForKey:scrollPointXKey];
+ NSNumber *scrollPointYValue = [dict objectForKey:scrollPointYKey];
+ if (scrollPointXValue && scrollPointYValue)
+ core(_private)->setScrollPoint(IntPoint([scrollPointXValue intValue], [scrollPointYValue intValue]));
+
+ uint32_t bookmarkIDValue = [[dict objectForKey:bookmarkIDKey] unsignedIntValue];
+ if (bookmarkIDValue)
+ core(_private)->setBookmarkID(bookmarkIDValue);
+
+ NSString *sharedLinkUniqueIdentifierValue = [dict objectForKey:sharedLinkUniqueIdentifierKey];
+ if (sharedLinkUniqueIdentifierValue)
+ core(_private)->setSharedLinkUniqueIdentifier(sharedLinkUniqueIdentifierValue);
+#endif
+
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -418,8 +469,18 @@
</span><span class="cx"> return [self initWithURLString:[URL _web_originalDataAsString] title:title lastVisitedTimeInterval:0];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: The only iOS difference here should be whether YES or NO is passed to dictionaryRepresentationIncludingChildren:
+#if PLATFORM(IOS)
</ins><span class="cx"> - (NSDictionary *)dictionaryRepresentation
</span><span class="cx"> {
</span><ins>+ return [self dictionaryRepresentationIncludingChildren:YES];
+}
+
+- (NSDictionary *)dictionaryRepresentationIncludingChildren:(BOOL)includesChildren
+#else
+- (NSDictionary *)dictionaryRepresentation
+#endif
+{
</ins><span class="cx"> ASSERT_MAIN_THREAD();
</span><span class="cx"> NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:8];
</span><span class="cx">
</span><span class="lines">@@ -471,8 +532,12 @@
</span><span class="cx"> [dict setObject:array forKey:weeklyVisitCountKey];
</span><span class="cx"> [array release];
</span><span class="cx"> }
</span><del>-
</del><ins>+
+#if PLATFORM(IOS)
+ if (includesChildren && coreItem->children().size()) {
+#else
</ins><span class="cx"> if (coreItem->children().size()) {
</span><ins>+#endif
</ins><span class="cx"> const HistoryItemVector& children = coreItem->children();
</span><span class="cx"> NSMutableArray *childDicts = [NSMutableArray arrayWithCapacity:children.size()];
</span><span class="cx">
</span><span class="lines">@@ -481,6 +546,27 @@
</span><span class="cx"> [dict setObject: childDicts forKey:childrenKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [dict setObject:[NSNumber numberWithFloat:core(_private)->scale()] forKey:scaleKey];
+ [dict setObject:[NSNumber numberWithBool:core(_private)->scaleIsInitial()] forKey:scaleIsInitialKey];
+
+ NSDictionary *viewportArguments = [self _viewportArguments];
+ if (viewportArguments)
+ [dict setObject:viewportArguments forKey:@"WebViewportArguments"];
+
+ IntPoint scrollPoint = core(_private)->scrollPoint();
+ [dict setObject:[NSNumber numberWithInt:scrollPoint.x()] forKey:scrollPointXKey];
+ [dict setObject:[NSNumber numberWithInt:scrollPoint.y()] forKey:scrollPointYKey];
+
+ uint32_t bookmarkID = core(_private)->bookmarkID();
+ if (bookmarkID)
+ [dict setObject:[NSNumber numberWithUnsignedInt:bookmarkID] forKey:bookmarkIDKey];
+
+ NSString *sharedLinkUniqueIdentifier = [self _sharedLinkUniqueIdentifier];
+ if (sharedLinkUniqueIdentifier)
+ [dict setObject:sharedLinkUniqueIdentifier forKey:sharedLinkUniqueIdentifierKey];
+#endif
+
</ins><span class="cx"> return dict;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -554,9 +640,11 @@
</span><span class="cx"> return kit(core(_private)->targetItem());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (void)_releaseAllPendingPageCaches
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (id)_transientPropertyForKey:(NSString *)key
</span><span class="cx"> {
</span><span class="lines">@@ -611,6 +699,80 @@
</span><span class="cx"> return coreItem->weeklyVisitCounts().size();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_setScale:(float)scale isInitial:(BOOL)aFlag
+{
+ core(_private)->setScale(scale, aFlag);
+}
+
+- (float)_scale
+{
+ return core(_private)->scale();
+}
+
+- (BOOL)_scaleIsInitial
+{
+ return core(_private)->scaleIsInitial();
+}
+
+- (NSDictionary *)_viewportArguments
+{
+ const ViewportArguments& viewportArguments = core(_private)->viewportArguments();
+ NSMutableDictionary *argumentsDictionary = [NSMutableDictionary dictionary];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.zoom] forKey:WebViewportInitialScaleKey];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.minZoom] forKey:WebViewportMinimumScaleKey];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.maxZoom] forKey:WebViewportMaximumScaleKey];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.width] forKey:WebViewportWidthKey];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.height] forKey:WebViewportHeightKey];
+ [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.userZoom] forKey:WebViewportUserScalableKey];
+ [argumentsDictionary setObject:[NSNumber numberWithBool:viewportArguments.minimalUI] forKey:WebViewportMinimalUIKey];
+ return argumentsDictionary;
+}
+
+- (void)_setViewportArguments:(NSDictionary *)arguments
+{
+ ViewportArguments viewportArguments;
+ viewportArguments.zoom = [[arguments objectForKey:WebViewportInitialScaleKey] floatValue];
+ viewportArguments.minZoom = [[arguments objectForKey:WebViewportMinimumScaleKey] floatValue];
+ viewportArguments.maxZoom = [[arguments objectForKey:WebViewportMaximumScaleKey] floatValue];
+ viewportArguments.width = [[arguments objectForKey:WebViewportWidthKey] floatValue];
+ viewportArguments.height = [[arguments objectForKey:WebViewportHeightKey] floatValue];
+ viewportArguments.userZoom = [[arguments objectForKey:WebViewportUserScalableKey] floatValue];
+ viewportArguments.minimalUI = [[arguments objectForKey:WebViewportMinimalUIKey] boolValue];
+ core(_private)->setViewportArguments(viewportArguments);
+}
+
+- (CGPoint)_scrollPoint
+{
+ return core(_private)->scrollPoint();
+}
+
+- (void)_setScrollPoint:(CGPoint)scrollPoint
+{
+ core(_private)->setScrollPoint(IntPoint(scrollPoint));
+}
+
+- (uint32_t)_bookmarkID
+{
+ return core(_private)->bookmarkID();
+}
+
+- (void)_setBookmarkID:(uint32_t)bookmarkID
+{
+ core(_private)->setBookmarkID(bookmarkID);
+}
+
+- (NSString *)_sharedLinkUniqueIdentifier
+{
+ return nsStringNilIfEmpty(core(_private)->sharedLinkUniqueIdentifier());
+}
+
+- (void)_setSharedLinkUniqueIdentifier:(NSString *)identifier
+{
+ core(_private)->setSharedLinkUniqueIdentifier(identifier);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (BOOL)_isInPageCache
</span><span class="cx"> {
</span><span class="cx"> return core(_private)->isInPageCache();
</span></span></pre></div>
<a id="trunkSourceWebKitmacHistoryWebURLsWithTitlesm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/History/WebURLsWithTitles.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/History/WebURLsWithTitles.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/History/WebURLsWithTitles.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebURLsWithTitles.h"
</span><span class="cx">
</span><span class="cx"> #import <WebKit/WebNSURLExtras.h>
</span><span class="lines">@@ -105,3 +107,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebCachemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebCache.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -37,13 +37,25 @@
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "MemoryMeasure.h"
+#import "WebFrameInternal.h"
+#import <WebCore/CachedImage.h>
+#import <WebCore/CredentialStorage.h>
+#import <WebCore/Frame.h>
+#import <WebCore/PageCache.h>
+#import <WebCore/WebCoreThreadRun.h>
+#endif
+
</ins><span class="cx"> @implementation WebCache
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> InitWebCoreSystemInterface();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -141,6 +153,93 @@
</span><span class="cx"> WebCore::CrossOriginPreflightResultCache::shared().empty();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (void)emptyInMemoryResources
+{
+ // This method gets called from MobileSafari after it calls [WebView
+ // _close]. [WebView _close] schedules its work on the WebThread. So we
+ // schedule this method on the WebThread as well so as to pick up all the
+ // dead resources left behind after closing the WebViews
+ WebThreadRun(^{
+ WebKit::MemoryMeasure measurer("[WebCache emptyInMemoryResources]");
+
+ // Toggling the cache model like this forces the cache to evict all its in-memory resources.
+ WebCacheModel cacheModel = [WebView _cacheModel];
+ [WebView _setCacheModel:WebCacheModelDocumentViewer];
+ [WebView _setCacheModel:cacheModel];
+
+ WebCore::memoryCache()->pruneLiveResources(true);
+ });
+}
+
++ (void)sizeOfDeadResources:(int *)resources
+{
+ WebCore::MemoryCache::Statistics stats = WebCore::memoryCache()->getStatistics();
+ if (resources) {
+ *resources = (stats.images.size - stats.images.liveSize)
+ + (stats.cssStyleSheets.size - stats.cssStyleSheets.liveSize)
+#if ENABLE(XSLT)
+ + (stats.xslStyleSheets.size - stats.xslStyleSheets.liveSize)
+#endif
+ + (stats.scripts.size - stats.scripts.liveSize);
+ }
+}
+
++ (void)clearCachedCredentials
+{
+ WebCore::CredentialStorage::clearCredentials();
+}
+
++ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url
+{
+ return [WebCache addImageToCache:image forURL:url forFrame:nil];
+}
+
++ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url forFrame:(WebFrame *)frame
+{
+ if (!image || !url || ![[url absoluteString] length])
+ return false;
+ WebCore::SecurityOrigin* topOrigin = nullptr;
+#if ENABLE(CACHE_PARTITIONING)
+ if (frame)
+ topOrigin = core(frame)->document()->topOrigin();
+#endif
+ return WebCore::memoryCache()->addImageToCache(image, url, topOrigin ? topOrigin->cachePartition() : emptyString());
+}
+
++ (void)removeImageFromCacheForURL:(NSURL *)url
+{
+ [WebCache removeImageFromCacheForURL:url forFrame:nil];
+}
+
++ (void)removeImageFromCacheForURL:(NSURL *)url forFrame:(WebFrame *)frame
+{
+ if (!url)
+ return;
+ WebCore::SecurityOrigin* topOrigin = nullptr;
+#if ENABLE(CACHE_PARTITIONING)
+ if (frame)
+ topOrigin = core(frame)->document()->topOrigin();
+#endif
+ WebCore::memoryCache()->removeImageFromCache(url, topOrigin ? topOrigin->cachePartition() : emptyString());
+}
+
++ (CGImageRef)imageForURL:(NSURL *)url
+{
+ if (!url)
+ return nullptr;
+
+ WebCore::CachedResource* cachedResource = WebCore::memoryCache()->resourceForURL(url);
+ if (!cachedResource || cachedResource->type() != WebCore::CachedResource::ImageResource)
+ return nullptr;
+ WebCore::CachedImage* cachedImage = static_cast<WebCore::CachedImage*>(cachedResource);
+ if (!cachedImage || !cachedImage->hasImage())
+ return nullptr;
+ return cachedImage->image()->getCGImageRef();
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> + (void)setDisabled:(BOOL)disabled
</span><span class="cx"> {
</span><span class="cx"> if (!pthread_main_np())
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebDownloadmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebDownload.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebDownload.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebDownload.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)download:(NSURLDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Try previously stored credential first.
</span><span class="cx"> if (![challenge previousFailureCount]) {
</span><span class="cx"> NSURLCredential *credential = mac(CredentialStorage::get(core([challenge protectionSpace])));
</span><span class="lines">@@ -144,15 +145,18 @@
</span><span class="cx">
</span><span class="cx"> [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:challenge window:window];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)download:(NSURLDownload *)download didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([realDelegate respondsToSelector:@selector(download:didCancelAuthenticationChallenge:)]) {
</span><span class="cx"> [realDelegate download:download didCancelAuthenticationChallenge:challenge];
</span><span class="cx"> } else {
</span><span class="cx"> [[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:challenge];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebElementDictionarymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -65,9 +65,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -210,8 +212,12 @@
</span><span class="cx">
</span><span class="cx"> - (NSValue *)_imageRect
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> IntRect rect = _result->imageRect();
</span><span class="cx"> return rect.isEmpty() ? nil : [NSValue valueWithRect:rect];
</span><ins>+#else
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)_absoluteImageURL
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebIconDatabasemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebIconDatabase.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebIconDatabaseInternal.h"
</span><span class="cx">
</span><span class="cx"> #import "WebIconDatabaseClient.h"
</span><span class="lines">@@ -492,3 +494,5 @@
</span><span class="cx"> }
</span><span class="cx"> return nsImage;
</span><span class="cx"> }
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebIconDatabaseInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebIconDatabaseInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebIconDatabaseInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebIconDatabaseInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebIconDatabasePrivate.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -48,3 +50,5 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> NSImage *webGetNSImage(WebCore::Image*, NSSize);
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitNSStringExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -38,19 +38,30 @@
</span><span class="cx"> #import <unicode/uchar.h>
</span><span class="cx"> #import <sys/param.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WAKViewPrivate.h>
+#import <WebKit/DOM.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebFrameView.h>
+#import <WebKit/WebViewPrivate.h>
+#endif
+
</ins><span class="cx"> NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static inline CGFloat webkit_CGCeiling(CGFloat value)
</span><span class="cx"> {
</span><span class="cx"> if (sizeof(value) == sizeof(float))
</span><span class="cx"> return ceilf(value);
</span><span class="cx"> return ceil(value);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> @implementation NSString (WebKitExtras)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
</span><span class="cx"> {
</span><span class="cx"> unsigned i;
</span><span class="lines">@@ -148,6 +159,7 @@
</span><span class="cx">
</span><span class="cx"> return [self sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]].width;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (NSString *)_web_stringByAbbreviatingWithTildeInPath
</span><span class="cx"> {
</span><span class="lines">@@ -172,10 +184,12 @@
</span><span class="cx"> return newString;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSStringEncoding)_web_encodingForResource:(Handle)resource
</span><span class="cx"> {
</span><span class="cx"> return CFStringConvertEncodingToNSStringEncoding(stringEncodingForResource(resource));
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_webkit_isCaseInsensitiveEqualToString:(NSString *)string
</span><span class="cx"> {
</span><span class="lines">@@ -285,6 +299,7 @@
</span><span class="cx"> return [result autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> -(NSString *)_webkit_fixedCarbonPOSIXPath
</span><span class="cx"> {
</span><span class="cx"> NSFileManager *fileManager = [NSFileManager defaultManager];
</span><span class="lines">@@ -326,18 +341,30 @@
</span><span class="cx">
</span><span class="cx"> return path;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (NSString *)_web_stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName
+{
+ return [WebFrame stringWithData:data textEncodingName:textEncodingName];
+}
+#endif
+
</ins><span class="cx"> + (NSString *)_webkit_localCacheDirectoryWithBundleIdentifier:(NSString*)bundleIdentifier
</span><span class="cx"> {
</span><span class="cx"> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span><span class="cx"> NSString *cacheDir = [defaults objectForKey:WebKitLocalCacheDefaultsKey];
</span><span class="cx">
</span><span class="cx"> if (!cacheDir || ![cacheDir isKindOfClass:[NSString class]]) {
</span><ins>+#if PLATFORM(IOS)
+ cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
+#else
</ins><span class="cx"> char cacheDirectory[MAXPATHLEN];
</span><span class="cx"> size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
</span><span class="cx">
</span><span class="cx"> if (cacheDirectoryLen)
</span><span class="cx"> cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return [cacheDir stringByAppendingPathComponent:bundleIdentifier];
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitSystemBitsm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitSystemBits.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitSystemBits.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebKitSystemBits.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -57,8 +57,18 @@
</span><span class="cx">
</span><span class="cx"> uint64_t WebMemorySize(void)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS_SIMULATOR)
+ // Pretend we have 512MB of memory to make cache sizes behave like on device
+ return 512 * 1024 * 1024;
+#endif
</ins><span class="cx"> pthread_once(&initControl, initCapabilities);
</span><ins>+#if PLATFORM(IOS)
+ // On iOS, round up the memory size to a power of 2 because max_mem may not be exactly 256MB
+ // (for example) and we have code that depends on those boundaries.
+ return powf(2.0, ceilf(log2f(gHostBasicInfo.max_mem)));
+#else
</ins><span class="cx"> return gHostBasicInfo.max_mem;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int WebNumberOfCPUs(void)
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitVersionChecksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> when adding a new version constant.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #define WEBKIT_FIRST_VERSION_WITH_3_0_CONTEXT_MENU_TAGS 0x020A0000 // 522.0.0
</span><span class="cx"> #define WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION 0x020A0000 // 522.0.0
</span><span class="cx"> #define WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK 0x020A0000 // 522.0.0
</span><span class="lines">@@ -58,6 +59,21 @@
</span><span class="cx"> #define WEBKIT_FIRST_VERSION_WITH_GET_MATCHED_CSS_RULES_RESTRICTIONS 0x02160B00 // 534.11.0
</span><span class="cx"> #define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 0x02170D00 // 535.13.0
</span><span class="cx"> #define WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR 0x02190100 // 537.1.0
</span><ins>+#else
+// <rdar://problem/6627758> Need to implement WebKitLinkedOnOrAfter
+// Actually UIKit version numbers, since applications don't link against WebKit
+#define WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION 229 // iOS 2.0
+#define WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION 818 // iOS 3.0
+#define WEBKIT_FIRST_VERSION_WITH_FLIPPED_SHADOWS 1100 // iOS 3.2
+#define WEBKIT_FIRST_VERSION_WITHOUT_MULTIPLE_IFRAME_TOUCH_EVENT_DISPATCH 1400 // iOS 4.2
+#define WEBKIT_FIRST_VERSION_WITH_CSS_TRANSFORMS_AFFECTING_OVERFLOW 1600 // iOS 5.0
+#define WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER 1600 // iOS 5.0
+#define WEBKIT_FIRST_VERSION_WITH_WINDOW_ON_ERROR 1600 // iOS 5.0
+#define WEBKIT_FIRST_VERSION_WITH_DELEGATE_CALLS_IN_COMMON_RUNLOOP_MODES 1600 // iOS 5.0
+#define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 2239 // iOS 6.0
+#define WEBKIT_FIRST_VERSION_WITH_YOUTUBE_EMBED_IFRAME_TRANSFORM 2239 // iOS 6.0
+#define WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR 2665 // iOS 7.0
+#endif // PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> extern "C" {
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitVersionChecksm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebKitVersionChecks.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -34,7 +34,18 @@
</span><span class="cx">
</span><span class="cx"> BOOL WebKitLinkedOnOrAfter(int version)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return (WebKitLinkTimeVersion() >= version);
</span><ins>+#else
+ int32_t linkTimeVersion = WebKitLinkTimeVersion();
+ int32_t majorVersion = linkTimeVersion >> 16 & 0x0000FFFF;
+
+ // The application was not linked against UIKit so assume most recent WebKit
+ if (linkTimeVersion == -1)
+ return YES;
+
+ return (majorVersion >= version);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void setWebKitLinkTimeVersion(int version)
</span><span class="lines">@@ -47,5 +58,11 @@
</span><span class="cx"> if (overridenWebKitLinkTimeVersion)
</span><span class="cx"> return overridenWebKitLinkTimeVersion;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return NSVersionOfLinkTimeLibrary("WebKit");
</span><ins>+#else
+ // <rdar://problem/6627758> Need to implement WebKitLinkedOnOrAfter
+ // Third party applications do not link against WebKit, but rather against UIKit.
+ return NSVersionOfLinkTimeLibrary("UIKit");
+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebLocalizableStringsmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebLocalizableStrings.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebLocalizableStrings.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebLocalizableStrings.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -31,6 +31,11 @@
</span><span class="cx"> #import <wtf/Assertions.h>
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebLocalizableStringsInternal.h"
+#import <dispatch/dispatch.h>
+#endif
+
</ins><span class="cx"> WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
</span><span class="cx">
</span><span class="cx"> NSString *WebLocalizedString(WebLocalizableStringsBundle *stringsBundle, const char *key)
</span><span class="lines">@@ -39,7 +44,9 @@
</span><span class="cx"> // and its use of [NSBundle localizedStringForKey:::], which is not guaranteed to be thread-safe. If
</span><span class="cx"> // we decide we need to use this on background threads, we'll need to add locking here and make sure
</span><span class="cx"> // it doesn't affect performance.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(isMainThread());
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSBundle *bundle;
</span><span class="cx"> if (stringsBundle == NULL) {
</span><span class="lines">@@ -65,3 +72,20 @@
</span><span class="cx"> ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><ins>+
+#if PLATFORM(IOS)
+// See <rdar://problem/7902473> Optimize WebLocalizedString for why we do this on a background thread on a timer callback
+static void LoadWebLocalizedStringsTimerCallback(CFRunLoopTimerRef timer, void *info)
+{
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+ UI_STRING_KEY_INTERNAL("Typing", "Typing (Undo action name)", "We don't care if we find this string, but searching for it will load the plist and save the results.");
+ });
+}
+
+void LoadWebLocalizedStrings(void)
+{
+ CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, &LoadWebLocalizedStringsTimerCallback, NULL);
+ CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopCommonModes);
+ CFRelease(timer);
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSArrayExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #import "WebTypesInternal.h"
</span><del>-#import <Cocoa/Cocoa.h>
</del><span class="cx">
</span><span class="cx"> @interface NSArray (WebNSArrayExtras)
</span><span class="cx">
</span><span class="lines">@@ -36,8 +35,10 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSMutableArray (WebNSArrayExtras)
</span><span class="cx">
</span><span class="cx"> - (void)_webkit_removeUselessMenuItemSeparators;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSArrayExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @implementation NSMutableArray (WebNSArrayExtras)
</span><span class="cx">
</span><span class="cx"> - (void)_webkit_removeUselessMenuItemSeparators
</span><span class="lines">@@ -72,3 +73,4 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSControlExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSControlExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSControlExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSControlExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,8 +26,12 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx">
</span><span class="cx"> @interface NSControl (WebExtras)
</span><span class="cx"> - (void)sizeToFitAndAdjustWindowHeight;
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSControlExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSControlExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSControlExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSControlExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebNSControlExtras.h"
</span><span class="cx">
</span><span class="cx"> @implementation NSControl (WebExtras)
</span><span class="lines">@@ -53,3 +55,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSDictionaryExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -44,4 +44,7 @@
</span><span class="cx"> - (void)_webkit_setBool:(BOOL)value forKey:(id)key;
</span><span class="cx"> - (void)_webkit_setLongLong:(long long)value forKey:(id)key;
</span><span class="cx"> - (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key;
</span><ins>+#if PLATFORM(IOS)
+- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key;
+#endif
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSDictionaryExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSDictionaryExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -118,5 +118,14 @@
</span><span class="cx"> [object release];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key
+{
+ NSNumber *object = [[NSNumber alloc] initWithUnsignedInt:value];
+ [self setObject:object forKey:key];
+ [object release];
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSEventExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSEventExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSEventExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSEventExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebNSEventExtras.h>
</span><span class="cx">
</span><span class="cx"> @implementation NSEvent (WebExtras)
</span><span class="lines">@@ -80,3 +82,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSFileManagerExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -36,8 +36,13 @@
</span><span class="cx"> #import <wtf/ObjcRuntimeExtras.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/FileSystemIOS.h>
+#endif
+
</ins><span class="cx"> @implementation NSFileManager (WebNSFileManagerExtras)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> typedef struct MetaDataInfo
</span><span class="cx"> {
</span><span class="lines">@@ -99,6 +104,8 @@
</span><span class="cx"> return [[(NSString *)CFDictionaryGetValue(adoptCF(DADiskCopyDescription(disk.get())).get(), kDADiskDescriptionVolumeNameKey) copy] autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#endif // !PLATFORM(IOS)
+
</ins><span class="cx"> // -[NSFileManager fileExistsAtPath:] returns NO if there is a broken symlink at the path.
</span><span class="cx"> // So we use this function instead, which returns YES if there is anything there, including
</span><span class="cx"> // a broken symlink.
</span><span class="lines">@@ -140,5 +147,12 @@
</span><span class="cx"> return path;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (NSString *)_webkit_createTemporaryDirectoryWithTemplatePrefix:(NSString *)prefix
+{
+ return WebCore::createTemporaryDirectory(prefix);
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSImageExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSImageExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSImageExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSImageExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx">
</span><span class="cx"> @interface NSImage (WebExtras)
</span><span class="lines">@@ -38,3 +40,5 @@
</span><span class="cx"> - (void)_web_saveAndOpen;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSImageExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSImageExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSImageExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSImageExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebNSImageExtras.h>
</span><span class="cx">
</span><span class="cx"> #import <WebKit/WebKitLogging.h>
</span><span class="lines">@@ -104,3 +106,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSPasteboardExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebNSPasteboardExtras.h"
</span><span class="cx">
</span><span class="cx"> #import "DOMElementInternal.h"
</span><span class="lines">@@ -293,3 +295,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSPrintOperationExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx">
</span><span class="cx"> @interface NSPrintOperation (WebKitExtras)
</span><span class="lines">@@ -35,3 +37,5 @@
</span><span class="cx"> - (float)_web_availablePaperHeight;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSPrintOperationExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSPrintOperationExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebNSPrintOperationExtras.h"
</span><span class="cx">
</span><span class="cx"> @implementation NSPrintOperation (WebKitExtras)
</span><span class="lines">@@ -48,3 +50,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSURLExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSURLExtras.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSURLExtras.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSURLExtras.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -43,9 +43,18 @@
</span><span class="cx"> #import <unicode/uchar.h>
</span><span class="cx"> #import <unicode/uscript.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <Foundation/NSString_NSURLExtras.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WTF;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+// Fake URL scheme.
+#define WebDataProtocolScheme @"webkit-fake-url"
+#endif
+
</ins><span class="cx"> #define URL_BYTES_BUFFER_LENGTH 2048
</span><span class="cx">
</span><span class="cx"> @implementation NSURL (WebNSURLExtras)
</span><span class="lines">@@ -280,6 +289,113 @@
</span><span class="cx"> return [NSURL URLWithString:[@"file:" stringByAppendingString:[self absoluteString]]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static inline NSURL *createYouTubeURL(NSString *videoID, NSString *timeID)
+{
+ // This method creates a youtube: URL, which is an internal format that is passed to YouTube.app.
+ // If the format of these internal links is changed below, then the app probably needs to be updated as well.
+
+ ASSERT(videoID && [videoID length] > 0 && ![videoID isEqualToString:@"/"]);
+
+ if ([timeID length])
+ return [NSURL URLWithString:[NSString stringWithFormat:@"youtube:%@?t=%@", videoID, timeID]];
+ return [NSURL URLWithString:[NSString stringWithFormat:@"youtube:%@", videoID]];
+}
+
+- (NSURL *)_webkit_youTubeURL
+{
+ // Bail out early if we aren't even on www.youtube.com or youtube.com.
+ NSString *scheme = [[self scheme] lowercaseString];
+ if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"])
+ return nil;
+
+ NSString *hostName = [[self host] lowercaseString];
+ BOOL isYouTubeMobileWebAppURL = [hostName isEqualToString:@"m.youtube.com"];
+ BOOL isYouTubeShortenedURL = [hostName isEqualToString:@"youtu.be"];
+ if (!isYouTubeMobileWebAppURL
+ && !isYouTubeShortenedURL
+ && ![hostName isEqualToString:@"www.youtube.com"]
+ && ![hostName isEqualToString:@"youtube.com"])
+ return nil;
+
+ NSString *path = [self path];
+
+ // Short URL of the form: http://youtu.be/v1d301D
+ if (isYouTubeShortenedURL) {
+ NSString *videoID = [path lastPathComponent];
+ if (videoID && ![videoID isEqualToString:@"/"])
+ return createYouTubeURL(videoID, nil);
+ return nil;
+ }
+
+ NSString *query = [self query];
+ NSString *fragment = [self fragment];
+
+ // On the YouTube mobile web app, the path and query string are put into the
+ // fragment so that one web page is only ever loaded (see <rdar://problem/9550639>).
+ if (isYouTubeMobileWebAppURL) {
+ NSRange range = [fragment rangeOfString:@"?"];
+ if (range.location == NSNotFound) {
+ path = fragment;
+ query = nil;
+ } else {
+ path = [fragment substringToIndex:range.location];
+ query = [fragment substringFromIndex:(range.location + 1)];
+ }
+ fragment = nil;
+ }
+
+ if ([[path lowercaseString] isEqualToString:@"/watch"]) {
+ if ([query length]) {
+ NSString *videoID = [[query _webkit_queryKeysAndValues] objectForKey:@"v"];
+ if (videoID) {
+ NSDictionary *fragmentDict = [[self fragment] _webkit_queryKeysAndValues];
+ NSString *timeID = [fragmentDict objectForKey:@"t"];
+ return createYouTubeURL(videoID, timeID);
+ }
+ }
+
+ // May be a new-style link (see <rdar://problem/7733692>).
+ if ([fragment hasPrefix:@"!"]) {
+ query = [fragment substringFromIndex:1];
+
+ if ([query length]) {
+ NSDictionary *queryDict = [query _webkit_queryKeysAndValues];
+ NSString *videoID = [queryDict objectForKey:@"v"];
+ if (videoID) {
+ NSString *timeID = [queryDict objectForKey:@"t"];
+ return createYouTubeURL(videoID, timeID);
+ }
+ }
+ }
+ } else if ([path _web_hasCaseInsensitivePrefix:@"/v/"] || [path _web_hasCaseInsensitivePrefix:@"/e/"]) {
+ NSString *videoID = [path lastPathComponent];
+
+ // These URLs are funny - they don't have a ? for the first query parameter.
+ // Strip all characters after and including '&' to remove extraneous parameters after the video ID.
+ NSRange ampersand = [videoID rangeOfString:@"&"];
+ if (ampersand.location != NSNotFound)
+ videoID = [videoID substringToIndex:ampersand.location];
+
+ if (videoID)
+ return createYouTubeURL(videoID, nil);
+ }
+
+ return nil;
+}
+
++ (NSURL *)uniqueURLWithRelativePart:(NSString *)relativePart
+{
+ CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault);
+ NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef);
+ CFRelease(UUIDRef);
+ NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", WebDataProtocolScheme, UUIDString, relativePart]];
+ CFRelease(UUIDString);
+
+ return URL;
+}
+
+#endif // PLATFORM(IOS)
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation NSString (WebNSURLExtras)
</span><span class="lines">@@ -390,4 +506,73 @@
</span><span class="cx"> return [self substringFromIndex:fragmentRange.location + 1];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+
+- (NSString *)_webkit_unescapedQueryValue
+{
+ NSMutableString *string = [[[self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] mutableCopy] autorelease];
+ if (!string) // If we failed to decode the URL as UTF8, fall back to Latin1
+ string = [[[self stringByReplacingPercentEscapesUsingEncoding:NSISOLatin1StringEncoding] mutableCopy] autorelease];
+ [string replaceOccurrencesOfString:@"+" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [string length])];
+ return string;
+}
+
+- (NSDictionary *)_webkit_queryKeysAndValues
+{
+ unsigned queryLength = [self length];
+ if (!queryLength)
+ return nil;
+
+ NSMutableDictionary *queryKeysAndValues = nil;
+ NSRange equalSearchRange = NSMakeRange(0, queryLength);
+
+ while (equalSearchRange.location < queryLength - 1 && equalSearchRange.length) {
+
+ // Search for "=".
+ NSRange equalRange = [self rangeOfString:@"=" options:NSLiteralSearch range:equalSearchRange];
+ if (equalRange.location == NSNotFound)
+ break;
+
+ unsigned indexAfterEqual = equalRange.location + 1;
+ if (indexAfterEqual > queryLength - 1)
+ break;
+
+ // Get the key before the "=".
+ NSRange keyRange = NSMakeRange(equalSearchRange.location, equalRange.location - equalSearchRange.location);
+
+ // Seach for the ampersand.
+ NSRange ampersandSearchRange = NSMakeRange(indexAfterEqual, queryLength - indexAfterEqual);
+ NSRange ampersandRange = [self rangeOfString:@"&" options:NSLiteralSearch range:ampersandSearchRange];
+
+ // Get the value after the "=", before the ampersand.
+ NSRange valueRange;
+ if (ampersandRange.location != NSNotFound)
+ valueRange = NSMakeRange(indexAfterEqual, ampersandRange.location - indexAfterEqual);
+ else
+ valueRange = NSMakeRange(indexAfterEqual, queryLength - indexAfterEqual);
+
+ // Save the key and the value.
+ if (keyRange.length && valueRange.length) {
+ if (queryKeysAndValues == nil)
+ queryKeysAndValues = [NSMutableDictionary dictionary];
+ NSString *key = [[self substringWithRange:keyRange] lowercaseString];
+ NSString *value = [[self substringWithRange:valueRange] _webkit_unescapedQueryValue];
+ if ([key length] && [value length])
+ [queryKeysAndValues setObject:value forKey:key];
+ }
+
+ // At the end.
+ if (ampersandRange.location == NSNotFound)
+ break;
+
+ // Continue searching after the ampersand.
+ unsigned indexAfterAmpersand = ampersandRange.location + 1;
+ equalSearchRange = NSMakeRange(indexAfterAmpersand, queryLength - indexAfterAmpersand);
+ }
+
+ return queryKeysAndValues;
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSViewExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -37,6 +37,11 @@
</span><span class="cx"> #import <WebKit/WebNSURLExtras.h>
</span><span class="cx"> #import <WebKit/WebView.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WAKWindow.h>
+#endif
+
</ins><span class="cx"> #define WebDragStartHysteresisX 5.0f
</span><span class="cx"> #define WebDragStartHysteresisY 5.0f
</span><span class="cx"> #define WebMaxDragImageSize NSMakeSize(400.0f, 400.0f)
</span><span class="lines">@@ -59,6 +64,7 @@
</span><span class="cx"> return (WebFrameView *)[self _web_superviewOfClass:[WebFrameView class]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Mail is the only client of _webView, remove this method once no versions of Mail need it.
</span><span class="cx"> - (WebView *)_webView
</span><span class="cx"> {
</span><span class="lines">@@ -206,6 +212,7 @@
</span><span class="cx"> [self dragImage:dragImage at:origin offset:NSZeroSize event:event pasteboard:pasteboard source:source slideBack:YES];
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_web_firstResponderIsSelfOrDescendantView
</span><span class="cx"> {
</span><span class="lines">@@ -250,3 +257,22 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#if PLATFORM(IOS)
+@implementation NSView (WebDocumentViewExtras)
+
+- (WebFrame *)_frame
+{
+ WebFrameView *webFrameView = [self _web_parentWebFrameView];
+ return [webFrameView webFrame];
+}
+
+- (WebView *)_webView
+{
+ // We used to use the view hierarchy exclusively here, but that won't work
+ // right when the first viewDidMoveToSuperview call is done, and this will.
+ return [[self _frame] webView];
+}
+
+@end
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSWindowExtrasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSWindowExtras.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSWindowExtras.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Misc/WebNSWindowExtras.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebNSWindowExtras.h"
</span><span class="cx">
</span><span class="cx"> @implementation NSWindow (WebExtras)
</span><span class="lines">@@ -56,3 +58,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPanelsWebAuthenticationPanelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx"> #import <Foundation/NSURLCredentialStorage.h>
</span><span class="cx">
</span><span class="lines">@@ -67,3 +69,4 @@
</span><span class="cx"> @interface WebNonBlockingPanel : NSPanel
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPanelsWebAuthenticationPanelm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Panels/WebAuthenticationPanel.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebAuthenticationPanel.h>
</span><span class="cx">
</span><span class="cx"> #import "WebLocalizableStringsInternal.h"
</span><span class="lines">@@ -305,3 +307,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPanelsWebPanelAuthenticationHandlerm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Panels/WebPanelAuthenticationHandler.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Panels/WebPanelAuthenticationHandler.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Panels/WebPanelAuthenticationHandler.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebPanelAuthenticationHandler.h>
</span><span class="cx">
</span><span class="cx"> #import <Foundation/NSURLAuthenticationChallenge.h>
</span><span class="lines">@@ -160,3 +162,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPluginsHostedWebHostedNetscapePluginViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -71,9 +71,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> WKSendUserChangeNotifications();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebBasePluginPackageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -35,6 +35,10 @@
</span><span class="cx"> typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WAKAppKitStubs.h>
+#endif
+
</ins><span class="cx"> @class WebPluginDatabase;
</span><span class="cx">
</span><span class="cx"> @protocol WebPluginManualLoader
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebBasePluginPackagemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -66,9 +66,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -102,6 +104,7 @@
</span><span class="cx"> {
</span><span class="cx"> NSString *newPath = [thePath stringByResolvingSymlinksInPath];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> FSRef fref;
</span><span class="cx"> OSStatus err;
</span><span class="cx">
</span><span class="lines">@@ -120,6 +123,7 @@
</span><span class="cx"> newPath = [(NSURL *)URL path];
</span><span class="cx"> CFRelease(URL);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return newPath;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebJavaPlugInh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebJavaPlugIn.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebJavaPlugIn.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebJavaPlugIn.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <JavaVM/jni.h>
</span><span class="cx">
</span><span class="cx"> /*!
</span><span class="lines">@@ -83,3 +85,4 @@
</span><span class="cx"> exceptionDescription:(NSString **)exceptionString;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginContainerCheckmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginContainerCheck.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginContainerCheck.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginContainerCheck.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -47,6 +47,12 @@
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WebPluginController (SecretsIKnow)
+- (WebFrame *)webFrame; // FIXME: This file calls -[WebPluginController webFrame], which is not declared in WebPluginController.h. Merge issue? Are the plug-in files out of date?
+@end
+#endif
+
</ins><span class="cx"> @implementation WebPluginContainerCheck
</span><span class="cx">
</span><span class="cx"> - (id)initWithRequest:(NSURLRequest *)request target:(NSString *)target resultObject:(id)obj selector:(SEL)selector controller:(id <WebPluginContainerCheckController>)controller contextInfo:(id)contextInfo /*optional*/
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginController.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginController.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginController.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -34,6 +34,9 @@
</span><span class="cx"> @class WebPluginPackage;
</span><span class="cx"> @class WebView;
</span><span class="cx"> @class WebDataSource;
</span><ins>+#if PLATFORM(IOS)
+@class CALayer;
+#endif
</ins><span class="cx">
</span><span class="cx"> @interface WebPluginController : NSObject <WebPluginManualLoader, WebPluginContainerCheckController>
</span><span class="cx"> {
</span><span class="lines">@@ -61,9 +64,18 @@
</span><span class="cx"> + (void)pluginViewHidden:(NSView *)view;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (void)addPlugInView:(NSView *)view;
+- (BOOL)plugInsAreRunning;
+- (CALayer *)superlayerForPluginView:(NSView *)view;
+#endif
</ins><span class="cx"> - (void)startAllPlugins;
</span><span class="cx"> - (void)stopAllPlugins;
</span><span class="cx"> - (void)destroyAllPlugins;
</span><ins>+#if PLATFORM(IOS)
+- (void)stopPluginsForPageCache;
+- (void)restorePluginsFromCache;
+#endif
</ins><span class="cx">
</span><span class="cx"> - (WebFrame *)webFrame;
</span><span class="cx"> - (WebView *)webView;
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginController.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginController.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginController.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -62,6 +62,17 @@
</span><span class="cx"> #import <runtime/JSLock.h>
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "DOMElementInternal.h"
+#import "WebUIKitDelegate.h"
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsLayer.h>
+#import <WebCore/Page.h>
+#import <WebCore/RuntimeApplicationChecksIOS.h>
+#import <WebCore/SoftLinking.h>
+#import <WebCore/WebCoreThreadRun.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><span class="lines">@@ -69,10 +80,12 @@
</span><span class="cx"> - (void)setContainingWindow:(NSWindow *)w;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // For compatibility only.
</span><span class="cx"> @interface NSObject (OldPluginAPI)
</span><span class="cx"> + (NSView *)pluginViewWithArguments:(NSDictionary *)arguments;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @interface NSView (OldPluginAPI)
</span><span class="cx"> - (void)pluginInitialize;
</span><span class="lines">@@ -81,21 +94,49 @@
</span><span class="cx"> - (void)pluginDestroy;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool isKindOfClass(id, NSString* className);
</span><span class="cx"> static void installFlip4MacPlugInWorkaroundIfNecessary();
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> static NSMutableSet *pluginViews = nil;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static void initializeAudioSession()
+{
+ static bool wasAudioSessionInitialized;
+ if (wasAudioSessionInitialized)
+ return;
+
+ wasAudioSessionInitialized = true;
+ if (!WebCore::applicationIsMobileSafari())
+ return;
+
+ AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback);
+}
+#endif
+
</ins><span class="cx"> @implementation WebPluginController
</span><span class="cx">
</span><span class="cx"> + (NSView *)plugInViewWithArguments:(NSDictionary *)arguments fromPluginPackage:(WebPluginPackage *)pluginPackage
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ initializeAudioSession();
+#endif
+
</ins><span class="cx"> [pluginPackage load];
</span><span class="cx"> Class viewFactory = [pluginPackage viewFactory];
</span><span class="cx">
</span><span class="cx"> NSView *view = nil;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ {
+ WebView *webView = [_documentView _webView];
+ JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
+ view = [[webView _UIKitDelegateForwarder] webView:webView plugInViewWithArguments:arguments fromPlugInPackage:pluginPackage];
+ }
+#else
</ins><span class="cx"> if ([viewFactory respondsToSelector:@selector(plugInViewWithArguments:)]) {
</span><span class="cx"> JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
</span><span class="cx"> view = [viewFactory plugInViewWithArguments:arguments];
</span><span class="lines">@@ -103,6 +144,7 @@
</span><span class="cx"> JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
</span><span class="cx"> view = [viewFactory pluginViewWithArguments:arguments];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (view == nil) {
</span><span class="cx"> return nil;
</span><span class="lines">@@ -116,6 +158,15 @@
</span><span class="cx"> return view;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (void)addPlugInView:(NSView *)view
+{
+ if (pluginViews == nil)
+ pluginViews = [[NSMutableSet alloc] init];
+ [pluginViews addObject:view];
+}
+#endif
+
</ins><span class="cx"> + (BOOL)isPlugInView:(NSView *)view
</span><span class="cx"> {
</span><span class="cx"> return [pluginViews containsObject:view];
</span><span class="lines">@@ -147,6 +198,36 @@
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)plugInsAreRunning
+{
+ NSUInteger pluginViewCount = [_views count];
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ pluginViewCount += [_viewsNotInDocument count];
+#endif
+ return _started && pluginViewCount;
+}
+
+- (CALayer *)superlayerForPluginView:(NSView *)view
+{
+#if USE(ACCELERATED_COMPOSITING)
+ Frame* coreFrame = core([self webFrame]);
+ FrameView* coreView = coreFrame ? coreFrame->view() : nullptr;
+ if (!coreView)
+ return nil;
+
+ // Get a GraphicsLayer;
+ GraphicsLayer* layerForWidget = coreView->graphicsLayerForPlatformWidget(view);
+ if (!layerForWidget)
+ return nil;
+
+ return layerForWidget->platformLayer();
+#else
+ return nil;
+#endif
+}
+#endif
+
</ins><span class="cx"> - (void)stopOnePlugin:(NSView *)view
</span><span class="cx"> {
</span><span class="cx"> if ([view respondsToSelector:@selector(webPlugInStop)]) {
</span><span class="lines">@@ -158,6 +239,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)stopOnePluginForPageCache:(NSView *)view
+{
+ if ([view respondsToSelector:@selector(webPlugInStopForPageCache)]) {
+ JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
+ [view webPlugInStopForPageCache];
+ } else
+ [self stopOnePlugin:view];
+}
+#endif
+
</ins><span class="cx"> - (void)destroyOnePlugin:(NSView *)view
</span><span class="cx"> {
</span><span class="cx"> if ([view respondsToSelector:@selector(webPlugInDestroy)]) {
</span><span class="lines">@@ -213,7 +305,48 @@
</span><span class="cx"> _started = NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)stopPluginsForPageCache
+{
+ if (!_started)
+ return;
+
+ NSUInteger viewsCount = [_views count];
+ if (viewsCount > 0)
+ LOG(Plugins, "stopping WebKit plugins for PageCache: %@", [_views description]);
+
+ for (NSUInteger i = 0; i < viewsCount; ++i)
+ [self stopOnePluginForPageCache:[_views objectAtIndex:i]];
+
</ins><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><ins>+ NSUInteger viewsNotInDocumentCount = [_viewsNotInDocument count];
+ for (NSUInteger i = 0; i < viewsNotInDocumentCount; ++i)
+ [self stopOnePluginForPageCache:[_viewsNotInDocument objectAtIndex:i]];
+#endif
+
+ _started = NO;
+}
+
+- (void)restorePluginsFromCache
+{
+ WebView *webView = [_documentView _webView];
+
+ NSUInteger viewsCount = [_views count];
+ if (viewsCount > 0)
+ LOG(Plugins, "restoring WebKit plugins from PageCache: %@", [_views description]);
+
+ for (NSUInteger i = 0; i < viewsCount; ++i)
+ [[webView _UIKitDelegateForwarder] webView:webView willAddPlugInView:[_views objectAtIndex:i]];
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ NSUInteger viewsNotInDocumentCount = [_viewsNotInDocument count];
+ for (NSUInteger i = 0; i < viewsNotInDocumentCount; ++i)
+ [[webView _UIKitDelegateForwarder] webView:webView willAddPlugInView:[_viewsNotInDocument objectAtIndex:i]];
+#endif
+}
+#endif // PLATFORM(IOS)
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</ins><span class="cx"> - (void)pluginViewCreated:(NSView *)view
</span><span class="cx"> {
</span><span class="cx"> if (!_viewsNotInDocument)
</span><span class="lines">@@ -237,19 +370,23 @@
</span><span class="cx">
</span><span class="cx"> if (![_views containsObject:view]) {
</span><span class="cx"> [_views addObject:view];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[_documentView _webView] addPluginInstanceView:view];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="cx"> if ([_viewsNotInDocument containsObject:view])
</span><span class="cx"> [_viewsNotInDocument removeObject:view];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL oldDefersCallbacks = [[self webView] defersCallbacks];
</span><span class="cx"> if (!oldDefersCallbacks)
</span><span class="cx"> [[self webView] setDefersCallbacks:YES];
</span><span class="cx">
</span><span class="cx"> if (isKindOfClass(view, @"WmvPlugin"))
</span><span class="cx"> installFlip4MacPlugInWorkaroundIfNecessary();
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> LOG(Plugins, "initializing plug-in %@", view);
</span><span class="cx"> if ([view respondsToSelector:@selector(webPlugInInitialize)]) {
</span><span class="lines">@@ -260,8 +397,10 @@
</span><span class="cx"> [view pluginInitialize];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!oldDefersCallbacks)
</span><span class="cx"> [[self webView] setDefersCallbacks:NO];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (_started) {
</span><span class="cx"> LOG(Plugins, "starting plug-in %@", view);
</span><span class="lines">@@ -298,7 +437,9 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> [pluginViews removeObject:view];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[_documentView _webView] removePluginInstanceView:view];
</span><ins>+#endif
</ins><span class="cx"> [_views removeObject:view];
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="cx"> [_viewsNotInDocument removeObject:view];
</span><span class="lines">@@ -347,7 +488,9 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> [pluginViews removeObject:aView];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[_documentView _webView] removePluginInstanceView:aView];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="lines">@@ -356,13 +499,24 @@
</span><span class="cx"> [self destroyOnePlugin:[_viewsNotInDocument objectAtIndex:i]];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
</span><ins>+#else
+ [_views makeObjectsPerformSelector:@selector(removeFromSuperview)];
+#endif
</ins><span class="cx"> [_views release];
</span><span class="cx"> _views = nil;
</span><span class="cx">
</span><span class="cx"> _documentView = nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)processingUserGesture
+{
+ return ScriptController::processingUserGesture();
+}
+#endif
+
</ins><span class="cx"> - (id)_webPluginContainerCheckIfAllowedToLoadRequest:(NSURLRequest *)request inFrame:(NSString *)target resultObject:(id)obj selector:(SEL)selector
</span><span class="cx"> {
</span><span class="cx"> WebPluginContainerCheck *check = [WebPluginContainerCheck checkWithRequest:request target:target resultObject:obj selector:selector controller:self contextInfo:nil];
</span><span class="lines">@@ -409,6 +563,20 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)webPlugInContainerWillShowFullScreenForView:(id)plugInView
+{
+ WebView *webView = [_dataSource _webView];
+ [[webView _UIKitDelegateForwarder] webView:webView willShowFullScreenForPlugInView:plugInView];
+}
+
+- (void)webPlugInContainerDidHideFullScreenForView:(id)plugInView
+{
+ WebView *webView = [_dataSource _webView];
+ [[webView _UIKitDelegateForwarder] webView:webView didHideFullScreenForPlugInView:plugInView];
+}
+#endif
+
</ins><span class="cx"> - (void)webPlugInContainerShowStatus:(NSString *)message
</span><span class="cx"> {
</span><span class="cx"> if (!message)
</span><span class="lines">@@ -424,6 +592,7 @@
</span><span class="cx"> [self webPlugInContainerShowStatus:message];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSColor *)webPlugInContainerSelectionColor
</span><span class="cx"> {
</span><span class="cx"> bool primary = true;
</span><span class="lines">@@ -437,6 +606,7 @@
</span><span class="cx"> {
</span><span class="cx"> return [self webPlugInContainerSelectionColor];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (WebFrame *)webFrame
</span><span class="cx"> {
</span><span class="lines">@@ -509,21 +679,34 @@
</span><span class="cx">
</span><span class="cx"> - (void)_webPluginContainerSetMediaPlayerProxy:(WebMediaPlayerProxy *)proxy forElement:(DOMElement *)element
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadRun(^{
+#endif
</ins><span class="cx"> WebCore::HTMLMediaElement* client = mediaProxyClient(element);
</span><span class="cx"> if (client)
</span><span class="cx"> client->setMediaPlayerProxy(proxy);
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_webPluginContainerPostMediaPlayerNotification:(int)notification forElement:(DOMElement *)element
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadRun(^{
+#endif
</ins><span class="cx"> WebCore::HTMLMediaElement* client = mediaProxyClient(element);
</span><span class="cx"> if (client)
</span><span class="cx"> client->deliverNotification((MediaPlayerProxyNotificationType)notification);
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool isKindOfClass(id object, NSString *className)
</span><span class="cx"> {
</span><span class="cx"> Class cls = NSClassFromString(className);
</span><span class="lines">@@ -605,3 +788,4 @@
</span><span class="cx"> hasInstalledFlip4MacPlugInWorkaround = true;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginDatabasemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -45,6 +45,10 @@
</span><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="cx"> #import <wtf/Assertions.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebUIKitSupport.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPackage **candidatePlugin);
</span><span class="lines">@@ -386,6 +390,7 @@
</span><span class="cx">
</span><span class="cx"> + (NSArray *)_defaultPlugInPaths
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Plug-ins are found in order of precedence.
</span><span class="cx"> // If there are duplicates, the first found plug-in is used.
</span><span class="cx"> // For example, if there is a QuickTime.plugin in the users's home directory
</span><span class="lines">@@ -396,6 +401,19 @@
</span><span class="cx"> @"/Library/Internet Plug-Ins",
</span><span class="cx"> [[NSBundle mainBundle] builtInPlugInsPath],
</span><span class="cx"> nil];
</span><ins>+#else
+ // iOS plug-ins are all located in /System/Library/Internet Plug-Ins
+#if !PLATFORM(IOS_SIMULATOR)
+ NSArray *systemLibrary = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, YES);
+ if (!systemLibrary || [systemLibrary count] == 0)
+ return nil;
+ NSString *systemDir = (NSString*)[systemLibrary objectAtIndex:0];
+#else
+ NSString* platformRootDir = [NSString stringWithUTF8String:WebKitPlatformSystemRootDirectory()];
+ NSString *systemDir = [platformRootDir stringByAppendingPathComponent:@"System/Library"];
+#endif
+ return [NSArray arrayWithObject:[systemDir stringByAppendingPathComponent:@"Internet Plug-Ins"]];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSArray *)_plugInPaths
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginPackagemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginPackage.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginPackage.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginPackage.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[nsBundle executablePath]];
</span><span class="cx"> NSData *data = [executableFile readDataOfLength:512];
</span><span class="cx"> [executableFile closeFile];
</span><span class="lines">@@ -68,6 +69,7 @@
</span><span class="cx"> [self release];
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (![self getPluginInfoFromPLists]) {
</span><span class="cx"> [self release];
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebPluginsPrivatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebPluginsPrivate.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebPluginsPrivate.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginsPrivate.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,10 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #include "WebPluginsPrivate.h"
</span><span class="cx">
</span><span class="cx"> NSString *WebPluginWillPresentNativeUserInterfaceNotification = @"WebPluginWillPresentNativeUserInterface";
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebDatabaseManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -37,6 +37,12 @@
</span><span class="cx"> #import <WebCore/DatabaseManager.h>
</span><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebDatabaseManagerInternal.h"
+#import <WebCore/DatabaseTracker.h>
+#import <WebCore/WebCoreThread.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
</span><span class="lines">@@ -49,6 +55,10 @@
</span><span class="cx"> NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification";
</span><span class="cx"> NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey";
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+CFStringRef WebDatabaseOriginsDidChangeNotification = CFSTR("WebDatabaseOriginsDidChangeNotification");
+#endif
+
</ins><span class="cx"> static NSString *databasesDirectoryPath();
</span><span class="cx">
</span><span class="cx"> @implementation WebDatabaseManager
</span><span class="lines">@@ -125,6 +135,11 @@
</span><span class="cx"> - (void)deleteAllDatabases
</span><span class="cx"> {
</span><span class="cx"> DatabaseManager::manager().deleteAllDatabases();
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: This needs to be removed once DatabaseTrackers in multiple processes
+ // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
+ [[NSFileManager defaultManager] removeItemAtPath:databasesDirectoryPath() error:NULL];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)deleteOrigin:(WebSecurityOrigin *)origin
</span><span class="lines">@@ -137,8 +152,150 @@
</span><span class="cx"> return DatabaseManager::manager().deleteDatabase([origin _core], databaseIdentifier);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static bool isFileHidden(NSString *file)
+{
+ ASSERT([file length]);
+ return [file characterAtIndex:0] == '.';
+}
+
++ (void)removeEmptyDatabaseFiles
+{
+ NSString *databasesDirectory = databasesDirectoryPath();
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSArray *array = [fileManager contentsOfDirectoryAtPath:databasesDirectory error:0];
+ if (!array)
+ return;
+
+ NSUInteger count = [array count];
+ for (NSUInteger i = 0; i < count; ++i) {
+ NSString *fileName = [array objectAtIndex:i];
+ // Skip hidden files.
+ if (![fileName length] || isFileHidden(fileName))
+ continue;
+
+ NSString *path = [databasesDirectory stringByAppendingPathComponent:fileName];
+ // Look for directories that contain database files belonging to the same origins.
+ BOOL isDirectory;
+ if (![fileManager fileExistsAtPath:path isDirectory:&isDirectory] || !isDirectory)
+ continue;
+
+ // Make sure the directory is not a symbolic link that points to something else.
+ NSDictionary *attributes = [fileManager attributesOfItemAtPath:path error:0];
+ if ([attributes fileType] == NSFileTypeSymbolicLink)
+ continue;
+
+ NSArray *databaseFilesInOrigin = [fileManager contentsOfDirectoryAtPath:path error:0];
+ NSUInteger databaseFileCount = [databaseFilesInOrigin count];
+ NSUInteger deletedDatabaseFileCount = 0;
+ for (NSUInteger j = 0; j < databaseFileCount; ++j) {
+ NSString *dbFileName = [databaseFilesInOrigin objectAtIndex:j];
+ // Skip hidden files.
+ if (![dbFileName length] || isFileHidden(dbFileName))
+ continue;
+
+ NSString *dbFilePath = [path stringByAppendingPathComponent:dbFileName];
+
+ // There shouldn't be any directories in this folder - but check for it anyway.
+ if (![fileManager fileExistsAtPath:dbFilePath isDirectory:&isDirectory] || isDirectory)
+ continue;
+
+ if (DatabaseTracker::deleteDatabaseFileIfEmpty(dbFilePath))
+ ++deletedDatabaseFileCount;
+ }
+
+ // If we have removed every database file for this origin, delete the folder for this origin.
+ if (databaseFileCount == deletedDatabaseFileCount) {
+ // Use rmdir - we don't want the deletion to happen if the folder is not empty.
+ rmdir([path fileSystemRepresentation]);
+ }
+ }
+}
+
++ (void)scheduleEmptyDatabaseRemoval
+{
+ DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled();
+
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
+ [WebDatabaseManager removeEmptyDatabaseFiles];
+ DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish();
+ });
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@implementation WebDatabaseManager (WebDatabaseManagerInternal)
+
+static Mutex& transactionBackgroundTaskIdentifierLock()
+{
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+ return mutex;
+}
+
+static WebBackgroundTaskIdentifier transactionBackgroundTaskIdentifier;
+
+static void setTransactionBackgroundTaskIdentifier(WebBackgroundTaskIdentifier identifier)
+{
+ transactionBackgroundTaskIdentifier = identifier;
+}
+
+static WebBackgroundTaskIdentifier getTransactionBackgroundTaskIdentifier()
+{
+ static dispatch_once_t pred;
+ dispatch_once(&pred, ^{
+ setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
+ });
+
+ return transactionBackgroundTaskIdentifier;
+}
+
++ (void)willBeginFirstTransaction
+{
+ [self startBackgroundTask];
+}
+
++ (void)didFinishLastTransaction
+{
+ [self endBackgroundTask];
+}
+
++ (void)startBackgroundTask
+{
+ MutexLocker lock(transactionBackgroundTaskIdentifierLock());
+
+ // If there's already an existing background task going on, there's no need to start a new one.
+ if (getTransactionBackgroundTaskIdentifier() != invalidWebBackgroundTaskIdentifier())
+ return;
+
+ setTransactionBackgroundTaskIdentifier(startBackgroundTask(^ { [WebDatabaseManager endBackgroundTask]; }));
+}
+
++ (void)endBackgroundTask
+{
+ MutexLocker lock(transactionBackgroundTaskIdentifierLock());
+
+ // It is possible that we were unable to start the background task when the first transaction began.
+ // Don't try to end the task in that case.
+ // It is also possible we finally finish the last transaction right when the background task expires
+ // and this will end up being called twice for the same background task. transactionBackgroundTaskIdentifier
+ // will be invalid for the second caller.
+ if (getTransactionBackgroundTaskIdentifier() == invalidWebBackgroundTaskIdentifier())
+ return;
+
+ endBackgroundTask(getTransactionBackgroundTaskIdentifier());
+ setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
+}
+
+@end
+
+void WebKitSetWebDatabasePaused(bool paused)
+{
+ DatabaseTracker::tracker().setDatabasesPaused(paused);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> static NSString *databasesDirectoryPath()
</span><span class="cx"> {
</span><span class="cx"> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebDatabaseManagerClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -34,8 +34,25 @@
</span><span class="cx"> virtual ~WebDatabaseManagerClient();
</span><span class="cx"> virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
</span><span class="cx"> virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseIdentifier);
</span><ins>+#if PLATFORM(IOS)
+ virtual void dispatchDidAddNewOrigin(WebCore::SecurityOrigin*) OVERRIDE;
+ virtual void dispatchDidDeleteDatabase() OVERRIDE;
+ virtual void dispatchDidDeleteDatabaseOrigin() OVERRIDE;
+ void newDatabaseOriginWasAdded();
+ void databaseWasDeleted();
+ void databaseOriginWasDeleted();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> WebDatabaseManagerClient();
</span><ins>+
+#if PLATFORM(IOS)
+ void databaseOriginsDidChange();
+
+ bool m_isHandlingNewDatabaseOriginNotification;
+ bool m_isHandlingDeleteDatabaseNotification;
+ bool m_isHandlingDeleteDatabaseOriginNotification;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebDatabaseManagerClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -33,20 +33,70 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WebCoreThread.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static CFStringRef WebDatabaseOriginWasAddedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseOriginWasAddedNotification");
+static CFStringRef WebDatabaseWasDeletedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseWasDeletedNotification");
+static CFStringRef WebDatabaseOriginWasDeletedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseOriginWasDeletedNotification");
+#endif
+
</ins><span class="cx"> WebDatabaseManagerClient* WebDatabaseManagerClient::sharedWebDatabaseManagerClient()
</span><span class="cx"> {
</span><span class="cx"> static WebDatabaseManagerClient* sharedClient = new WebDatabaseManagerClient();
</span><span class="cx"> return sharedClient;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static void onNewDatabaseOriginAdded(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+ ASSERT(observer);
+
+ WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
+ client->newDatabaseOriginWasAdded();
+}
+
+static void onDatabaseDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+ ASSERT(observer);
+
+ WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
+ client->databaseWasDeleted();
+}
+
+static void onDatabaseOriginDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+ ASSERT(observer);
+
+ WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
+ client->databaseOriginWasDeleted();
+}
+#endif
+
</ins><span class="cx"> WebDatabaseManagerClient::WebDatabaseManagerClient()
</span><ins>+#if PLATFORM(IOS)
+ : m_isHandlingNewDatabaseOriginNotification(false)
+ , m_isHandlingDeleteDatabaseNotification(false)
+ , m_isHandlingDeleteDatabaseOriginNotification(false)
+#endif
</ins><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
+ CFNotificationCenterAddObserver(center, this, onNewDatabaseOriginAdded, WebDatabaseOriginWasAddedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
+ CFNotificationCenterAddObserver(center, this, onDatabaseDeleted, WebDatabaseWasDeletedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
+ CFNotificationCenterAddObserver(center, this, onDatabaseOriginDeleted, WebDatabaseOriginWasDeletedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebDatabaseManagerClient::~WebDatabaseManagerClient()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, 0, 0);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class DidModifyOriginData {
</span><span class="lines">@@ -106,4 +156,80 @@
</span><span class="cx"> userInfo:userInfo.get()];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebDatabaseManagerClient::dispatchDidAddNewOrigin(SecurityOrigin*)
+{
+ m_isHandlingNewDatabaseOriginNotification = true;
+ // Send a notification to all apps that a new origin has been added, so other apps with opened database can refresh their origin maps.
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseOriginWasAddedNotification, 0, 0, true);
+}
+
+void WebDatabaseManagerClient::dispatchDidDeleteDatabase()
+{
+ m_isHandlingDeleteDatabaseNotification = true;
+ // Send a notification to all apps that a database has been deleted, so other apps with the deleted database open will close it properly.
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseWasDeletedNotification, 0, 0, true);
+}
+
+void WebDatabaseManagerClient::dispatchDidDeleteDatabaseOrigin()
+{
+ m_isHandlingDeleteDatabaseOriginNotification = true;
+ // Send a notification to all apps that an origin has been deleted, so other apps can update their origin maps.
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseOriginWasDeletedNotification, 0, 0, true);
+}
+
+void WebDatabaseManagerClient::newDatabaseOriginWasAdded()
+{
+ // Locks the WebThread for the rest of the run loop.
+ WebThreadLock();
+
+ // If this is the process that added the new origin, its quota map should have been updated
+ // and does not need to be invalidated.
+ if (m_isHandlingNewDatabaseOriginNotification) {
+ m_isHandlingNewDatabaseOriginNotification = false;
+ return;
+ }
+
+ databaseOriginsDidChange();
+}
+
+void WebDatabaseManagerClient::databaseWasDeleted()
+{
+ // Locks the WebThread for the rest of the run loop.
+ WebThreadLock();
+
+ // If this is the process that added the new origin, its quota map should have been updated
+ // and does not need to be invalidated.
+ if (m_isHandlingDeleteDatabaseNotification) {
+ m_isHandlingDeleteDatabaseNotification = false;
+ return;
+ }
+
+ DatabaseTracker::tracker().removeDeletedOpenedDatabases();
+}
+
+void WebDatabaseManagerClient::databaseOriginWasDeleted()
+{
+ // Locks the WebThread for the rest of the run loop.
+ WebThreadLock();
+
+ // If this is the process that added the new origin, its quota map should have been updated
+ // and does not need to be invalidated.
+ if (m_isHandlingDeleteDatabaseOriginNotification) {
+ m_isHandlingDeleteDatabaseOriginNotification = false;
+ return;
+ }
+
+ databaseOriginsDidChange();
+}
+
+void WebDatabaseManagerClient::databaseOriginsDidChange()
+{
+ // Send a notification (within the app) about the origins change. If an app needs to update its UI when the origins change
+ // (such as Safari Settings), it can listen for that notification.
+ CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), WebDatabaseOriginsDidChangeNotification, 0, 0, true);
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebDatabaseManagerInternalhfromrev161042trunkSourceWebKitmacMiscWebNSArrayExtrash"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h (from rev 161042, trunk/Source/WebKit/mac/Misc/WebNSArrayExtras.h) (0 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h         (rev 0)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebDatabaseManagerPrivate.h"
+
+#if ENABLE(SQL_DATABASE)
+
+#if PLATFORM(IOS)
+@interface WebDatabaseManager (WebDatabaseManagerInternal)
++ (void)willBeginFirstTransaction;
++ (void)didFinishLastTransaction;
++ (void)startBackgroundTask;
++ (void)endBackgroundTask;
+@end
+
+void WebKitSetWebDatabasePaused(bool);
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebStorageManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebStorageManager.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebStorageManager.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/Storage/WebStorageManager.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -50,6 +50,18 @@
</span><span class="cx"> return sharedManager;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)init
+{
+ if (!(self = [super init]))
+ return nil;
+
+ WebKitInitializeStorageIfNecessary();
+
+ return self;
+}
+#endif
+
</ins><span class="cx"> - (NSArray *)origins
</span><span class="cx"> {
</span><span class="cx"> Vector<RefPtr<SecurityOrigin>> coreOrigins;
</span><span class="lines">@@ -70,6 +82,11 @@
</span><span class="cx"> - (void)deleteAllOrigins
</span><span class="cx"> {
</span><span class="cx"> StorageTracker::tracker().deleteAllOrigins();
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: This needs to be removed once StorageTrackers in multiple processes
+ // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
+ [[NSFileManager defaultManager] removeItemAtPath:[WebStorageManager _storageDirectoryPath] error:NULL];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)deleteOrigin:(WebSecurityOrigin *)origin
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportCorrectionPanelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,12 +26,12 @@
</span><span class="cx"> #ifndef CorrectionPanel_h
</span><span class="cx"> #define CorrectionPanel_h
</span><span class="cx">
</span><ins>+#if USE(AUTOCORRECTION_PANEL)
+
</ins><span class="cx"> #import <AppKit/NSSpellChecker.h>
</span><span class="cx"> #import <WebCore/AlternativeTextClient.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><del>-#if USE(AUTOCORRECTION_PANEL)
-
</del><span class="cx"> @class WebView;
</span><span class="cx">
</span><span class="cx"> class CorrectionPanel {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -49,7 +49,16 @@
</span><span class="cx"> virtual Vector<String> dictationAlternatives(uint64_t dictationContext) OVERRIDE;
</span><span class="cx"> #endif
</span><span class="cx"> private:
</span><ins>+#if PLATFORM(IOS)
+#pragma clang diagnostic push
+#if defined(__has_warning) && __has_warning("-Wunused-private-field")
+#pragma clang diagnostic ignored "-Wunused-private-field"
+#endif
+#endif
</ins><span class="cx"> WebView* m_webView;
</span><ins>+#if PLATFORM(IOS)
+#pragma clang diagnostic pop
+#endif
</ins><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx"> CorrectionPanel m_correctionPanel;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebApplicationCachemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -31,10 +31,34 @@
</span><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebKitNSStringExtras.h"
+#import "WebSQLiteDatabaseTrackerClient.h"
+#import <WebCore/SQLiteDatabaseTracker.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> @implementation WebApplicationCache
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+// FIXME: This will be removed when WebKitInitializeApplicationCachePathIfNecessary()
+// is moved from WebView.mm to WebKitInitializeApplicationCacheIfNecessary() in this file.
+// https://bugs.webkit.org/show_bug.cgi?id=57567
++ (void)initializeWithBundleIdentifier:(NSString *)bundleIdentifier
+{
+ static BOOL initialized = NO;
+ if (initialized)
+ return;
+
+ SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
+
+ cacheStorage().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
+
+ initialized = YES;
+}
+#endif
+
</ins><span class="cx"> + (long long)maximumSize
</span><span class="cx"> {
</span><span class="cx"> return cacheStorage().maximumSize();
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -31,6 +31,15 @@
</span><span class="cx"> #import <WebCore/FocusDirection.h>
</span><span class="cx"> #import <wtf/Forward.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <wtf/Platform.h>
+#import <wtf/text/WTFString.h>
+#import <WebCore/Chrome.h>
+
+using WebCore::MessageLevel;
+using WebCore::MessageSource;
+#endif
+
</ins><span class="cx"> @class WebView;
</span><span class="cx">
</span><span class="cx"> class WebChromeClient : public WebCore::ChromeClient {
</span><span class="lines">@@ -123,8 +132,10 @@
</span><span class="cx"> virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>) OVERRIDE;
</span><span class="cx"> virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*) OVERRIDE;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> virtual void setCursor(const WebCore::Cursor&) OVERRIDE;
</span><span class="cx"> virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& lineRect) OVERRIDE;
</span><span class="cx"> virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect, bool behindText, bool entireLine) OVERRIDE;
</span><span class="lines">@@ -163,11 +174,14 @@
</span><span class="cx"> VideoTrigger |
</span><span class="cx"> PluginTrigger|
</span><span class="cx"> CanvasTrigger |
</span><ins>+#if PLATFORM(IOS)
+ AnimatedOpacityTrigger | // Allow opacity animations to trigger compositing mode for iOS: <rdar://problem/7830677>
+#endif
</ins><span class="cx"> AnimationTrigger);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx"> virtual bool supportsFullscreenForNode(const WebCore::Node*) OVERRIDE;
</span><span class="cx"> virtual void enterFullscreenForNode(WebCore::Node*) OVERRIDE;
</span><span class="cx"> virtual void exitFullscreenForNode(WebCore::Node*) OVERRIDE;
</span><span class="lines">@@ -188,7 +202,11 @@
</span><span class="cx">
</span><span class="cx"> virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ WebView* webView() const { return m_webView; }
+#else
</ins><span class="cx"> WebView* webView() { return m_webView; }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WebView *m_webView;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebChromeClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -92,6 +92,17 @@
</span><span class="cx"> #import "NetscapePluginHostManager.h"
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS) && ENABLE(GEOLOCATION)
+#import <WebCore/Geolocation.h>
+#endif
+
+#if PLATFORM(IOS)
+#import <WebCore/Console.h>
+#import <WebCore/WAKClipView.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WebCoreThreadMessage.h>
+#endif
+
</ins><span class="cx"> NSString *WebConsoleMessageXMLMessageSource = @"XMLMessageSource";
</span><span class="cx"> NSString *WebConsoleMessageJSMessageSource = @"JSMessageSource";
</span><span class="cx"> NSString *WebConsoleMessageNetworkMessageSource = @"NetworkMessageSource";
</span><span class="lines">@@ -109,9 +120,11 @@
</span><span class="cx"> NSString *WebConsoleMessageErrorMessageLevel = @"ErrorMessageLevel";
</span><span class="cx">
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSApplication (WebNSApplicationDetails)
</span><span class="cx"> - (NSCursor *)_cursorRectCursor;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @interface NSView (WebNSViewDetails)
</span><span class="cx"> - (NSView *)_findLastViewInKeyViewLoop;
</span><span class="lines">@@ -122,9 +135,11 @@
</span><span class="cx"> - (void)setIsSelected:(BOOL)isSelected;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSWindow (AppKitSecretsIKnowAbout)
</span><span class="cx"> - (NSRect)_growBoxRect;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="lines">@@ -144,14 +159,20 @@
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::setWindowRect(const FloatRect& rect)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSRect windowRect = toDeviceSpace(rect, [m_webView window]);
</span><span class="cx"> [[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> FloatRect WebChromeClient::windowRect()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView];
</span><span class="cx"> return toUserSpace(windowRect, [m_webView window]);
</span><ins>+#else
+ return FloatRect();
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIXME: We need to add API for setting and getting this.
</span><span class="lines">@@ -179,6 +200,7 @@
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::takeFocus(FocusDirection direction)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (direction == FocusDirectionForward) {
</span><span class="cx"> // Since we're trying to move focus out of m_webView, and because
</span><span class="cx"> // m_webView may contain subviews within it, we ask it for the next key
</span><span class="lines">@@ -195,6 +217,7 @@
</span><span class="cx"> return;
</span><span class="cx"> [[m_webView window] selectKeyViewPrecedingView:m_webView];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::focusedElementChanged(Element* element)
</span><span class="lines">@@ -393,7 +416,18 @@
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned int lineNumber, unsigned columnNumber, const String& sourceURL)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id delegate = [m_webView UIDelegate];
</span><ins>+#else
+ if (![m_webView _allowsMessaging])
+ return;
+
+ id delegate = [m_webView _UIKitDelegate];
+ // No delegate means nothing to send this data to so bail.
+ if (!delegate)
+ return;
+#endif
+
</ins><span class="cx"> BOOL respondsToNewSelector = NO;
</span><span class="cx">
</span><span class="cx"> SEL selector = @selector(webView:addMessageToConsole:withSource:);
</span><span class="lines">@@ -418,10 +452,14 @@
</span><span class="cx"> stringForMessageLevel(level), @"MessageLevel",
</span><span class="cx"> NULL];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [[[m_webView _UIKitDelegateForwarder] asyncForwarder] webView:m_webView addMessageToConsole:dictionary withSource:messageSource];
+#else
</ins><span class="cx"> if (respondsToNewSelector)
</span><span class="cx"> CallUIDelegate(m_webView, selector, dictionary, messageSource);
</span><span class="cx"> else
</span><span class="cx"> CallUIDelegate(m_webView, selector, dictionary);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [dictionary release];
</span><span class="cx"> }
</span><span class="lines">@@ -525,7 +563,11 @@
</span><span class="cx">
</span><span class="cx"> IntRect WebChromeClient::windowResizerRect() const
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return enclosingIntRect([[m_webView window] _growBoxRect]);
</span><ins>+#else
+ return IntRect();
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebChromeClient::supportsImmediateInvalidation()
</span><span class="lines">@@ -535,10 +577,14 @@
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::invalidateRootView(const IntRect&, bool immediate)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (immediate) {
</span><span class="cx"> [[m_webView window] displayIfNeeded];
</span><span class="cx"> [[m_webView window] flushWindowIfNeeded];
</span><span class="cx"> }
</span><ins>+#else
+ UNUSED_PARAM(immediate);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::invalidateContentsAndRootView(const IntRect& rect, bool immediate)
</span><span class="lines">@@ -638,11 +684,13 @@
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">
</span><span class="cx"> WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
</span><span class="cx"> if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
</span><span class="cx"> const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
</span><span class="cx"> [[webOrigin databaseQuotaManager] setQuota:defaultQuota];
</span><span class="cx"> } else
</span><ins>+#endif
</ins><span class="cx"> CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
</span><span class="cx"> [webOrigin release];
</span><span class="cx">
</span><span class="lines">@@ -757,6 +805,7 @@
</span><span class="cx"> iconLoader->notifyFinished(Icon::createIconForFiles(filenames));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
</span><span class="cx"> {
</span><span class="cx"> if ([NSApp _cursorRectCursor])
</span><span class="lines">@@ -772,6 +821,7 @@
</span><span class="cx"> {
</span><span class="cx"> [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> KeyboardUIMode WebChromeClient::keyboardUIMode()
</span><span class="cx"> {
</span><span class="lines">@@ -800,12 +850,16 @@
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::enableSuddenTermination()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSProcessInfo processInfo] enableSuddenTermination];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::disableSuddenTermination()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSProcessInfo processInfo] disableSuddenTermination];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename)
</span><span class="lines">@@ -850,18 +904,30 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return adoptRef(new PopupMenuMac(client));
</span><ins>+#else
+ return nullptr;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return adoptRef(new SearchPopupMenuMac(client));
</span><ins>+#else
+ return nullptr;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebChromeClient::shouldPaintEntireContents() const
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return false;
+#else
</ins><span class="cx"> NSView *documentView = [[[m_webView mainFrame] frameView] documentView];
</span><span class="cx"> return [documentView layer];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="lines">@@ -901,7 +967,7 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> bool WebChromeClient::supportsFullscreenForNode(const Node* node)
</span><span class="cx"> {
</span><span class="lines">@@ -931,7 +997,11 @@
</span><span class="cx"> SEL selector = @selector(webView:supportsFullScreenForElement:withKeyboard:);
</span><span class="cx"> if ([[m_webView UIDelegate] respondsToSelector:selector])
</span><span class="cx"> return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)), withKeyboard);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element) withKeyboard:withKeyboard];
</span><ins>+#else
+ return NO;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::enterFullScreenForElement(Element* element)
</span><span class="lines">@@ -941,8 +1011,11 @@
</span><span class="cx"> WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
</span><span class="cx"> CallUIDelegate(m_webView, selector, kit(element), listener);
</span><span class="cx"> [listener release];
</span><del>- } else
</del><ins>+ }
+#if !PLATFORM(IOS)
+ else
</ins><span class="cx"> [m_webView _enterFullScreenForElement:element];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::exitFullScreenForElement(Element* element)
</span><span class="lines">@@ -952,8 +1025,11 @@
</span><span class="cx"> WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
</span><span class="cx"> CallUIDelegate(m_webView, selector, kit(element), listener);
</span><span class="cx"> [listener release];
</span><del>- } else
</del><ins>+ }
+#if !PLATFORM(IOS)
+ else
</ins><span class="cx"> [m_webView _exitFullScreenForElement:element];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebChromeClient::fullScreenRendererChanged(RenderBox* renderer)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebContextMenuClient.h"
</span><span class="cx">
</span><span class="cx"> #import "WebDelegateImplementationCaching.h"
</span><span class="lines">@@ -371,3 +373,5 @@
</span><span class="cx"> if (nsMenu)
</span><span class="cx"> [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
</span><span class="cx"> }
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -42,11 +42,20 @@
</span><span class="cx"> virtual ~WebEditorClient();
</span><span class="cx"> virtual void pageDestroyed() OVERRIDE;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> virtual bool isGrammarCheckingEnabled() OVERRIDE;
</span><span class="cx"> virtual void toggleGrammarChecking() OVERRIDE;
</span><span class="cx"> virtual bool isContinuousSpellCheckingEnabled() OVERRIDE;
</span><span class="cx"> virtual void toggleContinuousSpellChecking() OVERRIDE;
</span><span class="cx"> virtual int spellCheckerDocumentTag() OVERRIDE;
</span><ins>+#else
+ virtual bool isGrammarCheckingEnabled() OVERRIDE { return false; }
+ virtual void toggleGrammarChecking() OVERRIDE { }
+ // Note: isContinuousSpellCheckingEnabled() is implemented.
+ virtual bool isContinuousSpellCheckingEnabled() OVERRIDE;
+ virtual void toggleContinuousSpellChecking() OVERRIDE { }
+ virtual int spellCheckerDocumentTag() OVERRIDE { return 0; }
+#endif
</ins><span class="cx">
</span><span class="cx"> virtual bool smartInsertDeleteEnabled() OVERRIDE;
</span><span class="cx"> virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE;
</span><span class="lines">@@ -127,7 +136,23 @@
</span><span class="cx"> virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) OVERRIDE;
</span><span class="cx"> virtual void textWillBeDeletedInTextField(WebCore::Element*) OVERRIDE;
</span><span class="cx"> virtual void textDidChangeInTextArea(WebCore::Element*) OVERRIDE;
</span><ins>+
+#if PLATFORM(IOS)
+ virtual void suppressSelectionNotifications() OVERRIDE;
+ virtual void restoreSelectionNotifications() OVERRIDE;
+ virtual void startDelayingAndCoalescingContentChangeNotifications() OVERRIDE;
+ virtual void stopDelayingAndCoalescingContentChangeNotifications() OVERRIDE;
+ virtual void writeDataToPasteboard(NSDictionary*) OVERRIDE;
+ virtual NSArray* supportedPasteboardTypesForCurrentSelection() OVERRIDE;
+ virtual NSArray* readDataFromPasteboard(NSString* type, int index) OVERRIDE;
+ virtual bool hasRichlyEditableSelection() OVERRIDE;
+ virtual int getPasteboardItemsCount() OVERRIDE;
+ virtual WebCore::DocumentFragment* documentFragmentFromDelegate(int index) OVERRIDE;
+ virtual bool performsTwoStepPaste(WebCore::DocumentFragment*) OVERRIDE;
+ virtual int pasteboardChangeCount() OVERRIDE;
+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const OVERRIDE;
</span><span class="cx"> virtual void ignoreWordInSpellDocument(const WTF::String&) OVERRIDE;
</span><span class="cx"> virtual void learnWord(const WTF::String&) OVERRIDE;
</span><span class="lines">@@ -140,6 +165,21 @@
</span><span class="cx"> virtual void showSpellingUI(bool show) OVERRIDE;
</span><span class="cx"> virtual bool spellingUIIsShowing() OVERRIDE;
</span><span class="cx"> virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE;
</span><ins>+#else
+ virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const OVERRIDE { return true; }
+ virtual void ignoreWordInSpellDocument(const WTF::String&) OVERRIDE { }
+ virtual void learnWord(const WTF::String&) OVERRIDE { }
+ virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) OVERRIDE { }
+ virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&) OVERRIDE { return ""; }
+ virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) OVERRIDE { }
+ // Note: checkTextOfParagraph() is implemented.
+ virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, WTF::Vector<WebCore::TextCheckingResult>& results) OVERRIDE;
+ virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&) OVERRIDE { }
+ virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE { }
+ virtual void showSpellingUI(bool show) OVERRIDE { }
+ virtual bool spellingUIIsShowing() OVERRIDE { return false; }
+ virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE { }
+#endif // PLATFORM(IOS)
</ins><span class="cx"> virtual void willSetInputMethodState() OVERRIDE;
</span><span class="cx"> virtual void setInputMethodState(bool enabled) OVERRIDE;
</span><span class="cx"> virtual void requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE;
</span><span class="lines">@@ -154,4 +194,9 @@
</span><span class="cx"> RetainPtr<WebEditorUndoTarget> m_undoTarget;
</span><span class="cx"> bool m_haveUndoRedoOperations;
</span><span class="cx"> RefPtr<WebCore::TextCheckingRequest> m_textCheckingRequest;
</span><ins>+#if PLATFORM(IOS)
+ int m_selectionNotificationSuppressions;
+ bool m_delayingContentChangeNotifications;
+ bool m_hasDelayedContentChangeNotification;
+#endif
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -73,13 +73,22 @@
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WebCoreThreadMessage.h>
+#import "DOMElementInternal.h"
+#import "WebFrameView.h"
+#import "WebUIKitDelegate.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSSpellChecker (WebNSSpellCheckerDetails)
</span><span class="cx"> - (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @interface NSAttributedString (WebNSAttributedStringDetails)
</span><span class="cx"> - (id)_initWithDOMRange:(DOMRange*)range;
</span><span class="lines">@@ -105,9 +114,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -182,6 +193,11 @@
</span><span class="cx"> : m_webView(webView)
</span><span class="cx"> , m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease])
</span><span class="cx"> , m_haveUndoRedoOperations(false)
</span><ins>+#if PLATFORM(IOS)
+ , m_selectionNotificationSuppressions(0)
+ , m_delayingContentChangeNotifications(0)
+ , m_hasDelayedContentChangeNotification(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -194,6 +210,7 @@
</span><span class="cx"> return [m_webView isContinuousSpellCheckingEnabled];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> void WebEditorClient::toggleContinuousSpellChecking()
</span><span class="cx"> {
</span><span class="cx"> [m_webView toggleContinuousSpellChecking:nil];
</span><span class="lines">@@ -213,6 +230,7 @@
</span><span class="cx"> {
</span><span class="cx"> return [m_webView spellCheckerDocumentTag];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldDeleteRange(Range* range)
</span><span class="cx"> {
</span><span class="lines">@@ -284,15 +302,44 @@
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didBeginEditing()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidBeginEditingNotification object:m_webView];
</span><ins>+#else
+ WebThreadPostNotification(WebViewDidBeginEditingNotification, m_webView, nil);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebEditorClient::startDelayingAndCoalescingContentChangeNotifications()
+{
+ m_delayingContentChangeNotifications = true;
+}
+
+void WebEditorClient::stopDelayingAndCoalescingContentChangeNotifications()
+{
+ m_delayingContentChangeNotifications = false;
+
+ if (m_hasDelayedContentChangeNotification)
+ this->respondToChangedContents();
+
+ m_hasDelayedContentChangeNotification = false;
+}
+#endif
+
</ins><span class="cx"> void WebEditorClient::respondToChangedContents()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView];
</span><span class="cx"> if ([view isKindOfClass:[WebHTMLView class]])
</span><span class="cx"> [(WebHTMLView *)view _updateFontPanel];
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeNotification object:m_webView];
</span><ins>+#else
+ if (m_delayingContentChangeNotifications) {
+ m_hasDelayedContentChangeNotification = true;
+ } else {
+ WebThreadPostNotification(WebViewDidChangeNotification, m_webView, nil);
+ }
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::respondToChangedSelection(Frame* frame)
</span><span class="lines">@@ -301,21 +348,34 @@
</span><span class="cx"> if ([documentView isKindOfClass:[WebHTMLView class]])
</span><span class="cx"> [(WebHTMLView *)documentView _selectionChanged];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end
</span><span class="cx"> if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"])
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeSelectionNotification object:m_webView];
</span><ins>+#else
+ // Selection can be changed while deallocating down the WebView / Frame / Editor. Do not post in that case because it's already too late
+ // for the NSInvocation to retain the WebView.
+ if (![m_webView _isClosing] && m_selectionNotificationSuppressions == 0)
+ WebThreadPostNotification(WebViewDidChangeSelectionNotification, m_webView, nil);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidEndEditingNotification object:m_webView];
</span><ins>+#else
+ WebThreadPostNotification(WebViewDidEndEditingNotification, m_webView, nil);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didWriteSelectionToPasteboard()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[m_webView _editingDelegateForwarder] webView:m_webView didWriteSelectionToPasteboard:[NSPasteboard generalPasteboard]];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::willWriteSelectionToPasteboard(WebCore::Range*)
</span><span class="lines">@@ -363,6 +423,10 @@
</span><span class="cx"> return elements;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static NSString *NSExcludedElementsDocumentAttribute = @"ExcludedElements";
+#endif
+
</ins><span class="cx"> DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource>>& resources)
</span><span class="cx"> {
</span><span class="cx"> static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion();
</span><span class="lines">@@ -382,8 +446,10 @@
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::setInsertionPasteboard(const String& pasteboardName)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSPasteboard *pasteboard = pasteboardName.isEmpty() ? nil : [NSPasteboard pasteboardWithName:pasteboardName];
</span><span class="cx"> [m_webView _setInsertionPasteboard:pasteboard];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(APPKIT)
</span><span class="lines">@@ -521,6 +587,10 @@
</span><span class="cx"> case EditActionOutdent: return UI_STRING_KEY_INTERNAL("Outdent", "Outdent (Undo action name)", "Undo action name");
</span><span class="cx"> case EditActionBold: return UI_STRING_KEY_INTERNAL("Bold", "Bold (Undo action name)", "Undo action name");
</span><span class="cx"> case EditActionItalics: return UI_STRING_KEY_INTERNAL("Italics", "Italics (Undo action name)", "Undo action name");
</span><ins>+#if PLATFORM(IOS)
+ case EditActionDelete: return UI_STRING_KEY_INTERNAL("Delete", "Delete (Undo action name)", "Undo action name (Used only by PLATFORM(IOS) code)");
+ case EditActionDictation: return UI_STRING_KEY_INTERNAL("Dictation", "Dictation (Undo action name)", "Undo action name (Used only by PLATFORM(IOS) code)");
+#endif
</ins><span class="cx"> }
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="lines">@@ -530,6 +600,13 @@
</span><span class="cx"> ASSERT(step);
</span><span class="cx">
</span><span class="cx"> NSUndoManager *undoManager = [m_webView undoManager];
</span><ins>+#if PLATFORM(IOS)
+ // While we are undoing, we shouldn't be asked to register another Undo operation, we shouldn't even be touching the DOM. But
+ // just in case this happens, return to avoid putting the undo manager into an inconsistent state. Same for being
+ // asked to register a Redo operation in the midst of another Redo.
+ if (([undoManager isUndoing] && !isRedo) || ([undoManager isRedoing] && isRedo))
+ return;
+#endif
</ins><span class="cx"> NSString *actionName = undoNameForEditAction(step->editingAction());
</span><span class="cx"> WebUndoStep *webEntry = [WebUndoStep stepWithUndoStep:step];
</span><span class="cx"> [undoManager registerUndoWithTarget:m_undoTarget.get() selector:(isRedo ? @selector(redoEditing:) : @selector(undoEditing:)) object:webEntry];
</span><span class="lines">@@ -603,17 +680,27 @@
</span><span class="cx"> void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
</span><span class="cx"> {
</span><span class="cx"> Frame* frame = event->target()->toNode()->document().frame();
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
</span><span class="cx"> if ([webHTMLView _interpretKeyEvent:event savingCommands:NO])
</span><span class="cx"> event->setDefaultHandled();
</span><ins>+#else
+ WebHTMLView *webHTMLView = (WebHTMLView *)[[kit(frame) frameView] documentView];
+ if ([webHTMLView _handleEditingKeyEvent:event])
+ event->setDefaultHandled();
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> Frame* frame = event->target()->toNode()->document().frame();
</span><span class="cx"> WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
</span><span class="cx"> if ([webHTMLView _interpretKeyEvent:event savingCommands:YES])
</span><span class="cx"> event->setDefaultHandled();
</span><ins>+#else
+ // iOS does not use input manager this way
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #define FormDelegateLog(ctrl) LOG(FormDelegate, "control=%@", ctrl)
</span><span class="lines">@@ -643,8 +730,10 @@
</span><span class="cx"> if (!isHTMLInputElement(element))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element)
</span><span class="cx"> return;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
</span><span class="cx"> FormDelegateLog(inputElement);
</span><span class="lines">@@ -707,6 +796,103 @@
</span><span class="cx"> CallFormDelegate(m_webView, @selector(textDidChangeInTextArea:inFrame:), textAreaElement, kit(element->document().frame()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebEditorClient::suppressSelectionNotifications()
+{
+ m_selectionNotificationSuppressions++;
+}
+
+void WebEditorClient::restoreSelectionNotifications()
+{
+ --m_selectionNotificationSuppressions;
+ if (m_selectionNotificationSuppressions < 0)
+ m_selectionNotificationSuppressions = 0;
+}
+
+void WebEditorClient::writeDataToPasteboard(NSDictionary* representation)
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(writeDataToPasteboard:)])
+ [[m_webView _UIKitDelegateForwarder] writeDataToPasteboard:representation];
+}
+
+NSArray* WebEditorClient::supportedPasteboardTypesForCurrentSelection()
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(supportedPasteboardTypesForCurrentSelection)])
+ return [[m_webView _UIKitDelegateForwarder] supportedPasteboardTypesForCurrentSelection];
+
+ return nil;
+}
+
+NSArray* WebEditorClient::readDataFromPasteboard(NSString* type, int index)
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(readDataFromPasteboard:withIndex:)])
+ return [[m_webView _UIKitDelegateForwarder] readDataFromPasteboard:type withIndex:index];
+
+ return nil;
+}
+
+bool WebEditorClient::hasRichlyEditableSelection()
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(hasRichlyEditableSelection)])
+ return [[m_webView _UIKitDelegateForwarder] hasRichlyEditableSelection];
+
+ return false;
+}
+
+int WebEditorClient::getPasteboardItemsCount()
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(getPasteboardItemsCount)])
+ return [[m_webView _UIKitDelegateForwarder] getPasteboardItemsCount];
+
+ return 0;
+}
+
+WebCore::DocumentFragment* WebEditorClient::documentFragmentFromDelegate(int index)
+{
+ if ([[m_webView _editingDelegateForwarder] respondsToSelector:@selector(documentFragmentForPasteboardItemAtIndex:)]) {
+ DOMDocumentFragment *fragmentFromDelegate = [[m_webView _editingDelegateForwarder] documentFragmentForPasteboardItemAtIndex:index];
+ if (fragmentFromDelegate)
+ return core(fragmentFromDelegate);
+ }
+
+ return 0;
+}
+
+bool WebEditorClient::performsTwoStepPaste(WebCore::DocumentFragment* fragment)
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(performsTwoStepPaste:)])
+ return [[m_webView _UIKitDelegateForwarder] performsTwoStepPaste:kit(fragment)];
+
+ return false;
+}
+
+int WebEditorClient::pasteboardChangeCount()
+{
+ if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(getPasteboardChangeCount)])
+ return [[m_webView _UIKitDelegateForwarder] getPasteboardChangeCount];
+
+ return 0;
+}
+
+void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
+{
+ ASSERT(checkingTypes & NSTextCheckingTypeSpelling);
+ NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO];
+ NSArray *incomingResults = [[m_webView _UIKitDelegateForwarder] checkSpellingOfString:textString];
+ [textString release];
+ for (NSValue *incomingResult in incomingResults) {
+ NSRange resultRange = [incomingResult rangeValue];
+ ASSERT(resultRange.location != NSNotFound && resultRange.length > 0);
+ TextCheckingResult result;
+ result.type = TextCheckingTypeSpelling;
+ result.location = resultRange.location;
+ result.length = resultRange.length;
+ results.append(result);
+ }
+}
+#endif // PLATFORM(IOS)
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const
</span><span class="cx"> {
</span><span class="cx"> // This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions.
</span><span class="lines">@@ -916,6 +1102,7 @@
</span><span class="cx"> guesses.append(string);
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> void WebEditorClient::willSetInputMethodState()
</span><span class="cx"> {
</span><span class="lines">@@ -925,6 +1112,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface WebEditorSpellCheckResponder : NSObject
</span><span class="cx"> {
</span><span class="cx"> WebEditorClient* _client;
</span><span class="lines">@@ -960,9 +1148,11 @@
</span><span class="cx"> m_textCheckingRequest->didSucceed(core(results, m_textCheckingRequest->data().mask()));
</span><span class="cx"> m_textCheckingRequest.clear();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!m_textCheckingRequest);
</span><span class="cx"> m_textCheckingRequest = request;
</span><span class="cx">
</span><span class="lines">@@ -975,4 +1165,5 @@
</span><span class="cx"> target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease]
</span><span class="cx"> argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
</span><span class="cx"> }];
</span><ins>+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -63,6 +63,9 @@
</span><span class="cx"> virtual void makeRepresentation(WebCore::DocumentLoader*) OVERRIDE;
</span><span class="cx"> virtual bool hasHTMLView() const OVERRIDE;
</span><span class="cx"> virtual void forceLayout() OVERRIDE;
</span><ins>+#if PLATFORM(IOS)
+ virtual void forceLayoutWithoutRecalculatingStyles() OVERRIDE;
+#endif
</ins><span class="cx"> virtual void forceLayoutForNonHTML() OVERRIDE;
</span><span class="cx">
</span><span class="cx"> virtual void setCopiesOnScroll() OVERRIDE;
</span><span class="lines">@@ -81,6 +84,11 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&) OVERRIDE;
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+ virtual RetainPtr<CFDictionaryRef> connectionProperties(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
+#endif
+
</ins><span class="cx"> virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) OVERRIDE;
</span><span class="cx"> virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) OVERRIDE;
</span><span class="cx"> virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
</span><span class="lines">@@ -126,11 +134,17 @@
</span><span class="cx"> virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) OVERRIDE;
</span><span class="cx"> virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) OVERRIDE;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> virtual void willChangeEstimatedProgress() OVERRIDE;
</span><span class="cx"> virtual void didChangeEstimatedProgress() OVERRIDE;
</span><ins>+#endif
</ins><span class="cx"> virtual void postProgressStartedNotification() OVERRIDE;
</span><span class="cx"> virtual void postProgressEstimateChangedNotification() OVERRIDE;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> virtual void postProgressFinishedNotification() OVERRIDE;
</span><ins>+#else
+ virtual void postProgressFinishedNotification() OVERRIDE { }
+#endif
</ins><span class="cx">
</span><span class="cx"> virtual void setMainFrameDocumentReady(bool) OVERRIDE;
</span><span class="cx">
</span><span class="lines">@@ -167,6 +181,9 @@
</span><span class="cx">
</span><span class="cx"> virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*) OVERRIDE;
</span><span class="cx"> virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) OVERRIDE;
</span><ins>+#if PLATFORM(IOS)
+ virtual void didRestoreFrameHierarchyForCachedFrame() OVERRIDE;
+#endif
</ins><span class="cx"> virtual void transitionToCommittedForNewPage() OVERRIDE;
</span><span class="cx">
</span><span class="cx"> virtual void didSaveToPageCache() OVERRIDE;
</span><span class="lines">@@ -216,6 +233,10 @@
</span><span class="cx">
</span><span class="cx"> virtual void registerForIconNotification(bool listen) OVERRIDE;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ virtual bool shouldLoadMediaElementURL(const WebCore::URL&) const OVERRIDE;
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> virtual RemoteAXObjectRef accessibilityRemoteObject() OVERRIDE { return 0; }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -138,9 +138,27 @@
</span><span class="cx"> #import "WebHostedNetscapePluginView.h"
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/HTMLPlugInImageElement.h>
+#import <WebCore/WAKClipView.h>
+#import <WebCore/WAKScrollView.h>
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WebCoreThreadMessage.h>
+#import "WebKitVersionChecks.h"
+#import "WebMailDelegate.h"
+#import "WebUIKitDelegate.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WebHTMLView (Init)
+- (id)initWithFrame:(CGRect)frame;
+@end
+#endif
+
</ins><span class="cx"> // For backwards compatibility with older WebKit plug-ins.
</span><span class="cx"> NSString *WebPluginBaseURLKey = @"WebPluginBaseURL";
</span><span class="cx"> NSString *WebPluginAttributesKey = @"WebPluginAttributes";
</span><span class="lines">@@ -161,6 +179,7 @@
</span><span class="cx"> return loader ? static_cast<WebDocumentLoaderMac*>(loader)->dataSource() : nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Quirk for the Apple Dictionary application.
</span><span class="cx"> //
</span><span class="cx"> // If a top level frame has a <script> element in its <head> for a script named MainPageJavaScript.js,
</span><span class="lines">@@ -193,14 +212,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static inline void applyAppleDictionaryApplicationQuirk(WebFrameLoaderClient* client, const ResourceRequest& request)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Use a one-time-initialized global variable so we can quickly determine there's nothing to do in
</span><span class="cx"> // all applications other than Apple Dictionary.
</span><span class="cx"> static bool isAppleDictionary = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Dictionary"];
</span><span class="cx"> if (isAppleDictionary)
</span><span class="cx"> applyAppleDictionaryApplicationQuirkNonInlinePart(client, request);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebFrameLoaderClient::WebFrameLoaderClient(WebFrame *webFrame)
</span><span class="lines">@@ -233,10 +255,43 @@
</span><span class="cx"> void WebFrameLoaderClient::forceLayout()
</span><span class="cx"> {
</span><span class="cx"> NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
</span><ins>+#if PLATFORM(IOS)
+ // This gets called to lay out a page restored from the page cache.
+ // To work around timing problems with UIKit, restore fixed
+ // layout settings here.
+ WebView* webView = getWebView(m_webFrame.get());
+ bool isMainFrame = [webView mainFrame] == m_webFrame.get();
+ Frame* coreFrame = core(m_webFrame.get());
+ if (isMainFrame && coreFrame->view()) {
+ IntSize newSize([webView _fixedLayoutSize]);
+ coreFrame->view()->setFixedLayoutSize(newSize);
+ coreFrame->view()->setUseFixedLayout(!newSize.isEmpty());
+ }
+#endif
</ins><span class="cx"> [view setNeedsLayout:YES];
</span><span class="cx"> [view layout];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebFrameLoaderClient::forceLayoutWithoutRecalculatingStyles()
+{
+ NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
+ // This gets called to lay out a page restored from the page cache.
+ // To work around timing problems with UIKit, restore fixed
+ // layout settings here.
+ WebView* webView = getWebView(m_webFrame.get());
+ bool isMainFrame = [webView mainFrame] == m_webFrame.get();
+ Frame* coreFrame = core(m_webFrame.get());
+ if (isMainFrame && coreFrame->view()) {
+ IntSize newSize([webView _fixedLayoutSize]);
+ coreFrame->view()->setFixedLayoutSize(newSize);
+ coreFrame->view()->setUseFixedLayout(!newSize.isEmpty());
+ }
+ [view setNeedsLayout:YES];
+ [view layout];
+}
+#endif
+
</ins><span class="cx"> void WebFrameLoaderClient::forceLayoutForNonHTML()
</span><span class="cx"> {
</span><span class="cx"> WebFrameView *thisView = m_webFrame->_private->webFrameView;
</span><span class="lines">@@ -261,7 +316,9 @@
</span><span class="cx"> {
</span><span class="cx"> //remove any NetScape plugins that are children of this frame because they are about to be detached
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [webView removePluginInstanceViewsFor:(m_webFrame.get())];
</span><ins>+#endif
</ins><span class="cx"> [m_webFrame->_private->webFrameView _setWebFrame:nil]; // needed for now to be compatible w/ old behavior
</span><span class="cx">
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="lines">@@ -315,6 +372,12 @@
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadDidLoadResourceFromMemoryCacheFunc) {
+ CallResourceLoadDelegateInWebThread(implementations->webThreadDidLoadResourceFromMemoryCacheFunc, webView, @selector(webThreadWebView:didLoadResourceFromMemoryCache:response:length:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), response.nsURLResponse(), length, dataSource(loader));
+ return true;
+ }
+#endif
</ins><span class="cx"> if (!implementations->didLoadResourceFromMemoryCacheFunc)
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -329,6 +392,11 @@
</span><span class="cx">
</span><span class="cx"> id object = nil;
</span><span class="cx"> BOOL shouldRelease = NO;
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadIdentifierForRequestFunc) {
+ object = CallResourceLoadDelegateInWebThread(implementations->webThreadIdentifierForRequestFunc, webView, @selector(webThreadWebView:identifierForInitialRequest:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), dataSource(loader));
+ } else
+#endif
</ins><span class="cx"> if (implementations->identifierForRequestFunc)
</span><span class="cx"> object = CallResourceLoadDelegate(implementations->identifierForRequestFunc, webView, @selector(webView:identifierForInitialRequest:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), dataSource(loader));
</span><span class="cx"> else {
</span><span class="lines">@@ -354,11 +422,20 @@
</span><span class="cx">
</span><span class="cx"> NSURLRequest *currentURLRequest = request.nsURLRequest(UpdateHTTPBody);
</span><span class="cx"> NSURLRequest *newURLRequest = currentURLRequest;
</span><ins>+#if PLATFORM(IOS)
+ bool isMainResourceRequest = request.isMainResourceRequest();
+ if (implementations->webThreadWillSendRequestFunc) {
+ newURLRequest = (NSURLRequest *)CallResourceLoadDelegateInWebThread(implementations->webThreadWillSendRequestFunc, webView, @selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
+ } else
+#endif
</ins><span class="cx"> if (implementations->willSendRequestFunc)
</span><span class="cx"> newURLRequest = (NSURLRequest *)CallResourceLoadDelegate(implementations->willSendRequestFunc, webView, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
</span><span class="cx">
</span><span class="cx"> if (newURLRequest != currentURLRequest)
</span><span class="cx"> request = newURLRequest;
</span><ins>+#if PLATFORM(IOS)
+ request.setMainResourceRequest(isMainResourceRequest);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, unsigned long identifier)
</span><span class="lines">@@ -388,8 +465,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSWindow *window = [webView hostWindow] ? [webView hostWindow] : [webView window];
</span><span class="cx"> [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:webChallenge window:window];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="lines">@@ -407,12 +486,28 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If our resource load delegate doesn't handle the question, then only send authentication
</span><del>- // challenges for pre-10.6 protection spaces. This is the same as the default implementation
</del><ins>+ // challenges for pre-iOS-3.0, pre-10.6 protection spaces. This is the same as the default implementation
</ins><span class="cx"> // in CFNetwork.
</span><span class="cx"> return (protectionSpace.authenticationScheme() < ProtectionSpaceAuthenticationSchemeClientCertificateRequested);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+RetainPtr<CFDictionaryRef> WebFrameLoaderClient::connectionProperties(DocumentLoader* loader, unsigned long identifier)
+{
+ WebView *webView = getWebView(m_webFrame.get());
+ id resource = [webView _objectForIdentifier:identifier];
+ if (!resource)
+ return nullptr;
+
+ WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
+ if (implementations->connectionPropertiesFunc)
+ return (CFDictionaryRef)CallResourceLoadDelegate(implementations->connectionPropertiesFunc, webView, @selector(webView:connectionPropertiesForResource:dataSource:), resource, dataSource(loader));
+
+ return nullptr;
+}
+#endif
+
</ins><span class="cx"> bool WebFrameLoaderClient::shouldPaintBrokenImage(const URL& imageURL) const
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="lines">@@ -438,13 +533,23 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [(WebPanelAuthenticationHandler *)[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:webChallenge];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response)
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><ins>+
+#if PLATFORM(IOS)
+ if (implementations->webThreadDidReceiveResponseFunc) {
+ if (id resource = [webView _objectForIdentifier:identifier])
+ CallResourceLoadDelegateInWebThread(implementations->webThreadDidReceiveResponseFunc, webView, @selector(webThreadWebView:resource:didReceiveResponse:fromDataSource:), resource, response.nsURLResponse(), dataSource(loader));
+
+ } else
+#endif
</ins><span class="cx"> if (implementations->didReceiveResponseFunc) {
</span><span class="cx"> if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx"> CallResourceLoadDelegate(implementations->didReceiveResponseFunc, webView, @selector(webView:resource:didReceiveResponse:fromDataSource:), resource, response.nsURLResponse(), dataSource(loader));
</span><span class="lines">@@ -456,6 +561,13 @@
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadWillCacheResponseFunc) {
+ if (id resource = [webView _objectForIdentifier:identifier])
+ return CallResourceLoadDelegateInWebThread(implementations->webThreadWillCacheResponseFunc, webView, @selector(webThreadWebView:resource:willCacheResponse:fromDataSource:), resource, response, dataSource(loader));
+
+ } else
+#endif
</ins><span class="cx"> if (implementations->willCacheResponseFunc) {
</span><span class="cx"> if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx"> return CallResourceLoadDelegate(implementations->willCacheResponseFunc, webView, @selector(webView:resource:willCacheResponse:fromDataSource:), resource, response, dataSource(loader));
</span><span class="lines">@@ -468,6 +580,12 @@
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadDidReceiveContentLengthFunc) {
+ if (id resource = [webView _objectForIdentifier:identifier])
+ CallResourceLoadDelegateInWebThread(implementations->webThreadDidReceiveContentLengthFunc, webView, @selector(webThreadWebView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader));
+ } else
+#endif
</ins><span class="cx"> if (implementations->didReceiveContentLengthFunc) {
</span><span class="cx"> if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx"> CallResourceLoadDelegate(implementations->didReceiveContentLengthFunc, webView, @selector(webView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader));
</span><span class="lines">@@ -479,6 +597,13 @@
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadDidFinishLoadingFromDataSourceFunc) {
+ if (id resource = [webView _objectForIdentifier:identifier])
+ CallResourceLoadDelegateInWebThread(implementations->webThreadDidFinishLoadingFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFinishLoadingFromDataSource:), resource, dataSource(loader));
+ } else
+#endif
+
</ins><span class="cx"> if (implementations->didFinishLoadingFromDataSourceFunc) {
</span><span class="cx"> if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx"> CallResourceLoadDelegate(implementations->didFinishLoadingFromDataSourceFunc, webView, @selector(webView:resource:didFinishLoadingFromDataSource:), resource, dataSource(loader));
</span><span class="lines">@@ -494,6 +619,12 @@
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadDidFailLoadingWithErrorFromDataSourceFunc) {
+ if (id resource = [webView _objectForIdentifier:identifier])
+ CallResourceLoadDelegateInWebThread(implementations->webThreadDidFailLoadingWithErrorFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFailLoadingWithError:fromDataSource:), resource, (NSError *)error, dataSource(loader));
+ } else
+#endif
</ins><span class="cx"> if (implementations->didFailLoadingWithErrorFromDataSourceFunc) {
</span><span class="cx"> if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx"> CallResourceLoadDelegate(implementations->didFailLoadingWithErrorFromDataSourceFunc, webView, @selector(webView:resource:didFailLoadingWithError:fromDataSource:), resource, (NSError *)error, dataSource(loader));
</span><span class="lines">@@ -548,6 +679,9 @@
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didChangeLocationWithinPageForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didChangeLocationWithinPageForFrameFunc, webView, @selector(webView:didChangeLocationWithinPageForFrame:), m_webFrame.get());
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView didChangeLocationWithinPageForFrame:m_webFrame.get()];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
</span><span class="lines">@@ -586,6 +720,9 @@
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->willCloseFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->willCloseFrameFunc, webView, @selector(webView:willCloseFrame:), m_webFrame.get());
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView willCloseFrame:m_webFrame.get()];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::dispatchDidReceiveIcon()
</span><span class="lines">@@ -603,8 +740,14 @@
</span><span class="cx"> m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader().provisionalDocumentLoader()->url().string();
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [webView _didStartProvisionalLoadForFrame:m_webFrame.get()];
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView didStartProvisionalLoadForFrame:m_webFrame.get()];
+#endif
+
</ins><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didStartProvisionalLoadForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didStartProvisionalLoadForFrameFunc, webView, @selector(webView:didStartProvisionalLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -635,6 +778,10 @@
</span><span class="cx"> m_webFrame->_private->url = m_webFrame->_private->provisionalURL;
</span><span class="cx"> m_webFrame->_private->provisionalURL = nullptr;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView didCommitLoadForFrame:m_webFrame.get()];
+#endif
+
</ins><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didCommitLoadForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didCommitLoadForFrameFunc, webView, @selector(webView:didCommitLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -645,7 +792,9 @@
</span><span class="cx"> m_webFrame->_private->provisionalURL = nullptr;
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [webView _didFailProvisionalLoadWithError:error forFrame:m_webFrame.get()];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didFailProvisionalLoadWithErrorForFrameFunc)
</span><span class="lines">@@ -659,11 +808,16 @@
</span><span class="cx"> ASSERT(!m_webFrame->_private->provisionalURL);
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [webView _didFailLoadWithError:error forFrame:m_webFrame.get()];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didFailLoadWithErrorForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didFailLoadWithErrorForFrameFunc, webView, @selector(webView:didFailLoadWithError:forFrame:), (NSError *)error, m_webFrame.get());
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView didFailLoadWithError:((NSError *)error) forFrame:m_webFrame.get()];
+#endif
</ins><span class="cx">
</span><span class="cx"> [m_webFrame->_private->internalLoadDelegate webFrame:m_webFrame.get() didFinishLoadWithError:error];
</span><span class="cx"> }
</span><span class="lines">@@ -671,6 +825,14 @@
</span><span class="cx"> void WebFrameLoaderClient::dispatchDidFinishDocumentLoad()
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+
+#if PLATFORM(IOS)
+ id webThreadDel = [webView _webMailDelegate];
+ if ([webThreadDel respondsToSelector:@selector(_webthread_webView:didFinishDocumentLoadForFrame:)]) {
+ [webThreadDel _webthread_webView:webView didFinishDocumentLoadForFrame:m_webFrame.get()];
+ }
+#endif
+
</ins><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didFinishDocumentLoadForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didFinishDocumentLoadForFrameFunc, webView, @selector(webView:didFinishDocumentLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -681,8 +843,17 @@
</span><span class="cx"> ASSERT(!m_webFrame->_private->provisionalURL);
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [webView _didFinishLoadForFrame:m_webFrame.get()];
</span><ins>+#else
+ [[webView _UIKitDelegateForwarder] webView:webView didFinishLoadForFrame:m_webFrame.get()];
</ins><span class="cx">
</span><ins>+ id webThreadDel = [webView _webMailDelegate];
+ if ([webThreadDel respondsToSelector:@selector(_webthread_webView:didFinishLoadForFrame:)]) {
+ [webThreadDel _webthread_webView:webView didFinishLoadForFrame:m_webFrame.get()];
+ }
+#endif
+
</ins><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx"> if (implementations->didFinishLoadForFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didFinishLoadForFrameFunc, webView, @selector(webView:didFinishLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -695,8 +866,13 @@
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (implementations->webThreadDidLayoutFunc)
+ CallFrameLoadDelegateInWebThread(implementations->webThreadDidLayoutFunc, webView, @selector(webThreadWebView:didLayout:), kitLayoutMilestones(milestones));
+#else
</ins><span class="cx"> if (implementations->didLayoutFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didLayoutFunc, webView, @selector(webView:didLayout:), kitLayoutMilestones(milestones));
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (milestones & DidFirstLayout) {
</span><span class="cx"> // FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the
</span><span class="lines">@@ -704,12 +880,18 @@
</span><span class="cx"> if (implementations->didFirstLayoutInFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get());
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [[webView _UIKitDelegateForwarder] webView:webView didFirstLayoutInFrame:m_webFrame.get()];
+#endif
+
</ins><span class="cx"> // See WebFrameLoaderClient::provisionalLoadStarted.
</span><span class="cx"> WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
</span><span class="cx"> if ([getWebView(m_webFrame.get()) drawsBackground])
</span><span class="cx"> [scrollView setDrawsBackground:YES];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic];
</span><span class="cx"> [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (milestones & DidFirstVisuallyNonEmptyLayout) {
</span><span class="lines">@@ -717,6 +899,10 @@
</span><span class="cx"> // double duty with the new didLayout API.
</span><span class="cx"> if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc)
</span><span class="cx"> CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get());
</span><ins>+#if PLATFORM(IOS)
+ if ([webView mainFrame] == m_webFrame.get())
+ [[webView _UIKitDelegateForwarder] webView:webView didFirstVisuallyNonEmptyLayoutInFrame:m_webFrame.get()];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -830,6 +1016,7 @@
</span><span class="cx"> [dataSource(loader) _setMainDocumentError:error];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> void WebFrameLoaderClient::willChangeEstimatedProgress()
</span><span class="cx"> {
</span><span class="cx"> [getWebView(m_webFrame.get()) _willChangeValueForKey:_WebEstimatedProgressKey];
</span><span class="lines">@@ -839,21 +1026,44 @@
</span><span class="cx"> {
</span><span class="cx"> [getWebView(m_webFrame.get()) _didChangeValueForKey:_WebEstimatedProgressKey];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::postProgressStartedNotification()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressStartedNotification object:getWebView(m_webFrame.get())];
</span><ins>+#else
+ WebThreadPostNotification(WebViewProgressStartedNotification, getWebView(m_webFrame.get()), nil);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::postProgressEstimateChangedNotification()
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressEstimateChangedNotification object:getWebView(m_webFrame.get())];
</span><ins>+#else
+ WebView *webView = getWebView(m_webFrame.get());
+ NSNumber *progress = [NSNumber numberWithFloat:[webView estimatedProgress]];
+ CGColorRef bodyBackgroundColor = [[webView mainFrame] _bodyBackgroundColor];
+
+ // Use a CFDictionary so we can add the CGColorRef without compile errors. And then thanks to
+ // toll-free bridging we can pass the CFDictionary as an NSDictionary to postNotification.
+ CFMutableDictionaryRef userInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionaryAddValue(userInfo, WebViewProgressEstimatedProgressKey, progress);
+ if (bodyBackgroundColor)
+ CFDictionaryAddValue(userInfo, WebViewProgressBackgroundColorKey, bodyBackgroundColor);
+
+ WebThreadPostNotification(WebViewProgressEstimateChangedNotification, webView, (NSDictionary *) userInfo);
+ CFRelease(userInfo);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> void WebFrameLoaderClient::postProgressFinishedNotification()
</span><span class="cx"> {
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressFinishedNotification object:getWebView(m_webFrame.get())];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready)
</span><span class="cx"> {
</span><span class="lines">@@ -868,14 +1078,18 @@
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::willChangeTitle(DocumentLoader* loader)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Should do this only in main frame case, right?
</span><span class="cx"> [getWebView(m_webFrame.get()) _willChangeValueForKey:_WebMainFrameTitleKey];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::didChangeTitle(DocumentLoader* loader)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Should do this only in main frame case, right?
</span><span class="cx"> [getWebView(m_webFrame.get()) _didChangeValueForKey:_WebMainFrameTitleKey];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
</span><span class="lines">@@ -901,6 +1115,10 @@
</span><span class="cx"> {
</span><span class="cx"> WebView* view = getWebView(m_webFrame.get());
</span><span class="cx"> DocumentLoader* loader = core(m_webFrame.get())->loader().documentLoader();
</span><ins>+#if PLATFORM(IOS)
+ if (loader->urlForHistory() == blankURL())
+ return;
+#endif
</ins><span class="cx">
</span><span class="cx"> if ([view historyDelegate]) {
</span><span class="cx"> WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
</span><span class="lines">@@ -1096,6 +1314,16 @@
</span><span class="cx"> {
</span><span class="cx"> if (!item)
</span><span class="cx"> return;
</span><ins>+
+#if PLATFORM(IOS)
+ // Let UIKit handle the scroll point for the main frame.
+ WebFrame *webFrame = m_webFrame.get();
+ WebView *webView = getWebView(webFrame);
+ if (webFrame == [webView mainFrame]) {
+ [[webView _UIKitDelegateForwarder] webView:webView saveStateToHistoryItem:kit(item) forFrame:webFrame];
+ return;
+ }
+#endif
</ins><span class="cx">
</span><span class="cx"> NSView <WebDocumentView> *docView = [m_webFrame->_private->webFrameView documentView];
</span><span class="cx">
</span><span class="lines">@@ -1117,6 +1345,16 @@
</span><span class="cx"> // so there *is* no scroll state to restore!
</span><span class="cx"> if (!currentItem)
</span><span class="cx"> return;
</span><ins>+
+#if PLATFORM(IOS)
+ // Let UIKit handle the scroll point for the main frame.
+ WebFrame *webFrame = m_webFrame.get();
+ WebView *webView = getWebView(webFrame);
+ if (webFrame == [webView mainFrame]) {
+ [[webView _UIKitDelegateForwarder] webView:webView restoreStateFromHistoryItem:kit(currentItem) forFrame:webFrame force:NO];
+ return;
+ }
+#endif
</ins><span class="cx">
</span><span class="cx"> NSView <WebDocumentView> *docView = [m_webFrame->_private->webFrameView documentView];
</span><span class="cx"> if ([docView conformsToProtocol:@protocol(_WebDocumentViewState)]) {
</span><span class="lines">@@ -1140,8 +1378,10 @@
</span><span class="cx">
</span><span class="cx"> WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
</span><span class="cx"> [scrollView setDrawsBackground:NO];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [scrollView setVerticalScrollElasticity:NSScrollElasticityNone];
</span><span class="cx"> [scrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::didFinishLoad()
</span><span class="lines">@@ -1156,6 +1396,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Make sure that any work that is triggered by resigning first reponder can get done.
</span><span class="cx"> // The main example where this came up is the textDidEndEditing that is sent to the
</span><span class="cx"> // FormsDelegate (3223413). We need to do this before _detachChildren, since that will
</span><span class="lines">@@ -1173,6 +1414,7 @@
</span><span class="cx"> NSResponder *firstResp = [window firstResponder];
</span><span class="cx"> if ([firstResp isKindOfClass:[NSView class]] && [(NSView *)firstResp isDescendantOf:frameView])
</span><span class="cx"> [window endEditingFor:firstResp];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
</span><span class="lines">@@ -1205,6 +1447,10 @@
</span><span class="cx"> nsURL = [nsURL _webkit_canonicalize];
</span><span class="cx"> if(!nsURL)
</span><span class="cx"> return;
</span><ins>+#if PLATFORM(IOS)
+ if ([[nsURL absoluteString] isEqualToString:@"about:blank"])
+ return;
+#endif
</ins><span class="cx"> NSString *titleNSString = title.string();
</span><span class="cx">
</span><span class="cx"> [[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
</span><span class="lines">@@ -1214,6 +1460,12 @@
</span><span class="cx"> {
</span><span class="cx"> OwnPtr<WebCachedFramePlatformData> webPlatformData = adoptPtr(new WebCachedFramePlatformData([m_webFrame->_private->webFrameView documentView]));
</span><span class="cx"> cachedFrame->setCachedFramePlatformData(webPlatformData.release());
</span><ins>+
+#if PLATFORM(IOS)
+ // At this point we know this frame is going to be cached. Stop all plugins.
+ WebView *webView = getWebView(m_webFrame.get());
+ [webView _stopAllPlugInsForPageCache];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cachedFrame)
</span><span class="lines">@@ -1224,25 +1476,49 @@
</span><span class="cx"> ASSERT(cachedFrame->documentLoader());
</span><span class="cx"> [cachedView setDataSource:dataSource(cachedFrame->documentLoader())];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // clean up webkit plugin instances before WebHTMLView gets freed.
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> [webView removePluginInstanceViewsFor:(m_webFrame.get())];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [m_webFrame->_private->webFrameView _setDocumentView:cachedView];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebFrameLoaderClient::didRestoreFrameHierarchyForCachedFrame()
+{
+ // When entering the PageCache the Document is detached and the plugin view may
+ // have cleaned itself up (removing its webview and layer references). Now, when
+ // restoring the page we want to recreate whatever is necessary.
+ WebView *webView = getWebView(m_webFrame.get());
+ [webView _restorePlugInsFromCache];
+}
+#endif
+
</ins><span class="cx"> void WebFrameLoaderClient::transitionToCommittedForNewPage()
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> WebDataSource *dataSource = [m_webFrame.get() _dataSource];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ bool willProduceHTMLView;
+ // Fast path that skips initialization of objc class objects.
+ if ([dataSource _documentLoader]->responseMIMEType() == "text/html")
+ willProduceHTMLView = true;
+ else
+ willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
+#else
+ // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
</ins><span class="cx"> bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
</span><ins>+#endif
</ins><span class="cx"> bool canSkipCreation = core(m_webFrame.get())->loader().stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
</span><span class="cx"> if (canSkipCreation) {
</span><span class="cx"> [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
</span><span class="cx"> if (!willProduceHTMLView)
</span><span class="cx"> [[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
</span><span class="lines">@@ -1251,6 +1527,17 @@
</span><span class="cx"> [webView removePluginInstanceViewsFor:(m_webFrame.get())];
</span><span class="cx">
</span><span class="cx"> NSView <WebDocumentView> *documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
</span><ins>+#else
+ NSView <WebDocumentView> *documentView = nil;
+
+ // Fast path that skips initialization of objc class objects.
+ if (willProduceHTMLView) {
+ documentView = [[WebHTMLView alloc] initWithFrame:[m_webFrame->_private->webFrameView bounds]];
+ [m_webFrame->_private->webFrameView _setDocumentView:documentView];
+ [documentView release];
+ } else
+ documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
+#endif
</ins><span class="cx"> if (!documentView)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -1269,8 +1556,12 @@
</span><span class="cx"> [m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen];
</span><span class="cx"> [m_webFrame->_private->webFrameView _install];
</span><span class="cx">
</span><del>- if (isMainFrame)
</del><ins>+ if (isMainFrame) {
+#if PLATFORM(IOS)
+ coreView->setDelegatesScrolling(true);
+#endif
</ins><span class="cx"> coreView->setParentVisible(true);
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // Call setDataSource on the document view after it has been placed in the view hierarchy.
</span><span class="cx"> // This what we for the top-level view, so should do this for views in subframes as well.
</span><span class="lines">@@ -1298,6 +1589,11 @@
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::didRestoreFromPageCache()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebView *webView = getWebView(m_webFrame.get());
+ if ([webView mainFrame] == m_webFrame.get())
+ [[webView _UIKitDelegateForwarder] webViewDidRestoreFromPageCache:webView];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool)
</span><span class="lines">@@ -1341,6 +1637,7 @@
</span><span class="cx"> {
</span><span class="cx"> unsigned modifierFlags = 0;
</span><span class="cx"> const Event* event = action.event();
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(event))) {
</span><span class="cx"> if (keyStateEvent->ctrlKey())
</span><span class="cx"> modifierFlags |= NSControlKeyMask;
</span><span class="lines">@@ -1351,6 +1648,10 @@
</span><span class="cx"> if (keyStateEvent->metaKey())
</span><span class="cx"> modifierFlags |= NSCommandKeyMask;
</span><span class="cx"> }
</span><ins>+#else
+ // No modifier flags on iOS right now
+ modifierFlags = 0;
+#endif
</ins><span class="cx">
</span><span class="cx"> NSURL *originalURL = action.url();
</span><span class="cx">
</span><span class="lines">@@ -1555,6 +1856,53 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WAKView (UIKitSecretsWebKitKnowsAboutSeeUIWebPlugInView)
+#if USE(ACCELERATED_COMPOSITING)
+- (PlatformLayer *)pluginLayer;
+- (BOOL)willProvidePluginLayer;
+- (void)attachPluginLayer;
+- (void)detachPluginLayer;
+#endif
+@end
+
+class PluginWidgetIOS : public PluginWidget {
+public:
+ PluginWidgetIOS(WAKView *view)
+ : PluginWidget(view)
+ {
+ }
+
+#if USE(ACCELERATED_COMPOSITING)
+ virtual PlatformLayer* platformLayer() const
+ {
+ if (![platformWidget() respondsToSelector:@selector(pluginLayer)])
+ return nullptr;
+
+ return [platformWidget() pluginLayer];
+ }
+
+ virtual bool willProvidePluginLayer() const
+ {
+ return [platformWidget() respondsToSelector:@selector(willProvidePluginLayer)]
+ && [platformWidget() willProvidePluginLayer];
+ }
+
+ virtual void attachPluginLayer()
+ {
+ if ([platformWidget() respondsToSelector:@selector(attachPluginLayer)])
+ [platformWidget() attachPluginLayer];
+ }
+
+ virtual void detachPluginLayer()
+ {
+ if ([platformWidget() respondsToSelector:@selector(detachPluginLayer)])
+ [platformWidget() detachPluginLayer];
+ }
+#endif
+};
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">
</span><span class="cx"> class NetscapePluginWidget : public PluginWidget {
</span><span class="lines">@@ -1645,7 +1993,9 @@
</span><span class="cx"> int errorCode = 0;
</span><span class="cx">
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> SEL selector = @selector(webView:plugInViewWithArguments:);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> Document* document = core(m_webFrame.get())->document();
</span><span class="cx"> NSURL *baseURL = document->baseURL();
</span><span class="lines">@@ -1656,8 +2006,11 @@
</span><span class="cx"> // embeds its plug-in. This site-specific hack works around the issue by
</span><span class="cx"> // converting the parameter names to lowercase before passing them to the
</span><span class="cx"> // plug-in.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> Frame* frame = core(m_webFrame.get());
</span><ins>+#endif
</ins><span class="cx"> NSMutableArray *attributeKeys = kit(paramNames);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (frame && frame->settings().needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) {
</span><span class="cx"> for (NSUInteger i = 0; i < [attributeKeys count]; ++i)
</span><span class="cx"> [attributeKeys replaceObjectAtIndex:i withObject:[[attributeKeys objectAtIndex:i] lowercaseString]];
</span><span class="lines">@@ -1682,6 +2035,7 @@
</span><span class="cx"> if (view)
</span><span class="cx"> return adoptRef(new PluginWidget(view));
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSString *MIMEType;
</span><span class="cx"> WebBasePluginPackage *pluginPackage;
</span><span class="lines">@@ -1694,7 +2048,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NSString *extension = [[pluginURL path] pathExtension];
</span><ins>+
+#if PLATFORM(IOS)
+ if (!pluginPackage && [extension length]) {
+#else
</ins><span class="cx"> if (!pluginPackage && [extension length] && ![MIMEType length]) {
</span><ins>+#endif
</ins><span class="cx"> pluginPackage = [webView _pluginForExtension:extension];
</span><span class="cx"> if (pluginPackage) {
</span><span class="cx"> NSString *newMIMEType = [pluginPackage MIMETypeForExtension:extension];
</span><span class="lines">@@ -1752,11 +2111,75 @@
</span><span class="cx"> [error release];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // See if this is a YouTube Flash plug-in
+ if ([MIMEType isEqualToString:@"application/x-shockwave-flash"]) {
+ NSDictionary *attributes = [NSDictionary dictionaryWithObjects:kit(paramValues) forKeys:kit(paramNames)];
+ NSString *srcString = [attributes objectForKey:@"src"];
+ if (srcString) {
+ NSURL *srcURL = [NSURL URLWithString:srcString];
+ NSURL *youtubeURL = [srcURL _webkit_youTubeURL];
+ if (srcURL && youtubeURL) {
+ // Transform the youtubeURL (youtube:VideoID) to iframe embed url which has the format: http://www.youtube.com/embed/VideoID
+ NSString *srcPath = [srcURL path];
+ NSString *videoID = [[youtubeURL absoluteString] substringFromIndex:[[youtubeURL scheme] length] + 1];
+ NSRange rangeOfVideoIDInPath = [srcPath rangeOfString:videoID];
+ NSString *srcURLPrefix = nil;
+ if (rangeOfVideoIDInPath.location == NSNotFound && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_YOUTUBE_EMBED_IFRAME_TRANSFORM)) {
+ // If the videoID is not inside srcPath, the embed src url is in wrong format. We still want to support them for apps build against 5.1 and older.
+ // For embed src like http://www.youtube.com/watch?v=VideoID, we make srcURLPrefix "http://www.youtube.com".
+ // See: <rdar://problem/11517502> youtube videos don't work in FAO Forestry
+ srcURLPrefix = [srcString substringToIndex:[srcString rangeOfString:srcPath].location];
+ } else {
+ ASSERT(rangeOfVideoIDInPath.length);
+
+ // From the original URL, we need to get the part before /path/VideoId.
+ NSRange rangeOfPathBeforeVideoID = [srcString rangeOfString:[srcPath substringToIndex:rangeOfVideoIDInPath.location]];
+ ASSERT(rangeOfPathBeforeVideoID.length);
+
+ srcURLPrefix = [srcString substringToIndex:rangeOfPathBeforeVideoID.location];
+ }
+ NSString *query = [srcURL query];
+ // By default, the iframe will display information like the video title and uploader on top of the video. Don't display
+ // them if the embeding html doesn't specify it.
+ if (query && [query length] && [query rangeOfString:@"showinfo"].location == NSNotFound)
+ query = [query stringByAppendingFormat:@"&showinfo=0"];
+ else
+ query = @"showinfo=0";
+
+ // Append the query string if it is valid. Some sites apparently forget to add "?" for the query string, in that case,
+ // we will discard the parameters in the url.
+ // See: <rdar://problem/11535155> [Bincompat] Regression: SC2Casts app: Videos don't play in SC2Casts
+ NSString *embedSrc = query ? [srcURLPrefix stringByAppendingFormat:@"/embed/%@?%@", videoID, query] : [srcURLPrefix stringByAppendingFormat:@"/embed/%@", videoID];
+
+ if (element->hasTagName(HTMLNames::embedTag) || element->hasTagName(HTMLNames::objectTag)) {
+ // Create a shadow subtree for the plugin element, the iframe player is injected in the shadow tree.
+ HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);
+ pluginElement->createShadowIFrameSubtree(embedSrc);
+ return nullptr;
+ }
+
+ // If this is a YouTube Flash plug-in. We don't have Flash. Create an instance of Apple's special YouTube plug-in instead
+ pluginPackage = [webView _pluginForMIMEType:@"application/x-apple-fake-youtube-plugin"];
+ if (pluginPackage) {
+ view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), loadManually);
+ if (view)
+ return adoptRef(new PluginWidgetIOS(view));
+ }
+ }
+ }
+ }
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(view);
</span><ins>+#if PLATFORM(IOS)
+ return adoptRef(new PluginWidgetIOS(view));
+#else
</ins><span class="cx"> return adoptRef(new PluginWidget(view));
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">
</span><span class="lines">@@ -1861,6 +2284,7 @@
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><span class="cx"> NSURL *URL = url;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> SEL selector = @selector(webView:plugInViewWithArguments:);
</span><span class="cx">
</span><span class="cx"> if ([[webView UIDelegate] respondsToSelector:selector]) {
</span><span class="lines">@@ -1881,6 +2305,7 @@
</span><span class="cx"> if (view)
</span><span class="cx"> return adoptRef(new PluginWidget(view));
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebBasePluginPackage *pluginPackage = [webView _videoProxyPluginForMIMEType:mimeType];
</span><span class="cx"> Document* document = core(m_webFrame.get())->document();
</span><span class="lines">@@ -1906,7 +2331,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(view);
</span><ins>+#if PLATFORM(IOS)
+ return adoptRef(new PluginWidgetIOS(view));
+#else
</ins><span class="cx"> return adoptRef(new PluginWidget(view));
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">
</span><span class="lines">@@ -1993,13 +2422,28 @@
</span><span class="cx"> return WebFrameNetworkingContext::create(core(m_webFrame.get()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+bool WebFrameLoaderClient::shouldLoadMediaElementURL(const URL& url) const
+{
+ WebView *webView = getWebView(m_webFrame.get());
+
+ if (id policyDelegate = [webView policyDelegate]) {
+ if ([policyDelegate respondsToSelector:@selector(webView:shouldLoadMediaURL:inFrame:)])
+ return [policyDelegate webView:webView shouldLoadMediaURL:url inFrame:m_webFrame.get()];
+ }
+ return true;
+}
+#endif
+
</ins><span class="cx"> @implementation WebFramePolicyListener
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameNetworkingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -38,6 +38,12 @@
</span><span class="cx"> static void ensurePrivateBrowsingSession();
</span><span class="cx"> static void destroyPrivateBrowsingSession();
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: If MobileSafari ever switches to per-tab or non-shared private storage, then this can be removed.
+ // <rdar://problem/10075665> Sub-TLF: Per-tab private browsing
+ static void clearPrivateBrowsingSessionCookieStorage();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">
</span><span class="cx"> WebFrameNetworkingContext(WebCore::Frame* frame)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameNetworkingContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -34,6 +34,12 @@
</span><span class="cx"> #include <WebCore/Settings.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <CFNetwork/CFHTTPCookiesPriv.h>
+#import <WebCore/WebCoreThread.h>
+#import <WebKit/WebFrameLoadDelegate.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> static std::unique_ptr<NetworkStorageSession>& privateSession()
</span><span class="lines">@@ -59,6 +65,16 @@
</span><span class="cx"> privateSession() = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebFrameNetworkingContext::clearPrivateBrowsingSessionCookieStorage()
+{
+ ASSERT(isMainThread());
+ ASSERT(privateSession());
+
+ CFHTTPCookieStorageDeleteAllCookies(privateSession()->cookieStorage().get());
+}
+#endif
+
</ins><span class="cx"> bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
</span><span class="cx"> {
</span><span class="cx"> return frame() && frame()->settings().needsSiteSpecificQuirks();
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebGeolocationClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -40,7 +40,12 @@
</span><span class="cx"> virtual void geolocationDestroyed() OVERRIDE;
</span><span class="cx"> virtual void startUpdating() OVERRIDE;
</span><span class="cx"> virtual void stopUpdating() OVERRIDE;
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: unify this with Mac on OpenSource.
+ virtual void setEnableHighAccuracy(bool) OVERRIDE;
+#else
</ins><span class="cx"> virtual void setEnableHighAccuracy(bool) OVERRIDE { }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> virtual WebCore::GeolocationPosition* lastPosition() OVERRIDE;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebGeolocationClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -38,15 +38,40 @@
</span><span class="cx"> #import <WebCore/Frame.h>
</span><span class="cx"> #import <WebCore/Geolocation.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/WAKResponder.h>
+#import <WebKit/WebCoreThreadRun.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
</span><span class="cx"> {
</span><span class="cx"> RefPtr<Geolocation> _geolocation;
</span><span class="cx"> }
</span><span class="cx"> - (id)initWithGeolocation:(Geolocation*)geolocation;
</span><span class="cx"> @end
</span><ins>+#else
+@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
+{
+ RefPtr<Geolocation> _geolocation;
+ RetainPtr<WebView *> _webView;
+ RetainPtr<id<WebGeolocationProvider> > _geolocationProvider;
+}
+- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView provider:(id<WebGeolocationProvider>)provider;
+@end
+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WebGeolocationProviderInitializationListener : NSObject <WebGeolocationProviderInitializationListener> {
+@private
+ RefPtr<Geolocation> m_geolocation;
+}
+- (id)initWithGeolocation:(Geolocation*)geolocation;
+@end
+#endif
+
</ins><span class="cx"> WebGeolocationClient::WebGeolocationClient(WebView *webView)
</span><span class="cx"> : m_webView(webView)
</span><span class="cx"> {
</span><span class="lines">@@ -67,6 +92,15 @@
</span><span class="cx"> [[m_webView _geolocationProvider] unregisterWebView:m_webView];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+void WebGeolocationClient::setEnableHighAccuracy(bool wantsHighAccuracy)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [[m_webView _geolocationProvider] setEnableHighAccuracy:wantsHighAccuracy];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+#endif
+
</ins><span class="cx"> void WebGeolocationClient::requestPermission(Geolocation* geolocation)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="lines">@@ -77,6 +111,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> Frame *frame = geolocation->frame();
</span><span class="cx"> WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
</span><span class="cx"> WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation];
</span><span class="lines">@@ -85,7 +120,10 @@
</span><span class="cx">
</span><span class="cx"> [webOrigin release];
</span><span class="cx"> [listener release];
</span><del>-
</del><ins>+#else
+ RetainPtr<WebGeolocationProviderInitializationListener> listener = adoptNS([[WebGeolocationProviderInitializationListener alloc] initWithGeolocation:geolocation]);
+ [[m_webView _geolocationProvider] initializeGeolocationForWebView:m_webView listener:listener.get()];
+#endif
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -94,6 +132,7 @@
</span><span class="cx"> return core([[m_webView _geolocationProvider] lastPosition]);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @implementation WebGeolocationPolicyListener
</span><span class="cx">
</span><span class="cx"> - (id)initWithGeolocation:(Geolocation*)geolocation
</span><span class="lines">@@ -116,4 +155,86 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#else
+@implementation WebGeolocationPolicyListener
+- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView provider:(id<WebGeolocationProvider>)provider
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ _geolocation = geolocation;
+ _webView = webView;
+ _geolocationProvider = provider;
+ return self;
+}
+
+- (void)allow
+{
+ WebThreadRun(^{
+ _geolocation->setIsAllowed(true);
+ });
+}
+
+- (void)deny
+{
+ WebThreadRun(^{
+ _geolocation->setIsAllowed(false);
+ [_geolocationProvider.get() cancelWarmUpForWebView:_webView.get()];
+ });
+}
+
+- (void)denyOnlyThisRequest
+{
+ WebThreadRun(^{
+ // A soft deny does not prevent subsequent request from the Geolocation object.
+ [self deny];
+ _geolocation->resetAllGeolocationPermission();
+ });
+}
+
+- (BOOL)shouldClearCache
+{
+ // Theoretically, WebView could changes the WebPreferences after we get the pointer.
+ // We lock to be on the safe side.
+ WebThreadLock();
+
+ return [[_webView.get() preferences] _alwaysRequestGeolocationPermission];
+}
+@end
+
+@implementation WebGeolocationProviderInitializationListener
+- (id)initWithGeolocation:(Geolocation*)geolocation
+{
+ self = [super init];
+ if (self)
+ m_geolocation = geolocation;
+ return self;
+}
+
+- (void)initializationAllowedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ Frame* frame = m_geolocation->frame();
+ if (!frame) {
+ [provider cancelWarmUpForWebView:webView];
+ return;
+ }
+ WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
+ WebGeolocationPolicyListener *listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:m_geolocation.get() forWebView:webView provider:provider];
+ SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
+ CallUIDelegate(webView, selector, webOrigin, kit(frame), listener);
+ [webOrigin release];
+ [listener release];
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+- (void)initializationDeniedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider
+{
+ m_geolocation->setIsAllowed(false);
+}
+@end
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #endif // ENABLE(GEOLOCATION)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebJavaScriptTextInputPanelm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebJavaScriptTextInputPanel.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebJavaScriptTextInputPanel.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebJavaScriptTextInputPanel.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebJavaScriptTextInputPanel.h"
</span><span class="cx">
</span><span class="cx"> #import <wtf/Assertions.h>
</span><span class="lines">@@ -71,3 +73,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebKeyGeneratormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebKeyGenerator.h>
</span><span class="cx">
</span><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="lines">@@ -59,3 +61,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebNotificationClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -288,5 +288,18 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)denyOnlyThisRequest
+{
+ ASSERT_NOT_REACHED();
+}
+
+- (BOOL)shouldClearCache
+{
+ ASSERT_NOT_REACHED();
+ return NO;
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebOpenPanelResultListenermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebOpenPanelResultListener.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebOpenPanelResultListener.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebOpenPanelResultListener.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -88,4 +88,30 @@
</span><span class="cx"> _chooser = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)chooseFilename:(NSString *)filename displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef
+{
+ [self chooseFilenames:[NSArray arrayWithObject:filename] displayString:displayString iconImage:imageRef];
+}
+
+- (void)chooseFilenames:(NSArray *)filenames displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef
+{
+ ASSERT(_chooser);
+ if (!_chooser)
+ return;
+
+ RefPtr<Icon> icon = Icon::createIconForImage(imageRef);
+
+ NSUInteger count = [filenames count];
+ Vector<String> names(count);
+ for (NSUInteger i = 0; i < count; ++i)
+ names[i] = [filenames objectAtIndex:i];
+ _chooser->chooseMediaFiles(names, displayString, icon.get());
+
+ // FIXME: we shouldn't be manually deref()'ing here.
+ _chooser->deref();
+ _chooser = nullptr;
+}
+#endif
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSecurityOriginmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -66,6 +66,13 @@
</span><span class="cx"> return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (NSString *)toString
+{
+ return reinterpret_cast<SecurityOrigin*>(_private)->toString();
+}
+#endif
+
</ins><span class="cx"> - (NSString *)stringValue
</span><span class="cx"> {
</span><span class="cx"> return reinterpret_cast<SecurityOrigin*>(_private)->toString();
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -42,15 +42,19 @@
</span><span class="cx"> if (didInit)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(AdvanceDefaultButtonPulseAnimation);
</span><ins>+#endif
</ins><span class="cx"> INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(CGContextGetShouldSmoothFonts);
</span><ins>+#endif
</ins><span class="cx"> INIT(CGPatternCreateWithImageAndTransform);
</span><span class="cx"> INIT(CGContextResetClip);
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</ins><span class="cx"> INIT(CGContextDrawsWithCorrectShadowOffsets);
</span><span class="cx"> #endif
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> INIT(CTFontTransformGlyphs);
</span><span class="cx"> #endif
</span><span class="cx"> INIT(CopyCFLocalizationPreferredName);
</span><span class="lines">@@ -60,6 +64,7 @@
</span><span class="cx"> INIT(CopyNSURLResponseCertificateChain);
</span><span class="cx"> #endif
</span><span class="cx"> INIT(CreateCustomCFReadStream);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(DrawCapsLockIndicator);
</span><span class="cx"> INIT(DrawBezeledTextArea);
</span><span class="cx"> INIT(DrawBezeledTextFieldCell);
</span><span class="lines">@@ -71,9 +76,11 @@
</span><span class="cx"> INIT(GetFontInLanguageForCharacter);
</span><span class="cx"> INIT(GetFontInLanguageForRange);
</span><span class="cx"> INIT(GetGlyphTransformedAdvances);
</span><ins>+#endif
</ins><span class="cx"> INIT(GetHTTPPipeliningPriority);
</span><span class="cx"> INIT(GetMIMETypeForExtension);
</span><span class="cx"> INIT(GetNSURLResponseLastModifiedDate);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(SignedPublicKeyAndChallengeString);
</span><span class="cx"> INIT(GetPreferredExtensionForMIMEType);
</span><span class="cx"> INIT(GetWheelEventDeltas);
</span><span class="lines">@@ -81,18 +88,23 @@
</span><span class="cx"> INIT(GetNSEventKeyChar);
</span><span class="cx"> #endif
</span><span class="cx"> INIT(HitTestMediaUIPart);
</span><ins>+#endif
</ins><span class="cx"> INIT(InitializeMaximumHTTPConnectionCountPerHost);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(MeasureMediaUIPart);
</span><span class="cx"> INIT(CreateMediaUIBackgroundView);
</span><span class="cx"> INIT(CreateMediaUIControl);
</span><span class="cx"> INIT(WindowSetAlpha);
</span><span class="cx"> INIT(WindowSetScaledFrame);
</span><span class="cx"> INIT(PopupMenu);
</span><ins>+ INIT(SetCGFontRenderingMode);
+#endif
</ins><span class="cx"> INIT(SetBaseCTM);
</span><del>- INIT(SetCGFontRenderingMode);
</del><span class="cx"> INIT(SetCONNECTProxyAuthorizationForStream);
</span><span class="cx"> INIT(SetCONNECTProxyForStream);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(SetDragImage);
</span><ins>+#endif
</ins><span class="cx"> INIT(SetHTTPPipeliningMaximumPriority);
</span><span class="cx"> INIT(SetHTTPPipeliningPriority);
</span><span class="cx"> INIT(SetHTTPPipeliningMinimumFastLanePriority);
</span><span class="lines">@@ -105,6 +117,7 @@
</span><span class="cx"> INIT(SignalCFReadStreamEnd);
</span><span class="cx"> INIT(SignalCFReadStreamError);
</span><span class="cx"> INIT(SignalCFReadStreamHasBytes);
</span><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx"> INIT(QTIncludeOnlyModernMediaFileTypes);
</span><span class="cx"> INIT(QTMovieDataRate);
</span><span class="cx"> INIT(QTMovieDisableComponent);
</span><span class="lines">@@ -120,22 +133,36 @@
</span><span class="cx"> INIT(QTGetSitesInMediaDownloadCache);
</span><span class="cx"> INIT(QTClearMediaDownloadCacheForSite);
</span><span class="cx"> INIT(QTClearMediaDownloadCache);
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(GetGlyphsForCharacters);
</span><ins>+#endif
</ins><span class="cx"> INIT(GetVerticalGlyphsForCharacters);
</span><ins>+#if PLATFORM(IOS)
+ INIT(ExecutableWasLinkedOnOrAfterIOSVersion);
+ INIT(GetDeviceClass);
+ INIT(GetViewportScreenSize);
+ INIT(GetScreenScaleFactor);
+ INIT(IsGB18030ComplianceRequired);
+#endif
</ins><span class="cx">
</span><span class="cx"> INIT(CreateCTLineWithUniCharProvider);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS_SIMULATOR)
</ins><span class="cx"> INIT(IOSurfaceContextCreate);
</span><span class="cx"> INIT(IOSurfaceContextCreateImage);
</span><ins>+#endif
</ins><span class="cx"> INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
</span><span class="cx"> INIT(CTRunGetInitialAdvance);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(RecommendedScrollerStyle);
</span><span class="cx"> INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
</span><span class="cx"> INIT(SetCrashReportApplicationSpecificInformation);
</span><span class="cx"> INIT(CopyDefaultSearchProviderDisplayName);
</span><span class="cx"> INIT(AVAssetResolvedURL);
</span><span class="cx"> INIT(Cursor);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> INIT(GetDefaultHTTPCookieStorage);
</span><span class="lines">@@ -146,6 +173,7 @@
</span><span class="cx"> INIT(SetRequestStorageSession);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> INIT(SpeechSynthesisGetVoiceIdentifiers);
</span><span class="cx"> INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
</span><span class="lines">@@ -160,6 +188,7 @@
</span><span class="cx"> INIT(AccessibilityHandleFocusChanged);
</span><span class="cx"> INIT(CreateAXUIElementRef);
</span><span class="cx"> INIT(UnregisterUniqueIdForElement);
</span><ins>+#endif
</ins><span class="cx"> INIT(CreatePrivateStorageSession);
</span><span class="cx"> INIT(CopyRequestWithStorageSession);
</span><span class="cx"> INIT(CopyHTTPCookieStorage);
</span><span class="lines">@@ -180,20 +209,24 @@
</span><span class="cx"> INIT(CopyCFURLResponseSuggestedFilename);
</span><span class="cx"> INIT(SetCFURLResponseMIMEType);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(SetMetadataURL);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> // FIXME: We should stop using this file in Chromium.
</span><span class="cx">
</span><span class="cx"> INIT(DestroyRenderingResources);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> INIT(CreateVMPressureDispatchOnMainQueue);
</span><ins>+#endif
</ins><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> INIT(CreateMemoryStatusPressureCriticalDispatchOnMainQueue);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</ins><span class="cx"> INIT(ExecutableWasLinkedOnOrBeforeLion);
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebKitPrefixh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebKitPrefix.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebKitPrefix.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebKitPrefix.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#include <wtf/Platform.h>
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> #define NULL __null
</span><span class="cx"> #else
</span><span class="lines">@@ -54,6 +56,7 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #import <ApplicationServices/ApplicationServices.h>
</span><span class="cx"> #import <Carbon/Carbon.h>
</span><span class="cx">
</span><span class="lines">@@ -65,10 +68,15 @@
</span><span class="cx"> #endif
</span><span class="cx"> #define CGFLOAT_DEFINED 1
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #ifdef __OBJC__
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><ins>+#else
+#import <Foundation/Foundation.h>
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #include <wtf/Platform.h>
</span><span class="cx"> #include <wtf/ExportMacros.h>
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebArchivemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebArchive.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebArchive.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebArchive.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -67,9 +67,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebClipViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebClipView.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebClipView.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebClipView.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <AppKit/AppKit.h>
</span><span class="cx">
</span><span class="cx"> @interface WebClipView : NSClipView
</span><span class="lines">@@ -41,3 +43,5 @@
</span><span class="cx"> - (NSRect)additionalClip;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDataSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDataSource.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -66,6 +66,10 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebPDFViewIOS.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> class WebDataSourcePrivate
</span><span class="lines">@@ -75,6 +79,9 @@
</span><span class="cx"> : loader(loader)
</span><span class="cx"> , representationFinishedLoading(NO)
</span><span class="cx"> , includedInWebKitStatistics(NO)
</span><ins>+#if PLATFORM(IOS)
+ , _dataSourceDelegate(nil)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(this->loader);
</span><span class="cx"> }
</span><span class="lines">@@ -90,6 +97,9 @@
</span><span class="cx"> RetainPtr<id<WebDocumentRepresentation> > representation;
</span><span class="cx"> BOOL representationFinishedLoading;
</span><span class="cx"> BOOL includedInWebKitStatistics;
</span><ins>+#if PLATFORM(IOS)
+ NSObject<WebDataSourcePrivateDelegate> *_dataSourceDelegate;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> static inline WebDataSourcePrivate* toPrivate(void* privateAttribute)
</span><span class="lines">@@ -143,9 +153,11 @@
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><span class="cx"> if (self == [WebDataSource class]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -164,6 +176,7 @@
</span><span class="cx"> toPrivate(_private)->loader->addAllArchiveResources([archive _coreLegacyWebArchive]);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL
</span><span class="cx"> {
</span><span class="cx"> if ([URL isFileURL])
</span><span class="lines">@@ -182,6 +195,7 @@
</span><span class="cx">
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSString *)_responseMIMEType
</span><span class="cx"> {
</span><span class="lines">@@ -206,6 +220,13 @@
</span><span class="cx"> toPrivate(_private)->loader->setDeferMainResourceDataLoad(flag);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_setOverrideTextEncodingName:(NSString *)encoding
+{
+ toPrivate(_private)->loader->setOverrideEncoding([encoding UTF8String]);
+}
+#endif
+
</ins><span class="cx"> - (void)_setAllowToBeMemoryMapped
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DISK_IMAGE_CACHE) && PLATFORM(IOS)
</span><span class="lines">@@ -298,7 +319,13 @@
</span><span class="cx"> // Since this is a "secret default" we don't both registering it.
</span><span class="cx"> BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
</span><span class="cx"> if (!omitPDFSupport)
</span><ins>+#if PLATFORM(IOS)
+#define WebPDFRepresentation ([WebView _getPDFRepresentationClass])
+#endif
</ins><span class="cx"> addTypesFromClass(repTypes, [WebPDFRepresentation class], [WebPDFRepresentation supportedMIMETypes]);
</span><ins>+#if PLATFORM(IOS)
+#undef WebPDFRepresentation
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!addedImageTypes && !allowImageTypeOmission) {
</span><span class="lines">@@ -389,7 +416,12 @@
</span><span class="cx"> - (void)_makeRepresentation
</span><span class="cx"> {
</span><span class="cx"> Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
</span><del>-
</del><ins>+
+#if PLATFORM(IOS)
+ if ([repClass respondsToSelector:@selector(_representationClassForWebFrame:)])
+ repClass = [repClass performSelector:@selector(_representationClassForWebFrame:) withObject:[self webFrame]];
+#endif
+
</ins><span class="cx"> // Check if the data source was already bound?
</span><span class="cx"> if (![[self representation] isKindOfClass:repClass]) {
</span><span class="cx"> id newRep = repClass != nil ? [[repClass alloc] init] : nil;
</span><span class="lines">@@ -399,6 +431,9 @@
</span><span class="cx">
</span><span class="cx"> id<WebDocumentRepresentation> representation = toPrivate(_private)->representation.get();
</span><span class="cx"> [representation setDataSource:self];
</span><ins>+#if PLATFORM(IOS)
+ toPrivate(_private)->loader->setResponseMIMEType([self _responseMIMEType]);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (DocumentLoader*)_documentLoader
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDelegateImplementationCachingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> #import "WebTypesInternal.h"
</span><span class="cx"> #import <JavaScriptCore/JSBase.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebKit/WAKAppKitStubs.h>
+#endif
+
</ins><span class="cx"> @class WebView;
</span><span class="cx">
</span><span class="cx"> struct WebResourceDelegateImplementationCache {
</span><span class="lines">@@ -39,6 +43,19 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> IMP canAuthenticateAgainstProtectionSpaceFunc;
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+ IMP connectionPropertiesFunc;
+ IMP webThreadDidFinishLoadingFromDataSourceFunc;
+ IMP webThreadDidFailLoadingWithErrorFromDataSourceFunc;
+ IMP webThreadIdentifierForRequestFunc;
+ IMP webThreadDidLoadResourceFromMemoryCacheFunc;
+ IMP webThreadWillSendRequestFunc;
+ IMP webThreadDidReceiveResponseFunc;
+ IMP webThreadDidReceiveContentLengthFunc;
+ IMP webThreadWillCacheResponseFunc;
+#endif
+
</ins><span class="cx"> IMP identifierForRequestFunc;
</span><span class="cx"> IMP willSendRequestFunc;
</span><span class="cx"> IMP didReceiveResponseFunc;
</span><span class="lines">@@ -84,6 +101,9 @@
</span><span class="cx"> IMP didRunInsecureContentFunc;
</span><span class="cx"> IMP didDetectXSSFunc;
</span><span class="cx"> IMP didRemoveFrameFromHierarchyFunc;
</span><ins>+#if PLATFORM(IOS)
+ IMP webThreadDidLayoutFunc;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct WebScriptDebugDelegateImplementationCache {
</span><span class="lines">@@ -126,6 +146,9 @@
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id);
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL);
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL, id);
</span><ins>+#if PLATFORM(IOS)
+BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id, BOOL);
+#endif
</ins><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP, WebView *, SEL);
</span><span class="cx"> id CallFrameLoadDelegate(IMP, WebView *, SEL, NSUInteger);
</span><span class="lines">@@ -134,6 +157,10 @@
</span><span class="cx"> id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id);
</span><span class="cx"> id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
</span><span class="cx"> id CallFrameLoadDelegate(IMP, WebView *, SEL, id, NSTimeInterval, id, id);
</span><ins>+#if PLATFORM(IOS)
+id CallFrameLoadDelegate(IMP, WebView *, SEL, id, double);
+id CallFrameLoadDelegateInWebThread(IMP, WebView *, SEL, NSUInteger);
+#endif
</ins><span class="cx">
</span><span class="cx"> BOOL CallFrameLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL);
</span><span class="cx">
</span><span class="lines">@@ -142,6 +169,13 @@
</span><span class="cx"> id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
</span><span class="cx"> id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id);
</span><span class="cx"> id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
</span><ins>+#if PLATFORM(IOS)
+id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id);
+id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, id);
+id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, id, id);
+id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, NSInteger, id);
+id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, NSInteger, id);
+#endif
</ins><span class="cx">
</span><span class="cx"> BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id);
</span><span class="cx"> BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDelegateImplementationCachingmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -34,6 +34,11 @@
</span><span class="cx"> #import "WebViewData.h"
</span><span class="cx"> #import <wtf/ObjcRuntimeExtras.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebViewInternal.h"
+#import <WebCore/WebCoreThreadMessage.h>
+#endif
+
</ins><span class="cx"> @implementation WebView (WebDelegateImplementationCaching)
</span><span class="cx">
</span><span class="cx"> WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView)
</span><span class="lines">@@ -73,14 +78,17 @@
</span><span class="cx"> // preventing more ObjC message dispatch and compensating for the expense of the @try/@catch.
</span><span class="cx">
</span><span class="cx"> typedef float (*ObjCMsgSendFPRet)(id, SEL, ...);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #if defined(__i386__)
</span><span class="cx"> static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend_fpret);
</span><span class="cx"> #else
</span><span class="cx"> static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend);
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -89,10 +97,31 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -101,10 +130,32 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, NSRect rect)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -113,10 +164,32 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&rect atIndex:3];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -125,10 +198,33 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, BOOL boolean)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -137,10 +233,33 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+ [invocation setArgument:&boolean atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -149,10 +268,34 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+ [invocation setArgument:&object3 atIndex:5];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, NSUInteger integer)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -161,10 +304,33 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+ [invocation setArgument:&integer atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline float CallDelegateReturningFloat(WebView *self, id delegate, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return 0.0f;
</span><span class="cx"> @try {
</span><span class="lines">@@ -173,10 +339,28 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return 0.0f;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return 0.0f;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+
+ float returnValue = 0.0f;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return 0.0f;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return result;
</span><span class="cx"> @try {
</span><span class="lines">@@ -185,10 +369,28 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return result;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return result;
</span><span class="cx"> @try {
</span><span class="lines">@@ -197,10 +399,29 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return result;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return result;
</span><span class="cx"> @try {
</span><span class="lines">@@ -209,6 +430,25 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return result;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+ [invocation setArgument:&boolean atIndex:4];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean, id object2)
</span><span class="lines">@@ -225,6 +465,7 @@
</span><span class="cx">
</span><span class="cx"> static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return result;
</span><span class="cx"> @try {
</span><span class="lines">@@ -233,10 +474,54 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return result;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2, BOOL boolean)
+{
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+ [invocation setArgument:&boolean atIndex:5];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+}
+#endif
+
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -245,10 +530,31 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -257,10 +563,32 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate || ![delegate respondsToSelector:selector])
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&integer atIndex:3];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -269,10 +597,83 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, object3);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3, id object4)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, object3, object4);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, integer);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -281,10 +682,59 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object, double double1)
+{
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object atIndex:3];
+ [invocation setArgument:&double1 atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+#endif
+
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -293,10 +743,34 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+ [invocation setArgument:&object3 atIndex:5];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3, id object4)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -305,10 +779,35 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+ [invocation setArgument:&object3 atIndex:5];
+ [invocation setArgument:&object4 atIndex:6];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -317,9 +816,36 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&integer atIndex:4];
+ [invocation setArgument:&object2 atIndex:5];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
</span><ins>+#else
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="lines">@@ -345,6 +871,7 @@
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -353,9 +880,62 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+ [invocation setArgument:&integer atIndex:5];
+ [invocation setArgument:&object3 atIndex:6];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, object1, integer, object2);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
+{
+ if (!delegate)
+ return nil;
+ @try {
+ return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, integer, object3);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
</span><ins>+#else
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="lines">@@ -367,7 +947,11 @@
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
</span><ins>+#else
+static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="lines">@@ -381,6 +965,7 @@
</span><span class="cx">
</span><span class="cx"> static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!delegate)
</span><span class="cx"> return nil;
</span><span class="cx"> @try {
</span><span class="lines">@@ -389,112 +974,234 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&self atIndex:2];
+ [invocation setArgument:&object1 atIndex:3];
+ [invocation setArgument:&interval atIndex:4];
+ [invocation setArgument:&object2 atIndex:5];
+ [invocation setArgument:&object3 atIndex:6];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, object);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, id object, BOOL boolean)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, object, boolean);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object, boolean);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, NSRect rect)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, rect);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, rect);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object1, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2, object3);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object1, object2, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallUIDelegate(WebView *self, SEL selector, id object, NSUInteger integer)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(self, self->_private->UIDelegate, selector, object, integer);
</span><ins>+#else
+ return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object, integer);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float CallUIDelegateReturningFloat(WebView *self, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningFloat(self, self->_private->UIDelegate, selector);
</span><ins>+#else
+ return CallDelegateReturningFloat(self, [self _UIDelegateForSelector:selector], selector);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector);
</span><ins>+#else
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object);
</span><ins>+#else
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean);
</span><ins>+#else
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object, boolean);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean, object2);
</span><ins>+#else
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object, boolean, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object1, object2);
</span><ins>+#else
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object1, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2, BOOL boolean)
+{
+ return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object1, object2, boolean);
+}
+#endif
+
</ins><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, integer);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, integer);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3, object4);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2, object3, object4);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, interval, object2, object3);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, interval, object2, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object, double double1)
+{
+ return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object, double1);
+}
+#endif
+
</ins><span class="cx"> BOOL CallFrameLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector)
</span><span class="cx"> {
</span><span class="cx"> @try {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(self->_private->frameLoadDelegate, selector, self);
</span><ins>+#else
+ return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)([self _frameLoadDelegateForwarder], selector, self);
+#endif
</ins><span class="cx"> } @catch(id exception) {
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="lines">@@ -503,29 +1210,81 @@
</span><span class="cx">
</span><span class="cx"> id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3, object4);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, object3, object4);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, integer, object2);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, integer, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, integer, object3);
</span><ins>+#else
+ return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, integer, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2);
+}
+
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3);
+}
+
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3, object4);
+}
+
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, integer, object2);
+}
+
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, integer, object3);
+}
+
+id CallFrameLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
+{
+ return CallDelegateInWebThread(implementation, self, self->_private->frameLoadDelegate, selector, integer);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
</span><span class="cx"> {
</span><span class="cx"> @try {
</span><span class="lines">@@ -558,22 +1317,38 @@
</span><span class="cx">
</span><span class="cx"> id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3);
</span><ins>+#else
+ return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
</span><ins>+#else
+ return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
</span><ins>+#else
+ return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
</span><ins>+#else
+ return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
</span><span class="lines">@@ -600,6 +1375,7 @@
</span><span class="cx">
</span><span class="cx"> id CallFormDelegate(WebView *self, SEL selector, id object1, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id delegate = self->_private->formDelegate;
</span><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="lines">@@ -609,10 +1385,33 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ id delegate = [self _formDelegateForSelector:selector];
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&object1 atIndex:2];
+ [invocation setArgument:&object2 atIndex:3];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id delegate = self->_private->formDelegate;
</span><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="lines">@@ -622,10 +1421,34 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ id delegate = [self _formDelegateForSelector:selector];
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&object1 atIndex:2];
+ [invocation setArgument:&object2 atIndex:3];
+ [invocation setArgument:&object3 atIndex:4];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id delegate = self->_private->formDelegate;
</span><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return nil;
</span><span class="lines">@@ -635,10 +1458,36 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><ins>+#else
+ id delegate = [self _formDelegateForSelector:selector];
+ if (!delegate)
+ return nil;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&object1 atIndex:2];
+ [invocation setArgument:&object2 atIndex:3];
+ [invocation setArgument:&object3 atIndex:4];
+ [invocation setArgument:&object4 atIndex:5];
+ [invocation setArgument:&object5 atIndex:6];
+
+ id returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ if ([[invocation methodSignature] methodReturnLength] == 0) {
+ return nil;
+ }
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BOOL CallFormDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, SEL selectorArg, id object2)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id delegate = self->_private->formDelegate;
</span><span class="cx"> if (!delegate || ![delegate respondsToSelector:selector])
</span><span class="cx"> return result;
</span><span class="lines">@@ -648,6 +1497,26 @@
</span><span class="cx"> ReportDiscardedDelegateException(selector, exception);
</span><span class="cx"> }
</span><span class="cx"> return result;
</span><ins>+#else
+ id delegate = [self _formDelegateForSelector:selector];
+ if (!delegate)
+ return result;
+
+ NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
+ [invocation setArgument:&object1 atIndex:2];
+ [invocation setArgument:&selectorArg atIndex:3];
+ [invocation setArgument:&object2 atIndex:4];
+
+ BOOL returnValue;
+ @try {
+ WebThreadCallDelegate(invocation);
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return result;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDeviceOrientationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDeviceOrientation.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -65,7 +65,13 @@
</span><span class="cx"> self = [super init];
</span><span class="cx"> if (!self)
</span><span class="cx"> return nil;
</span><ins>+#if PLATFORM(IOS)
+ // We don't use this API, but make sure that it compiles with the new
+ // compass parameters.
+ m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, false, 0, false, 0)];
+#else
</ins><span class="cx"> m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)];
</span><ins>+#endif
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDocumentInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDocumentInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDocumentInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDocumentInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -30,6 +30,12 @@
</span><span class="cx"> #import <WebKit/WebHTMLView.h>
</span><span class="cx"> #import <WebKit/WebViewPrivate.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#if !defined(IBAction)
+#define IBAction void
+#endif
+#endif
+
</ins><span class="cx"> /*!
</span><span class="cx"> @protocol _WebDocumentZooming
</span><span class="cx"> @discussion Optional protocol for a view that wants to handle its own zoom.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDocumentLoaderMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDocumentLoaderMac.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDocumentLoaderMac.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDocumentLoaderMac.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -42,9 +42,13 @@
</span><span class="cx">
</span><span class="cx"> static inline bool needsDataLoadWorkaround(WebView *webView)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool needsWorkaround = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_ADOBE_INSTALLER_QUIRK)
</span><span class="cx"> && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.adobe.Installers.Setup"];
</span><span class="cx"> return needsWorkaround;
</span><ins>+#else
+ return NO;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebDocumentLoaderMac::setDataSource(WebDataSource *dataSource, WebView *webView)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDynamicScrollBarsViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsViewInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsViewInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsViewInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebDynamicScrollBarsView.h"
</span><span class="cx"> #import <WebCore/WebCoreFrameView.h>
</span><span class="cx">
</span><span class="lines">@@ -62,3 +64,5 @@
</span><span class="cx"> // scrollers from inside this class should not fire JS events.
</span><span class="cx"> - (BOOL)inProgrammaticScroll;
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFormDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFormDelegate.m (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFormDelegate.m        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFormDelegate.m        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -69,10 +69,12 @@
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event inFrame:(WebFrame *)frame
</span><span class="cx"> {
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form
</span><span class="cx"> withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrame.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -105,6 +105,27 @@
</span><span class="cx"> #import <runtime/JSCJSValue.h>
</span><span class="cx"> #import <wtf/CurrentTime.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebMailDelegate.h"
+#import "WebResource.h"
+#import "WebUIKitDelegate.h"
+#import <JavaScriptCore/APIShims.h>
+#import <WebCore/Document.h>
+#import <WebCore/Editor.h>
+#import <WebCore/EditorClient.h>
+#import <WebCore/FocusController.h>
+#import <WebCore/FrameSelection.h>
+#import <WebCore/HistoryController.h>
+#import <WebCore/NodeTraversal.h>
+#import <WebCore/RenderLayer.h>
+#import <WebCore/SimpleFontData.h>
+#import <WebCore/TextResourceDecoder.h>
+#import <WebCore/WAKScrollView.h>
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WKGraphics.h>
+#import <WebCore/WebCoreThreadRun.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><span class="lines">@@ -303,6 +324,22 @@
</span><span class="cx"> return _private && _private->includedInWebKitStatistics;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static NSURL *createUniqueWebDataURL();
+
++ (void)_createMainFrameWithSimpleHTMLDocumentWithPage:(Page*)page frameView:(WebFrameView *)frameView style:(NSString *)style
+{
+ WebView *webView = kit(page);
+
+ WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
+ frame->_private->coreFrame = &page->mainFrame();
+ static_cast<WebFrameLoaderClient&>(page->mainFrame().loader().client()).setWebFrame(frame);
+ [frame release];
+
+ frame->_private->coreFrame->initWithSimpleHTMLDocument(style, createUniqueWebDataURL());
+}
+#endif
+
</ins><span class="cx"> - (void)_attachScriptDebugger
</span><span class="cx"> {
</span><span class="cx"> ScriptController& scriptController = _private->coreFrame->script();
</span><span class="lines">@@ -362,7 +399,11 @@
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(self);
</span><span class="cx"> BOOL drawsBackground = [webView drawsBackground];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSColor *backgroundColor = [webView backgroundColor];
</span><ins>+#else
+ CGColorRef backgroundColor = [webView backgroundColor];
+#endif
</ins><span class="cx">
</span><span class="cx"> Frame* coreFrame = _private->coreFrame;
</span><span class="cx"> for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame)) {
</span><span class="lines">@@ -371,11 +412,18 @@
</span><span class="cx"> WebFrame *webFrame = kit(frame);
</span><span class="cx"> if (!drawsBackground)
</span><span class="cx"> [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (FrameView* view = frame->view()) {
</span><span class="cx"> view->setTransparent(!drawsBackground);
</span><del>- view->setBaseBackgroundColor(colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]));
</del><ins>+#if !PLATFORM(IOS)
+ Color color = colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
+#else
+ Color color = Color(backgroundColor);
+#endif
+ view->setBaseBackgroundColor(color);
</ins><span class="cx"> view->setShouldUpdateWhileOffscreen([webView shouldUpdateWhileOffscreen]);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -402,11 +450,13 @@
</span><span class="cx">
</span><span class="cx"> - (void)_unmarkAllMisspellings
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> Frame* coreFrame = _private->coreFrame;
</span><span class="cx"> for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame)) {
</span><span class="cx"> if (Document* document = frame->document())
</span><span class="cx"> document->markers().removeMarkers(DocumentMarker::Spelling);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_hasSelection
</span><span class="lines">@@ -481,6 +531,18 @@
</span><span class="cx"> return dataSource(_private->coreFrame->loader().documentLoader());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_isCommitting
+{
+ return _private->isCommitting;
+}
+
+- (void)_setIsCommitting:(BOOL)value
+{
+ _private->isCommitting = value;
+}
+#endif
+
</ins><span class="cx"> - (NSArray *)_nodesFromList:(Vector<Node*> *)nodesVector
</span><span class="cx"> {
</span><span class="cx"> size_t size = nodesVector->size();
</span><span class="lines">@@ -502,10 +564,12 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_shouldFlattenCompositingLayers:(CGContextRef)context
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // -currentContextDrawingToScreen returns YES for bitmap contexts.
</span><span class="cx"> BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
</span><span class="cx"> if (isPrinting)
</span><span class="cx"> return YES;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if (!WKCGContextIsBitmapContext(context))
</span><span class="cx"> return NO;
</span><span class="lines">@@ -520,11 +584,22 @@
</span><span class="cx">
</span><span class="cx"> - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT([[NSGraphicsContext currentContext] isFlipped]);
</span><span class="cx">
</span><span class="cx"> CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
</span><ins>+#else
+ CGContextRef ctx = WKGetCurrentGraphicsContext();
+#endif
</ins><span class="cx"> GraphicsContext context(ctx);
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: when <rdar://problem/9034977> is fixed there will be no need to do this here.
+ WebCore::Frame *frame = core(self);
+ if (WebCore::Page* page = frame->page())
+ context.setIsAcceleratedContext(page->settings().acceleratedDrawingEnabled());
+#endif
+
</ins><span class="cx"> FrameView* view = _private->coreFrame->view();
</span><span class="cx">
</span><span class="cx"> bool shouldFlatten = false;
</span><span class="lines">@@ -577,6 +652,14 @@
</span><span class="cx"> ASSERT(_private->coreFrame->document());
</span><span class="cx"> RetainPtr<WebFrame> protect(self); // Executing arbitrary JavaScript can destroy the frame.
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ ASSERT(WebThreadIsLockedOrDisabled());
+ JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
+ // Need to use the full entry shim to prevent crashes arising from the UI thread being unknown
+ // to the JSC GC: <rdar://problem/11553172> Crash when breaking in the Web Inspector during stringByEvaluatingJavaScriptFromString:
+ JSC::APIEntryShim jscLock(exec);
+#endif
+
</ins><span class="cx"> JSC::JSValue result = _private->coreFrame->script().executeScript(string, forceUserGesture).jsValue();
</span><span class="cx">
</span><span class="cx"> if (!_private->coreFrame) // In case the script removed our frame from the page.
</span><span class="lines">@@ -588,8 +671,10 @@
</span><span class="cx"> if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
</span><span class="cx"> return @"";
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
</span><span class="cx"> JSC::JSLockHolder lock(exec);
</span><ins>+#endif
</ins><span class="cx"> return result.toWTFString(exec);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -609,15 +694,52 @@
</span><span class="cx"> NSRect rangeRect = [self _firstRectForDOMRange:range];
</span><span class="cx"> Node *startNode = core([range startContainer]);
</span><span class="cx">
</span><del>- if (startNode && startNode->renderer())
</del><ins>+ if (startNode && startNode->renderer()) {
+#if !PLATFORM(IOS)
</ins><span class="cx"> startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
</span><ins>+#else
+ RenderLayer* layer = startNode->renderer()->enclosingLayer();
+ if (layer) {
+ layer->setAdjustForIOSCaretWhenScrolling(true);
+ startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+ layer->setAdjustForIOSCaretWhenScrolling(false);
+ _private->coreFrame->selection().setCaretRectNeedsUpdate();
+ _private->coreFrame->selection().updateAppearance();
+ }
+#endif
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset
+{
+ NSRect rangeRect = NSInsetRect([self _firstRectForDOMRange:range], inset, inset);
+ Node *startNode = core([range startContainer]);
+
+ if (startNode && startNode->renderer()) {
+ RenderLayer* layer = startNode->renderer()->enclosingLayer();
+ if (layer) {
+ layer->setAdjustForIOSCaretWhenScrolling(true);
+ startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+ layer->setAdjustForIOSCaretWhenScrolling(false);
+
+ Frame *coreFrame = core(self);
+ if (coreFrame) {
+ FrameSelection& frameSelection = coreFrame->selection();
+ frameSelection.setCaretRectNeedsUpdate();
+ frameSelection.updateAppearance();
+ }
+ }
+ }
+}
+#endif
+
</ins><span class="cx"> - (BOOL)_needsLayout
</span><span class="cx"> {
</span><span class="cx"> return _private->coreFrame->view() ? _private->coreFrame->view()->needsLayout() : false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (DOMRange *)_rangeByAlteringCurrentSelection:(FrameSelection::EAlteration)alteration direction:(SelectionDirection)direction granularity:(TextGranularity)granularity
</span><span class="cx"> {
</span><span class="cx"> if (_private->coreFrame->selection().isNone())
</span><span class="lines">@@ -628,6 +750,7 @@
</span><span class="cx"> selection.modify(alteration, direction, granularity);
</span><span class="cx"> return kit(selection.toNormalizedRange().get());
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (TextGranularity)_selectionGranularity
</span><span class="cx"> {
</span><span class="lines">@@ -858,7 +981,11 @@
</span><span class="cx"> _private->shouldCreateRenderers = shouldCreateRenderers;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSColor *)_bodyBackgroundColor
</span><ins>+#else
+- (CGColorRef)_bodyBackgroundColor
+#endif
</ins><span class="cx"> {
</span><span class="cx"> Document* document = _private->coreFrame->document();
</span><span class="cx"> if (!document)
</span><span class="lines">@@ -872,7 +999,11 @@
</span><span class="cx"> Color color = bodyRenderer->style().visitedDependentColor(CSSPropertyBackgroundColor);
</span><span class="cx"> if (!color.isValid())
</span><span class="cx"> return nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return nsColor(color);
</span><ins>+#else
+ return cachedCGColor(color, ColorSpaceDeviceRGB);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_isFrameSet
</span><span class="lines">@@ -898,6 +1029,61 @@
</span><span class="cx"> return (WebFrameLoadType)_private->coreFrame->loader().loadType();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)needsLayout
+{
+ // Needed for Mail <rdar://problem/6228038>
+ return _private->coreFrame ? [self _needsLayout] : NO;
+}
+
+- (void)_setLoadsSynchronously:(BOOL)flag
+{
+ _private->coreFrame->loader().setLoadsSynchronously(flag);
+}
+
+- (BOOL)_loadsSynchronously
+{
+ return _private->coreFrame->loader().loadsSynchronously();
+}
+
+// FIXME: selection
+
+- (NSArray *)_rectsForRange:(DOMRange *)domRange
+{
+ Range *range = core(domRange);
+
+
+ Vector<IntRect> intRects;
+ range->textRects(intRects, NO);
+ unsigned size = intRects.size();
+
+ NSMutableArray *rectArray = [NSMutableArray arrayWithCapacity:size];
+ for (unsigned i = 0; i < size; i++) {
+ [rectArray addObject:[NSValue valueWithRect:(CGRect )intRects[i]]];
+ }
+
+ return rectArray;
+}
+
+- (DOMRange *)_selectionRangeForFirstPoint:(CGPoint)first secondPoint:(CGPoint)second
+{
+ VisiblePosition firstPos = [self _visiblePositionForPoint:first];
+ VisiblePosition secondPos = [self _visiblePositionForPoint:second];
+ VisibleSelection selection(firstPos, secondPos);
+ DOMRange *range = kit(selection.toNormalizedRange().get());
+ return range;
+}
+
+- (DOMRange *)_selectionRangeForPoint:(CGPoint)point
+{
+ VisiblePosition pos = [self _visiblePositionForPoint:point];
+ VisibleSelection selection(pos);
+ DOMRange *range = kit(selection.toNormalizedRange().get());
+ return range;
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (NSRange)_selectedNSRange
</span><span class="cx"> {
</span><span class="cx"> return [self _convertToNSRange:_private->coreFrame->selection().toNormalizedRange().get()];
</span><span class="lines">@@ -943,6 +1129,732 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (unsigned)formElementsCharacterCount
+{
+ WebCore::Frame *frame = core(self);
+ return frame->formElementsCharacterCount();
+}
+
+- (void)setTimeoutsPaused:(BOOL)flag
+{
+ id documentView = [_private->webFrameView documentView];
+ if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if (Frame* coreFrame = _private->coreFrame)
+ coreFrame->setTimersPaused(flag);
+ }
+}
+
+- (void)setPluginsPaused:(BOOL)flag
+{
+ WebView *webView = getWebView(self);
+ if (!webView)
+ return;
+
+ if (flag)
+ [webView _stopAllPlugIns];
+ else
+ [webView _startAllPlugIns];
+}
+
+- (void)prepareForPause
+{
+ id documentView = [_private->webFrameView documentView];
+ if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if (Frame* coreFrame = _private->coreFrame)
+ coreFrame->dispatchPageHideEventBeforePause();
+ }
+}
+
+- (void)resumeFromPause
+{
+ id documentView = [_private->webFrameView documentView];
+ if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if (Frame* coreFrame = _private->coreFrame)
+ coreFrame->dispatchPageShowEventBeforeResume();
+ }
+}
+
+- (void)selectNSRange:(NSRange)range
+{
+ [self _selectNSRange:range];
+}
+
+- (void)selectWithoutClosingTypingNSRange:(NSRange)range
+{
+ RefPtr<Range> domRange = [self _convertToDOMRange:range];
+ if (domRange) {
+ const VisibleSelection& newSelection = VisibleSelection(domRange.get(), SEL_DEFAULT_AFFINITY);
+ _private->coreFrame->selection().setSelection(newSelection, 0);
+
+ _private->coreFrame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
+ }
+}
+
+- (NSRange)selectedNSRange
+{
+ return [self _selectedNSRange];
+}
+
+- (void)forceLayoutAdjustingViewSize:(BOOL)adjust
+{
+ _private->coreFrame->view()->forceLayout(!adjust);
+ if (adjust)
+ _private->coreFrame->view()->adjustViewSize();
+}
+
+- (void)_handleKeyEvent:(WebEvent *)event
+{
+ core(self)->eventHandler().keyEvent(event);
+}
+
+- (void)_selectAll
+{
+ core(self)->selection().selectAll();
+}
+
+- (void)_setSelectionFromNone
+{
+ core(self)->selection().setSelectionFromNone();
+}
+
+- (void)_restoreViewState
+{
+ ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
+ _private->coreFrame->loader().client().restoreViewState();
+}
+
+- (void)_saveViewState
+{
+ ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
+ FrameLoader& frameLoader = _private->coreFrame->loader();
+ frameLoader.client().saveViewStateToItem(frameLoader.history().currentItem());
+}
+
+- (void)sendOrientationChangeEvent:(int)newOrientation
+{
+ WebThreadRun(^{
+ WebCore::Frame *frame = core(self);
+ if (frame)
+ frame->sendOrientationChangeEvent(newOrientation);
+ });
+}
+
+- (void)setNeedsLayout
+{
+ WebCore::Frame *frame = core(self);
+ if (frame->view())
+ frame->view()->setNeedsLayout();
+}
+
+- (CGSize)renderedSizeOfNode:(DOMNode *)node constrainedToWidth:(float)width
+{
+ Node *n = core(node);
+ RenderObject *r = n ? n->renderer() : 0;
+ float w = std::min((float)r->maxPreferredLogicalWidth(), width);
+ return r && r->isBox() ? CGSizeMake(w, toRenderBox(r)->height()) : CGSizeMake(0,0);
+}
+
+- (DOMNode *)deepestNodeAtViewportLocation:(CGPoint)aViewportLocation
+{
+ WebCore::Frame *frame = core(self);
+ return kit(frame->deepestNodeAtLocation(FloatPoint(aViewportLocation)));
+}
+
+- (DOMNode *)scrollableNodeAtViewportLocation:(CGPoint)aViewportLocation
+{
+ WebCore::Frame *frame = core(self);
+ WebCore::Node *node = frame->nodeRespondingToScrollWheelEvents(FloatPoint(aViewportLocation));
+ return kit(node);
+}
+
+- (DOMNode *)approximateNodeAtViewportLocation:(CGPoint *)aViewportLocation
+{
+ WebCore::Frame *frame = core(self);
+ FloatPoint viewportLocation(*aViewportLocation);
+ FloatPoint adjustedLocation;
+ WebCore::Node *node = frame->nodeRespondingToClickEvents(viewportLocation, adjustedLocation);
+ *aViewportLocation = adjustedLocation;
+ return kit(node);
+}
+
+- (CGRect)renderRectForPoint:(CGPoint)point isReplaced:(BOOL *)isReplaced fontSize:(float *)fontSize
+{
+ WebCore::Frame *frame = core(self);
+ bool replaced = false;
+ CGRect rect = frame->renderRectForPoint(point, &replaced, fontSize);
+ *isReplaced = replaced;
+ return rect;
+}
+
+- (void)_setProhibitsScrolling:(BOOL)flag
+{
+ WebCore::Frame *frame = core(self);
+ frame->view()->setProhibitsScrolling(flag);
+}
+
+- (void)revealSelectionAtExtent:(BOOL)revealExtent
+{
+ WebCore::Frame *frame = core(self);
+ RevealExtentOption revealExtentOption = revealExtent ? RevealExtent : DoNotRevealExtent;
+ frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);
+}
+
+- (void)resetSelection
+{
+ WebCore::Frame *frame = core(self);
+ frame->selection().setSelection(frame->selection().selection());
+}
+
+- (BOOL)hasEditableSelection
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().isContentEditable();
+}
+
+- (int)preferredHeight
+{
+ WebCore::Frame *frame = core(self);
+ return frame->preferredHeight();
+}
+
+- (int)innerLineHeight:(DOMNode *)node
+{
+ WebCore::Frame *frame = core(self);
+ return frame->innerLineHeight(node);
+}
+
+- (void)updateLayout
+{
+ WebCore::Frame *frame = core(self);
+ frame->updateLayout();
+}
+
+- (void)setIsActive:(BOOL)flag
+{
+ WebCore::Frame *frame = core(self);
+ frame->page()->focusController().setActive(flag);
+}
+
+- (void)setSelectionChangeCallbacksDisabled:(BOOL)flag
+{
+ WebCore::Frame *frame = core(self);
+ frame->setSelectionChangeCallbacksDisabled(flag);
+}
+
+- (NSRect)caretRect
+{
+ WebCore::Frame *frame = core(self);
+ return frame->caretRect();
+}
+
+- (NSRect)rectForScrollToVisible
+{
+ WebCore::Frame *frame = core(self);
+ return frame->rectForScrollToVisible();
+}
+
+- (void)setCaretColor:(CGColorRef)color
+{
+ Color qColor = color ? Color(color) : Color::black;
+ WebCore::Frame *frame = core(self);
+ frame->selection().setCaretColor(qColor);
+}
+
+- (NSView *)documentView
+{
+ WebCore::Frame *frame = core(self);
+ return [[kit(frame) frameView] documentView];
+}
+
+- (int)layoutCount
+{
+ WebCore::Frame *frame = core(self);
+ if (!frame || !frame->view())
+ return 0;
+ return frame->view()->layoutCount();
+}
+
+- (BOOL)isTelephoneNumberParsingAllowed
+{
+ Document *document = core(self)->document();
+ return document->isTelephoneNumberParsingAllowed();
+}
+
+- (BOOL)isTelephoneNumberParsingEnabled
+{
+ Document *document = core(self)->document();
+ return document->isTelephoneNumberParsingEnabled();
+}
+
+- (BOOL)mediaDataLoadsAutomatically
+{
+ WebCore::Frame *frame = core(self);
+ if (WebCore::Page* page = frame->page())
+ return page->settings().mediaDataLoadsAutomatically();
+
+ return NO;
+}
+
+- (void)setMediaDataLoadsAutomatically:(BOOL)flag
+{
+ WebCore::Frame *frame = core(self);
+ if (WebCore::Page* page = frame->page())
+ page->settings().setMediaDataLoadsAutomatically(flag);
+}
+
+- (DOMRange *)selectedDOMRange
+{
+ WebCore::Frame *frame = core(self);
+ RefPtr<WebCore::Range> range = frame->selection().toNormalizedRange();
+ return kit(range.get());
+}
+
+- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)affinity closeTyping:(BOOL)closeTyping
+{
+ WebCore::Frame *frame = core(self);
+#if PLATFORM(IOS)
+ // Ensure the view becomes first responder.
+ // This does not happen automatically on iOS because we don't forward
+ // all the click events to WebKit.
+ if (FrameView* frameView = frame->view()) {
+ if (NSView *documentView = frameView->documentView()) {
+ Page* page = frame->page();
+ if (!page)
+ return;
+ page->chrome().focusNSView(documentView);
+ }
+ }
+#endif
+ frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping);
+ if (!closeTyping)
+ frame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
+}
+
+- (NSSelectionAffinity)selectionAffinity
+{
+ WebCore::Frame *frame = core(self);
+ return (NSSelectionAffinity)(frame->selection().affinity());
+}
+
+- (void)expandSelectionToElementContainingCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ frame->selection().expandSelectionToElementContainingCaretSelection();
+}
+
+- (DOMRange *)elementRangeContainingCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ RefPtr<WebCore::Range> range = frame->selection().elementRangeContainingCaretSelection();
+ return kit(range.get());
+}
+
+- (void)expandSelectionToWordContainingCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ frame->selection().expandSelectionToWordContainingCaretSelection();
+}
+
+- (void)expandSelectionToStartOfWordContainingCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ frame->selection().expandSelectionToStartOfWordContainingCaretSelection();
+}
+
+- (unichar)characterInRelationToCaretSelection:(int)amount
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().characterInRelationToCaretSelection(amount);
+}
+
+- (unichar)characterBeforeCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().characterBeforeCaretSelection();
+}
+
+- (unichar)characterAfterCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().characterAfterCaretSelection();
+}
+
+- (DOMRange *)wordRangeContainingCaretSelection
+{
+ WebCore::Frame *frame = core(self);
+ RefPtr<WebCore::Range> range = frame->selection().wordRangeContainingCaretSelection();
+ return kit(range.get());
+}
+
+- (NSString *)wordInRange:(DOMRange *)range
+{
+ if (!range)
+ return nil;
+ return [self _stringForRange:range];
+}
+
+- (int)wordOffsetInRange:(DOMRange *)range
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().wordOffsetInRange(core(range));
+}
+
+- (BOOL)spaceFollowsWordInRange:(DOMRange *)range
+{
+ WebCore::Frame *frame = core(self);
+ return frame->selection().spaceFollowsWordInRange(core(range));
+}
+
+- (NSArray *)wordsInCurrentParagraph
+{
+ WebCore::Frame *frame = core(self);
+ return frame->wordsInCurrentParagraph();
+}
+
+- (BOOL)selectionAtDocumentStart
+{
+ WebCore::Frame *frame = core(self);
+
+ if (frame->selection().selection().isNone())
+ return NO;
+
+ frame->document()->updateLayout();
+
+ return frame->selection().selectionAtDocumentStart();
+}
+
+- (BOOL)selectionAtSentenceStart
+{
+ WebCore::Frame *frame = core(self);
+
+ if (frame->selection().selection().isNone())
+ return NO;
+
+ frame->document()->updateLayout();
+
+ return frame->selection().selectionAtSentenceStart();
+}
+
+- (BOOL)selectionAtWordStart
+{
+ WebCore::Frame *frame = core(self);
+
+ if (frame->selection().selection().isNone())
+ return NO;
+
+ frame->document()->updateLayout();
+
+ return frame->selection().selectionAtWordStart();
+}
+
+- (DOMRange *)rangeByMovingCurrentSelection:(int)amount
+{
+ WebCore::Frame *frame = core(self);
+ RefPtr<WebCore::Range> range = frame->selection().rangeByMovingCurrentSelection(amount);
+ return kit(range.get());
+}
+
+- (DOMRange *)rangeByExtendingCurrentSelection:(int)amount
+{
+ WebCore::Frame *frame = core(self);
+ RefPtr<WebCore::Range> range = frame->selection().rangeByExtendingCurrentSelection(amount);
+ return kit(range.get());
+}
+
+- (void)selectNSRange:(NSRange)range onElement:(DOMElement *)element
+{
+ WebCore::Frame *frame = core(self);
+
+ Document *doc = frame->document();
+ if (!doc)
+ return;
+
+ Node *node = core(element);
+ if (!node->inDocument())
+ return;
+
+ frame->selection().selectRangeOnElement(range.location, range.length, node);
+}
+
+- (DOMRange *)markedTextDOMRange
+{
+ WebCore::Frame *frame = core(self);
+ if (!frame)
+ return nil;
+
+ return kit(frame->editor().compositionRange().get());
+}
+
+- (void)setMarkedText:(NSString *)text selectedRange:(NSRange)newSelRange
+{
+ WebCore::Frame *frame = core(self);
+ if (!frame)
+ return;
+
+ Vector<CompositionUnderline> underlines;
+ frame->page()->chrome().client().suppressFormNotifications();
+ frame->editor().setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
+ frame->page()->chrome().client().restoreFormNotifications();
+}
+
+- (void)setMarkedText:(NSString *)text forCandidates:(BOOL)forCandidates
+{
+ WebCore::Frame *frame = core(self);
+ if (!frame)
+ return;
+
+ Vector<CompositionUnderline> underlines;
+ frame->editor().setComposition(text, underlines, 0, [text length]);
+}
+
+- (void)confirmMarkedText:(NSString *)text
+{
+ WebCore::Frame *frame = core(self);
+ if (!frame || !frame->editor().client())
+ return;
+
+ frame->page()->chrome().client().suppressFormNotifications();
+ if (text)
+ frame->editor().confirmComposition(text);
+ else
+ frame->editor().confirmMarkedText();
+ frame->page()->chrome().client().restoreFormNotifications();
+}
+
+- (void)setText:(NSString *)text asChildOfElement:(DOMElement *)element
+{
+ if (!element)
+ return;
+
+ WebCore::Frame *frame = core(self);
+ if (!frame || !frame->document())
+ return;
+
+ frame->editor().setTextAsChildOfElement(text, core(element));
+}
+
+- (void)setDictationPhrases:(NSArray *)dictationPhrases metadata:(id)metadata asChildOfElement:(DOMElement *)element
+{
+ if (!element)
+ return;
+
+ WebCore::Frame *frame = core(self);
+ if (!frame)
+ return;
+
+ frame->editor().setDictationPhrasesAsChildOfElement(vectorForDictationPhrasesArray(dictationPhrases), metadata, core(element));
+}
+
+- (NSArray *)interpretationsForCurrentRoot
+{
+ return core(self)->interpretationsForCurrentRoot();
+}
+
+// Collects the ranges and metadata for all of the mars voltas in the root editable element.
+- (void)getDictationResultRanges:(NSArray **)outRanges andMetadatas:(NSArray **)outMetadatas
+{
+ ASSERT(outRanges);
+ if (!outRanges)
+ return;
+
+ // *outRanges should not already point to an array.
+ ASSERT(!(*outRanges));
+ *outRanges = nil;
+
+ ASSERT(outMetadatas);
+ if (!outMetadatas)
+ return;
+
+ // *metadata should not already point to an array.
+ ASSERT(!(*outMetadatas));
+ *outMetadatas = nil;
+
+ NSMutableArray *ranges = [NSMutableArray array];
+ NSMutableArray *metadatas = [NSMutableArray array];
+
+ Frame *frame = core(self);
+ Document *document = frame->document();
+
+ Element *root = frame->selection().selectionType() == VisibleSelection::NoSelection ? frame->document()->body() : frame->selection().rootEditableElement();
+
+ DOMRange *previousDOMRange = nil;
+ id previousMetadata = nil;
+
+ for (Node* node = root; node; node = NodeTraversal::next(node)) {
+ Vector<DocumentMarker*> markers = document->markers().markersFor(node);
+ Vector<DocumentMarker*>::const_iterator end = markers.end();
+ for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) {
+
+ if ((*it)->type() != DocumentMarker::DictationResult)
+ continue;
+
+ const DocumentMarker* marker = *it;
+ id metadata = marker->metadata();
+
+ // All result markers should have metadata.
+ ASSERT(metadata);
+ if (!metadata)
+ continue;
+
+ RefPtr<Range> range = Range::create(*document, node, marker->startOffset(), node, marker->endOffset());
+ DOMRange *domRange = kit(range.get());
+
+ if (metadata != previousMetadata) {
+ [metadatas addObject:metadata];
+ [ranges addObject:domRange];
+ previousMetadata = metadata;
+ previousDOMRange = domRange;
+ } else {
+ // It is possible for a DocumentMarker to be split by editing. Adjacent markers with the
+ // the same metadata are for the same result. So combine their ranges.
+ ASSERT(previousDOMRange == [ranges lastObject]);
+ [previousDOMRange retain];
+ [ranges removeLastObject];
+ DOMNode *startContainer = [domRange startContainer];
+ int startOffset = [domRange startOffset];
+ [previousDOMRange setEnd:startContainer offset:startOffset];
+ [ranges addObject:previousDOMRange];
+ [previousDOMRange release];
+ }
+ }
+ }
+
+ *outRanges = ranges;
+ *outMetadatas = metadatas;
+
+ return;
+}
+
+- (id)dictationResultMetadataForRange:(DOMRange *)range
+{
+ if (!range)
+ return nil;
+
+ Vector<DocumentMarker*> markers = core(self)->document()->markers().markersInRange(core(range), DocumentMarker::DictationResult);
+
+ // UIKit should only ever give us a DOMRange for a phrase with alternatives, which should not be part of more than one result.
+ ASSERT(markers.size() <= 1);
+ if (markers.size() == 0)
+ return nil;
+
+ return markers[0]->metadata();
+}
+
+- (void)recursiveSetUpdateAppearanceEnabled:(BOOL)enabled
+{
+ WebCore::Frame *frame = core(self);
+ if (frame)
+ frame->recursiveSetUpdateAppearanceEnabled(enabled);
+}
+
+// WebCoreFrameBridge methods used by iOS applications and frameworks
+// FIXME: WebCoreFrameBridge is long gone. Can we remove these methods?
+
++ (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName
+{
+ WebCore::TextEncoding encoding(textEncodingName);
+ if (!encoding.isValid())
+ encoding = WindowsLatin1Encoding();
+ return encoding.decode(reinterpret_cast<const char*>([data bytes]), [data length]);
+}
+
+- (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity
+{
+ return [self _caretRectAtPosition:createLegacyEditingPosition(core(node), offset) affinity:affinity];
+}
+
+- (DOMRange *)characterRangeAtPoint:(NSPoint)point
+{
+ return [self _characterRangeAtPoint:point];
+}
+
+- (NSRange)convertDOMRangeToNSRange:(DOMRange *)range
+{
+ return [self _convertDOMRangeToNSRange:range];
+}
+
+- (DOMRange *)convertNSRangeToDOMRange:(NSRange)nsrange
+{
+ return [self _convertNSRangeToDOMRange:nsrange];
+}
+
+- (NSRect)firstRectForDOMRange:(DOMRange *)range
+{
+ return [self _firstRectForDOMRange:range];
+}
+
+- (CTFontRef)fontForSelection:(BOOL *)hasMultipleFonts
+{
+ bool multipleFonts = false;
+ CTFontRef font = nil;
+ if (_private->coreFrame) {
+ const SimpleFontData* fd = _private->coreFrame->editor().fontForSelection(multipleFonts);
+ if (fd)
+ font = fd->getCTFont();
+ }
+
+ if (hasMultipleFonts)
+ *hasMultipleFonts = multipleFonts;
+ return font;
+}
+
+- (void)sendScrollEvent
+{
+ ASSERT(WebThreadIsLockedOrDisabled());
+ _private->coreFrame->eventHandler().sendScrollEvent();
+}
+
+- (void)_userScrolled
+{
+ ASSERT(WebThreadIsLockedOrDisabled());
+ if (FrameView* view = _private->coreFrame->view())
+ view->setWasScrolledByUser(true);
+}
+
+- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture
+{
+ return [self _stringByEvaluatingJavaScriptFromString:string forceUserGesture:forceUserGesture];
+}
+
+- (NSString *)stringForRange:(DOMRange *)range
+{
+ return [self _stringForRange:range];
+}
+
+//
+// FIXME: We needed to add this method for iOS due to the opensource version's inclusion of
+// matchStyle:YES. It seems odd that we should need to explicitly match style, given that the
+// fragment is being made out of plain text, which shouldn't be carrying any style of its own.
+// When we paste that it will pick up its style from the surrounding content. What else would
+// we expect? If we flipped that matchStyle bit to NO, we could probably just get rid
+// of this method, and call the standard WebKit version.
+//
+// There's a second problem here, too, which is that ReplaceSelectionCommand sometimes adds
+// redundant style.
+//
+- (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle
+{
+ RefPtr<Range> range = _private->coreFrame->selection().toNormalizedRange();
+
+ DOMDocumentFragment* fragment = range ? kit(createFragmentFromText(*range, text).get()) : nil;
+ [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:matchStyle];
+}
+
+- (void)_replaceSelectionWithWebArchive:(WebArchive *)webArchive selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace
+{
+ NSArray* subresources = [webArchive subresources];
+ for (WebResource* subresource in subresources) {
+ if (![[self dataSource] subresourceForURL:[subresource URL]])
+ [[self dataSource] addSubresource:subresource];
+ }
+
+ DOMDocumentFragment* fragment = [[self dataSource] _documentFragmentWithArchive:webArchive];
+ [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO];
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span><span class="cx"> - (void)resetTextAutosizingBeforeLayout
</span><span class="cx"> {
</span><span class="lines">@@ -990,6 +1902,18 @@
</span><span class="cx"> _private->coreFrame->editor().replaceSelectionWithFragment(core(fragment), selectReplacement, smartReplace, matchStyle);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)removeUnchangeableStyles
+{
+ _private->coreFrame->editor().removeUnchangeableStyles();
+}
+
+- (BOOL)hasRichlyEditableSelection
+{
+ return _private->coreFrame->selection().isContentRichlyEditable();
+}
+#endif
+
</ins><span class="cx"> - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace
</span><span class="cx"> {
</span><span class="cx"> RefPtr<Range> range = _private->coreFrame->selection().toNormalizedRange();
</span><span class="lines">@@ -1004,6 +1928,7 @@
</span><span class="cx"> [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Determines whether whitespace needs to be added around aString to preserve proper spacing and
</span><span class="cx"> // punctuation when it's inserted into the receiver's text over charRange. Returns by reference
</span><span class="cx"> // in beforeString and afterString any whitespace that should be added, unless either or both are
</span><span class="lines">@@ -1061,6 +1986,7 @@
</span><span class="cx"> if (afterString && addTrailingSpace && !hasWhitespaceAtEnd)
</span><span class="cx"> *afterString = @" ";
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (NSMutableDictionary *)_cacheabilityDictionary
</span><span class="cx"> {
</span><span class="lines">@@ -1158,6 +2084,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)setAllowsScrollersToOverlapContent:(BOOL)flag
</span><span class="cx"> {
</span><span class="cx"> ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]);
</span><span class="lines">@@ -1174,6 +2101,7 @@
</span><span class="cx"> ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]);
</span><span class="cx"> [(WebDynamicScrollBarsView *)[[self frameView] _scrollView] setAlwaysHideVerticalScroller:flag];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)setAccessibleName:(NSString *)name
</span><span class="cx"> {
</span><span class="lines">@@ -1206,7 +2134,9 @@
</span><span class="cx"> #if HAVE(ACCESSIBILITY)
</span><span class="cx"> if (!AXObjectCache::accessibilityEnabled()) {
</span><span class="cx"> AXObjectCache::enableAccessibility();
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> AXObjectCache::setEnhancedUserInterfaceAccessibility([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue]);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!_private->coreFrame)
</span><span class="lines">@@ -1274,6 +2204,59 @@
</span><span class="cx"> return pages;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (DOMDocumentFragment *)_documentFragmentForText:(NSString *)text
+{
+ return kit(createFragmentFromText(*_private->coreFrame->selection().toNormalizedRange().get(), text).get());
+}
+
+- (DOMDocumentFragment *)_documentFragmentForWebArchive:(WebArchive *)webArchive
+{
+ return [[self dataSource] _documentFragmentWithArchive:webArchive];
+}
+
+- (DOMDocumentFragment *)_documentFragmentForImageData:(NSData *)data withRelativeURLPart:(NSString *)relativeURLPart andMIMEType:(NSString *)mimeType
+{
+ WebResource *resource = [[WebResource alloc] initWithData:data
+ URL:[NSURL uniqueURLWithRelativePart:relativeURLPart]
+ MIMEType:mimeType
+ textEncodingName:nil
+ frameName:nil];
+ DOMDocumentFragment *fragment = [[self _dataSource] _documentFragmentWithImageResource:resource];
+ [resource release];
+ return fragment;
+}
+
+- (BOOL)focusedNodeHasContent
+{
+ Frame* coreFrame = _private->coreFrame;
+
+ Element* root;
+ if (coreFrame->selection().isNone() || !coreFrame->selection().isContentEditable())
+ root = coreFrame->document()->body();
+ else {
+ // Can't use the focusedNode here because we want the root of the shadow tree for form elements.
+ root = coreFrame->selection().rootEditableElement();
+ }
+ // Early return to avoid the expense of creating VisiblePositions.
+ // FIXME: We fail to compute a root for SVG, we have a null check here so that we don't crash.
+ if (!root || !root->hasChildNodes())
+ return NO;
+
+ VisiblePosition first(createLegacyEditingPosition(root, 0));
+ VisiblePosition last(createLegacyEditingPosition(root, root->childNodeCount()));
+ return first != last;
+}
+
+- (void)_dispatchDidReceiveTitle:(NSString *)title
+{
+ Frame* coreFrame = _private->coreFrame;
+ if (!coreFrame)
+ return;
+ coreFrame->loader().client().dispatchDidReceiveTitle(StringWithDirection(title, LTR));
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (JSValueRef)jsWrapperForNode:(DOMNode *)node inScriptWorld:(WebScriptWorld *)world
</span><span class="cx"> {
</span><span class="cx"> Frame* coreFrame = _private->coreFrame;
</span><span class="lines">@@ -1437,8 +2420,10 @@
</span><span class="cx">
</span><span class="cx"> - (void)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL unreachableURL:(NSURL *)unreachableURL
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!pthread_main_np())
</span><span class="cx"> return [[self _webkit_invokeOnMainThread] _loadData:data MIMEType:MIMEType textEncodingName:encodingName baseURL:baseURL unreachableURL:unreachableURL];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> URL responseURL;
</span><span class="cx"> if (!baseURL) {
</span><span class="lines">@@ -1448,8 +2433,10 @@
</span><span class="cx">
</span><span class="cx"> ResourceRequest request([baseURL absoluteURL]);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // hack because Mail checks for this property to detect data / archive loads
</span><span class="cx"> [NSURLProtocol setProperty:@"" forKey:@"WebDataRequest" inRequest:(NSMutableURLRequest *)request.nsURLRequest(UpdateHTTPBody)];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> SubstituteData substituteData(WebCore::SharedBuffer::wrapNSData(data), MIMEType, encodingName, [unreachableURL absoluteURL], responseURL);
</span><span class="cx">
</span><span class="lines">@@ -1501,9 +2488,11 @@
</span><span class="cx">
</span><span class="cx"> - (void)reload
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_RELOAD_FROM_ORIGIN) && applicationIsSafari())
</span><span class="cx"> _private->coreFrame->loader().reload(GetCurrentKeyModifiers() & shiftKey);
</span><span class="cx"> else
</span><ins>+#endif
</ins><span class="cx"> _private->coreFrame->loader().reload(false);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFrameInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrameInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrameInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFrameInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -84,6 +84,9 @@
</span><span class="cx"> BOOL includedInWebKitStatistics;
</span><span class="cx"> RetainPtr<NSString> url;
</span><span class="cx"> RetainPtr<NSString> provisionalURL;
</span><ins>+#if PLATFORM(IOS)
+ BOOL isCommitting;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="lines">@@ -121,6 +124,13 @@
</span><span class="cx"> // should be used instead.
</span><span class="cx"> - (WebDataSource *)_dataSource;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (void)_createMainFrameWithSimpleHTMLDocumentWithPage:(WebCore::Page*)page frameView:(WebFrameView *)frameView style:(NSString *)style;
+
+- (BOOL)_isCommitting;
+- (void)_setIsCommitting:(BOOL)value;
+#endif
+
</ins><span class="cx"> - (BOOL)_needsLayout;
</span><span class="cx"> - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly;
</span><span class="cx"> - (BOOL)_getVisibleRect:(NSRect*)rect;
</span><span class="lines">@@ -137,8 +147,13 @@
</span><span class="cx"> - (NSRect)_caretRectAtPosition:(const WebCore::Position&)pos affinity:(NSSelectionAffinity)affinity;
</span><span class="cx"> - (NSRect)_firstRectForDOMRange:(DOMRange *)range;
</span><span class="cx"> - (void)_scrollDOMRangeToVisible:(DOMRange *)range;
</span><ins>+#if PLATFORM(IOS)
+- (void)_scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset;
+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::FrameSelection::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity;
</span><ins>+#endif
</ins><span class="cx"> - (NSRange)_convertToNSRange:(WebCore::Range*)range;
</span><span class="cx"> - (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFrameViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrameView.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrameView.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFrameView.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -69,18 +69,36 @@
</span><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="cx"> #import <wtf/Assertions.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebFrameInternal.h"
+#import "WebPDFViewIOS.h"
+#import "WebUIKitDelegate.h"
+#import <Foundation/NSURLRequest.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/KeyEventCodesIOS.h>
+#import <WebCore/MainFrame.h>
+#import <WebCore/WAKClipView.h>
+#import <WebCore/WAKScrollView.h>
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WKGraphics.h>
+#import <WebCore/WebEvent.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSWindow (WindowPrivate)
</span><span class="cx"> - (BOOL)_needsToResetDragMargins;
</span><span class="cx"> - (void)_setNeedsToResetDragMargins:(BOOL)s;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @interface NSClipView (AppKitSecretsIKnow)
</span><span class="cx"> - (BOOL)_scrollTo:(const NSPoint *)newOrigin animate:(BOOL)animate; // need the boolean result from this method
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> @interface NSView (Details)
</span><span class="cx"> - (void)setBackgroundColor:(NSColor *)color;
</span><span class="cx"> @end
</span><span class="lines">@@ -143,6 +161,7 @@
</span><span class="cx"> core([self _webView])->dragController().setDidInitiateDrag(false);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [sv setSuppressLayout:YES];
</span><span class="cx">
</span><span class="cx"> // If the old view is the first responder, transfer first responder status to the new view as
</span><span class="lines">@@ -154,12 +173,25 @@
</span><span class="cx"> // Suppress the resetting of drag margins since we know we can't affect them.
</span><span class="cx"> BOOL resetDragMargins = [window _needsToResetDragMargins];
</span><span class="cx"> [window _setNeedsToResetDragMargins:NO];
</span><ins>+#endif
</ins><span class="cx"> [sv setDocumentView:view];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [window _setNeedsToResetDragMargins:resetDragMargins];
</span><span class="cx">
</span><span class="cx"> if (makeNewViewFirstResponder)
</span><span class="cx"> [window makeFirstResponder:view];
</span><span class="cx"> [sv setSuppressLayout:NO];
</span><ins>+#else
+ ASSERT(_private->webFrame);
+
+ Frame* frame = core(_private->webFrame);
+
+ ASSERT(frame);
+ ASSERT(frame->page());
+
+ if (frame == &frame->page()->mainFrame())
+ [[self window] makeFirstResponder:[self documentView]];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -(NSView <WebDocumentView> *)_makeDocumentViewForDataSource:(WebDataSource *)dataSource
</span><span class="lines">@@ -243,7 +275,13 @@
</span><span class="cx"> // Since this is a "secret default" we don't bother registering it.
</span><span class="cx"> BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
</span><span class="cx"> if (!omitPDFSupport)
</span><ins>+#if PLATFORM(IOS)
+#define WebPDFView ([WebView _getPDFViewClass])
+#endif
</ins><span class="cx"> addTypesFromClass(viewTypes, [WebPDFView class], [WebPDFView supportedMIMETypes]);
</span><ins>+#if PLATFORM(IOS)
+#undef WebPDFView
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!addedImageTypes && !allowImageTypeOmission) {
</span><span class="lines">@@ -267,7 +305,14 @@
</span><span class="cx">
</span><span class="cx"> - (Class)_viewClassForMIMEType:(NSString *)MIMEType
</span><span class="cx"> {
</span><del>- return [[self class] _viewClassForMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
</del><ins>+ Class retVal = [[self class] _viewClassForMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
+
+#if PLATFORM(IOS)
+ if ([retVal respondsToSelector:@selector(_representationClassForWebFrame:)])
+ retVal = [retVal performSelector:@selector(_representationClassForWebFrame:) withObject:[self webFrame]];
+#endif
+
+ return retVal;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_install
</span><span class="lines">@@ -327,6 +372,7 @@
</span><span class="cx"> // Note: We also do this in WebHistoryItem's init method.
</span><span class="cx"> WebCore::notifyHistoryItemChanged = WKNotifyHistoryItemChanged;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Remove the NSAppKitVersionNumberWithDeferredWindowDisplaySupport check once
</span><span class="cx"> // once AppKit's Deferred Window Display support is available.
</span><span class="cx"> #if !defined(NSAppKitVersionNumberWithDeferredWindowDisplaySupport)
</span><span class="lines">@@ -341,13 +387,18 @@
</span><span class="cx"> bool throwExceptionsForRoundTwo = WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_ROUND_TWO_MAIN_THREAD_EXCEPTIONS);
</span><span class="cx"> if (!throwExceptionsForRoundTwo)
</span><span class="cx"> setDefaultThreadViolationBehavior(LogOnFirstThreadViolation, ThreadViolationRoundTwo);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _private = [[WebFrameViewPrivate alloc] init];
</span><span class="cx">
</span><span class="cx"> WebDynamicScrollBarsView *scrollView = [[WebDynamicScrollBarsView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frame.size.width, frame.size.height)];
</span><span class="cx"> _private->frameScrollView = scrollView;
</span><ins>+#if PLATFORM(IOS)
+ [scrollView setDelegate:self];
+#else
</ins><span class="cx"> [scrollView setContentView:[[[WebClipView alloc] initWithFrame:[scrollView bounds]] autorelease]];
</span><ins>+#endif
</ins><span class="cx"> [scrollView setDrawsBackground:NO];
</span><span class="cx"> [scrollView setHasVerticalScroller:NO];
</span><span class="cx"> [scrollView setHasHorizontalScroller:NO];
</span><span class="lines">@@ -382,6 +433,14 @@
</span><span class="cx"> [super finalize];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)scrollView:(WAKScrollView *)scrollView shouldScrollToPoint:(CGPoint)point
+{
+ WebView *webView = [self _webView];
+ return [[webView _UIKitDelegateForwarder] webView:webView shouldScrollToPoint:point forFrame:_private->webFrame];
+}
+#endif
+
</ins><span class="cx"> - (WebFrame *)webFrame
</span><span class="cx"> {
</span><span class="cx"> // This method can be called beneath -[NSView dealloc] after _private has been cleared.
</span><span class="lines">@@ -460,23 +519,40 @@
</span><span class="cx">
</span><span class="cx"> - (void)drawRect:(NSRect)rect
</span><span class="cx"> {
</span><del>- if (![self documentView]) {
</del><ins>+#if !PLATFORM(IOS)
+ if (![self documentView])
+#else
+ if (![self documentView] || [[self documentView] frame].size.height == 0 || [[self webFrame] _isCommitting])
+#endif
+ {
</ins><span class="cx"> // Need to paint ourselves if there's no documentView to do it instead.
</span><span class="cx"> if ([[self _webView] drawsBackground]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[[self _webView] backgroundColor] set];
</span><span class="cx"> NSRectFill(rect);
</span><ins>+#else
+ CGContextRef cgContext = WKGetCurrentGraphicsContext();
+ setStrokeAndFillColor(cgContext, cachedCGColor(Color::white, ColorSpaceDeviceRGB));
+ WKRectFill(cgContext, rect);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> if ([[self _scrollView] drawsBackground]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSColor cyanColor] set];
</span><span class="cx"> NSRectFill(rect);
</span><ins>+#else
+ CGContextRef cgContext = WKGetCurrentGraphicsContext();
+ setStrokeAndFillColor(cgContext, cachedCGColor(Color::cyan, ColorSpaceDeviceRGB));
+ WKRectFill(cgContext, rect);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> - (BOOL)wantsUpdateLayer
</span><span class="cx"> {
</span><span class="cx"> return YES;
</span><span class="lines">@@ -789,6 +865,9 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_firstResponderIsFormControl
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> NSResponder *firstResponder = [[self window] firstResponder];
</span><span class="cx">
</span><span class="cx"> // WebHTMLView is an NSControl subclass these days, but it's not a form control
</span><span class="lines">@@ -796,9 +875,38 @@
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx"> return [firstResponder isKindOfClass:[NSControl class]];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+// Unlike OS X WebKit, on iOS, unhandled mouse events are forwarded to allow for scrolling.
+// Since mouse events were forwarded to this WebFrameView, this means that the subviews didn't
+// handle the event. Pass the events to the next scroll view.
+- (void)_forwardMouseEvent:(WebEvent *)event
+{
+ WAKView *superview = [self superview];
+ if ([superview conformsToProtocol:@protocol(WebDocumentView)])
+ [[[superview _web_parentWebFrameView] _scrollView] handleEvent:event];
+ else
+ [[self nextResponder] handleEvent:event];
+}
+
+- (void)mouseDown:(WebEvent *)event
+{
+ [self _forwardMouseEvent:event];
+}
+
+- (void)mouseUp:(WebEvent *)event
+{
+ [self _forwardMouseEvent:event];
+}
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)keyDown:(NSEvent *)event
</span><ins>+#else
+- (void)keyDown:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><span class="cx"> // Implement common browser behaviors for all kinds of content.
</span><span class="cx">
</span><span class="lines">@@ -807,7 +915,13 @@
</span><span class="cx"> // This doesn't work automatically because most of the keys handled here are translated into moveXXX commands, which are not handled
</span><span class="cx"> // by Editor when focus is not in editable content.
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *characters = [event characters];
</span><ins>+ int modifierFlags = [event modifierFlags];
+#else
+ NSString *characters = event.characters;
+ int modifierFlags = event.modifierFlags;
+#endif
</ins><span class="cx"> int index, count;
</span><span class="cx"> BOOL callSuper = YES;
</span><span class="cx"> Frame* coreFrame = [self _web_frame];
</span><span class="lines">@@ -823,7 +937,7 @@
</span><span class="cx"> }
</span><span class="cx"> // This odd behavior matches some existing browsers,
</span><span class="cx"> // including Windows IE
</span><del>- if ([event modifierFlags] & NSShiftKeyMask) {
</del><ins>+ if (modifierFlags & NSShiftKeyMask) {
</ins><span class="cx"> [self _goForward];
</span><span class="cx"> } else {
</span><span class="cx"> [self _goBack];
</span><span class="lines">@@ -838,7 +952,7 @@
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- if ([event modifierFlags] & NSShiftKeyMask) {
</del><ins>+ if (modifierFlags & NSShiftKeyMask) {
</ins><span class="cx"> [self scrollPageUp:nil];
</span><span class="cx"> } else {
</span><span class="cx"> [self scrollPageDown:nil];
</span><span class="lines">@@ -879,10 +993,11 @@
</span><span class="cx"> break;
</span><span class="cx"> case NSUpArrowFunctionKey:
</span><span class="cx"> // We don't handle shifted or control-arrow keys here, so let super have a chance.
</span><del>- if ([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+ if (modifierFlags & (NSShiftKeyMask | NSControlKeyMask)) {
</ins><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ((![self allowsScrolling] && ![self _largestScrollableChild]) ||
</span><span class="cx"> [[[self window] firstResponder] isKindOfClass:[NSPopUpButton class]]) {
</span><span class="cx"> // Let arrow keys go through to pop up buttons
</span><span class="lines">@@ -891,9 +1006,10 @@
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- if ([event modifierFlags] & NSCommandKeyMask) {
</del><ins>+#endif
+ if (modifierFlags & NSCommandKeyMask) {
</ins><span class="cx"> [self scrollToBeginningOfDocument:nil];
</span><del>- } else if ([event modifierFlags] & NSAlternateKeyMask) {
</del><ins>+ } else if (modifierFlags & NSAlternateKeyMask) {
</ins><span class="cx"> [self scrollPageUp:nil];
</span><span class="cx"> } else {
</span><span class="cx"> [self scrollLineUp:nil];
</span><span class="lines">@@ -902,10 +1018,11 @@
</span><span class="cx"> break;
</span><span class="cx"> case NSDownArrowFunctionKey:
</span><span class="cx"> // We don't handle shifted or control-arrow keys here, so let super have a chance.
</span><del>- if ([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+ if (modifierFlags & (NSShiftKeyMask | NSControlKeyMask)) {
</ins><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ((![self allowsScrolling] && ![self _largestScrollableChild]) ||
</span><span class="cx"> [[[self window] firstResponder] isKindOfClass:[NSPopUpButton class]]) {
</span><span class="cx"> // Let arrow keys go through to pop up buttons
</span><span class="lines">@@ -914,9 +1031,10 @@
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- if ([event modifierFlags] & NSCommandKeyMask) {
</del><ins>+#endif
+ if (modifierFlags & NSCommandKeyMask) {
</ins><span class="cx"> [self scrollToEndOfDocument:nil];
</span><del>- } else if ([event modifierFlags] & NSAlternateKeyMask) {
</del><ins>+ } else if (modifierFlags & NSAlternateKeyMask) {
</ins><span class="cx"> [self scrollPageDown:nil];
</span><span class="cx"> } else {
</span><span class="cx"> [self scrollLineDown:nil];
</span><span class="lines">@@ -925,12 +1043,12 @@
</span><span class="cx"> break;
</span><span class="cx"> case NSLeftArrowFunctionKey:
</span><span class="cx"> // We don't handle shifted or control-arrow keys here, so let super have a chance.
</span><del>- if ([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+ if (modifierFlags & (NSShiftKeyMask | NSControlKeyMask)) {
</ins><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> // Check back/forward related keys.
</span><del>- if ([event modifierFlags] & NSCommandKeyMask) {
</del><ins>+ if (modifierFlags & NSCommandKeyMask) {
</ins><span class="cx"> if (!maintainsBackForwardList) {
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="lines">@@ -943,7 +1061,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ([event modifierFlags] & NSAlternateKeyMask) {
</del><ins>+ if (modifierFlags & NSAlternateKeyMask) {
</ins><span class="cx"> [self _pageHorizontally:YES];
</span><span class="cx"> } else {
</span><span class="cx"> [self _scrollLineHorizontally:YES];
</span><span class="lines">@@ -953,12 +1071,12 @@
</span><span class="cx"> break;
</span><span class="cx"> case NSRightArrowFunctionKey:
</span><span class="cx"> // We don't handle shifted or control-arrow keys here, so let super have a chance.
</span><del>- if ([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+ if (modifierFlags & (NSShiftKeyMask | NSControlKeyMask)) {
</ins><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> // Check back/forward related keys.
</span><del>- if ([event modifierFlags] & NSCommandKeyMask) {
</del><ins>+ if (modifierFlags & NSCommandKeyMask) {
</ins><span class="cx"> if (!maintainsBackForwardList) {
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> break;
</span><span class="lines">@@ -971,7 +1089,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ([event modifierFlags] & NSAlternateKeyMask) {
</del><ins>+ if (modifierFlags & NSAlternateKeyMask) {
</ins><span class="cx"> [self _pageHorizontally:NO];
</span><span class="cx"> } else {
</span><span class="cx"> [self _scrollLineHorizontally:NO];
</span><span class="lines">@@ -996,6 +1114,7 @@
</span><span class="cx"> return view ? [view _webcore_effectiveFirstResponder] : [super _webcore_effectiveFirstResponder];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)canPrintHeadersAndFooters
</span><span class="cx"> {
</span><span class="cx"> NSView *documentView = [[self _scrollView] documentView];
</span><span class="lines">@@ -1016,6 +1135,7 @@
</span><span class="cx"> }
</span><span class="cx"> return [NSPrintOperation printOperationWithView:documentView printInfo:printInfo];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)documentViewShouldHandlePrint
</span><span class="cx"> {
</span><span class="lines">@@ -1045,8 +1165,12 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_isScrollable
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebDynamicScrollBarsView *scrollView = [self _scrollView];
</span><span class="cx"> return [scrollView horizontalScrollingAllowed] || [scrollView verticalScrollingAllowed];
</span><ins>+#else
+ return [self _hasScrollBars];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WebFrameView *)_largestScrollableChild
</span><span class="lines">@@ -1125,6 +1249,7 @@
</span><span class="cx"> return [_private->frameScrollView class];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setCustomScrollViewClass:(Class)customClass
</span><span class="cx"> {
</span><span class="cx"> if (!customClass)
</span><span class="lines">@@ -1161,5 +1286,6 @@
</span><span class="cx"> [oldScrollView release];
</span><span class="cx"> [documentView release];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFullScreenControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#if ENABLE(FULLSCREEN_API)
</del><ins>+#if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> #import <WebCore/IntPoint.h>
</span><span class="cx"> #import <wtf/OwnPtr.h>
</span><span class="lines">@@ -73,4 +73,4 @@
</span><span class="cx"> - (void)close;
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-#endif // ENABLE(FULLSCREEN_API)
</del><ins>+#endif // ENABLE(FULLSCREEN_API) && !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFullScreenControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#if ENABLE(FULLSCREEN_API)
</del><ins>+#if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> #import "WebFullScreenController.h"
</span><span class="cx">
</span><span class="lines">@@ -578,4 +578,4 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx">
</span><del>-#endif /* ENABLE(FULLSCREEN_API) */
</del><ins>+#endif /* ENABLE(FULLSCREEN_API) && !PLATFORM(IOS) */
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLRepresentationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -266,6 +266,7 @@
</span><span class="cx"> return [[_private->dataSource webFrame] DOMDocument];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSAttributedString *)attributedText
</span><span class="cx"> {
</span><span class="cx"> // FIXME: Implement
</span><span class="lines">@@ -276,6 +277,7 @@
</span><span class="cx"> {
</span><span class="cx"> return [WebHTMLConverter editingAttributedStringFromRange:Range::create(core(startNode)->document(), core(startNode), startOffset, core(endNode), endOffset).get()];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static HTMLFormElement* formElementFromDOMElement(DOMElement *element)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -71,8 +71,6 @@
</span><span class="cx"> #import "WebTypesInternal.h"
</span><span class="cx"> #import "WebUIDelegatePrivate.h"
</span><span class="cx"> #import "WebViewInternal.h"
</span><del>-#import <AppKit/NSAccessibility.h>
-#import <ApplicationServices/ApplicationServices.h>
</del><span class="cx"> #import <WebCore/CSSStyleDeclaration.h>
</span><span class="cx"> #import <WebCore/CachedImage.h>
</span><span class="cx"> #import <WebCore/CachedResourceClient.h>
</span><span class="lines">@@ -106,7 +104,6 @@
</span><span class="cx"> #import <WebCore/MIMETypeRegistry.h>
</span><span class="cx"> #import <WebCore/MainFrame.h>
</span><span class="cx"> #import <WebCore/Page.h>
</span><del>-#import <WebCore/PlatformEventFactoryMac.h>
</del><span class="cx"> #import <WebCore/Range.h>
</span><span class="cx"> #import <WebCore/RenderView.h>
</span><span class="cx"> #import <WebCore/RenderWidget.h>
</span><span class="lines">@@ -136,10 +133,34 @@
</span><span class="cx"> #import <QuartzCore/QuartzCore.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+#import <AppKit/NSAccessibility.h>
+#import <ApplicationServices/ApplicationServices.h>
+#import <WebCore/PlatformEventFactoryMac.h>
+#endif
+
+#if PLATFORM(IOS)
+#import "WebUIKitDelegate.h"
+#import <WebCore/KeyEventCodesIOS.h>
+#import <WebCore/PlatformEventFactoryIOS.h>
+#import <WebCore/WAKScrollView.h>
+#import <WebCore/WAKViewPrivate.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WebEvent.h>
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> using namespace WTF;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface NSObject (Accessibility)
+- (id)accessibilityHitTest:(NSPoint)point;
+- (id)accessibilityFocusedUIElement;
+@end
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface WebMenuTarget : NSObject {
</span><span class="cx"> WebCore::ContextMenuController* _menuController;
</span><span class="cx"> }
</span><span class="lines">@@ -236,9 +257,11 @@
</span><span class="cx">
</span><span class="cx"> // if YES, do the "top WebHTMLView" hit test (which we'd like to do all the time but can't because of Java requirements [see bug 4349721])
</span><span class="cx"> static BOOL forceWebHTMLViewHitTest;
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> static WebHTMLView *lastHitView;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool needsCursorRectsSupportAtPoint(NSWindow* window, NSPoint point)
</span><span class="cx"> {
</span><span class="cx"> forceNSViewHitTest = YES;
</span><span class="lines">@@ -269,6 +292,7 @@
</span><span class="cx"> wtfCallIMP<id>(oldSetCursorForMouseLocationIMP, self, cmd, point);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> extern "C" {
</span><span class="cx">
</span><span class="lines">@@ -282,16 +306,22 @@
</span><span class="cx"> @interface NSView (WebNSViewDetails)
</span><span class="cx"> - (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView;
</span><span class="cx"> - (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView;
</span><span class="cx"> - (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx topView:(BOOL)isTopView shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor;
</span><ins>+#endif
</ins><span class="cx"> - (NSRect)_dirtyRect;
</span><span class="cx"> - (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants;
</span><span class="cx"> - (BOOL)_drawnByAncestor;
</span><span class="cx"> - (void)_invalidateGStatesForTree;
</span><span class="cx"> - (void)_propagateDirtyRectsToOpaqueAncestors;
</span><span class="cx"> - (void)_windowChangedKeyState;
</span><ins>+#if PLATFORM(IOS)
+- (void)centerSelectionInVisibleArea:(id)sender;
+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> static IMP oldSetNeedsDisplayInRectIMP;
</span><span class="cx">
</span><span class="lines">@@ -344,6 +374,7 @@
</span><span class="cx"> @interface NSSpellChecker (WebNSSpellCheckerDetails)
</span><span class="cx"> - (void)learnWord:(NSString *)word;
</span><span class="cx"> @end
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> // By imaging to a width a little wider than the available pixels,
</span><span class="cx"> // thin pages will be scaled down a little, matching the way they
</span><span class="lines">@@ -381,14 +412,21 @@
</span><span class="cx"> @implementation WebCoreScrollView
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // We need this to be able to safely reference the CachedImage for the promised drag data
</span><span class="cx"> static CachedImageClient* promisedDataClient()
</span><span class="cx"> {
</span><span class="cx"> static CachedImageClient* staticCachedResourceClient = new CachedImageClient;
</span><span class="cx"> return staticCachedResourceClient;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static NSString * const WebMarkedTextUpdatedNotification = @"WebMarkedTextUpdated";
+#endif
+
</ins><span class="cx"> @interface WebHTMLView (WebHTMLViewFileInternal)
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_imageExistsAtPaths:(NSArray *)paths;
</span><span class="cx"> - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard inContext:(DOMRange *)context allowPlainText:(BOOL)allowPlainText;
</span><span class="cx"> - (NSString *)_plainTextFromPasteboard:(NSPasteboard *)pasteboard;
</span><span class="lines">@@ -397,20 +435,29 @@
</span><span class="cx"> - (void)_removeMouseMovedObserverUnconditionally;
</span><span class="cx"> - (void)_removeSuperviewObservers;
</span><span class="cx"> - (void)_removeWindowObservers;
</span><ins>+#endif
</ins><span class="cx"> - (BOOL)_shouldInsertFragment:(DOMDocumentFragment *)fragment replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
</span><span class="cx"> - (BOOL)_shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
</span><span class="cx"> - (BOOL)_shouldReplaceSelectionWithText:(NSString *)text givenAction:(WebViewInsertAction)action;
</span><span class="cx"> - (DOMRange *)_selectedRange;
</span><span class="cx"> - (BOOL)_shouldDeleteRange:(DOMRange *)range;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSView *)_hitViewForEvent:(NSEvent *)event;
</span><span class="cx"> - (void)_writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard cachedAttributedString:(NSAttributedString *)attributedString;
</span><ins>+#endif
</ins><span class="cx"> - (DOMRange *)_documentRange;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setMouseDownEvent:(NSEvent *)event;
</span><ins>+#else
+- (void)_setMouseDownEvent:(WebEvent *)event;
+#endif
</ins><span class="cx"> - (WebHTMLView *)_topHTMLView;
</span><span class="cx"> - (BOOL)_isTopHTMLView;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_web_setPrintingModeRecursive;
</span><span class="cx"> - (void)_web_setPrintingModeRecursiveAndAdjustViewSize;
</span><span class="cx"> - (void)_web_clearPrintingModeRecursive;
</span><ins>+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface WebHTMLView (WebHTMLViewTextCheckingInternal)
</span><span class="lines">@@ -437,9 +484,12 @@
</span><span class="cx">
</span><span class="cx"> @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick.
</span><span class="cx"> - (void)_setPrinting:(BOOL)printing minimumPageLogicalWidth:(float)minPageWidth logicalHeight:(float)minPageHeight originalPageWidth:(float)pageLogicalWidth originalPageHeight:(float)pageLogicalHeight maximumShrinkRatio:(float)maximumShrinkRatio adjustViewSize:(BOOL)adjustViewSize paginateScreenContent:(BOOL)paginateScreenContent;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_updateSecureInputState;
</span><ins>+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @class NSTextInputContext;
</span><span class="cx"> @interface NSResponder (AppKitDetails)
</span><span class="cx"> - (NSTextInputContext *)inputContext;
</span><span class="lines">@@ -449,14 +499,24 @@
</span><span class="cx"> - (BOOL)wantsToHandleMouseEvents;
</span><span class="cx"> - (BOOL)handleMouseEvent:(NSEvent *)event;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface WebHTMLView (WebNSTextInputSupport) <NSTextInput>
</span><ins>+#else
+@interface WebHTMLView (WebNSTextInputSupport)
+#endif
</ins><span class="cx"> - (void)_updateSelectionForInputManager;
</span><ins>+#if PLATFORM(IOS)
+- (void)doCommandBySelector:(SEL)selector;
+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface WebHTMLView (WebEditingStyleSupport)
</span><span class="cx"> - (DOMCSSStyleDeclaration *)_emptyStyle;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSString *)_colorAsString:(NSColor *)color;
</span><ins>+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface NSView (WebHTMLViewFileInternal)
</span><span class="lines">@@ -481,30 +541,42 @@
</span><span class="cx"> BOOL ignoringMouseDraggedEvents;
</span><span class="cx"> BOOL printing;
</span><span class="cx"> BOOL paginateScreenContent;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL observingMouseMovedNotifications;
</span><span class="cx"> BOOL observingSuperviewNotifications;
</span><span class="cx"> BOOL observingWindowNotifications;
</span><span class="cx">
</span><span class="cx"> id savedSubviews;
</span><span class="cx"> BOOL subviewsSetAside;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> NSView *layerHostingView;
</span><span class="cx"> BOOL drawingIntoLayer;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSEvent *mouseDownEvent; // Kept after handling the event.
</span><ins>+#else
+ WebEvent *mouseDownEvent; // Kept after handling the event.
+#endif
</ins><span class="cx"> BOOL handlingMouseDownEvent;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSEvent *keyDownEvent; // Kept after handling the event.
</span><ins>+#else
+ WebEvent *keyDownEvent; // Kept after handling the event.
+#endif
</ins><span class="cx">
</span><span class="cx"> // A WebHTMLView has a single input context, but we return nil when in non-editable content to avoid making input methods do their work.
</span><span class="cx"> // This state is saved each time selection changes, because computing it causes style recalc, which is not always safe to do.
</span><span class="cx"> BOOL exposeInputContext;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Track whether the view has set a secure input state.
</span><span class="cx"> BOOL isInSecureInputState;
</span><span class="cx">
</span><span class="cx"> BOOL _forceUpdateSecureInputState;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSPoint lastScrollPosition;
</span><span class="cx"> BOOL inScrollPositionChanged;
</span><span class="lines">@@ -512,30 +584,42 @@
</span><span class="cx"> WebPluginController *pluginController;
</span><span class="cx">
</span><span class="cx"> NSString *toolTip;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSToolTipTag lastToolTipTag;
</span><ins>+#endif
</ins><span class="cx"> id trackingRectOwner;
</span><span class="cx"> void *trackingRectUserData;
</span><span class="cx">
</span><span class="cx"> NSTimer *autoscrollTimer;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSEvent *autoscrollTriggerEvent;
</span><ins>+#else
+ WebEvent *autoscrollTriggerEvent;
+#endif
</ins><span class="cx">
</span><span class="cx"> NSArray *pageRects;
</span><span class="cx">
</span><span class="cx"> NSMutableDictionary *highlighters;
</span><span class="cx">
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebTextCompletionController *completionController;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> BOOL transparentBackground;
</span><span class="cx">
</span><span class="cx"> WebHTMLViewInterpretKeyEventsParameters* interpretKeyEventsParameters;
</span><span class="cx">
</span><span class="cx"> WebDataSource *dataSource;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebCore::CachedImage* promisedDragTIFFDataSource;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> SEL selectorForDoCommandBySelector;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSTrackingArea *trackingAreaForNonKeyWindow;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> BOOL enumeratingSubviews;
</span><span class="lines">@@ -544,6 +628,7 @@
</span><span class="cx"> - (void)clear;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static NSCellStateValue kit(TriState state)
</span><span class="cx"> {
</span><span class="cx"> switch (state) {
</span><span class="lines">@@ -557,16 +642,20 @@
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> return NSOffState;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @implementation WebHTMLViewPrivate
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!oldSetCursorForMouseLocationIMP) {
</span><span class="cx"> Method setCursorMethod = class_getInstanceMethod([NSWindow class], @selector(_setCursorForMouseLocation:));
</span><span class="cx"> ASSERT(setCursorMethod);
</span><span class="lines">@@ -583,6 +672,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // USE(ACCELERATED_COMPOSITING)
</span><span class="cx">
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -594,16 +684,27 @@
</span><span class="cx"> ASSERT(!autoscrollTimer);
</span><span class="cx"> ASSERT(!autoscrollTriggerEvent);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [mouseDownEvent release];
</span><span class="cx"> [keyDownEvent release];
</span><ins>+#else
+ if (mouseDownEvent)
+ CFRelease (mouseDownEvent);
+ if (keyDownEvent)
+ CFRelease(keyDownEvent);
+#endif
</ins><span class="cx"> [pluginController release];
</span><span class="cx"> [toolTip release];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [completionController release];
</span><ins>+#endif
</ins><span class="cx"> [dataSource release];
</span><span class="cx"> [highlighters release];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [trackingAreaForNonKeyWindow release];
</span><span class="cx"> if (promisedDragTIFFDataSource)
</span><span class="cx"> promisedDragTIFFDataSource->removeClient(promisedDataClient());
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -612,34 +713,51 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT_MAIN_THREAD();
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (promisedDragTIFFDataSource)
</span><span class="cx"> promisedDragTIFFDataSource->removeClient(promisedDataClient());
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [super finalize];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)clear
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [mouseDownEvent release];
</span><span class="cx"> [keyDownEvent release];
</span><ins>+#else
+ if (mouseDownEvent)
+ CFRelease(mouseDownEvent);
+ if (keyDownEvent)
+ CFRelease(keyDownEvent);
+#endif
</ins><span class="cx"> [pluginController release];
</span><span class="cx"> [toolTip release];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [completionController release];
</span><ins>+#endif
</ins><span class="cx"> [dataSource release];
</span><span class="cx"> [highlighters release];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [trackingAreaForNonKeyWindow release];
</span><span class="cx"> if (promisedDragTIFFDataSource)
</span><span class="cx"> promisedDragTIFFDataSource->removeClient(promisedDataClient());
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> mouseDownEvent = nil;
</span><span class="cx"> keyDownEvent = nil;
</span><span class="cx"> pluginController = nil;
</span><span class="cx"> toolTip = nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> completionController = nil;
</span><ins>+#endif
</ins><span class="cx"> dataSource = nil;
</span><span class="cx"> highlighters = nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> trackingAreaForNonKeyWindow = nil;
</span><span class="cx"> promisedDragTIFFDataSource = 0;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> layerHostingView = nil;
</span><span class="lines">@@ -655,6 +773,7 @@
</span><span class="cx"> return [[[self _frame] DOMDocument] _documentRange];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_imageExistsAtPaths:(NSArray *)paths
</span><span class="cx"> {
</span><span class="cx"> NSEnumerator *enumerator = [paths objectEnumerator];
</span><span class="lines">@@ -668,6 +787,7 @@
</span><span class="cx">
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (WebDataSource *)_dataSource
</span><span class="cx"> {
</span><span class="lines">@@ -684,6 +804,7 @@
</span><span class="cx"> return [[_private->dataSource webFrame] frameView];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (DOMDocumentFragment *)_documentFragmentWithPaths:(NSArray *)paths
</span><span class="cx"> {
</span><span class="cx"> DOMDocumentFragment *fragment;
</span><span class="lines">@@ -939,6 +1060,7 @@
</span><span class="cx">
</span><span class="cx"> _private->observingWindowNotifications = false;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_shouldInsertFragment:(DOMDocumentFragment *)fragment replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
</span><span class="cx"> {
</span><span class="lines">@@ -972,6 +1094,7 @@
</span><span class="cx"> return coreFrame && coreFrame->editor().shouldDeleteRange(core(range));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSView *)_hitViewForEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> // Usually, we hack AK's hitTest method to catch all events at the topmost WebHTMLView.
</span><span class="lines">@@ -981,7 +1104,9 @@
</span><span class="cx"> forceNSViewHitTest = NO;
</span><span class="cx"> return hitView;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard cachedAttributedString:(NSAttributedString *)attributedString
</span><span class="cx"> {
</span><span class="cx"> // Put HTML on the pasteboard.
</span><span class="lines">@@ -1025,10 +1150,19 @@
</span><span class="cx"> [pasteboard setData:nil forType:WebSmartPastePboardType];
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setMouseDownEvent:(NSEvent *)event
</span><ins>+#else
+- (void)_setMouseDownEvent:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown);
</span><ins>+#else
+ ASSERT(!event || event.type == WebEventMouseDown);
+#endif
</ins><span class="cx">
</span><span class="cx"> if (event == _private->mouseDownEvent)
</span><span class="cx"> return;
</span><span class="lines">@@ -1052,6 +1186,7 @@
</span><span class="cx"> return self == [self _topHTMLView];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_web_setPrintingModeRecursive
</span><span class="cx"> {
</span><span class="cx"> [self _setPrinting:YES minimumPageLogicalWidth:0 logicalHeight:0 originalPageWidth:0 originalPageHeight:0 maximumShrinkRatio:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
</span><span class="lines">@@ -1120,6 +1255,7 @@
</span><span class="cx"> _private->enumeratingSubviews = NO;
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="lines">@@ -1145,6 +1281,16 @@
</span><span class="cx"> return [WebHTMLRepresentation unsupportedTextMIMETypes];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)mouseMoved:(WebEvent *)event
+{
+ Frame* frame = core([self _frame]);
+ if (frame)
+ frame->eventHandler().mouseMoved(event);
+}
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent
</span><span class="cx"> {
</span><span class="cx"> // This is a workaround for: <rdar://problem/2981619> NSResponder_Private should include notification for FlagsChanged
</span><span class="lines">@@ -1188,6 +1334,7 @@
</span><span class="cx">
</span><span class="cx"> [self _updateMouseoverWithEvent:fakeEvent];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_frameOrBoundsChanged
</span><span class="cx"> {
</span><span class="lines">@@ -1204,7 +1351,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [_private->completionController endRevertingChange:NO moveLeft:NO];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [[webView _UIDelegateForwarder] webView:webView didScrollDocumentInFrameView:[self _frameView]];
</span><span class="cx"> }
</span><span class="lines">@@ -1213,6 +1362,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)_setAsideSubviews
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!_private->subviewsSetAside);
</span><span class="cx"> ASSERT(_private->savedSubviews == nil);
</span><span class="cx"> _private->savedSubviews = _subviews;
</span><span class="lines">@@ -1227,10 +1377,12 @@
</span><span class="cx"> _subviews = nil;
</span><span class="cx"> #endif
</span><span class="cx"> _private->subviewsSetAside = YES;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_restoreSubviews
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(_private->subviewsSetAside);
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> if (_private->layerHostingView) {
</span><span class="lines">@@ -1246,6 +1398,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> _private->savedSubviews = nil;
</span><span class="cx"> _private->subviewsSetAside = NO;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifndef NDEBUG
</span><span class="lines">@@ -1265,10 +1418,19 @@
</span><span class="cx"> // once the FIXME in _isTopHTMLView is fixed.
</span><span class="cx"> if (_private->dataSource && [self _isTopHTMLView])
</span><span class="cx"> [self _web_updateLayoutAndStyleIfNeededRecursive];
</span><ins>+
+#if PLATFORM(IOS)
+ if (Frame* coreFrame = core([self _frame])) {
+ if (FrameView* coreView = coreFrame->view())
+ coreView->flushDeferredRepaints();
+ }
+#endif
+
</ins><span class="cx"> [super viewWillDraw];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Don't let AppKit even draw subviews. We take care of that.
</span><span class="cx"> - (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView
</span><span class="cx"> {
</span><span class="lines">@@ -1370,12 +1532,14 @@
</span><span class="cx"> if (didSetAsideSubviews)
</span><span class="cx"> [self _restoreSubviews];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_insideAnotherHTMLView
</span><span class="cx"> {
</span><span class="cx"> return self != [self _topHTMLView];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static BOOL isQuickLookEvent(NSEvent *event)
</span><span class="cx"> {
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</span><span class="lines">@@ -1385,6 +1549,7 @@
</span><span class="cx"> return NO;
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSView *)hitTest:(NSPoint)point
</span><span class="cx"> {
</span><span class="lines">@@ -1415,6 +1580,21 @@
</span><span class="cx"> if (_private->closed)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // Preserve <rdar://problem/7992472> behavior for third party applications. See <rdar://problem/8463725>.
+ if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_MULTIPLE_IFRAME_TOUCH_EVENT_DISPATCH)) {
+ WebEvent *event = [WAKWindow currentEvent];
+ if (event != NULL && event.type == WebEventMouseDown && [self mouse:point inRect:[self frame]])
+ return self;
+ NSView *view = [super hitTest:point];
+
+ // Find the clicked document view
+ while (view && ![view conformsToProtocol:@protocol(WebDocumentView)])
+ view = [view superview];
+
+ return view;
+ }
+#else
</ins><span class="cx"> BOOL captureHitsOnSubviews;
</span><span class="cx"> if (forceNSViewHitTest)
</span><span class="cx"> captureHitsOnSubviews = NO;
</span><span class="lines">@@ -1438,6 +1618,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> return hitView;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
+
</ins><span class="cx"> if ([[self superview] mouse:point inRect:[self frame]])
</span><span class="cx"> return self;
</span><span class="cx"> return nil;
</span><span class="lines">@@ -1449,6 +1631,7 @@
</span><span class="cx"> lastHitView = nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSTrackingRectTag)addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside
</span><span class="cx"> {
</span><span class="cx"> ASSERT(_private->trackingRectOwner == nil);
</span><span class="lines">@@ -1540,9 +1723,11 @@
</span><span class="cx"> userData:_private->trackingRectUserData];
</span><span class="cx"> [_private->trackingRectOwner mouseEntered:fakeEvent];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_setToolTip:(NSString *)string
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *toolTip = [string length] == 0 ? nil : string;
</span><span class="cx"> NSString *oldToolTip = _private->toolTip;
</span><span class="cx"> if ((toolTip == nil || oldToolTip == nil) ? toolTip == oldToolTip : [toolTip isEqualToString:oldToolTip]) {
</span><span class="lines">@@ -1560,8 +1745,10 @@
</span><span class="cx"> _private->lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL];
</span><span class="cx"> [self _sendToolTipMouseEntered];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data
</span><span class="cx"> {
</span><span class="cx"> return [[_private->toolTip copy] autorelease];
</span><span class="lines">@@ -1682,12 +1869,37 @@
</span><span class="cx"> [self autoscroll:event];
</span><span class="cx"> [self _startAutoscrollTimer:event];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (WebPluginController *)_pluginController
</span><span class="cx"> {
</span><span class="cx"> return _private->pluginController;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+// WAKView override.
+- (void)layoutIfNeeded
+{
+ [self _layoutIfNeeded];
+}
+
+// WAKView override.
+- (void)setScale:(float)scale
+{
+ [super setScale:scale];
+ Frame* coreFrame = core([self _frame]);
+ if (!coreFrame)
+ return;
+
+ if (Page* page = coreFrame->page())
+ page->setPageScaleFactor(scale, IntPoint());
+
+ [[self _webView] _documentScaleChanged];
+}
+
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_layoutForPrinting
</span><span class="cx"> {
</span><span class="cx"> // Set printing mode temporarily so we can adjust the size of the view. This will allow
</span><span class="lines">@@ -1697,7 +1909,9 @@
</span><span class="cx"> [self _web_setPrintingModeRecursiveAndAdjustViewSize];
</span><span class="cx"> [self _web_clearPrintingModeRecursive];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString
</span><span class="cx"> {
</span><span class="cx"> if (!pasteString || !rangeToReplace || ![[self _webView] smartInsertDeleteEnabled]) {
</span><span class="lines">@@ -1717,6 +1931,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_startAutoscrollTimer:(NSEvent *)triggerEvent
</span><ins>+#else
+- (void)_startAutoscrollTimer: (WebEvent *)triggerEvent
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (_private->autoscrollTimer == nil) {
</span><span class="cx"> _private->autoscrollTimer = [[NSTimer scheduledTimerWithTimeInterval:AUTOSCROLL_INTERVAL
</span><span class="lines">@@ -1736,7 +1953,12 @@
</span><span class="cx"> {
</span><span class="cx"> NSTimer *timer = _private->autoscrollTimer;
</span><span class="cx"> _private->autoscrollTimer = nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [_private->autoscrollTriggerEvent release];
</span><ins>+#else
+ if (_private->autoscrollTriggerEvent)
+ CFRelease (_private->autoscrollTriggerEvent);
+#endif
</ins><span class="cx"> _private->autoscrollTriggerEvent = nil;
</span><span class="cx"> [timer invalidate];
</span><span class="cx"> [timer release];
</span><span class="lines">@@ -1746,12 +1968,17 @@
</span><span class="cx"> {
</span><span class="cx"> // Guarantee that the autoscroll timer is invalidated, even if we don't receive
</span><span class="cx"> // a mouse up event.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL isStillDown = CGEventSourceButtonState(kCGEventSourceStateCombinedSessionState, kCGMouseButtonLeft);
</span><ins>+#else
+ BOOL isStillDown = NO;
+#endif
</ins><span class="cx"> if (!isStillDown){
</span><span class="cx"> [self _stopAutoscrollTimer];
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored "-Wdeprecated-declarations"
</span><span class="cx"> NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged
</span><span class="lines">@@ -1763,6 +1990,7 @@
</span><span class="cx"> eventNumber:0 clickCount:0 pressure:0];
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> [self mouseDragged:fakeEvent];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_canEdit
</span><span class="lines">@@ -1816,6 +2044,7 @@
</span><span class="cx"> _private->transparentBackground = f;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSImage *)_selectionDraggingImage
</span><span class="cx"> {
</span><span class="cx"> if (![self _hasSelection])
</span><span class="lines">@@ -1835,6 +2064,7 @@
</span><span class="cx"> // Mail currently calls this method. We can eliminate it when Mail no longer calls it.
</span><span class="cx"> return [self selectionRect];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (DOMNode *)_insertOrderedList
</span><span class="cx"> {
</span><span class="lines">@@ -1897,6 +2127,7 @@
</span><span class="cx"> [_private->highlighters removeObjectForKey:type];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> ASSERT([self _hasSelection]);
</span><span class="lines">@@ -1915,6 +2146,7 @@
</span><span class="cx"> [self _writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard cachedAttributedString:attributedString];
</span><span class="cx"> [mutableTypes release];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)close
</span><span class="cx"> {
</span><span class="lines">@@ -1926,11 +2158,14 @@
</span><span class="cx"> _private->closed = YES;
</span><span class="cx">
</span><span class="cx"> [self _clearLastHitViewIfSelf];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _removeMouseMovedObserverUnconditionally];
</span><span class="cx"> [self _removeWindowObservers];
</span><span class="cx"> [self _removeSuperviewObservers];
</span><ins>+#endif
</ins><span class="cx"> [_private->pluginController destroyAllPlugins];
</span><span class="cx"> [_private->pluginController setDataSource:nil];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // remove tooltips before clearing _private so removeTrackingRect: will work correctly
</span><span class="cx"> [self removeAllToolTips];
</span><span class="cx">
</span><span class="lines">@@ -1938,6 +2173,7 @@
</span><span class="cx"> DisableSecureEventInput();
</span><span class="cx"> _private->isInSecureInputState = NO;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [_private clear];
</span><span class="cx"> }
</span><span class="lines">@@ -1951,6 +2187,7 @@
</span><span class="cx"> return document && document->isHTMLDocument();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> forType:(NSString *)pboardType
</span><span class="cx"> inContext:(DOMRange *)context
</span><span class="lines">@@ -2077,6 +2314,7 @@
</span><span class="cx"> }
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> - (void)_pauseNullEventsForAllNetscapePlugins
</span><span class="lines">@@ -2240,12 +2478,22 @@
</span><span class="cx"> return newBottom;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)accessibilityRootElement
+{
+ return [[self _frame] accessibilityRoot];
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation NSView (WebHTMLViewFileInternal)
</span><span class="cx">
</span><span class="cx"> - (void)_web_addDescendantWebHTMLViewsToArray:(NSMutableArray *)array
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ NSArray* _subviews = [self subviews];
+#endif
</ins><span class="cx"> unsigned count = [_subviews count];
</span><span class="cx"> for (unsigned i = 0; i < count; ++i) {
</span><span class="cx"> NSView *child = [_subviews objectAtIndex:i];
</span><span class="lines">@@ -2274,11 +2522,13 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSApp registerServicesMenuSendTypes:[[self class] _selectionPasteboardTypes]
</span><span class="cx"> returnTypes:[[self class] _insertablePasteboardTypes]];
</span><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2288,7 +2538,9 @@
</span><span class="cx"> if (!self)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self setFocusRingType:NSFocusRingTypeNone];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Make all drawing go through us instead of subviews.
</span><span class="cx"> [self _setDrawsOwnDescendants:YES];
</span><span class="lines">@@ -2296,6 +2548,11 @@
</span><span class="cx"> _private = [[WebHTMLViewPrivate alloc] init];
</span><span class="cx">
</span><span class="cx"> _private->pluginController = [[WebPluginController alloc] initWithDocumentView:self];
</span><ins>+#if PLATFORM(IOS)
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self selector:@selector(markedTextUpdate:)
+ name:WebMarkedTextUpdatedNotification object:nil];
+#endif
</ins><span class="cx">
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="lines">@@ -2305,6 +2562,10 @@
</span><span class="cx"> if (WebCoreObjCScheduleDeallocateOnMainThread([WebHTMLView class], self))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:WebMarkedTextUpdatedNotification object:nil];
+#endif
+
</ins><span class="cx"> // We can't assert that close has already been called because
</span><span class="cx"> // this view can be removed from it's superview, even though
</span><span class="cx"> // it could be needed later, so close if needed.
</span><span class="lines">@@ -2505,10 +2766,18 @@
</span><span class="cx"> WEBCORE_COMMAND(yank)
</span><span class="cx"> WEBCORE_COMMAND(yankAndSelect)
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+WEBCORE_COMMAND(clearText)
+WEBCORE_COMMAND(toggleBold)
+WEBCORE_COMMAND(toggleItalic)
+WEBCORE_COMMAND(toggleUnderline)
+#endif
+
</ins><span class="cx"> #undef WEBCORE_COMMAND
</span><span class="cx">
</span><span class="cx"> #define COMMAND_PROLOGUE if ([self callDelegateDoCommandBySelectorIfNeeded:_cmd]) return;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (IBAction)takeFindStringFromSelection:(id)sender
</span><span class="cx"> {
</span><span class="cx"> COMMAND_PROLOGUE
</span><span class="lines">@@ -2543,6 +2812,7 @@
</span><span class="cx"> return self;
</span><span class="cx"> return [[self nextResponder] validRequestorForSendType:sendType returnType:returnType];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // jumpToSelection is the old name for what AppKit now calls centerSelectionInVisibleArea. Safari
</span><span class="cx"> // was using the old jumpToSelection selector in its menu. Newer versions of Safari will use the
</span><span class="lines">@@ -2557,6 +2827,7 @@
</span><span class="cx"> coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item
</span><span class="cx"> {
</span><span class="cx"> SEL action = [item action];
</span><span class="lines">@@ -2754,6 +3025,7 @@
</span><span class="cx"> BOOL result = [self validateUserInterfaceItemWithoutDelegate:item];
</span><span class="cx"> return CallUIDelegateReturningBoolean(result, [self _webView], @selector(webView:validateUserInterfaceItem:defaultValidation:), item, result);
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)acceptsFirstResponder
</span><span class="cx"> {
</span><span class="lines">@@ -2761,12 +3033,20 @@
</span><span class="cx"> // We have to pass the event down through WebCore first to be sure we don't hit a subview.
</span><span class="cx"> // Do accept first responder at any other time, for example from keyboard events,
</span><span class="cx"> // or from calls back from WebCore once we begin mouse-down event handling.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSEvent *event = [NSApp currentEvent];
</span><span class="cx"> if ([event type] == NSLeftMouseDown
</span><span class="cx"> && !_private->handlingMouseDownEvent
</span><span class="cx"> && NSPointInRect([event locationInWindow], [self convertRect:[self visibleRect] toView:nil])) {
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><ins>+#else
+ WebEvent *event = [WAKWindow currentEvent];
+ if (event && event.type == WebEventMouseDown
+ && !_private->handlingMouseDownEvent
+ && NSPointInRect([event locationInWindow], [self convertRect:[self visibleRect] toView:nil]))
+ return NO;
+#endif
</ins><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2808,6 +3088,7 @@
</span><span class="cx"> return selectionIsEditable && nextResponderIsInWebView;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)addMouseMovedObserver
</span><span class="cx"> {
</span><span class="cx"> if (!_private->dataSource || ![self _isTopHTMLView] || _private->observingMouseMovedNotifications)
</span><span class="lines">@@ -2903,6 +3184,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)viewWillMoveToWindow:(NSWindow *)window
</span><span class="cx"> {
</span><span class="lines">@@ -2913,10 +3195,12 @@
</span><span class="cx"> if (!_private)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Some of these calls may not work because this view may be already removed from it's superview.
</span><span class="cx"> [self _removeMouseMovedObserverUnconditionally];
</span><span class="cx"> [self _removeWindowObservers];
</span><span class="cx"> [self _removeSuperviewObservers];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // FIXME: This accomplishes the same thing as the call to setCanStartMedia(false) in
</span><span class="cx"> // WebView. It would be nice to have a single mechanism instead of two.
</span><span class="lines">@@ -2935,9 +3219,11 @@
</span><span class="cx"> [self _stopAutoscrollTimer];
</span><span class="cx"> if ([self window]) {
</span><span class="cx"> _private->lastScrollPosition = [[self superview] bounds].origin;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self addWindowObservers];
</span><span class="cx"> [self addSuperviewObservers];
</span><span class="cx"> [self addMouseMovedObserver];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // FIXME: This accomplishes the same thing as the call to setCanStartMedia(true) in
</span><span class="cx"> // WebView. It would be nice to have a single mechanism instead of two.
</span><span class="lines">@@ -2966,12 +3252,16 @@
</span><span class="cx">
</span><span class="cx"> - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _web_makePluginSubviewsPerformSelector:@selector(viewWillMoveToHostWindow:) withObject:hostWindow];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)viewDidMoveToHostWindow
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _web_makePluginSubviewsPerformSelector:@selector(viewDidMoveToHostWindow) withObject:nil];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -2979,8 +3269,15 @@
</span><span class="cx"> {
</span><span class="cx"> [super addSubview:view];
</span><span class="cx">
</span><del>- if ([WebPluginController isPlugInView:view])
</del><ins>+ if ([WebPluginController isPlugInView:view]) {
+
+#if PLATFORM(IOS)
+ WebView *webView = [self _webView];
+ [[webView _UIKitDelegateForwarder] webView:webView willAddPlugInView:view];
+#endif
+
</ins><span class="cx"> [[self _pluginController] addPlugin:view];
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)willRemoveSubview:(NSView *)subview
</span><span class="lines">@@ -3062,6 +3359,7 @@
</span><span class="cx"> [self layoutToMinimumPageWidth:0 height:0 originalPageWidth:0 originalPageHeight:0 maximumShrinkRatio:0 adjustingViewSize:NO];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Deliver mouseup events to the DOM for button 2.
</span><span class="cx"> - (void)rightMouseUp:(NSEvent *)event
</span><span class="cx"> {
</span><span class="lines">@@ -3151,6 +3449,7 @@
</span><span class="cx">
</span><span class="cx"> return menu;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag
</span><span class="cx"> {
</span><span class="lines">@@ -3174,6 +3473,7 @@
</span><span class="cx"> return [[self _webView] drawsBackground];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)setLayer:(CALayer *)layer
</span><span class="cx"> {
</span><span class="cx"> if (Frame* frame = core([self _frame])) {
</span><span class="lines">@@ -3183,6 +3483,7 @@
</span><span class="cx">
</span><span class="cx"> [super setLayer:layer];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> - (void)setNeedsDisplay:(BOOL)flag
</span><span class="lines">@@ -3233,21 +3534,26 @@
</span><span class="cx">
</span><span class="cx"> - (void)drawSingleRect:(NSRect)rect
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSGraphicsContext saveGraphicsState];
</span><span class="cx"> NSRectClip(rect);
</span><span class="cx">
</span><span class="cx"> ASSERT([[self superview] isKindOfClass:[WebClipView class]]);
</span><span class="cx">
</span><span class="cx"> [(WebClipView *)[self superview] setAdditionalClip:rect];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @try {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([self _transparentBackground]) {
</span><span class="cx"> [[NSColor clearColor] set];
</span><span class="cx"> NSRectFill (rect);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [[self _frame] _drawRect:rect contentsOnly:YES];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebView *webView = [self _webView];
</span><span class="cx">
</span><span class="cx"> // This hack is needed for <rdar://problem/5023545>. We can hit a race condition where drawRect will be
</span><span class="lines">@@ -3259,13 +3565,20 @@
</span><span class="cx">
</span><span class="cx"> if (WebNodeHighlight *currentHighlight = [webView currentNodeHighlight])
</span><span class="cx"> [currentHighlight setNeedsUpdateInTargetViewRect:[self convertRect:rect toView:[currentHighlight targetView]]];
</span><ins>+#else
+ // Don't send didDrawRect, it is not used by anyone and it is causing thread synchronization problems.
+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [(WebClipView *)[self superview] resetAdditionalClip];
</span><span class="cx">
</span><span class="cx"> [NSGraphicsContext restoreGraphicsState];
</span><ins>+#endif
</ins><span class="cx"> } @catch (NSException *localException) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [(WebClipView *)[self superview] resetAdditionalClip];
</span><span class="cx"> [NSGraphicsContext restoreGraphicsState];
</span><ins>+#endif
</ins><span class="cx"> LOG_ERROR("Exception caught while drawing: %@", localException);
</span><span class="cx"> [localException raise];
</span><span class="cx"> }
</span><span class="lines">@@ -3276,6 +3589,7 @@
</span><span class="cx"> ASSERT_MAIN_THREAD();
</span><span class="cx"> LOG(View, "%@ drawing", self);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> const NSRect *rects;
</span><span class="cx"> NSInteger count;
</span><span class="cx"> [self getRectsBeingDrawn:&rects count:&count];
</span><span class="lines">@@ -3283,11 +3597,13 @@
</span><span class="cx"> BOOL subviewsWereSetAside = _private->subviewsSetAside;
</span><span class="cx"> if (subviewsWereSetAside)
</span><span class="cx"> [self _restoreSubviews];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #ifdef LOG_TIMES
</span><span class="cx"> double start = CFAbsoluteTimeGetCurrent();
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // If count == 0 here, use the rect passed in for drawing. This is a workaround for:
</span><span class="cx"> // <rdar://problem/3908282> REGRESSION (Mail): No drag image dragging selected text in Blot and Mail
</span><span class="cx"> // The reason for the workaround is that this method is called explicitly from the code
</span><span class="lines">@@ -3314,18 +3630,23 @@
</span><span class="cx"> for (int i = 0; i < count; ++i)
</span><span class="cx"> [self drawSingleRect:rects[i]];
</span><span class="cx"> }
</span><ins>+#else
+ [self drawSingleRect:rect];
+#endif
</ins><span class="cx">
</span><span class="cx"> #ifdef LOG_TIMES
</span><span class="cx"> double thisTime = CFAbsoluteTimeGetCurrent() - start;
</span><span class="cx"> LOG(Timing, "%s draw seconds = %f", widget->part()->baseURL().URL().latin1(), thisTime);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (subviewsWereSetAside)
</span><span class="cx"> [self _setAsideSubviews];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebView *webView = [self _webView];
</span><span class="cx">
</span><del>-#if USE(ACCELERATED_COMPOSITING)
</del><ins>+#if USE(ACCELERATED_COMPOSITING) && !PLATFORM(IOS)
</ins><span class="cx"> // Only do the synchronization dance if we're drawing into the window, otherwise
</span><span class="cx"> // we risk disabling screen updates when no flush is pending.
</span><span class="cx"> if ([NSGraphicsContext currentContext] == [[self window] graphicsContext] && [webView _needsOneShotDrawingSynchronization]) {
</span><span class="lines">@@ -3344,6 +3665,7 @@
</span><span class="cx"> CallUIDelegate(webView, @selector(webView:didDrawFrame:), [self _frame]);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Turn off the additional clip while computing our visibleRect.
</span><span class="cx"> - (NSRect)visibleRect
</span><span class="cx"> {
</span><span class="lines">@@ -3463,25 +3785,46 @@
</span><span class="cx"> [_private->completionController endRevertingChange:NO moveLeft:NO];
</span><span class="cx"> [[self _pluginController] destroyAllPlugins];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)scrollWheel:(NSEvent *)event
</span><ins>+#else
+- (void)scrollWheel:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="cx"> // fetching a new event might release the old one. Retaining and then autoreleasing
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[event retain] autorelease];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> Frame* frame = core([self _frame]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!frame || !frame->eventHandler().wheelEvent(event))
</span><span class="cx"> [super scrollWheel:event];
</span><ins>+#else
+ if (frame)
+ frame->eventHandler().wheelEvent(event);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_isSelectionEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
</span><span class="cx"> return [[[self elementAtPoint:point allowShadowContent:YES] objectForKey:WebElementIsSelectedKey] boolValue];
</span><span class="cx"> }
</span><ins>+#else
+- (BOOL)_isSelectionEvent:(WebEvent *)event
+{
+ NSPoint point = [self convertPoint:event.locationInWindow fromView:nil];
+ return [[[self elementAtPoint:point] objectForKey:WebElementIsSelectedKey] boolValue];
+}
+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_isScrollBarEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
</span><span class="lines">@@ -3547,23 +3890,45 @@
</span><span class="cx"> }
</span><span class="cx"> return [hitView shouldDelayWindowOrderingForEvent:event];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)mouseDown:(NSEvent *)event
</span><ins>+#else
+- (void)mouseDown:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="cx"> // fetching a new event might release the old one. Retaining and then autoreleasing
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[event retain] autorelease];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> RetainPtr<WebHTMLView> protector = self;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([[self inputContext] wantsToHandleMouseEvents] && [[self inputContext] handleMouseEvent:event])
</span><span class="cx"> return;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> _private->handlingMouseDownEvent = YES;
</span><span class="cx">
</span><span class="cx"> // Record the mouse down position so we can determine drag hysteresis.
</span><span class="cx"> [self _setMouseDownEvent:event];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // TEXTINPUT: if there is marked text and the current input
+ // manager wants to handle mouse events, we need to make sure to
+ // pass it to them. If not, then we need to notify the input
+ // manager when the marked text is abandoned (user clicks outside
+ // the marked area)
+ _private->ignoringMouseDraggedEvents = NO;
+
+ // Let WebCore get a chance to deal with the event. This will call back to us
+ // to start the autoscroll timer if appropriate.
+ if (Frame* coreframe = core([self _frame]))
+ coreframe->eventHandler().mouseDown(event);
+#else
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored "-Wdeprecated-declarations"
</span><span class="cx"> NSInputManager *currentInputManager = [NSInputManager currentInputManager];
</span><span class="lines">@@ -3583,6 +3948,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> #pragma clang diagnostic pop
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> _private->handlingMouseDownEvent = NO;
</span><span class="cx"> }
</span><span class="lines">@@ -3727,22 +4093,29 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)mouseUp:(NSEvent *)event
</span><ins>+#else
+- (void)mouseUp:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="cx"> // fetching a new event might release the old one. Retaining and then autoreleasing
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[event retain] autorelease];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [self _setMouseDownEvent:nil];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored "-Wdeprecated-declarations"
</span><span class="cx"> NSInputManager *currentInputManager = [NSInputManager currentInputManager];
</span><span class="cx"> if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
</span><span class="cx"> return;
</span><span class="cx"> #pragma clang diagnostic pop
</span><del>-
</del><ins>+#endif
</ins><span class="cx"> [self retain];
</span><span class="cx">
</span><span class="cx"> [self _stopAutoscrollTimer];
</span><span class="lines">@@ -3750,22 +4123,28 @@
</span><span class="cx"> if (Page* page = frame->page())
</span><span class="cx"> page->mainFrame().eventHandler().mouseUp(event);
</span><span class="cx"> }
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _updateMouseoverWithFakeEvent];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [self release];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)mouseMovedNotification:(NSNotification *)notification
</span><span class="cx"> {
</span><span class="cx"> [self _updateMouseoverWithEvent:[[notification userInfo] objectForKey:@"NSEvent"]];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // returning YES from this method is the way we tell AppKit that it is ok for this view
</span><span class="cx"> // to be in the key loop even when "tab to all controls" is not on.
</span><span class="cx"> - (BOOL)needsPanelToBecomeKey
</span><span class="cx"> {
</span><span class="cx"> return YES;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Utility function to make sure we don't return anything through the NSTextInput
</span><span class="cx"> // API when an editable region is not currently focused.
</span><span class="lines">@@ -3774,13 +4153,16 @@
</span><span class="cx"> return coreFrame && !coreFrame->selection().isNone() && coreFrame->selection().isContentEditable();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static BOOL isInPasswordField(Frame* coreFrame)
</span><span class="cx"> {
</span><span class="cx"> return coreFrame && coreFrame->selection().isInPasswordField();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSEvent *event = [NSApp currentEvent];
</span><span class="cx"> if (!event)
</span><span class="cx"> return 0;
</span><span class="lines">@@ -3796,6 +4178,17 @@
</span><span class="cx"> default:
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><ins>+#else
+ WebEvent *event = [WAKWindow currentEvent];
+ if (!event)
+ return 0;
+ WebEventType type = event.type;
+ if (type == WebEventKeyDown || type == WebEventKeyUp) {
+ Document* document = coreFrame->document();
+ return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), document ? document->defaultView() : 0);
+ }
+ return 0;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)becomeFirstResponder
</span><span class="lines">@@ -3804,12 +4197,15 @@
</span><span class="cx"> if (![[self _webView] _isPerformingProgrammaticFocus])
</span><span class="cx"> direction = [[self window] keyViewSelectionDirection];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _updateFontPanel];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> Frame* frame = core([self _frame]);
</span><span class="cx"> if (!frame)
</span><span class="cx"> return YES;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL exposeInputContext = isTextInput(frame) && !isInPasswordField(frame);
</span><span class="cx"> if (exposeInputContext != _private->exposeInputContext) {
</span><span class="cx"> _private->exposeInputContext = exposeInputContext;
</span><span class="lines">@@ -3819,6 +4215,7 @@
</span><span class="cx"> _private->_forceUpdateSecureInputState = YES;
</span><span class="cx"> [self _updateSecureInputState];
</span><span class="cx"> _private->_forceUpdateSecureInputState = NO;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // FIXME: Kill ring handling is mostly in WebCore, so this call should also be moved there.
</span><span class="cx"> frame->editor().setStartNewKillRingSequence(true);
</span><span class="lines">@@ -3846,14 +4243,24 @@
</span><span class="cx"> {
</span><span class="cx"> BOOL resign = [super resignFirstResponder];
</span><span class="cx"> if (resign) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->isInSecureInputState) {
</span><span class="cx"> DisableSecureEventInput();
</span><span class="cx"> _private->isInSecureInputState = NO;
</span><span class="cx"> }
</span><span class="cx"> [_private->completionController endRevertingChange:NO moveLeft:NO];
</span><ins>+#endif
</ins><span class="cx"> Frame* coreFrame = core([self _frame]);
</span><span class="cx"> if (!coreFrame)
</span><span class="cx"> return resign;
</span><ins>+
+#if PLATFORM(IOS)
+ if (Document* document = coreFrame->document()) {
+ document->markers().removeMarkers(DocumentMarker::DictationPhraseWithAlternatives);
+ document->markers().removeMarkers(DocumentMarker::DictationResult);
+ }
+#endif
+
</ins><span class="cx"> Page* page = coreFrame->page();
</span><span class="cx"> if (!page)
</span><span class="cx"> return resign;
</span><span class="lines">@@ -3863,11 +4270,17 @@
</span><span class="cx"> [self clearFocus];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> id nextResponder = [[self window] _newFirstResponderAfterResigning];
</span><span class="cx"> bool nextResponderIsInWebView = [nextResponder isKindOfClass:[NSView class]]
</span><span class="cx"> && [nextResponder isDescendantOf:[[[self _webView] mainFrame] frameView]];
</span><span class="cx"> if (!nextResponderIsInWebView)
</span><span class="cx"> page->focusController().setFocused(false);
</span><ins>+#else
+ NSView* nextResponder = [[self window] _newFirstResponderAfterResigning];
+ if (nextResponder && ![nextResponder isDescendantOf:[[[self _webView] mainFrame] frameView]])
+ page->focusController().setFocused(false);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> return resign;
</span><span class="cx"> }
</span><span class="lines">@@ -3877,15 +4290,19 @@
</span><span class="cx"> ASSERT(dataSource);
</span><span class="cx"> if (_private->dataSource != dataSource) {
</span><span class="cx"> ASSERT(!_private->closed);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL hadDataSource = _private->dataSource != nil;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [dataSource retain];
</span><span class="cx"> [_private->dataSource release];
</span><span class="cx"> _private->dataSource = dataSource;
</span><span class="cx"> [_private->pluginController setDataSource:dataSource];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!hadDataSource)
</span><span class="cx"> [self addMouseMovedObserver];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3893,12 +4310,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // This is an override of an NSControl method that wants to repaint the entire view when the window resigns/becomes
</span><span class="cx"> // key. WebHTMLView is an NSControl only because it hosts NSCells that are painted by WebCore's Aqua theme
</span><span class="cx"> // renderer (and those cells must be hosted by an enclosing NSControl in order to paint properly).
</span><span class="cx"> - (void)updateCell:(NSCell*)cell
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Does setNeedsDisplay:NO as a side effect when printing is ending.
</span><span class="cx"> // pageWidth != 0 implies we will relayout to a new width
</span><span class="lines">@@ -3947,6 +4366,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)canPrintHeadersAndFooters
</span><span class="cx"> {
</span><span class="cx"> return YES;
</span><span class="lines">@@ -4126,13 +4546,20 @@
</span><span class="cx"> // Note sadly at this point [NSGraphicsContext currentContextDrawingToScreen] is still NO
</span><span class="cx"> [self _endPrintModeAndRestoreWindowAutodisplay];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)keyDown:(NSEvent *)event
</span><ins>+#else
+- (void)keyDown:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="cx"> // fetching a new event might release the old one. Retaining and then autoreleasing
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[event retain] autorelease];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> RetainPtr<WebHTMLView> selfProtector = self;
</span><span class="cx"> BOOL eventWasSentToWebCore = (_private->keyDownEvent == event);
</span><span class="lines">@@ -4142,6 +4569,7 @@
</span><span class="cx"> [_private->keyDownEvent release];
</span><span class="cx"> _private->keyDownEvent = [event retain];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL completionPopupWasOpen = _private->completionController && [_private->completionController popupWindowIsOpen];
</span><span class="cx"> Frame* coreFrame = core([self _frame]);
</span><span class="cx"> if (!eventWasSentToWebCore && coreFrame && coreFrame->eventHandler().keyEvent(event)) {
</span><span class="lines">@@ -4153,18 +4581,30 @@
</span><span class="cx"> [_private->completionController endRevertingChange:YES moveLeft:NO];
</span><span class="cx"> callSuper = YES;
</span><span class="cx"> }
</span><ins>+#else
+ Frame *coreFrame = core([self _frame]);
+ if (!eventWasSentToWebCore && coreFrame)
+ coreFrame->eventHandler().keyEvent(event);
+#endif
+
</ins><span class="cx"> if (callSuper)
</span><span class="cx"> [super keyDown:event];
</span><span class="cx"> else
</span><span class="cx"> [NSCursor setHiddenUntilMouseMoves:YES];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)keyUp:(NSEvent *)event
</span><ins>+#else
+- (void)keyUp:(WebEvent *)event
+#endif
</ins><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="cx"> // fetching a new event might release the old one. Retaining and then autoreleasing
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[event retain] autorelease];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> BOOL eventWasSentToWebCore = (_private->keyDownEvent == event);
</span><span class="cx">
</span><span class="lines">@@ -4176,6 +4616,7 @@
</span><span class="cx"> [super keyUp:event];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)flagsChanged:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="lines">@@ -4207,6 +4648,7 @@
</span><span class="cx"> }
</span><span class="cx"> return [super accessibilityAttributeValue:attributeName];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (id)accessibilityFocusedUIElement
</span><span class="cx"> {
</span><span class="lines">@@ -4220,11 +4662,15 @@
</span><span class="cx"> {
</span><span class="cx"> id accTree = [[self _frame] accessibilityRoot];
</span><span class="cx"> if (accTree) {
</span><ins>+#if PLATFORM(IOS)
+ return [accTree accessibilityHitTest:point];
+#else
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored "-Wdeprecated-declarations"
</span><span class="cx"> NSPoint windowCoord = [[self window] convertScreenToBase:point];
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> return [accTree accessibilityHitTest:[self convertPoint:windowCoord fromView:nil]];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="lines">@@ -4248,6 +4694,7 @@
</span><span class="cx"> coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSData *)_selectionStartFontAttributesAsRTF
</span><span class="cx"> {
</span><span class="cx"> Frame* coreFrame = core([self _frame]);
</span><span class="lines">@@ -4272,12 +4719,14 @@
</span><span class="cx"> return nil;
</span><span class="cx"> return [string fontAttributesInRange:NSMakeRange(0, 1)];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (DOMCSSStyleDeclaration *)_emptyStyle
</span><span class="cx"> {
</span><span class="cx"> return [[[self _frame] DOMDocument] createCSSStyleDeclaration];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSString *)_colorAsString:(NSColor *)color
</span><span class="cx"> {
</span><span class="cx"> NSColor *rgbColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
</span><span class="lines">@@ -4375,6 +4824,7 @@
</span><span class="cx">
</span><span class="cx"> return style;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_applyStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
</span><span class="cx"> {
</span><span class="lines">@@ -4385,6 +4835,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = [self _webView];
</span><span class="lines">@@ -4720,6 +5171,7 @@
</span><span class="cx"> [self _applyStyleToSelection:[self _styleFromColorPanelWithSelector:@selector(setColor:)]
</span><span class="cx"> withUndoAction:EditActionSetColor];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_changeWordCaseWithSelector:(SEL)selector
</span><span class="cx"> {
</span><span class="lines">@@ -4755,6 +5207,7 @@
</span><span class="cx"> [self _changeWordCaseWithSelector:@selector(capitalizedString)];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)complete:(id)sender
</span><span class="cx"> {
</span><span class="cx"> COMMAND_PROLOGUE
</span><span class="lines">@@ -4927,6 +5380,7 @@
</span><span class="cx">
</span><span class="cx"> [self _changeBaseWritingDirectionTo:NSWritingDirectionRightToLeft];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)makeBaseWritingDirectionNatural:(id)sender
</span><span class="cx"> {
</span><span class="lines">@@ -4970,7 +5424,7 @@
</span><span class="cx"> return haveWebCoreFrame;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
</ins><span class="cx"> - (BOOL)_automaticFocusRingDisabled
</span><span class="cx"> {
</span><span class="cx"> // The default state for _automaticFocusRingDisabled is NO, which prevents focus rings
</span><span class="lines">@@ -4997,14 +5451,19 @@
</span><span class="cx"> // to do this with API. <rdar://problem/5136760>
</span><span class="cx"> - (void)_windowChangedKeyState
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (pthread_main_np())
</span><span class="cx"> [self _updateControlTints];
</span><span class="cx"> else
</span><span class="cx"> [self performSelectorOnMainThread:@selector(_updateControlTints) withObject:nil waitUntilDone:NO];
</span><ins>+#else
+ [self _updateControlTints];
+#endif
</ins><span class="cx">
</span><span class="cx"> [super _windowChangedKeyState];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)otherMouseDown:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> if ([event buttonNumber] == 2)
</span><span class="lines">@@ -5028,6 +5487,7 @@
</span><span class="cx"> else
</span><span class="cx"> [super otherMouseUp:event];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="lines">@@ -5036,9 +5496,12 @@
</span><span class="cx"> - (void)_selectionChanged
</span><span class="cx"> {
</span><span class="cx"> [self _updateSelectionForInputManager];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _updateFontPanel];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_updateFontPanel
</span><span class="cx"> {
</span><span class="cx"> // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
</span><span class="lines">@@ -5067,6 +5530,7 @@
</span><span class="cx">
</span><span class="cx"> [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:multipleFonts];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_canSmartCopyOrDelete
</span><span class="cx"> {
</span><span class="lines">@@ -5076,10 +5540,12 @@
</span><span class="cx"> return coreFrame && coreFrame->selection().granularity() == WordGranularity;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSEvent *)_mouseDownEvent
</span><span class="cx"> {
</span><span class="cx"> return _private->mouseDownEvent;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (id<WebHTMLHighlighter>)_highlighterForType:(NSString*)type
</span><span class="cx"> {
</span><span class="lines">@@ -5097,6 +5563,7 @@
</span><span class="cx"> [self close];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (DOMDocumentFragment*)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> return [self _documentFragmentFromPasteboard:pasteboard inContext:nil allowPlainText:NO];
</span><span class="lines">@@ -5257,6 +5724,7 @@
</span><span class="cx">
</span><span class="cx"> [self showDefinitionForAttributedString:attrString atPoint:rect.origin];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_executeSavedKeypressCommands
</span><span class="cx"> {
</span><span class="lines">@@ -5292,6 +5760,7 @@
</span><span class="cx"> parameters->executingSavedKeypressCommands = false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_interpretKeyEvent:(KeyboardEvent*)event savingCommands:(BOOL)savingCommands
</span><span class="cx"> {
</span><span class="cx"> ASSERT(core([self _frame]) == event->target()->toNode()->document().frame());
</span><span class="lines">@@ -5362,7 +5831,109 @@
</span><span class="cx"> // If we have already executed all commands, don't do it again.
</span><span class="cx"> return parameters.eventInterpretationHadSideEffects;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
+
+#if PLATFORM(IOS)
+
+#define kWebEnterKey 0x0003
+#define kWebBackspaceKey 0x0008
+#define kWebReturnKey 0x000d
+#define kWebDeleteKey 0x007F
+#define kWebLeftArrowKey 0x00AC
+#define kWebUpArrowKey 0x00AD
+#define kWebRightArrowKey 0x00AE
+#define kWebDownArrowKey 0x00AF
+#define kWebDeleteForwardKey 0xF728
+
+- (BOOL)_handleEditingKeyEvent:(KeyboardEvent *)wcEvent
+{
+ // Use the isEditable state to determine whether or not to process tab key events.
+ // The idea here is that isEditable will be NO when this WebView is being used
+ // in a browser, and we desire the behavior where tab moves to the next element
+ // in tab order. If isEditable is YES, it is likely that the WebView is being
+ // embedded as the whole view, as in Mail, and tabs should input tabs as expected
+ // in a text editor.
+
+ // FIXME - this code will break when content editable is supported.
+ if (const PlatformKeyboardEvent* platformEvent = wcEvent->keyEvent()) {
+ WebEvent *event = platformEvent->event();
+ if (![[self _webView] isEditable] && event.isTabKey)
+ return NO;
+
+ // Now process the key normally
+ BOOL shift = platformEvent->shiftKey();
+
+ switch (event.characterSet) {
+ case WebEventCharacterSetSymbol: {
+ SEL sel = 0;
+ NSString *s = [event charactersIgnoringModifiers];
+ if ([s length] == 0)
+ break;
+ switch ([s characterAtIndex:0]) {
+ case kWebLeftArrowKey:
+ sel = shift ? @selector(moveLeftAndModifySelection:) : @selector(moveLeft:);
+ break;
+ case kWebUpArrowKey:
+ sel = shift ? @selector(moveUpAndModifySelection:) : @selector(moveUp:);
+ break;
+ case kWebRightArrowKey:
+ sel = shift ? @selector(moveRightAndModifySelection:) : @selector(moveRight:);
+ break;
+ case kWebDownArrowKey:
+ sel = shift ? @selector(moveDownAndModifySelection:) : @selector(moveDown:);
+ break;
+ }
+ if (sel) {
+ [self performSelector:sel withObject:self];
+ return YES;
+ }
+ break;
+ }
+ case WebEventCharacterSetASCII:
+ case WebEventCharacterSetUnicode: {
+ NSString *s = [event characters];
+ if ([s length] == 0)
+ break;
+ switch ([s characterAtIndex:0]) {
+ case kWebBackspaceKey:
+ case kWebDeleteKey:
+ [[[self _webView] _UIKitDelegateForwarder] deleteFromInput];
+ return YES;
+ case kWebEnterKey:
+ case kWebReturnKey:
+ if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+ // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
+ // FIXME: remove the first call when UIKit implements the new method.
+ [[[self _webView] _UIKitDelegateForwarder] addInputString:@"\n" fromVariantKey:NO];
+ [[[self _webView] _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
+ return YES;
+ }
+ return NO;
+ case kWebDeleteForwardKey:
+ [self deleteForward:self];
+ return YES;
+ default: {
+ if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+ //NSString *string = event.characters;
+ // FIXME: remove the first call when UIKit implements the new method.
+ [[[self _webView] _UIKitDelegateForwarder] addInputString:event.characters fromVariantKey:event.popupVariant];
+ [[[self _webView] _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
+ return YES;
+ }
+ return NO;
+ }
+ }
+ break;
+ }
+ default:
+ return NO;
+ }
+ }
+ return NO;
+}
+#endif // PLATFORM(IOS)
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (WebCore::CachedImage*)promisedDragTIFFDataSource
</span><span class="cx"> {
</span><span class="cx"> return _private->promisedDragTIFFDataSource;
</span><span class="lines">@@ -5377,12 +5948,15 @@
</span><span class="cx"> _private->promisedDragTIFFDataSource->removeClient(promisedDataClient());
</span><span class="cx"> _private->promisedDragTIFFDataSource = source;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #undef COMMAND_PROLOGUE
</span><span class="cx">
</span><span class="cx"> - (void)_layoutIfNeeded
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!_private->subviewsSetAside);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if ([self _needsLayout])
</span><span class="cx"> [self layout];
</span><span class="lines">@@ -5409,6 +5983,7 @@
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> - (void)attachRootLayer:(CALayer*)layer
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!_private->layerHostingView) {
</span><span class="cx"> NSView* hostingView = [[WebLayerHostingFlippedView alloc] initWithFrame:[self bounds]];
</span><span class="cx"> [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
</span><span class="lines">@@ -5443,16 +6018,19 @@
</span><span class="cx">
</span><span class="cx"> if (WKExecutableWasLinkedOnOrBeforeLion())
</span><span class="cx"> [viewLayer setGeometryFlipped:YES];
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)detachRootLayer
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->layerHostingView) {
</span><span class="cx"> [_private->layerHostingView setLayer:nil];
</span><span class="cx"> [_private->layerHostingView setWantsLayer:NO];
</span><span class="cx"> [_private->layerHostingView removeFromSuperview];
</span><span class="cx"> _private->layerHostingView = nil;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
</span><span class="lines">@@ -5470,7 +6048,11 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_web_isDrawingIntoLayer
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return YES;
+#else
</ins><span class="cx"> return _private->drawingIntoLayer;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // USE(ACCELERATED_COMPOSITING)
</span><span class="lines">@@ -5479,6 +6061,7 @@
</span><span class="cx">
</span><span class="cx"> @implementation WebHTMLView (WebNSTextInputSupport)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSArray *)validAttributesForMarkedText
</span><span class="cx"> {
</span><span class="cx"> static NSArray *validAttributes;
</span><span class="lines">@@ -5522,6 +6105,7 @@
</span><span class="cx"> // We have to return an empty string rather than null to prevent TSM from calling -string
</span><span class="cx"> return result ? result : [[[NSAttributedString alloc] initWithString:@""] autorelease];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (NSUInteger)characterIndexForPoint:(NSPoint)thePoint
</span><span class="cx"> {
</span><span class="lines">@@ -5605,6 +6189,7 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSAttributedString *)attributedSubstringFromRange:(NSRange)nsRange
</span><span class="cx"> {
</span><span class="cx"> [self _executeSavedKeypressCommands];
</span><span class="lines">@@ -5634,6 +6219,7 @@
</span><span class="cx"> LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> \"%@\"", nsRange.location, nsRange.length, [result string]);
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSInteger)conversationIdentifier
</span><span class="cx"> {
</span><span class="lines">@@ -5673,6 +6259,7 @@
</span><span class="cx"> coreFrame->editor().confirmComposition();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnderline>& result)
</span><span class="cx"> {
</span><span class="cx"> int length = [[string string] length];
</span><span class="lines">@@ -5692,15 +6279,18 @@
</span><span class="cx"> i = range.location + range.length;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange
</span><span class="cx"> {
</span><span class="cx"> [self _executeSavedKeypressCommands];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
</span><span class="cx"> ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]);
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "setMarkedText:\"%@\" selectedRange:(%u, %u)", isAttributedString ? [string string] : string, newSelRange.location, newSelRange.length);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Use pointer to get parameters passed to us by the caller of interpretKeyEvents.
</span><span class="cx"> WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters;
</span><span class="lines">@@ -5721,6 +6311,7 @@
</span><span class="cx"> NSString *text;
</span><span class="cx"> NSRange replacementRange = { NSNotFound, 0 };
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (isAttributedString) {
</span><span class="cx"> // FIXME: We ignore most attributes from the string, so an input method cannot specify e.g. a font or a glyph variation.
</span><span class="cx"> text = [string string];
</span><span class="lines">@@ -5733,6 +6324,7 @@
</span><span class="cx">
</span><span class="cx"> extractUnderlines(string, underlines);
</span><span class="cx"> } else
</span><ins>+#endif
</ins><span class="cx"> text = string;
</span><span class="cx">
</span><span class="cx"> if (replacementRange.location != NSNotFound)
</span><span class="lines">@@ -5741,6 +6333,15 @@
</span><span class="cx"> coreFrame->editor().setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)markedTextUpdate:(NSNotification *)notification
+{
+ NSString *text = [notification object];
+ NSRange range = NSMakeRange(0, [text length]);
+ [self setMarkedText:text selectedRange:range];
+}
+#endif
+
</ins><span class="cx"> - (void)doCommandBySelector:(SEL)selector
</span><span class="cx"> {
</span><span class="cx"> LOG(TextInput, "doCommandBySelector:\"%s\"", sel_getName(selector));
</span><span class="lines">@@ -5773,6 +6374,7 @@
</span><span class="cx"> Editor::Command command = [self coreCommandBySelector:selector];
</span><span class="cx"> if (command.isSupported())
</span><span class="cx"> eventWasHandled = command.execute(event);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> else {
</span><span class="cx"> // If WebKit does not support this command, we need to pass the selector to super.
</span><span class="cx"> _private->selectorForDoCommandBySelector = selector;
</span><span class="lines">@@ -5787,6 +6389,7 @@
</span><span class="cx">
</span><span class="cx"> _private->selectorForDoCommandBySelector = 0;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (parameters)
</span><span class="lines">@@ -5798,10 +6401,12 @@
</span><span class="cx">
</span><span class="cx"> - (void)insertText:(id)string
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]];
</span><span class="cx"> ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]);
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "insertText:\"%@\"", isAttributedString ? [string string] : string);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebHTMLViewInterpretKeyEventsParameters* parameters = _private->interpretKeyEventsParameters;
</span><span class="cx"> if (parameters)
</span><span class="lines">@@ -5813,6 +6418,7 @@
</span><span class="cx"> bool isFromInputMethod = coreFrame && coreFrame->editor().hasComposition();
</span><span class="cx">
</span><span class="cx"> Vector<DictationAlternative> dictationAlternativeLocations;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (isAttributedString) {
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> Vector<WebCore::TextAlternativeWithRange> textAlternatives;
</span><span class="lines">@@ -5830,6 +6436,7 @@
</span><span class="cx"> isFromInputMethod = true;
</span><span class="cx"> }
</span><span class="cx"> } else
</span><ins>+#endif
</ins><span class="cx"> text = string;
</span><span class="cx">
</span><span class="cx"> KeyboardEvent* event = parameters ? parameters->event : 0;
</span><span class="lines">@@ -5872,6 +6479,7 @@
</span><span class="cx"> parameters->eventInterpretationHadSideEffects |= eventHandled;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_updateSecureInputState
</span><span class="cx"> {
</span><span class="cx"> if (![[self window] isKeyWindow] || ([[self window] firstResponder] != self && !_private->_forceUpdateSecureInputState)) {
</span><span class="lines">@@ -5902,9 +6510,11 @@
</span><span class="cx"> TSMRemoveDocumentProperty(0, kTSMDocumentEnabledInputSourcesPropertyTag);
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)_updateSelectionForInputManager
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> Frame* coreFrame = core([self _frame]);
</span><span class="cx"> if (!coreFrame)
</span><span class="cx"> return;
</span><span class="lines">@@ -5934,6 +6544,16 @@
</span><span class="cx"> [[NSInputManager currentInputManager] markedTextAbandoned:self];
</span><span class="cx"> }
</span><span class="cx"> #pragma clang diagnostic pop
</span><ins>+#else
+ // FIXME: The following code:
+ //
+ // if (!coreFrame->editor()->getCompositionSelection(start, end))
+ // coreFrame->editor()->confirmCompositionWithoutDisturbingSelection();
+ //
+ //
+ // would work if getCompositionSelection returned false when composition != selection.
+ // Why doesn't it? See <rdar://problem/6837252> for questions.
+#endif // PLATFORM(IOS)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -5971,7 +6591,11 @@
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSImage *)selectionImageForcingBlackText:(BOOL)forceBlackText
</span><ins>+#else
+- (CGImageRef)selectionImageForcingBlackText:(BOOL)forceBlackText
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (![self _hasSelection])
</span><span class="cx"> return nil;
</span><span class="lines">@@ -5989,6 +6613,7 @@
</span><span class="cx"> return core([self _frame])->selection().bounds();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSArray *)pasteboardTypesForSelection
</span><span class="cx"> {
</span><span class="cx"> if ([self _canSmartCopyOrDelete]) {
</span><span class="lines">@@ -6004,6 +6629,7 @@
</span><span class="cx"> {
</span><span class="cx"> [self _writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard cachedAttributedString:nil];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)selectAll
</span><span class="cx"> {
</span><span class="lines">@@ -6025,6 +6651,7 @@
</span><span class="cx"> return [[self _frame] _stringForRange:[self _documentRange]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSAttributedString *)_attributeStringFromDOMRange:(DOMRange *)range
</span><span class="cx"> {
</span><span class="cx"> NSAttributedString *attributedString;
</span><span class="lines">@@ -6049,12 +6676,14 @@
</span><span class="cx"> }
</span><span class="cx"> return attributedString;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSString *)selectedString
</span><span class="cx"> {
</span><span class="cx"> return [[self _frame] _selectedString];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSAttributedString *)selectedAttributedString
</span><span class="cx"> {
</span><span class="cx"> NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[self _selectedRange]];
</span><span class="lines">@@ -6067,6 +6696,7 @@
</span><span class="cx"> }
</span><span class="cx"> return attributedString;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)supportsTextEncoding
</span><span class="cx"> {
</span><span class="lines">@@ -6173,6 +6803,7 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @implementation WebResponderChainSink
</span><span class="cx">
</span><span class="cx"> - (id)initWithResponderChain:(NSResponder *)chain
</span><span class="lines">@@ -6213,3 +6844,4 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -42,11 +42,14 @@
</span><span class="cx">
</span><span class="cx"> @interface WebHTMLView (WebInternal)
</span><span class="cx"> - (void)_selectionChanged;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_updateFontPanel;
</span><ins>+#endif
</ins><span class="cx"> - (BOOL)_canSmartCopyOrDelete;
</span><span class="cx">
</span><span class="cx"> - (id <WebHTMLHighlighter>)_highlighterForType:(NSString*)type;
</span><span class="cx"> - (WebFrame *)_frame;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_lookUpInDictionaryFromMenu:(id)sender;
</span><span class="cx"> - (BOOL)_interpretKeyEvent:(WebCore::KeyboardEvent *)event savingCommands:(BOOL)savingCommands;
</span><span class="cx"> - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard;
</span><span class="lines">@@ -56,6 +59,9 @@
</span><span class="cx"> - (void)toggleGrammarChecking:(id)sender;
</span><span class="cx"> - (WebCore::CachedImage*)promisedDragTIFFDataSource;
</span><span class="cx"> - (void)setPromisedDragTIFFDataSource:(WebCore::CachedImage*)source;
</span><ins>+#else
+- (BOOL)_handleEditingKeyEvent:(WebCore::KeyboardEvent *)event;
+#endif
</ins><span class="cx"> - (void)_web_updateLayoutAndStyleIfNeededRecursive;
</span><span class="cx"> - (void)_destroyAllWebPlugins;
</span><span class="cx"> - (BOOL)_needsLayout;
</span><span class="lines">@@ -66,4 +72,16 @@
</span><span class="cx"> - (BOOL)_web_isDrawingIntoLayer;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_layoutIfNeeded;
+#endif
+
</ins><span class="cx"> @end
</span><ins>+
+#if PLATFORM(IOS)
+@interface WebHTMLView (RemovedAppKitSuperclassMethods)
+- (void)delete:(id)sender;
+- (void)transpose:(id)sender;
+- (BOOL)hasMarkedText;
+@end
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFDocumentExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -23,6 +23,12 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @class PDFDocument;
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+NSArray *allScriptsInPDFDocument(CGPDFDocumentRef);
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> NSArray *allScriptsInPDFDocument(PDFDocument *);
</span><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFDocumentExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -28,7 +28,10 @@
</span><span class="cx"> #import "WebTypesInternal.h"
</span><span class="cx"> #import <wtf/Vector.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><ins>+
+#if !PLATFORM(IOS)
</ins><span class="cx"> #import <PDFKit/PDFDocument.h>
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static void appendValuesInPDFNameSubtreeToVector(CGPDFDictionaryRef subtree, Vector<CGPDFObjectRef>& values)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFRepresentationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebDocument.h"
</span><span class="cx">
</span><span class="cx"> @protocol WebDocumentRepresentation;
</span><span class="lines">@@ -33,3 +35,5 @@
</span><span class="cx"> @interface WebPDFRepresentation : NSObject <WebDocumentRepresentation>
</span><span class="cx"> + (NSArray *)supportedMIMETypes;
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFRepresentationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebPDFRepresentation.h"
</span><span class="cx">
</span><span class="cx"> #import "WebDataSourcePrivate.h"
</span><span class="lines">@@ -164,3 +166,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFView.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFView.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFView.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import <WebKit/WebDocumentInternal.h>
</span><span class="cx">
</span><span class="cx"> @class PDFDocument;
</span><span class="lines">@@ -54,3 +56,5 @@
</span><span class="cx"> - (PDFDocument *)PDFDocument;
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPDFViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPDFView.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPDFView.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPDFView.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> #import "WebPDFView.h"
</span><span class="cx">
</span><span class="cx"> #import "DOMNodeInternal.h"
</span><span class="lines">@@ -1581,3 +1583,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+
+#endif // !PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -50,6 +50,12 @@
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/ImageSource.h>
+#import <WebCore/WebCoreThreadMessage.h>
+#endif
+
</ins><span class="cx"> NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
</span><span class="cx"> NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
</span><span class="cx"> NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification";
</span><span class="lines">@@ -137,7 +143,11 @@
</span><span class="cx"> if (!isLinkedAgainstWebKit)
</span><span class="cx"> return WebCacheModelDocumentViewer; // Apps that don't link against WebKit probably aren't meant to be browsers.
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> bool isLegacyApp = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CACHE_MODEL_API);
</span><ins>+#else
+ bool isLegacyApp = false;
+#endif
</ins><span class="cx"> if (isLegacyApp)
</span><span class="cx"> return WebCacheModelDocumentBrowser; // To avoid regressions in apps that depended on old WebKit's large cache.
</span><span class="cx">
</span><span class="lines">@@ -161,14 +171,27 @@
</span><span class="cx"> : autosaves(NO)
</span><span class="cx"> , automaticallyDetectsCacheModel(NO)
</span><span class="cx"> , numWebViews(0)
</span><ins>+#if PLATFORM(IOS)
+ , readWriteQueue(dispatch_queue_create("com.apple.WebPreferences.ReadWriteQueue", DISPATCH_QUEUE_CONCURRENT))
+#endif
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ ~WebPreferencesPrivate()
+ {
+ dispatch_release(readWriteQueue);
+ }
+#endif
+
</ins><span class="cx"> RetainPtr<NSMutableDictionary> values;
</span><span class="cx"> RetainPtr<NSString> identifier;
</span><span class="cx"> BOOL autosaves;
</span><span class="cx"> BOOL automaticallyDetectsCacheModel;
</span><span class="cx"> unsigned numWebViews;
</span><ins>+#if PLATFORM(IOS)
+ dispatch_queue_t readWriteQueue;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> @interface WebPreferences (WebForwardDeclarations)
</span><span class="lines">@@ -186,6 +209,12 @@
</span><span class="cx"> - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WebPreferences ()
+- (id)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification;
+@end
+#endif
+
</ins><span class="cx"> @implementation WebPreferences
</span><span class="cx">
</span><span class="cx"> - (instancetype)init
</span><span class="lines">@@ -203,7 +232,18 @@
</span><span class="cx"> return [self initWithIdentifier:fakeIdentifier];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)initWithIdentifier:(NSString *)anIdentifier
+{
+ return [self initWithIdentifier:anIdentifier sendChangeNotification:YES];
+}
+#endif
+
+#if PLATFORM(IOS)
+- (instancetype)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification
+#else
</ins><span class="cx"> - (instancetype)initWithIdentifier:(NSString *)anIdentifier
</span><ins>+#endif
</ins><span class="cx"> {
</span><span class="cx"> WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
</span><span class="cx"> if (instance) {
</span><span class="lines">@@ -222,8 +262,15 @@
</span><span class="cx">
</span><span class="cx"> [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (sendChangeNotification) {
+ [self _postPreferencesChangedNotification];
+ [self _postCacheModelChangedNotification];
+ }
+#else
</ins><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="cx"> [self _postCacheModelChangedNotification];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="lines">@@ -280,42 +327,79 @@
</span><span class="cx"> {
</span><span class="cx"> if ([encoder allowsKeyedCoding]){
</span><span class="cx"> [encoder encodeObject:_private->identifier.get() forKey:@"Identifier"];
</span><ins>+#if PLATFORM(IOS)
+ dispatch_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [encoder encodeObject:_private->values.get() forKey:@"Values"];
</span><span class="cx"> LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx"> else {
</span><span class="cx"> int version = WebPreferencesVersion;
</span><span class="cx"> [encoder encodeValueOfObjCType:@encode(int) at:&version];
</span><span class="cx"> [encoder encodeObject:_private->identifier.get()];
</span><ins>+#if PLATFORM(IOS)
+ dispatch_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [encoder encodeObject:_private->values.get()];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> + (WebPreferences *)standardPreferences
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_standardPreferences == nil) {
</span><span class="cx"> _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil];
</span><span class="cx"> [_standardPreferences setAutosaves:YES];
</span><span class="cx"> }
</span><ins>+#else
+ if (_standardPreferences)
+ return _standardPreferences;
</ins><span class="cx">
</span><ins>+ static dispatch_once_t pred;
+ dispatch_once(&pred, ^{
+ _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil sendChangeNotification:NO];
+ [_standardPreferences _postPreferencesChangedNotification];
+ [_standardPreferences setAutosaves:YES];
+ });
+#endif
+
</ins><span class="cx"> return _standardPreferences;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // if we ever have more than one WebPreferences object, this would move to init
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
+#if PLATFORM(IOS)
+ static unsigned defaultMaximumImageSize = 20 * 1024 * 1024;
+#endif
</ins><span class="cx">
</span><span class="cx"> NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
</span><span class="cx"> @"Times", WebKitStandardFontPreferenceKey,
</span><span class="cx"> @"Courier", WebKitFixedFontPreferenceKey,
</span><span class="cx"> @"Times", WebKitSerifFontPreferenceKey,
</span><span class="cx"> @"Helvetica", WebKitSansSerifFontPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @"Apple Chancery", WebKitCursiveFontPreferenceKey,
</span><ins>+#else
+ @"Snell Roundhand", WebKitCursiveFontPreferenceKey,
+#endif
</ins><span class="cx"> @"Papyrus", WebKitFantasyFontPreferenceKey,
</span><ins>+#if PLATFORM(IOS)
+ @"AppleColorEmoji", WebKitPictographFontPreferenceKey,
+#else
</ins><span class="cx"> @"Apple Color Emoji", WebKitPictographFontPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> @"0", WebKitMinimumFontSizePreferenceKey,
</span><span class="cx"> @"9", WebKitMinimumLogicalFontSizePreferenceKey,
</span><span class="cx"> @"16", WebKitDefaultFontSizePreferenceKey,
</span><span class="lines">@@ -324,17 +408,28 @@
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitUsesEncodingDetectorPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitUserStyleSheetEnabledPreferenceKey,
</span><span class="cx"> @"", WebKitUserStyleSheetLocationPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitShouldPrintBackgroundsPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitTextAreasAreResizablePreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitShrinksStandaloneImagesToFitPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitJavaEnabledPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitJavaScriptEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitWebSecurityEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitAllowFileAccessFromFileURLsPreferenceKey,
</span><ins>+#if PLATFORM(IOS)
+ [NSNumber numberWithBool:NO], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
+#else
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
</span><ins>+#if PLATFORM(IOS)
+ [NSNumber numberWithBool:NO], WebKitStorageTrackerEnabledPreferenceKey,
+#endif
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitLocalStorageEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitExperimentalNotificationsEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey,
</span><span class="lines">@@ -342,18 +437,24 @@
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitDisplayImagesKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitLoadSiteIconsKey,
</span><span class="cx"> @"1800", WebKitBackForwardCacheExpirationIntervalKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitTabToLinksPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitPrivateBrowsingEnabledPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitRespectStandardStyleKeyEquivalentsPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitShowsURLsInToolTipsPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitShowsToolTipOverTruncatedTextPreferenceKey,
</span><span class="cx"> @"1", WebKitPDFDisplayModePreferenceKey,
</span><span class="cx"> @"0", WebKitPDFScaleFactorPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> @"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
</span><span class="cx"> [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
</span><span class="cx"> WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitDOMPasteAllowedPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitUsesPageCachePreferenceKey,
</span><span class="cx"> [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitPageCacheSupportsPluginsPreferenceKey,
</span><span class="lines">@@ -373,21 +474,31 @@
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitCSSRegionsEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitCSSCompositingEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitCSSGridLayoutEnabledPreferenceKey,
</span><ins>+#if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
+ [NSNumber numberWithBool:YES], WebKitAcceleratedDrawingEnabledPreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
+#else
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitWebGLEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitMultithreadedWebGLEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitForceSoftwareWebGLRenderingPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitAccelerated2dCanvasEnabledPreferenceKey,
</span><ins>+#if PLATFORM(IOS)
+ [NSNumber numberWithBool:YES], WebKitFrameFlatteningEnabledPreferenceKey,
+#else
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey,
</span><ins>+#endif
</ins><span class="cx"> [NSNumber numberWithBool:NO], WebKitSpatialNavigationEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitDNSPrefetchingEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitHyperlinkAuditingEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitAVFoundationEnabledKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitMediaPlaybackRequiresUserGesturePreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitMediaPlaybackAllowsInlinePreferenceKey,
</span><span class="lines">@@ -400,10 +511,27 @@
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitShouldDisplayTextDescriptionsPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:YES], WebKitNotificationsEnabledKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey,
</span><ins>+#else
+ [NSNumber numberWithBool:NO], WebKitAVFoundationEnabledKey,
+ [NSNumber numberWithBool:YES], WebKitMediaPlaybackRequiresUserGesturePreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitMediaPlaybackAllowsInlinePreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitMediaPlaybackAllowsAirPlayPreferenceKey,
+ [NSNumber numberWithUnsignedInt:AudioSession::None], WebKitAudioSessionCategoryOverride,
+ [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
+
+ // Per-Origin Quota on iOS is 25MB. When the quota is reached for a particular origin
+ // the quota for that origin can be increased. See also webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded in WebUI/WebUIDelegate.m.
+ [NSNumber numberWithLongLong:(25 * 1024 * 1024)], WebKitApplicationCacheDefaultOriginQuota,
+
+ // Enable WebAudio by default in all iOS UIWebViews
+ [NSNumber numberWithBool:YES], WebKitWebAudioEnabledPreferenceKey,
+
+ [NSNumber numberWithBool:YES], WebKitShouldRespectImageOrientationKey,
+#endif // PLATFORM(IOS)
</ins><span class="cx"> [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey,
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> [NSNumber numberWithBool:NO],
</span><span class="cx"> #else
</span><span class="cx"> [NSNumber numberWithBool:YES],
</span><span class="lines">@@ -411,6 +539,24 @@
</span><span class="cx"> WebKitScreenFontSubstitutionEnabledKey,
</span><span class="cx"> [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitPlugInSnapshottingEnabledPreferenceKey,
</span><ins>+
+#if PLATFORM(IOS)
+ [NSNumber numberWithUnsignedInt:defaultMaximumImageSize], WebKitMaximumImageSizePreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitTelephoneParsingEnabledPreferenceKey,
+ [NSNumber numberWithInt:-1], WebKitLayoutIntervalPreferenceKey,
+ [NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
+ [NSNumber numberWithInt:-1], WebKitPageCacheSizePreferenceKey,
+ [NSNumber numberWithInt:-1], WebKitObjectCacheSizePreferenceKey,
+ [NSNumber numberWithInt:-1], WebKitNSURLMemoryCacheSizePreferenceKey,
+ [NSNumber numberWithInt:-1], WebKitNSURLDiskCacheSizePreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
+ [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitPasswordEchoEnabledPreferenceKey,
+ [NSNumber numberWithFloat:2.0f], WebKitPasswordEchoDurationPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitNetworkDataUsageTrackingEnabledPreferenceKey,
+ @"", WebKitNetworkInterfaceNamePreferenceKey,
+#endif
</ins><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span><span class="cx"> [NSNumber numberWithFloat:WKGetMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
</span><span class="cx"> #endif
</span><span class="lines">@@ -430,15 +576,18 @@
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitVideoPluginProxyEnabledKey,
</span><ins>+#else
+ [NSNumber numberWithBool:YES], WebKitVideoPluginProxyEnabledKey,
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="cx"> [NSNumber numberWithBool:NO], WebKitMediaSourceEnabledPreferenceKey,
</span><span class="cx"> #endif
</span><span class="cx"> nil];
</span><span class="cx">
</span><del>-
</del><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
</span><span class="cx"> ASSERT(kPDFDisplaySinglePageContinuous == 1);
</span><ins>+#endif
</ins><span class="cx"> [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -456,7 +605,14 @@
</span><span class="cx"> - (id)_valueForKey:(NSString *)key
</span><span class="cx"> {
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ __block id o = nil;
+ dispatch_sync(_private->readWriteQueue, ^{
+ o = [_private->values.get() objectForKey:_key];
+ });
+#else
</ins><span class="cx"> id o = [_private->values.get() objectForKey:_key];
</span><ins>+#endif
</ins><span class="cx"> if (o)
</span><span class="cx"> return o;
</span><span class="cx"> o = [[NSUserDefaults standardUserDefaults] objectForKey:_key];
</span><span class="lines">@@ -476,7 +632,13 @@
</span><span class="cx"> if ([[self _stringValueForKey:key] isEqualToString:value])
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() setObject:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="lines">@@ -493,12 +655,38 @@
</span><span class="cx"> if ([self _integerValueForKey:key] == value)
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() _webkit_setInt:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (unsigned int)_unsignedIntValueForKey:(NSString *)key
+{
+ id o = [self _valueForKey:key];
+ return [o respondsToSelector:@selector(unsignedIntValue)] ? [o unsignedIntValue] : 0;
+}
+
+- (void)_setUnsignedIntValue:(unsigned int)value forKey:(NSString *)key
+{ if ([self _unsignedIntValueForKey:key] == value)
+ return;
+ NSString *_key = KEY(key);
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+ [_private->values.get() _webkit_setUnsignedInt:value forKey:_key];
+ });
+ if (_private->autosaves)
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInt:value] forKey:_key];
+ [self _postPreferencesChangedNotification];
+}
+#endif
+
</ins><span class="cx"> - (float)_floatValueForKey:(NSString *)key
</span><span class="cx"> {
</span><span class="cx"> id o = [self _valueForKey:key];
</span><span class="lines">@@ -510,7 +698,13 @@
</span><span class="cx"> if ([self _floatValueForKey:key] == value)
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() _webkit_setFloat:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="lines">@@ -526,7 +720,13 @@
</span><span class="cx"> if ([self _boolValueForKey:key] == value)
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() _webkit_setBool:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="lines">@@ -543,7 +743,13 @@
</span><span class="cx"> if ([self _longLongValueForKey:key] == value)
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() _webkit_setLongLong:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="lines">@@ -560,7 +766,13 @@
</span><span class="cx"> if ([self _unsignedLongLongValueForKey:key] == value)
</span><span class="cx"> return;
</span><span class="cx"> NSString *_key = KEY(key);
</span><ins>+#if PLATFORM(IOS)
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+#endif
</ins><span class="cx"> [_private->values.get() _webkit_setUnsignedLongLong:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> if (_private->autosaves)
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key];
</span><span class="cx"> [self _postPreferencesChangedNotification];
</span><span class="lines">@@ -676,6 +888,7 @@
</span><span class="cx"> [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)userStyleSheetEnabled
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
</span><span class="lines">@@ -713,7 +926,42 @@
</span><span class="cx">
</span><span class="cx"> [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
</span><span class="cx"> }
</span><ins>+#else
</ins><span class="cx">
</span><ins>+// These methods have had their implementations removed on iOS since it
+// is wrong to have such a setting stored in preferences that, when read,
+// is applied to all WebViews in a iOS process. Such a design might work
+// OK for an application like Safari on Mac OS X, where the only WebViews
+// in use display web content in a straightforward manner. However, it is
+// wrong for iOS, where WebViews are used for various purposes, like
+// text editing, text rendering, and displaying web content.
+//
+// I have changed the user style sheet mechanism to be a per-WebView
+// setting, rather than a per-process preference. This seems to give the
+// behavior we want for iOS.
+
+- (BOOL)userStyleSheetEnabled
+{
+ return NO;
+}
+
+- (void)setUserStyleSheetEnabled:(BOOL)flag
+{
+ // no-op
+}
+
+- (NSURL *)userStyleSheetLocation
+{
+ return nil;
+}
+
+- (void)setUserStyleSheetLocation:(NSURL *)URL
+{
+ // no-op
+}
+#endif // PLATFORM(IOS)
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)shouldPrintBackgrounds
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];
</span><span class="lines">@@ -723,6 +971,7 @@
</span><span class="cx"> {
</span><span class="cx"> [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)isJavaEnabled
</span><span class="cx"> {
</span><span class="lines">@@ -804,6 +1053,7 @@
</span><span class="cx"> return _private->autosaves;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)setTabsToLinks:(BOOL)flag
</span><span class="cx"> {
</span><span class="cx"> [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];
</span><span class="lines">@@ -813,6 +1063,7 @@
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)setPrivateBrowsingEnabled:(BOOL)flag
</span><span class="cx"> {
</span><span class="lines">@@ -836,10 +1087,12 @@
</span><span class="cx">
</span><span class="cx"> - (void)_postCacheModelChangedNotification
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!pthread_main_np()) {
</span><span class="cx"> [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil];
</span><span class="cx"> }
</span><span class="lines">@@ -871,6 +1124,12 @@
</span><span class="cx">
</span><span class="cx"> @implementation WebPreferences (WebPrivate)
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS) && !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 60000)
+- (void) setWebInspectorServerEnabled:(BOOL)flag
+{
+}
+#endif
+
</ins><span class="cx"> - (BOOL)isDNSPrefetchingEnabled
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey:WebKitDNSPrefetchingEnabledPreferenceKey];
</span><span class="lines">@@ -990,6 +1249,7 @@
</span><span class="cx"> [self _setBoolValue:flag forKey:WebKitXSSAuditorEnabledPreferenceKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)respectStandardStyleKeyEquivalents
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
</span><span class="lines">@@ -1029,6 +1289,7 @@
</span><span class="cx"> {
</span><span class="cx"> [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)shrinksStandaloneImagesToFit
</span><span class="cx"> {
</span><span class="lines">@@ -1095,6 +1356,33 @@
</span><span class="cx"> return (NSTimeInterval)[self _floatValueForKey:WebKitBackForwardCacheExpirationIntervalKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (size_t)_maximumImageSize
+{
+ return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitMaximumImageSizePreferenceKey];
+}
+
+- (BOOL)_standalone
+{
+ return [self _boolValueForKey:WebKitStandalonePreferenceKey];
+}
+
+- (void)_setStandalone:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitStandalonePreferenceKey];
+}
+
+- (void)_setTelephoneNumberParsingEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitTelephoneParsingEnabledPreferenceKey];
+}
+
+- (BOOL)_telephoneNumberParsingEnabled
+{
+ return [self _boolValueForKey:WebKitTelephoneParsingEnabledPreferenceKey];
+}
+#endif
+
</ins><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span><span class="cx"> - (void)_setMinimumZoomFontSize:(float)size
</span><span class="cx"> {
</span><span class="lines">@@ -1107,6 +1395,130 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_setLayoutInterval:(int)l
+{
+ [self _setIntegerValue:l forKey:WebKitLayoutIntervalPreferenceKey];
+}
+
+- (int)_layoutInterval
+{
+ return [self _integerValueForKey:WebKitLayoutIntervalPreferenceKey];
+}
+
+- (void)_setMaxParseDuration:(float)d
+{
+ [self _setFloatValue:d forKey:WebKitMaxParseDurationPreferenceKey];
+}
+
+- (float)_maxParseDuration
+{
+ return [self _floatValueForKey:WebKitMaxParseDurationPreferenceKey];
+}
+
+- (void)_setPageCacheSize:(int)size
+{
+ [self _setIntegerValue:size forKey:WebKitPageCacheSizePreferenceKey];
+}
+
+- (int)_pageCacheSize
+{
+ return [self _integerValueForKey:WebKitPageCacheSizePreferenceKey];
+}
+
+- (void)_setObjectCacheSize:(int)size
+{
+ [self _setIntegerValue:size forKey:WebKitObjectCacheSizePreferenceKey];
+}
+
+- (int)_objectCacheSize
+{
+ return [self _integerValueForKey:WebKitObjectCacheSizePreferenceKey];
+}
+
+- (void)_setNSURLMemoryCacheSize:(int)size
+{
+ [self _setIntegerValue:size forKey:WebKitNSURLMemoryCacheSizePreferenceKey];
+}
+
+- (int)_NSURLMemoryCacheSize
+{
+ return [self _integerValueForKey:WebKitNSURLMemoryCacheSizePreferenceKey];
+}
+
+- (void)_setNSURLDiskCacheSize:(int)size
+{
+ [self _setIntegerValue:size forKey:WebKitNSURLDiskCacheSizePreferenceKey];
+}
+
+- (int)_NSURLDiskCacheSize
+{
+ return [self _integerValueForKey:WebKitNSURLDiskCacheSizePreferenceKey];
+}
+
+- (void)_setAlwaysUseBaselineOfPrimaryFont:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitAlwaysUseBaselineOfPrimaryFontPreferenceKey];
+}
+
+- (BOOL)_alwaysUseBaselineOfPrimaryFont
+{
+ return [self _boolValueForKey:WebKitAlwaysUseBaselineOfPrimaryFontPreferenceKey];
+}
+
+- (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
+}
+
+- (BOOL)_allowMultiElementImplicitFormSubmission
+{
+ return [self _boolValueForKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
+}
+
+- (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
+}
+
+- (BOOL)_alwaysRequestGeolocationPermission
+{
+ return [self _boolValueForKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
+}
+
+- (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
+}
+
+- (BOOL)_alwaysUseAcceleratedOverflowScroll
+{
+ return [self _boolValueForKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
+}
+
+- (void)_setInterpolationQuality:(int)quality
+{
+ [self _setIntegerValue:quality forKey:WebKitInterpolationQualityPreferenceKey];
+}
+
+- (int)_interpolationQuality
+{
+ return [self _integerValueForKey:WebKitInterpolationQualityPreferenceKey];
+}
+
+- (BOOL)_allowPasswordEcho
+{
+ return [self _boolValueForKey:WebKitPasswordEchoEnabledPreferenceKey];
+}
+
+- (float)_passwordEchoDuration
+{
+ return [self _floatValueForKey:WebKitPasswordEchoDurationPreferenceKey];
+}
+
+#endif // PLATFORM(IOS)
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (float)PDFScaleFactor
</span><span class="cx"> {
</span><span class="cx"> return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];
</span><span class="lines">@@ -1116,6 +1528,7 @@
</span><span class="cx"> {
</span><span class="cx"> [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (int64_t)applicationCacheTotalQuota
</span><span class="cx"> {
</span><span class="lines">@@ -1140,6 +1553,7 @@
</span><span class="cx"> [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (PDFDisplayMode)PDFDisplayMode
</span><span class="cx"> {
</span><span class="cx"> PDFDisplayMode value = [self _integerValueForKey:WebKitPDFDisplayModePreferenceKey];
</span><span class="lines">@@ -1154,6 +1568,7 @@
</span><span class="cx"> {
</span><span class="cx"> [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (WebKitEditableLinkBehavior)editableLinkBehavior
</span><span class="cx"> {
</span><span class="lines">@@ -1212,6 +1627,18 @@
</span><span class="cx"> [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)storageTrackerEnabled
+{
+ return [self _boolValueForKey:WebKitStorageTrackerEnabledPreferenceKey];
+}
+
+- (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled
+{
+ [self _setBoolValue:storageTrackerEnabled forKey:WebKitStorageTrackerEnabledPreferenceKey];
+}
+#endif
+
</ins><span class="cx"> - (BOOL)localStorageEnabled
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];
</span><span class="lines">@@ -1271,10 +1698,12 @@
</span><span class="cx">
</span><span class="cx"> - (void)_postPreferencesChangedNotification
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!pthread_main_np()) {
</span><span class="cx"> [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil];
</span><span class="cx"> [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
</span><span class="lines">@@ -1695,6 +2124,76 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)mediaPlaybackAllowsAirPlay
+{
+ return [self _boolValueForKey:WebKitMediaPlaybackAllowsAirPlayPreferenceKey];
+}
+
+- (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitMediaPlaybackAllowsAirPlayPreferenceKey];
+}
+
+- (unsigned)audioSessionCategoryOverride
+{
+ return [self _unsignedIntValueForKey:WebKitAudioSessionCategoryOverride];
+}
+
+- (void)setAudioSessionCategoryOverride:(unsigned)override
+{
+ if (override > AudioSession::AudioProcessing) {
+ // Clients are passing us OSTypes values from AudioToolbox/AudioSession.h,
+ // which need to be translated into AudioSession::CategoryType:
+ switch (override) {
+ case kAudioSessionCategory_AmbientSound:
+ override = AudioSession::AmbientSound;
+ break;
+ case kAudioSessionCategory_SoloAmbientSound:
+ override = AudioSession::SoloAmbientSound;
+ break;
+ case kAudioSessionCategory_MediaPlayback:
+ override = AudioSession::MediaPlayback;
+ break;
+ case kAudioSessionCategory_RecordAudio:
+ override = AudioSession::RecordAudio;
+ break;
+ case kAudioSessionCategory_PlayAndRecord:
+ override = AudioSession::PlayAndRecord;
+ break;
+ case kAudioSessionCategory_AudioProcessing:
+ override = AudioSession::AudioProcessing;
+ break;
+ default:
+ override = AudioSession::None;
+ break;
+ }
+ }
+
+ [self _setUnsignedIntValue:override forKey:WebKitAudioSessionCategoryOverride];
+}
+
+- (BOOL)networkDataUsageTrackingEnabled
+{
+ return [self _boolValueForKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
+}
+
+- (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled
+{
+ [self _setBoolValue:trackingEnabled forKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
+}
+
+- (NSString *)networkInterfaceName
+{
+ return [self _stringValueForKey:WebKitNetworkInterfaceNamePreferenceKey];
+}
+
+- (void)setNetworkInterfaceName:(NSString *)name
+{
+ [self _setStringValue:name forKey:WebKitNetworkInterfaceNamePreferenceKey];
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (BOOL)mediaPlaybackRequiresUserGesture
</span><span class="cx"> {
</span><span class="cx"> return [self _boolValueForKey:WebKitMediaPlaybackRequiresUserGesturePreferenceKey];
</span><span class="lines">@@ -1756,6 +2255,38 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_invalidateCachedPreferences
+{
+ dispatch_barrier_sync(_private->readWriteQueue, ^{
+ if (_private->values)
+ _private->values = adoptNS([[NSMutableDictionary alloc] init]);
+ });
+
+ // Tell any live WebViews to refresh their preferences
+ [self _postPreferencesChangedNotification];
+}
+
+- (void)_synchronizeWebStoragePolicyWithCookiePolicy
+{
+ NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
+ WebStorageBlockingPolicy storageBlockingPolicy;
+ switch (cookieAcceptPolicy) {
+ case NSHTTPCookieAcceptPolicyAlways:
+ storageBlockingPolicy = WebAllowAllStorage;
+ break;
+ case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+ storageBlockingPolicy = WebBlockThirdPartyStorage;
+ break;
+ case NSHTTPCookieAcceptPolicyNever:
+ storageBlockingPolicy = WebBlockAllStorage;
+ break;
+ }
+
+ [self setStorageBlockingPolicy:storageBlockingPolicy];
+}
+#endif
+
</ins><span class="cx"> - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag
</span><span class="cx"> {
</span><span class="cx"> [self _setBoolValue:flag forKey:WebKitBackspaceKeyNavigationEnabledKey];
</span><span class="lines">@@ -1868,7 +2399,7 @@
</span><span class="cx">
</span><span class="cx"> static bool needsScreenFontsEnabledQuirk()
</span><span class="cx"> {
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> static bool is1PasswordNeedingScreenFontsQuirk = WKExecutableWasLinkedOnOrBeforeMountainLion()
</span><span class="cx"> && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"ws.agile.1Password"];
</span><span class="cx"> return is1PasswordNeedingScreenFontsQuirk;
</span><span class="lines">@@ -1891,7 +2422,13 @@
</span><span class="cx">
</span><span class="cx"> - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ // We don't want to write the setting out, so we just reset the default instead of storing the new setting.
+ NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:storageBlockingPolicy] forKey:WebKitStorageBlockingPolicyKey];
+ [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
+#else
</ins><span class="cx"> [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WebStorageBlockingPolicy)storageBlockingPolicy
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebResourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebResource.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebResource.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebResource.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -66,9 +66,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -254,7 +256,11 @@
</span><span class="cx">
</span><span class="cx"> - (NSString *)description
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> return [NSString stringWithFormat:@"<%@ %@>", [self className], [self URL]];
</span><ins>+#else
+ return [NSString stringWithFormat:@"<%@ %@>", NSStringFromClass([self class]), [self URL]];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -348,6 +354,7 @@
</span><span class="cx"> return suggestedFilename;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSFileWrapper *)_fileWrapperRepresentation
</span><span class="cx"> {
</span><span class="cx"> NSFileWrapper *wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:[self data]] autorelease];
</span><span class="lines">@@ -357,6 +364,7 @@
</span><span class="cx"> [wrapper setPreferredFilename:filename];
</span><span class="cx"> return wrapper;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSURLResponse *)_response
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebTextCompletionControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebTextCompletionController.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebTextCompletionController.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebTextCompletionController.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> @class WebView;
</span><span class="cx"> @class WebHTMLView;
</span><span class="cx">
</span><span class="lines">@@ -43,3 +45,5 @@
</span><span class="cx"> - (BOOL)filterKeyDown:(NSEvent *)event;
</span><span class="cx"> - (void)_reflectSelection;
</span><span class="cx"> @end
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebTextIteratormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebTextIterator.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebTextIterator.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebTextIterator.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -48,9 +48,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -202,6 +202,48 @@
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="cx"> #import <wtf/StdLibExtras.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "MemoryMeasure.h"
+#import "WebCaretChangeListener.h"
+#import "WebChromeClientIOS.h"
+#import "WebDefaultFormDelegate.h"
+#import "WebDefaultFrameLoadDelegate.h"
+#import "WebDefaultResourceLoadDelegate.h"
+#import "WebDefaultUIKitDelegate.h"
+#import "WebFixedPositionContent.h"
+#import "WebMailDelegate.h"
+#import "WebNSUserDefaultsExtras.h"
+#import "WebPDFViewIOS.h"
+#import "WebPlainWhiteView.h"
+#import "WebPluginController.h"
+#import "WebPolicyDelegatePrivate.h"
+#import "WebSQLiteDatabaseTrackerClient.h"
+#import "WebStorageManagerPrivate.h"
+#import "WebUIKitSupport.h"
+#import "WebVisiblePosition.h"
+#import <CFNetwork/CFURLCachePriv.h>
+#import <MobileGestalt.h>
+#import <WebCore/EventNames.h>
+#import <WebCore/FontCache.h>
+#import <WebCore/IconController.h>
+#import <WebCore/NetworkStateNotifier.h>
+#import <WebCore/RuntimeApplicationChecksIOS.h>
+#import <WebCore/SQLiteDatabaseTracker.h>
+#import <WebCore/SmartReplace.h>
+#import <WebCore/TextRun.h>
+#import <WebCore/WAKWindow.h>
+#import <WebCore/WebCoreThread.h>
+#import <WebCore/WebCoreThreadMessage.h>
+#import <WebCore/WebCoreThreadRun.h>
+#import <WebCore/WebEvent.h>
+#import <dispatch/private.h
+#import <wtf/FastMalloc.h>
+
+#if USE(ACCELERATED_COMPOSITING)
+#import <WebCore/GraphicsLayer.h>
+#endif
+#endif
+
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx"> #import <WebKit/WebDashboardRegion.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -221,6 +263,7 @@
</span><span class="cx"> #import <glib.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSSpellChecker (WebNSSpellCheckerDetails)
</span><span class="cx"> - (void)_preflightChosenSpellServer;
</span><span class="cx"> @end
</span><span class="lines">@@ -237,6 +280,7 @@
</span><span class="cx"> - (BOOL)_wrapsCarbonWindow;
</span><span class="cx"> - (BOOL)_hasKeyAppearance;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace JSC;
</span><span class="lines">@@ -246,8 +290,10 @@
</span><span class="cx"> #elif defined(__i386__) || defined(__x86_64__)
</span><span class="cx"> #define PROCESSOR "Intel"
</span><span class="cx"> #else
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> #error Unknown architecture
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #define FOR_EACH_RESPONDER_SELECTOR(macro) \
</span><span class="cx"> macro(alignCenter) \
</span><span class="lines">@@ -386,20 +432,55 @@
</span><span class="cx"> static BOOL s_didSetCacheModel;
</span><span class="cx"> static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static Class s_pdfRepresentationClass;
+static Class s_pdfViewClass;
+#endif
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> static const char webViewIsOpen[] = "At least one WebView is still open.";
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface WebView(WebViewPrivate)
+- (void)_preferencesChanged:(WebPreferences *)preferoid)_updateScreenScaleFromWindow;
+@end
+
+@interface NSURLCache (WebPrivate)
+- (CFURLCacheRef)_CFURLCache;
+@end
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface NSObject (WebValidateWithoutDelegate)
</span><span class="cx"> - (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item;
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@class _WebSafeForwarder;
+
+@interface _WebSafeAsyncForwarder : NSObject {
+ _WebSafeForwarder *_forwarder;
+}
+- (id)initWithForwarder:(_WebSafeForwarder *)forwarder;
+@end
+#endif
+
</ins><span class="cx"> @interface _WebSafeForwarder : NSObject
</span><span class="cx"> {
</span><span class="cx"> id target; // Non-retained. Don't retain delegates.
</span><span class="cx"> id defaultTarget;
</span><ins>+#if PLATFORM(IOS)
+ _WebSafeAsyncForwarder *asyncForwarder;
+ dispatch_once_t asyncForwarderPred;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> - (instancetype)initWithTarget:(id)target defaultTarget:(id)defaultTarget;
</span><ins>+#if PLATFORM(IOS)
+- (void)clearTarget;
+- (id)asyncForwarder;
+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> FindOptions coreOptions(WebFindOptions options)
</span><span class="lines">@@ -457,7 +538,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @interface WebView (WebFileInternal)
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (float)_deviceScaleFactor;
</span><ins>+#endif
</ins><span class="cx"> - (BOOL)_isLoading;
</span><span class="cx"> - (WebFrameView *)_frameViewAtWindowPoint:(NSPoint)point;
</span><span class="cx"> - (WebFrame *)_focusedFrame;
</span><span class="lines">@@ -489,7 +572,12 @@
</span><span class="cx">
</span><span class="cx"> NSString *WebViewProgressStartedNotification = @"WebProgressStartedNotification";
</span><span class="cx"> NSString *WebViewProgressEstimateChangedNotification = @"WebProgressEstimateChangedNotification";
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *WebViewProgressFinishedNotification = @"WebProgressFinishedNotification";
</span><ins>+#else
+NSString * const WebViewProgressEstimatedProgressKey = @"WebProgressEstimatedProgressKey";
+NSString * const WebViewProgressBackgroundColorKey = @"WebProgressBackgroundColorKey";
+#endif
</ins><span class="cx">
</span><span class="cx"> NSString * const WebViewDidBeginEditingNotification = @"WebViewDidBeginEditingNotification";
</span><span class="cx"> NSString * const WebViewDidChangeNotification = @"WebViewDidChangeNotification";
</span><span class="lines">@@ -503,6 +591,7 @@
</span><span class="cx">
</span><span class="cx"> static NSMutableSet *schemesWithRepresentationsSet;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *_WebCanGoBackKey = @"canGoBack";
</span><span class="cx"> NSString *_WebCanGoForwardKey = @"canGoForward";
</span><span class="cx"> NSString *_WebEstimatedProgressKey = @"estimatedProgress";
</span><span class="lines">@@ -511,6 +600,7 @@
</span><span class="cx"> NSString *_WebMainFrameTitleKey = @"mainFrameTitle";
</span><span class="cx"> NSString *_WebMainFrameURLKey = @"mainFrameURL";
</span><span class="cx"> NSString *_WebMainFrameDocumentKey = @"mainFrameDocument";
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSString *_WebViewDidStartAcceleratedCompositingNotification = @"_WebViewDidStartAcceleratedCompositing";
</span><span class="cx"> NSString * const WebViewWillCloseNotification = @"WebViewWillCloseNotification";
</span><span class="lines">@@ -534,12 +624,14 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> static BOOL continuousSpellCheckingEnabled;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static BOOL grammarCheckingEnabled;
</span><span class="cx"> static BOOL automaticQuoteSubstitutionEnabled;
</span><span class="cx"> static BOOL automaticLinkDetectionEnabled;
</span><span class="cx"> static BOOL automaticDashSubstitutionEnabled;
</span><span class="cx"> static BOOL automaticTextReplacementEnabled;
</span><span class="cx"> static BOOL automaticSpellingCorrectionEnabled;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @implementation WebView (AllWebViews)
</span><span class="cx">
</span><span class="lines">@@ -580,6 +672,7 @@
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebPrivate)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static NSString *systemMarketingVersionForUserAgentString()
</span><span class="cx"> {
</span><span class="cx"> // Use underscores instead of dots because when we first added the Mac OS X version to the user agent string
</span><span class="lines">@@ -587,6 +680,7 @@
</span><span class="cx"> // but we're sticking with the underscores for compatibility with the format used by older versions of Safari.
</span><span class="cx"> return [systemMarketingVersion() stringByReplacingOccurrencesOfString:@"." withString:@"_"];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static NSString *createUserVisibleWebKitVersionString()
</span><span class="cx"> {
</span><span class="lines">@@ -601,6 +695,7 @@
</span><span class="cx"> return [fullVersion copy];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName
</span><span class="cx"> {
</span><span class="cx"> // Note: Do *not* move the initialization of osVersion nor webKitVersion into the declaration.
</span><span class="lines">@@ -615,7 +710,55 @@
</span><span class="cx"> return [NSString stringWithFormat:@"Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko) %@", osVersion, webKitVersion, applicationName];
</span><span class="cx"> return [NSString stringWithFormat:@"Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko)", osVersion, webKitVersion];
</span><span class="cx"> }
</span><ins>+#else
++ (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName osMarketingVersion:(NSString *)osMarketingVersion
+{
+ // Check to see if there is a user agent override for all WebKit clients.
+ CFPropertyListRef override = CFPreferencesCopyAppValue(CFSTR("UserAgent"), CFSTR("com.apple.WebFoundation"));
+ if (override) {
+ if (CFGetTypeID(override) == CFStringGetTypeID())
+ return (NSString *)CFBridgingRelease(override);
+ CFRelease(override);
+ }
</ins><span class="cx">
</span><ins>+ static NSString *webKitVersion;
+ if (!webKitVersion)
+ webKitVersion = createUserVisibleWebKitVersionString();
+ if ([applicationName length])
+ return [NSString stringWithFormat:@"Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko) %@", WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion, webKitVersion, applicationName];
+ return [NSString stringWithFormat:@"Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko)", WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion, webKitVersion];
+}
+
++ (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName
+{
+ static NSString *osMarketingVersion;
+ if (!osMarketingVersion) {
+#if !PLATFORM(IOS_SIMULATOR)
+ NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
+#else
+ NSString *rootDirectory = [NSString stringWithUTF8String:WebKitPlatformSystemRootDirectory()];
+ NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:[rootDirectory stringByAppendingPathComponent:@"System/Library/CoreServices/SystemVersion.plist"]];
+#endif
+ NSString *productVersion = [systemInfo objectForKey:@"ProductVersion"];
+ // Due to <rdar://problem/3787996>, we must use something other than periods to delimit the marketing version. Using underscores to match Leopard's new convention.
+ osMarketingVersion = !productVersion ? @"" : [[productVersion stringByReplacingOccurrencesOfString:@"." withString:@"_"] retain];
+ [systemInfo release];
+ }
+ return [self _standardUserAgentWithApplicationName:applicationName osMarketingVersion:osMarketingVersion];
+}
+
+- (void)_setBrowserUserAgentProductVersion:(NSString *)productVersion buildVersion:(NSString *)buildVersion bundleVersion:(NSString *)bundleVersion
+{
+ [self setApplicationNameForUserAgent:[NSString stringWithFormat:@"Version/%@ Mobile/%@ Safari/%@", productVersion, buildVersion, bundleVersion]];
+}
+
+- (void)_setUIWebViewUserAgentWithBuildVersion:(NSString *)buildVersion
+{
+ [self setApplicationNameForUserAgent:[@"Mobile/" stringByAppendingString:buildVersion]];
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> + (void)_reportException:(JSValueRef)exception inContext:(JSContextRef)context
</span><span class="cx"> {
</span><span class="cx"> if (!exception || !context)
</span><span class="lines">@@ -640,6 +783,10 @@
</span><span class="cx"> NSString *appName = [[NSBundle mainBundle] bundleIdentifier];
</span><span class="cx"> if (!appName)
</span><span class="cx"> appName = [[NSProcessInfo processInfo] processName];
</span><ins>+#if PLATFORM(IOS)
+ if (WebCore::applicationIsMobileSafari() || WebCore::applicationIsWebApp())
+ appName = @"com.apple.WebAppCache";
+#endif
</ins><span class="cx">
</span><span class="cx"> ASSERT(appName);
</span><span class="cx">
</span><span class="lines">@@ -656,7 +803,11 @@
</span><span class="cx">
</span><span class="cx"> static bool shouldRestrictWindowFocus()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return true;
+#else
</ins><span class="cx"> return !applicationIsHRBlock();
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_dispatchPendingLoadRequests
</span><span class="lines">@@ -664,6 +815,7 @@
</span><span class="cx"> resourceLoadScheduler()->servePendingRequests();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_registerDraggedTypes
</span><span class="cx"> {
</span><span class="cx"> NSArray *editableTypes = [WebHTMLView _insertablePasteboardTypes];
</span><span class="lines">@@ -694,18 +846,51 @@
</span><span class="cx"> core(self)->group().addUserScriptToWorld(*core([WebScriptWorld world]),
</span><span class="cx"> outlookQuirksScriptContents, URL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInAllFrames);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static bool shouldRespectPriorityInCSSAttributeSetters()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ static bool isStanzaNeedingAttributeSetterQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY)
+ && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.lexcycle.stanza"];
+ return isStanzaNeedingAttributeSetterQuirk;
+#else
</ins><span class="cx"> static bool isIAdProducerNeedingAttributeSetterQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY)
</span><span class="cx"> && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.iAdProducer"];
</span><span class="cx"> return isIAdProducerNeedingAttributeSetterQuirk;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+static bool shouldTransformsAffectOverflow()
+{
+ static bool shouldTransformsAffectOverflow = !applicationIsOkCupid() || WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CSS_TRANSFORMS_AFFECTING_OVERFLOW);
+ return shouldTransformsAffectOverflow;
+}
+
+static bool shouldDispatchJavaScriptWindowOnErrorEvents()
+{
+ static bool shouldDispatchJavaScriptWindowOnErrorEvents = !applicationIsFacebook() || WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_WINDOW_ON_ERROR);
+ return shouldDispatchJavaScriptWindowOnErrorEvents;
+}
+
+static bool isInternalInstall()
+{
+ static bool isInternal = MGGetBoolAnswer(kMGQAppleInternalInstallCapability);
+ return isInternal;
+}
+
+static bool didOneTimeInitialization = false;
+#endif
+
</ins><span class="cx"> static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ static bool shouldUseLegacyBackgroundSizeShorthandBehavior = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
+#else
</ins><span class="cx"> static bool shouldUseLegacyBackgroundSizeShorthandBehavior = applicationIsVersions()
</span><span class="cx"> && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
</span><ins>+#endif
</ins><span class="cx"> return shouldUseLegacyBackgroundSizeShorthandBehavior;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -723,7 +908,11 @@
</span><span class="cx"> _private->preferences = [standardPreferences retain];
</span><span class="cx"> _private->mainFrameDocumentReady = NO;
</span><span class="cx"> _private->drawsBackground = YES;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
</span><ins>+#else
+ _private->backgroundColor = CGColorRetain(cachedCGColor(Color::white, ColorSpaceDeviceRGB));
+#endif
</ins><span class="cx"> _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES;
</span><span class="cx">
</span><span class="cx"> NSRect f = [self frame];
</span><span class="lines">@@ -732,7 +921,9 @@
</span><span class="cx"> [self addSubview:frameView];
</span><span class="cx"> [frameView release];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool didOneTimeInitialization = false;
</span><ins>+#endif
</ins><span class="cx"> if (!didOneTimeInitialization) {
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> WebKitInitializeLoggingChannelsIfNecessary();
</span><span class="lines">@@ -744,9 +935,18 @@
</span><span class="cx"> WebPlatformStrategies::initializeIfNecessary();
</span><span class="cx">
</span><span class="cx"> #if ENABLE(SQL_DATABASE)
</span><ins>+#if PLATFORM(IOS)
+ // Set the WebSQLiteDatabaseTrackerClient.
+ SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
+
+ if ([standardPreferences databasesEnabled])
+#endif
</ins><span class="cx"> [WebDatabaseManager sharedWebDatabaseManager];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if ([standardPreferences storageTrackerEnabled])
+#endif
</ins><span class="cx"> WebKitInitializeStorageIfNecessary();
</span><span class="cx"> WebKitInitializeApplicationCachePathIfNecessary();
</span><span class="cx"> #if ENABLE(DISK_IMAGE_CACHE) && PLATFORM(IOS)
</span><span class="lines">@@ -761,13 +961,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Page::PageClients pageClients;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> pageClients.chromeClient = new WebChromeClient(self);
</span><span class="cx"> pageClients.contextMenuClient = new WebContextMenuClient(self);
</span><del>- pageClients.editorClient = new WebEditorClient(self);
</del><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> pageClients.dragClient = new WebDragClient(self);
</span><span class="cx"> #endif
</span><span class="cx"> pageClients.inspectorClient = new WebInspectorClient(self);
</span><ins>+#else
+ pageClients.chromeClient = new WebChromeClientIOS(self);
+ pageClients.inspectorClient = new WebInspectorClient(self);
+#endif
+ pageClients.editorClient = new WebEditorClient(self);
</ins><span class="cx"> pageClients.alternativeTextClient = new WebAlternativeTextClient(self);
</span><span class="cx"> pageClients.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx"> _private->page = new Page(pageClients);
</span><span class="lines">@@ -778,8 +983,10 @@
</span><span class="cx"> WebCore::provideNotification(_private->page, new WebNotificationClient(self));
</span><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(DEVICE_ORIENTATION)
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> WebCore::provideDeviceOrientationTo(_private->page, new WebDeviceOrientationClient(self));
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> WebCore::provideUserMediaTo(_private->page, new WebUserMediaClient(self));
</span><span class="cx"> #endif
</span><span class="lines">@@ -792,22 +999,37 @@
</span><span class="cx"> _private->page->settings().setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
</span><span class="cx"> _private->page->settings().setUseLegacyBackgroundSizeShorthandBehavior(shouldUseLegacyBackgroundSizeShorthandBehavior());
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (needsOutlookQuirksScript()) {
</span><span class="cx"> _private->page->settings().setShouldInjectUserScriptsInInitialEmptyDocument(true);
</span><span class="cx"> [self _injectOutlookQuirksScript];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // Preserve the behavior we had before <rdar://problem/7580867>
+ // by enforcing a 5MB limit for session storage.
+ _private->page->settings().setSessionStorageQuota(5 * 1024 * 1024);
+
+ [self _updateScreenScaleFromWindow];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil];
+ _private->_fixedPositionContent = [[WebFixedPositionContent alloc] initWithWebView:self];
+#endif
+
</ins><span class="cx"> if ([[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled])
</span><span class="cx"> [self setSmartInsertDeleteEnabled:[[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled]];
</span><span class="cx">
</span><span class="cx"> [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSRunLoop *runLoop = [NSRunLoop mainRunLoop];
</span><span class="cx">
</span><span class="cx"> if (WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES))
</span><span class="cx"> [self scheduleInRunLoop:runLoop forMode:(NSString *)kCFRunLoopCommonModes];
</span><span class="cx"> else
</span><span class="cx"> [self scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [self _addToAllWebViewsSet];
</span><span class="cx"> [self setGroupName:groupName];
</span><span class="lines">@@ -824,7 +1046,9 @@
</span><span class="cx"> if ([[self class] shouldIncludeInWebKitStatistics])
</span><span class="cx"> ++WebViewCount;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _registerDraggedTypes];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [self _setVisibilityState:([self _isViewVisible] ? WebPageVisibilityStateVisible : WebPageVisibilityStateHidden) isInitialState:YES];
</span><span class="cx">
</span><span class="lines">@@ -832,8 +1056,15 @@
</span><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
</span><span class="cx"> name:WebPreferencesChangedInternalNotification object:prefs];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _preferencesChanged:[self preferences]];
</span><span class="cx"> [[self preferences] _postPreferencesChangedAPINotification];
</span><ins>+#else
+ // do this on the current thread on iOS, since the web thread could be blocked on the main thread,
+ // and prefs need to be changed synchronously <rdar://problem/5841558>
+ [self _preferencesChanged:prefs];
+ _private->page->settings().setFontFallbackPrefersPictographs(true);
+#endif
</ins><span class="cx">
</span><span class="cx"> memoryPressureHandler().install();
</span><span class="cx">
</span><span class="lines">@@ -846,8 +1077,10 @@
</span><span class="cx"> SecurityPolicy::setLocalLoadPolicy(SecurityPolicy::AllowLocalLoadsForLocalAndSubstituteData);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_CONTENT_SNIFFING_FOR_FILE_URLS))
</span><span class="cx"> ResourceHandle::forceContentSniffing();
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(GLIB)
</span><span class="cx"> [self _scheduleGlibContextIterations];
</span><span class="lines">@@ -879,7 +1112,9 @@
</span><span class="cx"> _private = [[WebViewPrivate alloc] init];
</span><span class="cx"> [self _commonInitializationWithFrameName:frameName groupName:groupName];
</span><span class="cx"> [self setMaintainsBackForwardList: YES];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
</span><ins>+#endif
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -897,6 +1132,7 @@
</span><span class="cx"> return [[WebFrameView _viewTypesAllowImageTypeOmission:NO] allKeys];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSArray *)_supportedFileExtensions
</span><span class="cx"> {
</span><span class="cx"> NSMutableSet *extensions = [[NSMutableSet alloc] init];
</span><span class="lines">@@ -913,7 +1149,263 @@
</span><span class="cx"> [extensions release];
</span><span class="cx"> return uniqueExtensions;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
++ (void)enableWebThread
+{
+ static BOOL isWebThreadEnabled = NO;
+ if (!isWebThreadEnabled) {
+ WebCoreObjCDeallocOnWebThread([WebBasePluginPackage class]);
+ WebCoreObjCDeallocOnWebThread([WebDataSource class]);
+ WebCoreObjCDeallocOnWebThread([WebFrame class]);
+ WebCoreObjCDeallocOnWebThread([WebHTMLView class]);
+ WebCoreObjCDeallocOnWebThread([WebHistoryItem class]);
+ WebCoreObjCDeallocOnWebThread([WebPlainWhiteView class]);
+ WebCoreObjCDeallocOnWebThread([WebPolicyDecisionListener class]);
+ WebCoreObjCDeallocOnWebThread([WebView class]);
+ WebCoreObjCDeallocOnWebThread([WebVisiblePosition class]);
+ if (applicationIsTheEconomistOnIPhone() && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_DELEGATE_CALLS_IN_COMMON_RUNLOOP_MODES))
+ WebThreadSetDelegateSourceRunLoopMode(kCFRunLoopDefaultMode);
+ WebThreadEnable();
+ isWebThreadEnabled = YES;
+ }
+}
+
+- (id)initSimpleHTMLDocumentWithStyle:(NSString *)style frame:(CGRect)frame preferences:(WebPreferences *)preferences groupName:(NSString *)groupName
+{
+ self = [super initWithFrame:frame];
+ if (!self)
+ return nil;
+
+ _private = [[WebViewPrivate alloc] init];
+
+#ifndef NDEBUG
+ WTF::RefCountedLeakCounter::suppressMessages(webViewIsOpen);
+#endif
+
+ if (!preferences)
+ preferences = [WebPreferences standardPreferences];
+ [preferences willAddToWebView];
+
+ _private->preferences = [preferences retain];
+ _private->mainFrameDocumentReady = NO;
+ _private->drawsBackground = YES;
+ _private->backgroundColor = CGColorRetain(cachedCGColor(Color::white, ColorSpaceDeviceRGB));
+
+#if ENABLE(REMOTE_INSPECTOR)
+ // Production installs always disallow debugging simple HTML documents.
+ // Internal installs allow debugging simple HTML documents (TextFields) if the Internal Setting is enabled.
+ if (!isInternalInstall())
+ _private->allowsRemoteInspection = NO;
+ else {
+ static BOOL textFieldInspectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitTextFieldRemoteInspectionEnabledPreferenceKey];
+ _private->allowsRemoteInspection = textFieldInspectionEnabled;
+ if (_private->allowsRemoteInspection && autoStartRemoteInspector)
+ [WebView _enableRemoteInspector];
+ }
+#endif
+
+ WebFrameView *frameView = nil;
+ frameView = [[WebFrameView alloc] initWithFrame: CGRectMake(0,0,frame.size.width,frame.size.height)];
+ [frameView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [self addSubview:frameView];
+ [frameView release];
+
+
+ Page::PageClients pageClients;
+ pageClients.chromeClient = new WebChromeClientIOS(self);
+#if ENABLE(DRAG_SUPPORT)
+ pageClients.dragClient = new WebDragClient(self);
+#endif
+ pageClients.editorClient = new WebEditorClient(self);
+ pageClients.inspectorClient = new WebInspectorClient(self);
+ pageClients.loaderClientForMainFrame = new WebFrameLoaderClient;
+ _private->page = new Page(pageClients);
+
+ [self setSmartInsertDeleteEnabled:YES];
+
+ // FIXME: <rdar://problem/6851451> Should respect preferences in fast path WebView initialization
+ // We are ignoring the preferences object on fast path and just using Settings defaults (everything fancy off).
+ // This matches how UIKit sets up the preferences. We need to set default values for fonts though, <rdar://problem/6850611>.
+ // This should be revisited later. There is some risk involved, _preferencesChanged used to show up badly in Shark.
+ _private->page->settings().setMinimumLogicalFontSize(9);
+ _private->page->settings().setDefaultFontSize([_private->preferences defaultFontSize]);
+ _private->page->settings().setDefaultFixedFontSize(13);
+ _private->page->settings().setDownloadableBinaryFontsEnabled(false);
+ _private->page->settings().setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]);
+ _private->page->settings().setScreenFontSubstitutionEnabled(false);
+
+ // FIXME: <rdar://problem/7394370> Always use primary font baseline in text field base line calculation, ignore fallback fonts.
+ _private->page->settings().setAlwaysUseBaselineOfPrimaryFont([preferences _alwaysUseBaselineOfPrimaryFont]);
+
+ _private->page->settings().setFontFallbackPrefersPictographs(true);
+ _private->page->settings().setPictographFontFamily("AppleColorEmoji");
+
+ // FIXME: this is a workaround for <rdar://problem/11518688> REGRESSION: Quoted text font changes when replying to certain email
+ _private->page->settings().setStandardFontFamily([_private->preferences standardFontFamily]);
+
+ // FIXME: this is a workaround for <rdar://problem/11820090> Quoted text changes in size when replying to certain email
+ _private->page->settings().setMinimumFontSize([_private->preferences minimumFontSize]);
+
+ _private->page->setGroupName(groupName);
+
+ [WebFrame _createMainFrameWithSimpleHTMLDocumentWithPage:_private->page frameView:frameView style:style];
+
+ [self _addToAllWebViewsSet];
+
+ ++WebViewCount;
+
+ SecurityPolicy::setLocalLoadPolicy(SecurityPolicy::AllowLocalLoadsForLocalAndSubstituteData);
+
+ return self;
+}
+
++ (void)_handleMemoryWarning
+{
+ ASSERT(WebThreadIsCurrent());
+ WebKit::MemoryMeasure totalMemory("Memory warning: Overall memory change from [WebView _handleMemoryWarning].");
+
+ // Always peform the following.
+ [WebView purgeInactiveFontData];
+
+ // Only perform the remaining if a non-simple document was created.
+ if (!didOneTimeInitialization)
+ return;
+
+#if ENABLE(DISK_IMAGE_CACHE)
+ {
+ WebKit::MemoryMeasure measurer("Memory warning: flushing images to disk.");
+ WebCore::memoryCache()->flushCachedImagesToDisk();
+ }
+#endif
+
+ [WebStorageManager closeIdleLocalStorageDatabases];
+
+ [WebView _releaseMemoryNow];
+}
+
++ (void)registerForMemoryNotifications
+{
+ BOOL shouldAutoClearPressureOnMemoryRelease = !WebCore::applicationIsMobileSafari();
+
+ memoryPressureHandler().installMemoryReleaseBlock(^{
+ [WebView _handleMemoryWarning];
+ }, shouldAutoClearPressureOnMemoryRelease);
+
+ static dispatch_source_t memoryNotificationEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VM, 0, DISPATCH_VM_PRESSURE, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
+ dispatch_source_set_event_handler(memoryNotificationEventSource, ^{
+ // Set memory pressure flag and schedule releasing memory in web thread runloop exit.
+ memoryPressureHandler().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMPressure);
+ });
+
+ dispatch_resume(memoryNotificationEventSource);
+
+ if (!shouldAutoClearPressureOnMemoryRelease) {
+ // Listen to memory status notification to reset the memory pressure flag.
+ static dispatch_source_t memoryStatusEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS,
+ 0,
+ DISPATCH_MEMORYSTATUS_PRESSURE_WARN | DISPATCH_MEMORYSTATUS_PRESSURE_NORMAL,
+ dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
+ dispatch_source_set_event_handler(memoryStatusEventSource, ^{
+ unsigned long currentStatus = dispatch_source_get_data(memoryStatusEventSource);
+ if (currentStatus == DISPATCH_MEMORYSTATUS_PRESSURE_NORMAL)
+ memoryPressureHandler().clearMemoryPressure();
+ else if (currentStatus == DISPATCH_MEMORYSTATUS_PRESSURE_WARN)
+ memoryPressureHandler().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMStatus);
+ });
+
+ dispatch_resume(memoryStatusEventSource);
+ }
+}
+
++ (void)_releaseMemoryNow
+{
+ ASSERT(WebThreadIsCurrent());
+ [WebView discardAllCompiledCode];
+ [WebView garbageCollectNow];
+ [WebView purgeInactiveFontData];
+ [WebView drainLayerPool];
+ [WebCache emptyInMemoryResources];
+ [WebView releaseFastMallocMemoryOnCurrentThread];
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Clear the main thread's TCMalloc thread cache.
+ [WebView releaseFastMallocMemoryOnCurrentThread];
+ });
+}
+
++ (void)_clearPrivateBrowsingSessionCookieStorage
+{
+ WebFrameNetworkingContext::clearPrivateBrowsingSessionCookieStorage();
+}
+
+- (void)_replaceCurrentHistoryItem:(WebHistoryItem *)item
+{
+ Frame* frame = [self _mainCoreFrame];
+ if (frame)
+ frame->loader().history().replaceCurrentItem(core(item));
+}
+
++ (void)willEnterBackgroundWithCompletionHandler:(void(^)(void))handler
+{
+ WebThreadRun(^{
+ [WebView _releaseMemoryNow];
+ dispatch_async(dispatch_get_main_queue(), handler);
+ });
+}
+
++ (void)releaseFastMallocMemoryOnCurrentThread
+{
+ WebKit::MemoryMeasure measurer("Memory warning: Releasing fast malloc memory to system.");
+ WTF::releaseFastMallocFreeMemory();
+}
+
++ (void)garbageCollectNow
+{
+ ASSERT(WebThreadIsCurrent());
+ WebKit::MemoryMeasure measurer("Memory warning: Calling JavaScript GC.");
+ gcController().garbageCollectNow();
+}
+
++ (void)purgeInactiveFontData
+{
+ ASSERT(WebThreadIsCurrent());
+ WebKit::MemoryMeasure measurer("Memory warning: Purging inactive font data.");
+ fontCache()->purgeInactiveFontData();
+}
+
++ (void)drainLayerPool
+{
+ ASSERT(WebThreadIsCurrent());
+ WebKit::MemoryMeasure measurer("Memory warning: Draining layer pool.");
+ WebCore::TileCache::drainLayerPool();
+}
+
++ (void)discardAllCompiledCode
+{
+ ASSERT(WebThreadIsCurrent());
+ WebKit::MemoryMeasure measurer("Memory warning: Discarding JIT'ed code.");
+ gcController().discardAllCompiledCode();
+}
+
++ (BOOL)isCharacterSmartReplaceExempt:(unichar)character isPreviousCharacter:(BOOL)b
+{
+ return WebCore::isCharacterSmartReplaceExempt(character, b);
+}
+
+- (void)updateLayoutIgnorePendingStyleSheets
+{
+ WebThreadRun(^{
+ for (Frame* frame = [self _mainCoreFrame]; frame; frame = frame->tree().traverseNext()) {
+ Document *document = frame->document();
+ if (document)
+ document->updateLayoutIgnorePendingStylesheets();
+ }
+ });
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> static NSMutableSet *knownPluginMIMETypes()
</span><span class="cx"> {
</span><span class="cx"> static NSMutableSet *mimeTypes = [[NSMutableSet alloc] init];
</span><span class="lines">@@ -939,7 +1431,13 @@
</span><span class="cx"> Class viewClass = [[WebFrameView _viewTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType];
</span><span class="cx"> Class repClass = [[WebDataSource _repTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#define WebPDFView ([WebView _getPDFViewClass])
+#endif
</ins><span class="cx"> if (!viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType]) {
</span><ins>+#if PLATFORM(IOS)
+#undef WebPDFView
+#endif
</ins><span class="cx"> // Our optimization to avoid loading the plug-in DB and image types for the HTML case failed.
</span><span class="cx">
</span><span class="cx"> if (allowPlugins) {
</span><span class="lines">@@ -982,7 +1480,7 @@
</span><span class="cx"> {
</span><span class="cx"> if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[_private->preferences arePlugInsEnabled]])
</span><span class="cx"> return YES;
</span><del>-
</del><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->pluginDatabase) {
</span><span class="cx"> WebBasePluginPackage *pluginPackage = [_private->pluginDatabase pluginForMIMEType:MIMEType];
</span><span class="cx"> if (pluginPackage) {
</span><span class="lines">@@ -993,14 +1491,16 @@
</span><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+#endif
</ins><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (void)_setAlwaysUseATSU:(BOOL)f
</span><span class="cx"> {
</span><span class="cx"> [self _setAlwaysUsesComplexTextCodePath:f];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> + (void)_setAlwaysUsesComplexTextCodePath:(BOOL)f
</span><span class="cx"> {
</span><span class="lines">@@ -1039,22 +1539,139 @@
</span><span class="cx"> return [[self class] canShowMIMEType:[WebView _MIMETypeForFile:path]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSString *)suggestedFileExtensionForMIMEType:(NSString *)type
</span><span class="cx"> {
</span><span class="cx"> return WKGetPreferredExtensionForMIMEType(type);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_isClosed
</span><span class="cx"> {
</span><span class="cx"> return !_private || _private->closed;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_dispatchUnloadEvent
+{
+ WebThreadRun(^{
+ WebFrame *mainFrame = [self mainFrame];
+ Frame *coreMainFrame = core(mainFrame);
+ if (coreMainFrame) {
+ Document *document = coreMainFrame->document();
+ if (document)
+ document->dispatchWindowEvent(Event::create(eventNames().unloadEvent, false, false));
+ }
+ });
+}
+
+- (DOMCSSStyleDeclaration *)styleAtSelectionStart
+{
+ WebFrame *mainFrame = [self mainFrame];
+ Frame *coreMainFrame = core(mainFrame);
+ if (!coreMainFrame)
+ return nil;
+ return coreMainFrame->styleAtSelectionStart();
+}
+
+- (NSUInteger)_renderTreeSize
+{
+ if (!_private->page)
+ return 0;
+ return _private->page->renderTreeSize();
+}
+
+- (void)_dispatchTileDidDraw:(CALayer*)tile
+{
+ id mailDelegate = [self _webMailDelegate];
+ if ([mailDelegate respondsToSelector:@selector(_webthread_webView:tileDidDraw:)]) {
+ [mailDelegate _webthread_webView:self tileDidDraw:tile];
+ return;
+ }
+
+ if (!OSAtomicCompareAndSwap32(0, 1, &_private->didDrawTiles))
+ return;
+
+ WebThreadLock();
+
+ [[[self _UIKitDelegateForwarder] asyncForwarder] webViewDidDrawTiles:self];
+}
+
+- (void)_willStartScrollingOrZooming
+{
+ // Pause timers during top level interaction
+ if (_private->mainViewIsScrollingOrZooming)
+ return;
+ _private->mainViewIsScrollingOrZooming = YES;
+
+ // This suspends active DOM objects like timers, but not media.
+ [[self mainFrame] setTimeoutsPaused:YES];
+
+ // This defers loading callbacks only.
+ // WARNING: This behavior could change if Bug 49401 lands in open source WebKit again.
+ [self setDefersCallbacks:YES];
+}
+
+- (void)_didFinishScrollingOrZooming
+{
+ if (!_private->mainViewIsScrollingOrZooming)
+ return;
+ _private->mainViewIsScrollingOrZooming = NO;
+ [self setDefersCallbacks:NO];
+ [[self mainFrame] setTimeoutsPaused:NO];
+}
+
+- (void)_setResourceLoadSchedulerSuspended:(BOOL)suspend
+{
+ if (suspend)
+ resourceLoadScheduler()->suspendPendingRequests();
+ else
+ resourceLoadScheduler()->resumePendingRequests();
+}
+
++ (void)_setAcceleratedImageDecoding:(BOOL)enabled
+{
+ ImageSource::setAcceleratedImageDecodingEnabled(enabled);
+}
+
++ (BOOL)_acceleratedImageDecoding
+{
+ return ImageSource::acceleratedImageDecodingEnabled();
+}
+
++ (void)_setAllowCookies:(BOOL)allow
+{
+ ResourceRequestBase::setDefaultAllowCookies(allow);
+}
+
++ (BOOL)_allowCookies
+{
+ return ResourceRequestBase::defaultAllowCookies();
+}
+
++ (BOOL)_isUnderMemoryPressure
+{
+ return memoryPressureHandler().hasReceivedMemoryPressure();
+}
+
++ (void)_clearMemoryPressure
+{
+ memoryPressureHandler().clearMemoryPressure();
+}
+
++ (BOOL)_shouldWaitForMemoryClearMessage
+{
+ return memoryPressureHandler().shouldWaitForMemoryClearMessage();
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (void)_closePluginDatabases
</span><span class="cx"> {
</span><span class="cx"> pluginDatabaseClientCount--;
</span><span class="cx">
</span><span class="cx"> // Close both sets of plug-in databases because plug-ins need an opportunity to clean up files, etc.
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Unload the WebView local plug-in database.
</span><span class="cx"> if (_private->pluginDatabase) {
</span><span class="cx"> [_private->pluginDatabase destroyAllPluginInstanceViews];
</span><span class="lines">@@ -1062,6 +1679,7 @@
</span><span class="cx"> [_private->pluginDatabase release];
</span><span class="cx"> _private->pluginDatabase = nil;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Keep the global plug-in database active until the app terminates to avoid having to reload plug-in bundles.
</span><span class="cx"> if (!pluginDatabaseClientCount && applicationIsTerminating)
</span><span class="lines">@@ -1074,7 +1692,9 @@
</span><span class="cx"> WTF::RefCountedLeakCounter::suppressMessages("At least one WebView was closed with fast teardown.");
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
</span><ins>+#endif
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] removeObserver:self];
</span><span class="cx">
</span><span class="cx"> [self _closePluginDatabases];
</span><span class="lines">@@ -1103,6 +1723,16 @@
</span><span class="cx"> // public method -close instead.
</span><span class="cx"> - (void)_close
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ // Always clear delegates on calling thread, becasue caller can deallocate delegates right after calling -close
+ // (and could in fact already be in delegate's -dealloc method, as seen in <rdar://problem/11540972>).
+
+ [self _clearDelegates];
+
+ // Fix for problems such as <rdar://problem/5774587> Crash closing tab in WebCore::Frame::page() from -[WebCoreFrameBridge pauseTimeouts]
+ WebThreadRun(^{
+#endif
+
</ins><span class="cx"> if (!_private || _private->closed)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -1122,15 +1752,20 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx"> [self _exitFullscreen];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ _private->closing = YES;
+#endif
+
</ins><span class="cx"> if (Frame* mainFrame = [self _mainCoreFrame])
</span><span class="cx"> mainFrame->loader().detachFromParent();
</span><span class="cx">
</span><span class="cx"> [self setHostWindow:nil];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self setDownloadDelegate:nil];
</span><span class="cx"> [self setEditingDelegate:nil];
</span><span class="cx"> [self setFrameLoadDelegate:nil];
</span><span class="lines">@@ -1140,9 +1775,12 @@
</span><span class="cx"> [self setUIDelegate:nil];
</span><span class="cx">
</span><span class="cx"> [_private->inspector webViewClosed];
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
</span><span class="cx"> [self removeDragCaret];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Deleteing the WebCore::Page will clear the page cache so we call destroy on
</span><span class="cx"> // all the plug-ins in the page cache to break any retain cycles.
</span><span class="lines">@@ -1151,10 +1789,12 @@
</span><span class="cx"> _private->page = 0;
</span><span class="cx"> delete page;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->hasSpellCheckerDocumentTag) {
</span><span class="cx"> [[NSSpellChecker sharedSpellChecker] closeSpellDocumentWithTag:_private->spellCheckerDocumentTag];
</span><span class="cx"> _private->hasSpellCheckerDocumentTag = NO;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx"> if (_private->layerFlushController) {
</span><span class="lines">@@ -1169,7 +1809,9 @@
</span><span class="cx">
</span><span class="cx"> [[self _notificationProvider] unregisterWebView:self];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
</span><ins>+#endif
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] removeObserver:self];
</span><span class="cx">
</span><span class="cx"> [WebPreferences _removeReferenceForIdentifier:[self preferencesIdentifier]];
</span><span class="lines">@@ -1188,6 +1830,10 @@
</span><span class="cx"> [WebCache setDisabled:YES];
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+ // Fix for problems such as <rdar://problem/5774587> Crash closing tab in WebCore::Frame::page() from -[WebCoreFrameBridge pauseTimeouts]
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Indicates if the WebView is in the midst of a user gesture.
</span><span class="lines">@@ -1198,13 +1844,17 @@
</span><span class="cx">
</span><span class="cx"> + (NSString *)_MIMETypeForFile:(NSString *)path
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *extension = [path pathExtension];
</span><ins>+#endif
</ins><span class="cx"> NSString *MIMEType = nil;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Get the MIME type from the extension.
</span><span class="cx"> if ([extension length] != 0) {
</span><span class="cx"> MIMEType = WKGetMIMETypeForExtension(extension);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // If we can't get a known MIME type from the extension, sniff.
</span><span class="cx"> if ([MIMEType length] == 0 || [MIMEType isEqualToString:@"application/octet-stream"]) {
</span><span class="lines">@@ -1351,6 +2001,7 @@
</span><span class="cx"> return _private->page;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items
</span><span class="cx"> {
</span><span class="cx"> NSArray *defaultMenuItems = [[WebDefaultUIDelegate sharedUIDelegate] webView:self contextMenuItemsForElement:element defaultMenuItems:items];
</span><span class="lines">@@ -1375,6 +2026,7 @@
</span><span class="cx">
</span><span class="cx"> return [menu autorelease];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags
</span><span class="cx"> {
</span><span class="lines">@@ -1428,6 +2080,11 @@
</span><span class="cx"> - (void)_setFormDelegate: (id<WebFormDelegate>)delegate
</span><span class="cx"> {
</span><span class="cx"> _private->formDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+ [_private->formDelegateForwarder clearTarget];
+ [_private->formDelegateForwarder release];
+ _private->formDelegateForwarder = nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id<WebFormDelegate>)_formDelegate
</span><span class="lines">@@ -1435,6 +2092,32 @@
</span><span class="cx"> return _private->formDelegate;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)_formDelegateForwarder
+{
+ if (_private->closing)
+ return nil;
+
+ if (!_private->formDelegateForwarder)
+ _private->formDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self _formDelegate] defaultTarget:[WebDefaultFormDelegate sharedFormDelegate]];
+ return _private->formDelegateForwarder;
+}
+
+- (id)_formDelegateForSelector:(SEL)selector
+{
+ id delegate = self->_private->formDelegate;
+ if ([delegate respondsToSelector:selector])
+ return delegate;
+
+ delegate = [WebDefaultFormDelegate sharedFormDelegate];
+ if ([delegate respondsToSelector:selector])
+ return delegate;
+
+ return nil;
+}
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_needsAdobeFrameReloadingQuirk
</span><span class="cx"> {
</span><span class="cx"> static BOOL needsQuirk = WKAppVersionCheckLessThan(@"com.adobe.Acrobat", -1, 9.0)
</span><span class="lines">@@ -1482,9 +2165,11 @@
</span><span class="cx"> static bool needsQuirk = applicationIsAperture();
</span><span class="cx"> return needsQuirk;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_needsPreHTML5ParserQuirks
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // AOL Instant Messenger and Microsoft My Day contain markup incompatible
</span><span class="cx"> // with the new HTML5 parser. If these applications were linked against a
</span><span class="cx"> // version of WebKit prior to the introduction of the HTML5 parser, enable
</span><span class="lines">@@ -1505,18 +2190,49 @@
</span><span class="cx"> || (_private->page && _private->page->settings().usesDashboardBackwardCompatibilityMode())
</span><span class="cx"> #endif
</span><span class="cx"> || [[self preferences] usePreHTML5ParserQuirks];
</span><ins>+#else
+ static bool isApplicationNeedingParserQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER) && applicationIsDaijisenDictionary();
+ return isApplicationNeedingParserQuirks || [[self preferences] usePreHTML5ParserQuirks];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_needsUnrestrictedGetMatchedCSSRules
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool needsUnrestrictedGetMatchedCSSRules = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_GET_MATCHED_CSS_RULES_RESTRICTIONS) && applicationIsSafari();
</span><span class="cx"> return needsUnrestrictedGetMatchedCSSRules;
</span><ins>+#else
+ // FIXME: <rdar://problem/8963684> Implement linked-on-or-after check for needsUnrestrictedGetMatchedCSSRules
+ return NO;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_preferencesChangedNotification:(NSNotification *)notification
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ // For WebViews that load synchronously, preference changes need to be propagated
+ // down to WebCore synchronously so that loads in that WebView have the correct
+ // up-to-date settings.
+ if (!WebThreadIsLocked())
+ WebThreadLock();
+ if ([[self mainFrame] _loadsSynchronously]) {
+#endif
+
</ins><span class="cx"> WebPreferences *preferences = (WebPreferences *)[notification object];
</span><span class="cx"> [self _preferencesChanged:preferences];
</span><ins>+
+#if PLATFORM(IOS)
+ } else {
+ WebThreadRun(^{
+ // It is possible that the prefs object has already changed before the invocation could be called
+ // on the web thread. This is not possible on TOT which is why they have a simple ASSERT.
+ WebPreferences *preferences = (WebPreferences *)[notification object];
+ if (preferences != [self preferences])
+ return;
+ [self _preferencesChanged:preferences];
+ });
+ }
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_preferencesChanged:(WebPreferences *)preferences
</span><span class="lines">@@ -1531,6 +2247,24 @@
</span><span class="cx"> // Update corresponding WebCore Settings object.
</span><span class="cx"> if (!_private->page)
</span><span class="cx"> return;
</span><ins>+
+#if PLATFORM(IOS)
+ // iOS waits to call [WebDatabaseManager sharedWebDatabaseManager] until
+ // didOneTimeInitialization is true so that we don't initialize databases
+ // until the first WebView has been created. This is because database
+ // initialization current requires disk access to populate the origins
+ // quota map and we want to do this lazily by waiting until WebKit is
+ // used to display web content in a WebView. The possible cases are:
+ // - on one time initialize (the first WebView creation) if databases are enabled (default)
+ // - when databases are dynamically enabled later, and they were disabled at startup (this case)
+ if (didOneTimeInitialization) {
+ if ([preferences databasesEnabled])
+ [WebDatabaseManager sharedWebDatabaseManager];
+
+ if ([preferences storageTrackerEnabled])
+ WebKitInitializeStorageIfNecessary();
+ }
+#endif
</ins><span class="cx">
</span><span class="cx"> Settings& settings = _private->page->settings();
</span><span class="cx">
</span><span class="lines">@@ -1542,7 +2276,7 @@
</span><span class="cx"> settings.setFantasyFontFamily([preferences fantasyFontFamily]);
</span><span class="cx"> settings.setFixedFontFamily([preferences fixedFontFamily]);
</span><span class="cx"> settings.setScreenFontSubstitutionEnabled(
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"] ||
</span><span class="cx"> #endif
</span><span class="cx"> [preferences screenFontSubstitutionEnabled]
</span><span class="lines">@@ -1564,7 +2298,9 @@
</span><span class="cx"> DatabaseManager::manager().setIsAvailable([preferences databasesEnabled]);
</span><span class="cx"> #endif
</span><span class="cx"> settings.setLocalStorageEnabled([preferences localStorageEnabled]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> settings.setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> bool privateBrowsingEnabled = [preferences privateBrowsingEnabled];
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK)
</span><span class="lines">@@ -1580,8 +2316,12 @@
</span><span class="cx"> settings.setStandardFontFamily([preferences standardFontFamily]);
</span><span class="cx"> settings.setLoadsImagesAutomatically([preferences loadsImagesAutomatically]);
</span><span class="cx"> settings.setLoadsSiteIconsIgnoringImageLoadingSetting([preferences loadsSiteIconsIgnoringImageLoadingPreference]);
</span><ins>+#if PLATFORM(IOS)
+ settings.setShouldPrintBackgrounds(true);
+#else
</ins><span class="cx"> settings.setShouldPrintBackgrounds([preferences shouldPrintBackgrounds]);
</span><span class="cx"> settings.setTextAreasAreResizable([preferences textAreasAreResizable]);
</span><ins>+#endif
</ins><span class="cx"> settings.setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]);
</span><span class="cx"> settings.setEditableLinkBehavior(core([preferences editableLinkBehavior]));
</span><span class="cx"> settings.setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior]));
</span><span class="lines">@@ -1589,12 +2329,15 @@
</span><span class="cx"> settings.setUsesPageCache([self usesPageCache]);
</span><span class="cx"> settings.setPageCacheSupportsPlugins([preferences pageCacheSupportsPlugins]);
</span><span class="cx"> settings.setBackForwardCacheExpirationInterval([preferences _backForwardCacheExpirationInterval]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> settings.setShowsURLsInToolTips([preferences showsURLsInToolTips]);
</span><span class="cx"> settings.setShowsToolTipOverTruncatedText([preferences showsToolTipOverTruncatedText]);
</span><ins>+#endif
</ins><span class="cx"> settings.setDeveloperExtrasEnabled([preferences developerExtrasEnabled]);
</span><span class="cx"> settings.setJavaScriptExperimentsEnabled([preferences javaScriptExperimentsEnabled]);
</span><span class="cx"> settings.setAuthorAndUserStylesEnabled([preferences authorAndUserStylesEnabled]);
</span><span class="cx"> settings.setApplicationChromeMode([preferences applicationChromeModeEnabled]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([preferences userStyleSheetEnabled]) {
</span><span class="cx"> NSString* location = [[preferences userStyleSheetLocation] _web_originalDataAsString];
</span><span class="cx"> if ([location isEqualToString:@"apple-dashboard://stylesheet"])
</span><span class="lines">@@ -1605,13 +2348,26 @@
</span><span class="cx"> settings.setNeedsAdobeFrameReloadingQuirk([self _needsAdobeFrameReloadingQuirk]);
</span><span class="cx"> settings.setTreatsAnyTextCSSLinkAsStylesheet([self _needsLinkElementTextCSSQuirk]);
</span><span class="cx"> settings.setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
</span><ins>+#else
+ // iOS-specific settings
+ settings.setStandalone([preferences _standalone]);
+ settings.setMaximumDecodedImageSize([preferences _maximumImageSize]);
+ settings.setTelephoneNumberParsingEnabled([preferences _telephoneNumberParsingEnabled]);
+ settings.setAlwaysUseBaselineOfPrimaryFont([preferences _alwaysUseBaselineOfPrimaryFont]);
+ settings.setAllowMultiElementImplicitSubmission([preferences _allowMultiElementImplicitFormSubmission]);
+ settings.setLayoutInterval([preferences _layoutInterval]);
+ settings.setMaxParseDuration([preferences _maxParseDuration]);
+ settings.setAlwaysUseAcceleratedOverflowScroll([preferences _alwaysUseAcceleratedOverflowScroll]);
+#endif
</ins><span class="cx"> settings.setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing);
</span><span class="cx"> settings.setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]);
</span><span class="cx"> settings.setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]);
</span><span class="cx"> settings.setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]);
</span><span class="cx"> settings.setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]);
</span><span class="cx"> settings.setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> settings.setEnforceCSSMIMETypeInNoQuirksMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1));
</span><ins>+#endif
</ins><span class="cx"> settings.setDNSPrefetchingEnabled([preferences isDNSPrefetchingEnabled]);
</span><span class="cx">
</span><span class="cx"> // FIXME: Enabling accelerated compositing when WebGL is enabled causes tests to fail on Leopard which expect HW compositing to be disabled.
</span><span class="lines">@@ -1622,7 +2378,10 @@
</span><span class="cx"> settings.setShowDebugBorders([preferences showDebugBorders]);
</span><span class="cx"> settings.setShowRepaintCounter([preferences showRepaintCounter]);
</span><span class="cx"> settings.setWebGLEnabled([preferences webGLEnabled]);
</span><ins>+#if !PLATFORM(IOS)
+ // FIXME: Should we enable this following <rdar://problem/15290404>?
</ins><span class="cx"> settings.setMultithreadedWebGLEnabled([preferences multithreadedWebGLEnabled]);
</span><ins>+#endif
</ins><span class="cx"> settings.setForceSoftwareWebGLRendering([preferences forceSoftwareWebGLRendering]);
</span><span class="cx"> settings.setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]);
</span><span class="cx"> settings.setLoadDeferringEnabled(shouldEnableLoadDeferring());
</span><span class="lines">@@ -1657,6 +2416,12 @@
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> settings.setQTKitEnabled([preferences isQTKitEnabled]);
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+ settings.setMediaPlaybackAllowsAirPlay([preferences mediaPlaybackAllowsAirPlay]);
+ settings.setAudioSessionCategoryOverride([preferences audioSessionCategoryOverride]);
+ settings.setNetworkDataUsageTrackingEnabled([preferences networkDataUsageTrackingEnabled]);
+ settings.setNetworkInterfaceName([preferences networkInterfaceName]);
+#endif
</ins><span class="cx"> settings.setMediaPlaybackRequiresUserGesture([preferences mediaPlaybackRequiresUserGesture]);
</span><span class="cx"> settings.setMediaPlaybackAllowsInline([preferences mediaPlaybackAllowsInline]);
</span><span class="cx"> settings.setSuppressesIncrementalRendering([preferences suppressesIncrementalRendering]);
</span><span class="lines">@@ -1672,7 +2437,9 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> settings.setShouldRespectImageOrientation([preferences shouldRespectImageOrientation]);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> settings.setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]);
</span><ins>+#endif
</ins><span class="cx"> settings.setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]);
</span><span class="cx"> settings.setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]);
</span><span class="cx"> settings.setLowPowerVideoAudioBufferSizeEnabled([preferences lowPowerVideoAudioBufferSizeEnabled]);
</span><span class="lines">@@ -1680,7 +2447,7 @@
</span><span class="cx"> settings.setUseLegacyTextAlignPositionedElementBehavior([preferences useLegacyTextAlignPositionedElementBehavior]);
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><del>- settings->setVideoPluginProxyEnabled([preferences isVideoPluginProxyEnabled]);
</del><ins>+ settings.setVideoPluginProxyEnabled([preferences isVideoPluginProxyEnabled]);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="lines">@@ -1709,7 +2476,8 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // We have enabled this setting in WebKit2 for the sake of some ScrollingCoordinator work.
</span><del>- // To avoid possible rendering differences, we should enable it for WebKit1 too.
</del><ins>+ // To avoid possible rendering differences, we should enable it for WebKit1 too. We also
+ // want to keep this setting enabled for iOS. See <rdar://problem/9813262> for more details.
</ins><span class="cx"> settings.setFixedPositionCreatesStackingContext(true);
</span><span class="cx">
</span><span class="cx"> NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
</span><span class="lines">@@ -1729,6 +2497,22 @@
</span><span class="cx"> diskImageCache.setMinimumImageSize([preferences diskImageCacheMinimumImageSize]);
</span><span class="cx"> diskImageCache.setMaximumCacheSize([preferences diskImageCacheMaximumCacheSize]);
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+ [[self window] setTileBordersVisible:[preferences showDebugBorders]];
+ [[self window] setTilePaintCountsVisible:[preferences showRepaintCounter]];
+ [[self window] setAcceleratedDrawingEnabled:[preferences acceleratedDrawingEnabled]];
+ [WAKView _setInterpolationQuality:[preferences _interpolationQuality]];
+ settings.setDelegatesPageScaling(true);
+
+ settings.setShouldTransformsAffectOverflow(shouldTransformsAffectOverflow());
+ settings.setShouldDispatchJavaScriptWindowOnErrorEvents(shouldDispatchJavaScriptWindowOnErrorEvents());
+ ASSERT_WITH_MESSAGE(settings.pageCacheSupportsPlugins(), "PageCacheSupportsPlugins should be enabled on iOS.");
+
+ // Password echo
+ settings.setPasswordEchoEnabled([preferences _allowPasswordEcho]);
+ settings.setPasswordEchoDurationInSeconds([preferences _passwordEchoDuration]);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline IMP getMethod(id o, SEL s)
</span><span class="lines">@@ -1736,6 +2520,18 @@
</span><span class="cx"> return [o respondsToSelector:s] ? [o methodForSelector:s] : 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)_UIKitDelegateForwarder
+{
+ if (_private->closing)
+ return nil;
+
+ if (!_private->UIKitDelegateForwarder)
+ _private->UIKitDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIKitDelegate defaultTarget:[WebDefaultUIKitDelegate sharedUIKitDelegate]];
+ return _private->UIKitDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)_cacheResourceLoadDelegateImplementations
</span><span class="cx"> {
</span><span class="cx"> WebResourceDelegateImplementationCache *cache = &_private->resourceLoadDelegateImplementations;
</span><span class="lines">@@ -1754,6 +2550,19 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> cache->canAuthenticateAgainstProtectionSpaceFunc = getMethod(delegate, @selector(webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:));
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+ cache->connectionPropertiesFunc = getMethod(delegate, @selector(webView:connectionPropertiesForResource:dataSource:));
+ cache->webThreadDidFinishLoadingFromDataSourceFunc = getMethod(delegate, @selector(webThreadWebView:resource:didFinishLoadingFromDataSource:));
+ cache->webThreadDidFailLoadingWithErrorFromDataSourceFunc = getMethod(delegate, @selector(webThreadWebView:resource:didFailLoadingWithError:fromDataSource:));
+ cache->webThreadIdentifierForRequestFunc = getMethod(delegate, @selector(webThreadWebView:identifierForInitialRequest:fromDataSource:));
+ cache->webThreadDidLoadResourceFromMemoryCacheFunc = getMethod(delegate, @selector(webThreadWebView:didLoadResourceFromMemoryCache:response:length:fromDataSource:));
+ cache->webThreadWillSendRequestFunc = getMethod(delegate, @selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:));
+ cache->webThreadDidReceiveResponseFunc = getMethod(delegate, @selector(webThreadWebView:resource:didReceiveResponse:fromDataSource:));
+ cache->webThreadDidReceiveContentLengthFunc = getMethod(delegate, @selector(webThreadWebView:resource:didReceiveContentLength:fromDataSource:));
+ cache->webThreadWillCacheResponseFunc = getMethod(delegate, @selector(webThreadWebView:resource:willCacheResponse:fromDataSource:));
+#endif
+
</ins><span class="cx"> cache->didReceiveContentLengthFunc = getMethod(delegate, @selector(webView:resource:didReceiveContentLength:fromDataSource:));
</span><span class="cx"> cache->didReceiveResponseFunc = getMethod(delegate, @selector(webView:resource:didReceiveResponse:fromDataSource:));
</span><span class="cx"> cache->identifierForRequestFunc = getMethod(delegate, @selector(webView:identifierForInitialRequest:fromDataSource:));
</span><span class="lines">@@ -1805,6 +2614,9 @@
</span><span class="cx"> cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:));
</span><span class="cx"> cache->didDetectXSSFunc = getMethod(delegate, @selector(webView:didDetectXSS:));
</span><span class="cx"> cache->didRemoveFrameFromHierarchyFunc = getMethod(delegate, @selector(webView:didRemoveFrameFromHierarchy:));
</span><ins>+#if PLATFORM(IOS)
+ cache->webThreadDidLayoutFunc = getMethod(delegate, @selector(webThreadWebView:didLayout:));
+#endif
</ins><span class="cx">
</span><span class="cx"> // It would be nice to get rid of this code and transition all clients to using didLayout instead of
</span><span class="cx"> // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required
</span><span class="lines">@@ -1812,8 +2624,12 @@
</span><span class="cx"> Page* page = core(self);
</span><span class="cx"> if (page) {
</span><span class="cx"> unsigned milestones = DidFirstLayout;
</span><ins>+#if PLATFORM(IOS)
+ milestones |= DidFirstVisuallyNonEmptyLayout;
+#else
</ins><span class="cx"> if (cache->didFirstVisuallyNonEmptyLayoutInFrameFunc)
</span><span class="cx"> milestones |= DidFirstVisuallyNonEmptyLayout;
</span><ins>+#endif
</ins><span class="cx"> page->addLayoutMilestones(static_cast<LayoutMilestones>(milestones));
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1867,6 +2683,10 @@
</span><span class="cx">
</span><span class="cx"> - (id)_policyDelegateForwarder
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (_private->closing)
+ return nil;
+#endif
</ins><span class="cx"> if (!_private->policyDelegateForwarder)
</span><span class="cx"> _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate]];
</span><span class="cx"> return _private->policyDelegateForwarder;
</span><span class="lines">@@ -1874,13 +2694,36 @@
</span><span class="cx">
</span><span class="cx"> - (id)_UIDelegateForwarder
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (_private->closing)
+ return nil;
+#endif
</ins><span class="cx"> if (!_private->UIDelegateForwarder)
</span><span class="cx"> _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate]];
</span><span class="cx"> return _private->UIDelegateForwarder;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)_UIDelegateForSelector:(SEL)selector
+{
+ id delegate = self->_private->UIDelegate;
+ if ([delegate respondsToSelector:selector])
+ return delegate;
+
+ delegate = [WebDefaultUIDelegate sharedUIDelegate];
+ if ([delegate respondsToSelector:selector])
+ return delegate;
+
+ return nil;
+}
+#endif
+
</ins><span class="cx"> - (id)_editingDelegateForwarder
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (_private->closing)
+ return nil;
+#endif
</ins><span class="cx"> // This can be called during window deallocation by QTMovieView in the QuickTime Cocoa Plug-in.
</span><span class="cx"> // Not sure if that is a bug or not.
</span><span class="cx"> if (!_private)
</span><span class="lines">@@ -1991,6 +2834,7 @@
</span><span class="cx"> return _private->programmaticFocusCount != 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_didChangeValueForKey: (NSString *)key
</span><span class="cx"> {
</span><span class="cx"> LOG (Bindings, "calling didChangeValueForKey: %@", key);
</span><span class="lines">@@ -2172,6 +3016,20 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#else
+
+- (void)_didCommitLoadForFrame:(WebFrame *)frame
+{
+ if (frame == [self mainFrame]) {
+ _private->didDrawTiles = 0;
+#if ENABLE(REMOTE_INSPECTOR)
+ [[WebView sharedWebInspectorServer] pushListing];
+#endif
+ }
+}
+
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx">
</span><span class="cx"> #define DASHBOARD_CONTROL_LABEL @"control"
</span><span class="lines">@@ -2361,6 +3219,7 @@
</span><span class="cx"> return Font::shouldUseSmoothing();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (void)_setUsesTestModeFocusRingColor:(BOOL)f
</span><span class="cx"> {
</span><span class="cx"> setUsesTestModeFocusRingColor(f);
</span><span class="lines">@@ -2370,7 +3229,111 @@
</span><span class="cx"> {
</span><span class="cx"> return usesTestModeFocusRingColor();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_setUIKitDelegate:(id)delegate
+{
+ _private->UIKitDelegate = delegate;
+ [_private->UIKitDelegateForwarder clearTarget];
+ [_private->UIKitDelegateForwarder release];
+ _private->UIKitDelegateForwarder = nil;
+}
+
+- (id)_UIKitDelegate
+{
+ return _private->UIKitDelegate;
+}
+
+- (void)setWebMailDelegate:(id)delegate
+{
+ _private->WebMailDelegate = delegate;
+}
+
+- (id)_webMailDelegate
+{
+ return _private->WebMailDelegate;
+}
+
+- (id <WebCaretChangeListener>)caretChangeListener
+{
+ return _private->_caretChangeListener;
+}
+
+- (void)setCaretChangeListener:(id <WebCaretChangeListener>)listener
+{
+ _private->_caretChangeListener = listener;
+}
+
+- (NSSet *)caretChangeListeners
+{
+ return _private->_caretChangeListeners;
+}
+
+- (void)addCaretChangeListener:(id <WebCaretChangeListener>)listener
+{
+ if (_private->_caretChangeListeners == nil) {
+ _private->_caretChangeListeners = [[NSMutableSet alloc] init];
+ }
+
+ [_private->_caretChangeListeners addObject:listener];
+}
+
+- (void)removeCaretChangeListener:(id <WebCaretChangeListener>)listener
+{
+ [_private->_caretChangeListeners removeObject:listener];
+}
+
+- (void)removeAllCaretChangeListeners
+{
+ [_private->_caretChangeListeners removeAllObjects];
+}
+
+- (void)caretChanged
+{
+ [_private->_caretChangeListener caretChanged];
+ NSSet *copy = [_private->_caretChangeListeners copy];
+ for (id <WebCaretChangeListener> listener in copy) {
+ [listener caretChanged];
+ }
+ [copy release];
+}
+
+- (void)_clearDelegates
+{
+ ASSERT(WebThreadIsLocked() || !WebThreadIsEnabled());
+
+ [self _setFormDelegate:nil];
+ [self _setUIKitDelegate:nil];
+ [self setCaretChangeListener:nil];
+ [self removeAllCaretChangeListeners];
+ [self setWebMailDelegate:nil];
+
+ [self setDownloadDelegate:nil];
+ [self setEditingDelegate:nil];
+ [self setFrameLoadDelegate:nil];
+ [self setPolicyDelegate:nil];
+ [self setResourceLoadDelegate:nil];
+ [self setScriptDebugDelegate:nil];
+ [self setUIDelegate:nil];
+}
+
+- (NSURL *)_displayURL
+{
+ WebThreadLock();
+ WebFrame *frame = [self mainFrame];
+ // FIXME: <rdar://problem/6362369> We used to get provisionalDataSource here if in provisional state; how do we tell that now? Is this right?
+ WebDataSource *dataSource = [frame provisionalDataSource];
+ if (!dataSource)
+ dataSource = [frame dataSource];
+ NSURL *unreachableURL = [dataSource unreachableURL];
+ NSURL *URL = unreachableURL != nil ? unreachableURL : [[dataSource request] URL];
+ [[URL retain] autorelease];
+ return URL;
+}
+#endif // PLATFORM(IOS)
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)setAlwaysShowVerticalScroller:(BOOL)flag
</span><span class="cx"> {
</span><span class="cx"> WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
</span><span class="lines">@@ -2410,6 +3373,7 @@
</span><span class="cx"> WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
</span><span class="cx"> return [scrollview horizontalScrollingModeLocked] && [scrollview horizontalScrollingMode] == ScrollbarAlwaysOn;
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)_setInViewSourceMode:(BOOL)flag
</span><span class="cx"> {
</span><span class="lines">@@ -2451,6 +3415,7 @@
</span><span class="cx"> _private->page->settings().setCookieEnabled(enable);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setAdditionalWebPlugInPaths:(NSArray *)newPaths
</span><span class="cx"> {
</span><span class="cx"> if (!_private->pluginDatabase)
</span><span class="lines">@@ -2459,7 +3424,131 @@
</span><span class="cx"> [_private->pluginDatabase setPlugInPaths:newPaths];
</span><span class="cx"> [_private->pluginDatabase refresh];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_locked_plugInsAreRunningInFrame:(WebFrame *)frame
+{
+ // Ask plug-ins in this frame
+ id <WebDocumentView> documentView = [[frame frameView] documentView];
+ if (documentView && [documentView isKindOfClass:[WebHTMLView class]]) {
+ if ([[(WebHTMLView *)documentView _pluginController] plugInsAreRunning])
+ return YES;
+ }
+
+ // Ask plug-ins in child frames
+ NSArray *childFrames = [frame childFrames];
+ unsigned childCount = [childFrames count];
+ unsigned childIndex;
+ for (childIndex = 0; childIndex < childCount; childIndex++) {
+ if ([self _locked_plugInsAreRunningInFrame:[childFrames objectAtIndex:childIndex]])
+ return YES;
+ }
+
+ return NO;
+}
+
+- (BOOL)_pluginsAreRunning
+{
+ WebThreadLock();
+ return [self _locked_plugInsAreRunningInFrame:[self mainFrame]];
+}
+
+- (void)_locked_recursivelyPerformPlugInSelector:(SEL)selector inFrame:(WebFrame *)frame
+{
+ // Send the message to plug-ins in this frame
+ id <WebDocumentView> documentView = [[frame frameView] documentView];
+ if (documentView && [documentView isKindOfClass:[WebHTMLView class]])
+ [[(WebHTMLView *)documentView _pluginController] performSelector:selector];
+
+ // Send the message to plug-ins in child frames
+ NSArray *childFrames = [frame childFrames];
+ unsigned childCount = [childFrames count];
+ unsigned childIndex;
+ for (childIndex = 0; childIndex < childCount; childIndex++) {
+ [self _locked_recursivelyPerformPlugInSelector:selector inFrame:[childFrames objectAtIndex:childIndex]];
+ }
+}
+
+- (void)_destroyAllPlugIns
+{
+ WebThreadLock();
+ [self _locked_recursivelyPerformPlugInSelector:@selector(destroyAllPlugins) inFrame:[self mainFrame]];
+}
+
+- (void)_clearBackForwardCache
+{
+ WebThreadRun(^{
+ WebKit::MemoryMeasure measurer("[WebView _clearBackForwardCache]");
+ BackForwardList* bfList = core([self backForwardList]);
+ if (!bfList)
+ return;
+
+ BOOL didClearBFCache = bfList->clearAllPageCaches();
+ if (WebKit::MemoryMeasure::isLoggingEnabled())
+ NSLog(@"[WebView _clearBackForwardCache] %@ empty cache\n", (didClearBFCache ? @"DID" : @"did NOT"));
+ });
+}
+
+- (void)_startAllPlugIns
+{
+ WebThreadLock();
+ [self _locked_recursivelyPerformPlugInSelector:@selector(startAllPlugins) inFrame:[self mainFrame]];
+}
+
+- (void)_stopAllPlugIns
+{
+ WebThreadLock();
+ [self _locked_recursivelyPerformPlugInSelector:@selector(stopAllPlugins) inFrame:[self mainFrame]];
+}
+
+- (void)_stopAllPlugInsForPageCache
+{
+ WebThreadLock();
+ [self _locked_recursivelyPerformPlugInSelector:@selector(stopPluginsForPageCache) inFrame:[self mainFrame]];
+}
+
+- (void)_restorePlugInsFromCache
+{
+ WebThreadLock();
+ [self _locked_recursivelyPerformPlugInSelector:@selector(restorePluginsFromCache) inFrame:[self mainFrame]];
+}
+
+- (BOOL)_setMediaLayer:(CALayer*)layer forPluginView:(NSView*)pluginView
+{
+#if USE(ACCELERATED_COMPOSITING)
+ WebThreadLock();
+
+ Frame* mainCoreFrame = [self _mainCoreFrame];
+ for (Frame* frame = mainCoreFrame; frame; frame = frame->tree().traverseNext()) {
+ FrameView* coreView = frame ? frame->view() : 0;
+ if (!coreView)
+ continue;
+
+ // Get the GraphicsLayer for this widget.
+ GraphicsLayer* layerForWidget = coreView->graphicsLayerForPlatformWidget(pluginView);
+ if (!layerForWidget)
+ continue;
+
+ if (layerForWidget->contentsLayerForMedia() != layer) {
+ layerForWidget->setContentsToMedia(layer);
+ // We need to make sure the layer hierachy change is applied immediately.
+ if (mainCoreFrame->view())
+ mainCoreFrame->view()->flushCompositingStateIncludingSubframes();
+ return YES;
+ }
+ }
+#endif
+ return NO;
+}
+
+- (void)_setNeedsUnrestrictedGetMatchedCSSRules:(BOOL)flag
+{
+ if (_private->page)
+ _private->page->settings().setCrossOriginCheckInGetMatchedCSSRulesDisabled(flag);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (void)_attachScriptDebuggerToAllFrames
</span><span class="cx"> {
</span><span class="cx"> for (Frame* frame = [self _mainCoreFrame]; frame; frame = frame->tree().traverseNext())
</span><span class="lines">@@ -2472,6 +3561,7 @@
</span><span class="cx"> [kit(frame) _detachScriptDebugger];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)setBackgroundColor:(NSColor *)backgroundColor
</span><span class="cx"> {
</span><span class="cx"> if ([_private->backgroundColor isEqual:backgroundColor])
</span><span class="lines">@@ -2488,7 +3578,26 @@
</span><span class="cx"> {
</span><span class="cx"> return _private->backgroundColor;
</span><span class="cx"> }
</span><ins>+#else
+- (void)setBackgroundColor:(CGColorRef)backgroundColor
+{
+ if (!backgroundColor || CFEqual(_private->backgroundColor, backgroundColor))
+ return;
</ins><span class="cx">
</span><ins>+ CFTypeRef old = _private->backgroundColor;
+ CFRetain(backgroundColor);
+ _private->backgroundColor = backgroundColor;
+ CFRelease(old);
+
+ [[self mainFrame] _updateBackgroundAndUpdatesWhileOffscreen];
+}
+
+- (CGColorRef)backgroundColor
+{
+ return _private->backgroundColor;
+}
+#endif
+
</ins><span class="cx"> - (BOOL)defersCallbacks
</span><span class="cx"> {
</span><span class="cx"> if (!_private->page)
</span><span class="lines">@@ -2503,6 +3612,131 @@
</span><span class="cx"> return _private->page->setDefersLoading(defer);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_isStopping
+{
+ return _private->isStopping;
+}
+
+- (BOOL)_isClosing
+{
+ return _private->closing;
+}
+
++ (NSArray *)_productivityDocumentMIMETypes
+{
+#if USE(QUICK_LOOK)
+ return [QLPreviewGetSupportedMIMETypesSet() allObjects];
+#else
+ return nil;
+#endif
+}
+
+- (void)_setAllowsMessaging:(BOOL)aFlag
+{
+ _private->allowsMessaging = aFlag;
+}
+
+- (BOOL)_allowsMessaging
+{
+ return _private->allowsMessaging;
+}
+
+- (void)_setNetworkStateIsOnline:(BOOL)isOnLine
+{
+ WebThreadRun(^{
+ networkStateNotifier().setIsOnLine(isOnLine);
+ });
+}
+
+- (void)_setFixedLayoutSize:(CGSize)size
+{
+ ASSERT(WebThreadIsLocked());
+ _private->fixedLayoutSize = size;
+ if (Frame* mainFrame = core([self mainFrame])) {
+ IntSize newSize(size);
+ mainFrame->view()->setFixedLayoutSize(newSize);
+ mainFrame->view()->setUseFixedLayout(!newSize.isEmpty());
+ [self setNeedsDisplay:YES];
+ }
+}
+
+- (CGSize)_fixedLayoutSize
+{
+ return _private->fixedLayoutSize;
+}
+
+- (void)_synchronizeCustomFixedPositionLayoutRect
+{
+ ASSERT(WebThreadIsLocked());
+
+ IntRect newRect;
+ {
+ MutexLocker locker(_private->pendingFixedPositionLayoutRectMutex);
+ if (CGRectIsNull(_private->pendingFixedPositionLayoutRect))
+ return;
+ newRect = enclosingIntRect(_private->pendingFixedPositionLayoutRect);
+ _private->pendingFixedPositionLayoutRect = CGRectNull;
+ }
+
+ if (Frame* mainFrame = core([self mainFrame]))
+ mainFrame->view()->setCustomFixedPositionLayoutRect(newRect);
+}
+
+- (void)_setCustomFixedPositionLayoutRectInWebThread:(CGRect)rect synchronize:(BOOL)synchronize
+{
+ {
+ MutexLocker locker(_private->pendingFixedPositionLayoutRectMutex);
+ _private->pendingFixedPositionLayoutRect = rect;
+ }
+ if (!synchronize)
+ return;
+ WebThreadRun(^{
+ [self _synchronizeCustomFixedPositionLayoutRect];
+ });
+}
+
+- (void)_setCustomFixedPositionLayoutRect:(CGRect)rect
+{
+ ASSERT(WebThreadIsLocked());
+ {
+ MutexLocker locker(_private->pendingFixedPositionLayoutRectMutex);
+ _private->pendingFixedPositionLayoutRect = rect;
+ }
+ [self _synchronizeCustomFixedPositionLayoutRect];
+}
+
+- (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect
+{
+ MutexLocker locker(_private->pendingFixedPositionLayoutRectMutex);
+ if (CGRectIsNull(_private->pendingFixedPositionLayoutRect))
+ return false;
+
+ *rect = _private->pendingFixedPositionLayoutRect;
+ _private->pendingFixedPositionLayoutRect = CGRectNull;
+ return true;
+}
+
+- (void)_viewGeometryDidChange
+{
+ ASSERT(WebThreadIsLocked());
+
+ if (Frame* coreFrame = [self _mainCoreFrame])
+ coreFrame->viewportOffsetChanged(Frame::IncrementalScrollOffset);
+}
+
+- (void)_overflowScrollPositionChangedTo:(CGPoint)offset forNode:(DOMNode *)domNode isUserScroll:(BOOL)userScroll
+{
+ // Find the frame
+ Node* node = core(domNode);
+ Frame* frame = node->document().frame();
+ if (!frame)
+ return;
+
+ frame->overflowScrollPositionChangedForNode(roundedIntPoint(offset), node, userScroll);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> // For backwards compatibility with the WebBackForwardList API, we honor both
</span><span class="cx"> // a per-WebView and a per-preferences setting for whether to use the page cache.
</span><span class="cx">
</span><span class="lines">@@ -2553,12 +3787,14 @@
</span><span class="cx"> [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:challenge window:window];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_clearUndoRedoOperations
</span><span class="cx"> {
</span><span class="cx"> if (!_private->page)
</span><span class="cx"> return;
</span><span class="cx"> _private->page->clearUndoRedoOperations();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value
</span><span class="cx"> {
</span><span class="lines">@@ -2610,10 +3846,12 @@
</span><span class="cx"> return _private->page->areMemoryCacheClientCallsEnabled();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSCursor *)_pointingHandCursor
</span><span class="cx"> {
</span><span class="cx"> return handCursor().platformCursor();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_postsAcceleratedCompositingNotifications
</span><span class="cx"> {
</span><span class="lines">@@ -2732,10 +3970,12 @@
</span><span class="cx"> return [rectsArray autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSPasteboard *)_insertionPasteboard
</span><span class="cx"> {
</span><span class="cx"> return _private ? _private->insertionPasteboard : nil;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> + (void)_addOriginAccessWhitelistEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains
</span><span class="cx"> {
</span><span class="lines">@@ -2775,7 +4015,11 @@
</span><span class="cx"> - (void)_updateActiveState
</span><span class="cx"> {
</span><span class="cx"> if (_private && _private->page)
</span><ins>+#if PLATFORM(IOS)
+ _private->page->focusController().setActive([[self window] isKeyWindow]);
+#else
</ins><span class="cx"> _private->page->focusController().setActive([[self window] _hasKeyAppearance]);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static Vector<String> toStringVector(NSArray* patterns)
</span><span class="lines">@@ -3006,6 +4250,7 @@
</span><span class="cx"> view->setFixedLayoutSize(IntSize());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setFixedLayoutSize:(NSSize)size
</span><span class="cx"> {
</span><span class="cx"> Frame* coreFrame = [self _mainCoreFrame];
</span><span class="lines">@@ -3019,6 +4264,7 @@
</span><span class="cx"> view->setFixedLayoutSize(IntSize(size));
</span><span class="cx"> view->forceLayout();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_useFixedLayout
</span><span class="cx"> {
</span><span class="lines">@@ -3033,6 +4279,7 @@
</span><span class="cx"> return view->useFixedLayout();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSSize)_fixedLayoutSize
</span><span class="cx"> {
</span><span class="cx"> Frame* coreFrame = [self _mainCoreFrame];
</span><span class="lines">@@ -3045,6 +4292,7 @@
</span><span class="cx">
</span><span class="cx"> return view->fixedLayoutSize();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)_setPaginationMode:(WebPaginationMode)paginationMode
</span><span class="cx"> {
</span><span class="lines">@@ -3205,6 +4453,7 @@
</span><span class="cx"> return page->pageCount();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (CGFloat)_backingScaleFactor
</span><span class="cx"> {
</span><span class="cx"> return [self _deviceScaleFactor];
</span><span class="lines">@@ -3219,6 +4468,7 @@
</span><span class="cx"> if (oldScaleFactor != [self _deviceScaleFactor])
</span><span class="cx"> _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit
</span><span class="cx"> {
</span><span class="lines">@@ -3251,6 +4501,55 @@
</span><span class="cx"> ResourceRequest::setHTTPPipeliningEnabled(enabled);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (WebFixedPositionContent*)_fixedPositionContent
+{
+ return _private ? _private->_fixedPositionContent : nil;
+}
+
+- (void)_documentScaleChanged
+{
+ if (WebNodeHighlight *currentHighlight = [self currentNodeHighlight])
+ [currentHighlight setNeedsDisplay];
+
+ if (_private->indicateLayer) {
+ [_private->indicateLayer setNeedsLayout];
+ [_private->indicateLayer setNeedsDisplay];
+ }
+}
+
+- (BOOL)_wantsTelephoneNumberParsing
+{
+ if (!_private->page)
+ return NO;
+ return _private->page->settings().telephoneNumberParsingEnabled();
+}
+
+- (void)_setWantsTelephoneNumberParsing:(BOOL)flag
+{
+ if (_private->page)
+ _private->page->settings().setTelephoneNumberParsingEnabled(flag);
+}
+
+- (BOOL)_webGLEnabled
+{
+ if (!_private->page)
+ return NO;
+ return _private->page->settings().webGLEnabled();
+}
+
+- (void)_setWebGLEnabled:(BOOL)enabled
+{
+ if (_private->page)
+ _private->page->settings().setWebGLEnabled(enabled);
+}
+
++ (void)_setTileCacheLayerPoolCapacity:(unsigned)capacity
+{
+ TileCache::setLayerPoolCapacity(capacity);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData
</span><span class="cx"> {
</span><span class="cx"> if (_private->sourceApplicationAuditData == sourceApplicationAuditData)
</span><span class="lines">@@ -3286,8 +4585,36 @@
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)asyncForwarder
+{
+ dispatch_once(&asyncForwarderPred, ^{
+ asyncForwarder = [[_WebSafeAsyncForwarder alloc] initWithForwarder:self];
+ });
+ return asyncForwarder;
+}
+
+- (void)dealloc
+{
+ [asyncForwarder release];
+ [super dealloc];
+}
+
+- (void)clearTarget
+{
+ target = nil;
+}
+#endif
+
</ins><span class="cx"> - (void)forwardInvocation:(NSInvocation *)invocation
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (WebThreadIsCurrent()) {
+ [invocation retainArguments];
+ WebThreadCallDelegate(invocation);
+ return;
+ }
+#endif
</ins><span class="cx"> if ([target respondsToSelector:[invocation selector]]) {
</span><span class="cx"> @try {
</span><span class="cx"> [invocation invokeWithTarget:target];
</span><span class="lines">@@ -3303,6 +4630,13 @@
</span><span class="cx"> // Do nothing quietly if method not implemented.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)respondsToSelector:(SEL)aSelector
+{
+ return [defaultTarget respondsToSelector:aSelector];
+}
+#endif
+
</ins><span class="cx"> - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
</span><span class="cx"> {
</span><span class="cx"> return [defaultTarget methodSignatureForSelector:aSelector];
</span><span class="lines">@@ -3310,6 +4644,43 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@implementation _WebSafeAsyncForwarder
+
+- (id)initWithForwarder:(_WebSafeForwarder *)forwarder
+{
+ if (!(self = [super init]))
+ return nil;
+ _forwarder = forwarder;
+ return self;
+}
+
+- (void)forwardInvocation:(NSInvocation *)invocation
+{
+ // Store _forwarder in an ivar so it is retained by the block.
+ _WebSafeForwarder *forwarder = _forwarder;
+ if (WebThreadIsCurrent()) {
+ [invocation retainArguments];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [forwarder forwardInvocation:invocation];
+ });
+ } else
+ [forwarder forwardInvocation:invocation];
+}
+
+- (BOOL)respondsToSelector:(SEL)aSelector
+{
+ return [_forwarder respondsToSelector:aSelector];
+}
+
+- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
+{
+ return [_forwarder methodSignatureForSelector:aSelector];
+}
+
+@end
+#endif
+
</ins><span class="cx"> @implementation WebView
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="lines">@@ -3320,25 +4691,36 @@
</span><span class="cx"> initialized = YES;
</span><span class="cx">
</span><span class="cx"> InitWebCoreSystemInterface();
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp];
</span><ins>+#endif
</ins><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_cacheModelChangedNotification:) name:WebPreferencesCacheModelChangedInternalNotification object:nil];
</span><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil];
</span><span class="cx">
</span><span class="cx"> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
</ins><span class="cx"> [defaults registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey]];
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ continuousSpellCheckingEnabled = NO;
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> continuousSpellCheckingEnabled = [defaults boolForKey:WebContinuousSpellCheckingEnabled];
</span><span class="cx"> grammarCheckingEnabled = [defaults boolForKey:WebGrammarCheckingEnabled];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> Font::setDefaultTypesettingFeatures([defaults boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey] ? Kerning | Ligatures : 0);
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> automaticQuoteSubstitutionEnabled = [self _shouldAutomaticQuoteSubstitutionBeEnabled];
</span><span class="cx"> automaticLinkDetectionEnabled = [defaults boolForKey:WebAutomaticLinkDetectionEnabled];
</span><span class="cx"> automaticDashSubstitutionEnabled = [self _shouldAutomaticDashSubstitutionBeEnabled];
</span><span class="lines">@@ -3356,8 +4738,10 @@
</span><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeAutomaticDashSubstitutionEnabled:)
</span><span class="cx"> name:NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification object:nil];
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (BOOL)_shouldAutomaticTextReplacementBeEnabled
</span><span class="cx"> {
</span><span class="cx"> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span><span class="lines">@@ -3432,6 +4816,7 @@
</span><span class="cx">
</span><span class="cx"> PageGroup::closeLocalStorage();
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins
</span><span class="cx"> {
</span><span class="lines">@@ -3457,8 +4842,10 @@
</span><span class="cx"> if (pluginPackage)
</span><span class="cx"> return pluginPackage;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->pluginDatabase)
</span><span class="cx"> return [_private->pluginDatabase pluginForMIMEType:MIMEType];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="lines">@@ -3470,8 +4857,10 @@
</span><span class="cx"> if (pluginPackage)
</span><span class="cx"> return pluginPackage;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->pluginDatabase)
</span><span class="cx"> return [_private->pluginDatabase pluginForMIMEType:MIMEType];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="lines">@@ -3486,12 +4875,15 @@
</span><span class="cx"> if (pluginPackage)
</span><span class="cx"> return pluginPackage;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->pluginDatabase)
</span><span class="cx"> return [_private->pluginDatabase pluginForExtension:extension];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)addPluginInstanceView:(NSView *)view
</span><span class="cx"> {
</span><span class="cx"> if (!_private->pluginDatabase)
</span><span class="lines">@@ -3510,6 +4902,7 @@
</span><span class="cx"> if (_private->pluginDatabase)
</span><span class="cx"> [_private->pluginDatabase removePluginInstanceViewsFor:webFrame];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType
</span><span class="cx"> {
</span><span class="lines">@@ -3519,14 +4912,22 @@
</span><span class="cx"> if ([[WebPluginDatabase sharedDatabase] isMIMETypeRegistered:MIMEType])
</span><span class="cx"> return YES;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (_private->pluginDatabase && [_private->pluginDatabase isMIMETypeRegistered:MIMEType])
</span><span class="cx"> return YES;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: <rdar://problem/7961656> +[WebView canShowMIMETypeAsHTML:] regressed significantly in iOS 4.0
+ // Fast path for the common case to avoid creating the MIME type registry.
+ if ([MIMEType isEqualToString:@"text/html"])
+ return YES;
+#endif
</ins><span class="cx"> return [WebFrameView _canShowMIMETypeAsHTML:MIMEType];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3564,6 +4965,7 @@
</span><span class="cx"> [viewTypes release];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> return [pasteboard _web_bestURL];
</span><span class="lines">@@ -3573,6 +4975,7 @@
</span><span class="cx"> {
</span><span class="cx"> return [pasteboard stringForType:WebURLNamePboardType];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> + (void)registerURLSchemeAsLocal:(NSString *)protocol
</span><span class="cx"> {
</span><span class="lines">@@ -3581,21 +4984,26 @@
</span><span class="cx">
</span><span class="cx"> - (id)_initWithArguments:(NSDictionary *) arguments
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSCoder *decoder = [arguments objectForKey:@"decoder"];
</span><span class="cx"> if (decoder) {
</span><span class="cx"> self = [self initWithCoder:decoder];
</span><span class="cx"> } else {
</span><ins>+#endif
</ins><span class="cx"> ASSERT([arguments objectForKey:@"frame"]);
</span><span class="cx"> NSValue *frameValue = [arguments objectForKey:@"frame"];
</span><span class="cx"> NSRect frame = (frameValue ? [frameValue rectValue] : NSZeroRect);
</span><span class="cx"> NSString *frameName = [arguments objectForKey:@"frameName"];
</span><span class="cx"> NSString *groupName = [arguments objectForKey:@"groupName"];
</span><span class="cx"> self = [self initWithFrame:frame frameName:frameName groupName:groupName];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static bool clientNeedsWebViewInitThreadWorkaround()
</span><span class="cx"> {
</span><span class="cx"> if (WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_WEBVIEW_INIT_THREAD_WORKAROUND))
</span><span class="lines">@@ -3627,6 +5035,7 @@
</span><span class="cx"> static bool isOldClient = clientNeedsWebViewInitThreadWorkaround();
</span><span class="cx"> return isOldClient && !pthread_main_np();
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (instancetype)initWithFrame:(NSRect)f
</span><span class="cx"> {
</span><span class="lines">@@ -3635,13 +5044,16 @@
</span><span class="cx">
</span><span class="cx"> - (instancetype)initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if (needsWebViewInitThreadWorkaround())
</span><span class="cx"> return [[self _webkit_invokeOnMainThread] initWithFrame:f frameName:frameName groupName:groupName];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> WebCoreThreadViolationCheckRoundTwo();
</span><span class="cx"> return [self _initWithFrame:f frameName:frameName groupName:groupName usesDocumentViews:YES];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (instancetype)initWithCoder:(NSCoder *)decoder
</span><span class="cx"> {
</span><span class="cx"> if (needsWebViewInitThreadWorkaround())
</span><span class="lines">@@ -3737,12 +5149,18 @@
</span><span class="cx">
</span><span class="cx"> LOG(Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", [[self mainFrame] name], [self groupName], (int)useBackForwardList);
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx"> if (WebCoreObjCScheduleDeallocateOnMainThread([WebView class], self))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (_private)
+ [_private->_geolocationProvider stopTrackingWebView:self];
+#endif
+
</ins><span class="cx"> // call close to ensure we tear-down completely
</span><span class="cx"> // this maintains our old behavior for existing applications
</span><span class="cx"> [self close];
</span><span class="lines">@@ -3750,8 +5168,10 @@
</span><span class="cx"> if ([[self class] shouldIncludeInWebKitStatistics])
</span><span class="cx"> --WebViewCount;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([self _needsFrameLoadDelegateRetainQuirk])
</span><span class="cx"> [_private->frameLoadDelegate release];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [_private release];
</span><span class="cx"> // [super dealloc] can end up dispatching against _private (3466082)
</span><span class="lines">@@ -3773,6 +5193,13 @@
</span><span class="cx"> {
</span><span class="cx"> // _close existed first, and some clients might be calling or overriding it, so call through.
</span><span class="cx"> [self _close];
</span><ins>+
+#if PLATFORM(IOS) && USE(ACCELERATED_COMPOSITING)
+ if (_private->layerFlushController) {
+ _private->layerFlushController->invalidate();
+ _private->layerFlushController = nullptr;
+ }
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setShouldCloseWithWindow:(BOOL)close
</span><span class="lines">@@ -3785,6 +5212,7 @@
</span><span class="cx"> return _private->shouldCloseWithWindow;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: Use AppKit constants for these when they are available.
</span><span class="cx"> static NSString * const windowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification";
</span><span class="cx"> static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOldScaleFactorKey";
</span><span class="lines">@@ -3864,6 +5292,7 @@
</span><span class="cx"> [self addWindowObserversForWindow:window];
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)viewDidMoveToWindow
</span><span class="cx"> {
</span><span class="lines">@@ -3878,14 +5307,25 @@
</span><span class="cx"> _private->page->setCanStartMedia(true);
</span><span class="cx"> _private->page->didMoveOnscreen();
</span><span class="cx"> _private->page->setIsInWindow(true);
</span><ins>+
+#if PLATFORM(IOS)
+ WebPreferences *preferences = [self preferences];
+ NSWindow *window = [self window];
+ [window setTileBordersVisible:[preferences showDebugBorders]];
+ [window setTilePaintCountsVisible:[preferences showRepaintCounter]];
+ [window setAcceleratedDrawingEnabled:[preferences acceleratedDrawingEnabled]];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [self _updateActiveState];
</span><span class="cx"> [self _updateVisibilityState];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)doWindowDidChangeScreen
</span><span class="cx"> {
</span><span class="cx"> if (_private && _private->page)
</span><span class="lines">@@ -3944,7 +5384,30 @@
</span><span class="cx">
</span><span class="cx"> _private->page->setDeviceScaleFactor(newBackingScaleFactor);
</span><span class="cx"> }
</span><ins>+#else
+- (void)_wakWindowScreenScaleChanged:(NSNotification *)notification
+{
+ [self _updateScreenScaleFromWindow];
+}
</ins><span class="cx">
</span><ins>+- (void)_wakWindowVisibilityChanged:(NSNotification *)notification
+{
+ if ([notification object] == [self window])
+ [self _updateVisibilityState];
+}
+
+- (void)_updateScreenScaleFromWindow
+{
+ float scaleFactor = 1.0f;
+ if (WAKWindow *window = [self window])
+ scaleFactor = [window screenScale];
+ else
+ scaleFactor = WKGetScreenScaleFactor();
+
+ _private->page->setDeviceScaleFactor(scaleFactor);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (void)setPreferences:(WebPreferences *)prefs
</span><span class="cx"> {
</span><span class="cx"> if (!prefs)
</span><span class="lines">@@ -3995,6 +5458,9 @@
</span><span class="cx"> - (void)setUIDelegate:delegate
</span><span class="cx"> {
</span><span class="cx"> _private->UIDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+ [_private->UIDelegateForwarder clearTarget];
+#endif
</ins><span class="cx"> [_private->UIDelegateForwarder release];
</span><span class="cx"> _private->UIDelegateForwarder = nil;
</span><span class="cx"> }
</span><span class="lines">@@ -4004,8 +5470,25 @@
</span><span class="cx"> return _private->UIDelegate;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)_resourceLoadDelegateForwarder
+{
+ if (_private->closing)
+ return nil;
+
+ if (!_private->resourceProgressDelegateForwarder)
+ _private->resourceProgressDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self resourceLoadDelegate] defaultTarget:[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate]];
+ return _private->resourceProgressDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)setResourceLoadDelegate: delegate
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ [_private->resourceProgressDelegateForwarder clearTarget];
+ [_private->resourceProgressDelegateForwarder release];
+ _private->resourceProgressDelegateForwarder = nil;
+#endif
</ins><span class="cx"> _private->resourceProgressDelegate = delegate;
</span><span class="cx"> [self _cacheResourceLoadDelegateImplementations];
</span><span class="cx"> }
</span><span class="lines">@@ -4029,6 +5512,9 @@
</span><span class="cx"> - (void)setPolicyDelegate:delegate
</span><span class="cx"> {
</span><span class="cx"> _private->policyDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+ [_private->policyDelegateForwarder clearTarget];
+#endif
</ins><span class="cx"> [_private->policyDelegateForwarder release];
</span><span class="cx"> _private->policyDelegateForwarder = nil;
</span><span class="cx"> }
</span><span class="lines">@@ -4038,17 +5524,35 @@
</span><span class="cx"> return _private->policyDelegate;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (id)_frameLoadDelegateForwarder
+{
+ if (_private->closing)
+ return nil;
+
+ if (!_private->frameLoadDelegateForwarder)
+ _private->frameLoadDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self frameLoadDelegate] defaultTarget:[WebDefaultFrameLoadDelegate sharedFrameLoadDelegate]];
+ return _private->frameLoadDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)setFrameLoadDelegate:delegate
</span><span class="cx"> {
</span><span class="cx"> // <rdar://problem/6950660> - Due to some subtle WebKit changes - presumably to delegate callback behavior - we've
</span><span class="cx"> // unconvered a latent bug in at least one WebKit app where the delegate wasn't properly retained by the app and
</span><span class="cx"> // was dealloc'ed before being cleared.
</span><span class="cx"> // This is an effort to keep such apps working for now.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> if ([self _needsFrameLoadDelegateRetainQuirk]) {
</span><span class="cx"> [delegate retain];
</span><span class="cx"> [_private->frameLoadDelegate release];
</span><span class="cx"> }
</span><del>-
</del><ins>+#else
+ [_private->frameLoadDelegateForwarder clearTarget];
+ [_private->frameLoadDelegateForwarder release];
+ _private->frameLoadDelegateForwarder = nil;
+#endif
+
</ins><span class="cx"> _private->frameLoadDelegate = delegate;
</span><span class="cx"> [self _cacheFrameLoadDelegateImplementations];
</span><span class="cx">
</span><span class="lines">@@ -4108,7 +5612,17 @@
</span><span class="cx"> if (!_private->page)
</span><span class="cx"> return NO;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (WebThreadIsCurrent() || !WebThreadIsEnabled())
+#endif
</ins><span class="cx"> return _private->page->goBack();
</span><ins>+#if PLATFORM(IOS)
+ WebThreadRun(^{
+ _private->page->goBack();
+ });
+ // FIXME: <rdar://problem/9157572> -[WebView goBack] and -goForward always return YES when called from the main thread
+ return YES;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)goForward
</span><span class="lines">@@ -4116,7 +5630,17 @@
</span><span class="cx"> if (!_private->page)
</span><span class="cx"> return NO;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (WebThreadIsCurrent() || !WebThreadIsEnabled())
+#endif
</ins><span class="cx"> return _private->page->goForward();
</span><ins>+#if PLATFORM(IOS)
+ WebThreadRun(^{
+ _private->page->goForward();
+ });
+ // FIXME: <rdar://problem/9157572> -[WebView goBack] and -goForward always return YES when called from the main thread
+ return YES;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)goToBackForwardItem:(WebHistoryItem *)item
</span><span class="lines">@@ -4318,6 +5842,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // Return statements are only valid in a function but some applications pass in scripts
</span><span class="cx"> // prefixed with return (<rdar://problems/5103720&4616860>) since older WebKit versions
</span><span class="cx"> // silently ignored the return. If the application is linked against an earlier version
</span><span class="lines">@@ -4327,6 +5852,7 @@
</span><span class="cx"> if (returnStringRange.length && !returnStringRange.location)
</span><span class="cx"> script = [script substringFromIndex:returnStringRange.location + returnStringRange.length];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSString *result = [[self mainFrame] _stringByEvaluatingJavaScriptFromString:script];
</span><span class="cx"> // The only way stringByEvaluatingJavaScriptFromString can return nil is if the frame was removed by the script
</span><span class="lines">@@ -4366,17 +5892,21 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> Frame* coreFrame = [self _mainCoreFrame];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame))
</span><span class="cx"> [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow];
</span><span class="cx"> if (_private->hostWindow && [self window] != _private->hostWindow)
</span><span class="cx"> [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_private->hostWindow];
</span><span class="cx"> if (hostWindow)
</span><span class="cx"> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:hostWindow];
</span><ins>+#endif
</ins><span class="cx"> [_private->hostWindow release];
</span><span class="cx"> _private->hostWindow = [hostWindow retain];
</span><span class="cx"> for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame))
</span><span class="cx"> [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSWindow *)hostWindow
</span><span class="lines">@@ -4514,9 +6044,12 @@
</span><span class="cx"> // This works together with setNextKeyView to splice the WebView into
</span><span class="cx"> // the key loop similar to the way NSScrollView does this. Note that
</span><span class="cx"> // WebFrameView has very similar code.
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSWindow *window = [self window];
</span><ins>+#endif
</ins><span class="cx"> WebFrameView *mainFrameView = [[self mainFrame] frameView];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSResponder *previousFirstResponder = [[self window] _oldFirstResponderBeforeBecoming];
</span><span class="cx"> BOOL fromOutside = ![previousFirstResponder isKindOfClass:[NSView class]] || (![(NSView *)previousFirstResponder isDescendantOf:self] && previousFirstResponder != self);
</span><span class="cx">
</span><span class="lines">@@ -4532,13 +6065,16 @@
</span><span class="cx"> }
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> if ([mainFrameView acceptsFirstResponder]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> _private->becomingFirstResponder = YES;
</span><span class="cx"> _private->becomingFirstResponderFromOutside = fromOutside;
</span><span class="cx"> [window makeFirstResponder:mainFrameView];
</span><span class="cx"> _private->becomingFirstResponderFromOutside = NO;
</span><span class="cx"> _private->becomingFirstResponder = NO;
</span><ins>+#endif
</ins><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4612,6 +6148,7 @@
</span><span class="cx"> return _private->page->progress().estimatedProgress();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSArray *)pasteboardTypesForSelection
</span><span class="cx"> {
</span><span class="cx"> NSView <WebDocumentView> *documentView = [[[self _selectedOrMainFrame] frameView] documentView];
</span><span class="lines">@@ -4669,6 +6206,7 @@
</span><span class="cx"> page->dragController().dragEnded();
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> - (void)setMainFrameURL:(NSString *)URLString
</span><span class="cx"> {
</span><span class="lines">@@ -4702,11 +6240,24 @@
</span><span class="cx"> return (mainFrameTitle != nil) ? mainFrameTitle : (NSString *)@"";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSImage *)mainFrameIcon
</span><span class="cx"> {
</span><span class="cx"> return [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[self mainFrame] _dataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
</span><span class="cx"> }
</span><ins>+#else
+- (NSURL *)mainFrameIconURL
+{
+ WebFrame *mainFrame = [self mainFrame];
+ Frame *coreMainFrame = core(mainFrame);
+ if (!coreMainFrame)
+ return nil;
</ins><span class="cx">
</span><ins>+ NSURL *url = (NSURL *)coreMainFrame->loader().icon().url();
+ return url;
+}
+#endif
+
</ins><span class="cx"> - (DOMDocument *)mainFrameDocument
</span><span class="cx"> {
</span><span class="cx"> // only return the actual value if the state we're in gives NSTreeController
</span><span class="lines">@@ -4799,7 +6350,12 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)canGoBack
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadLock();
+ if (!_private->page)
+#else
</ins><span class="cx"> if (!_private->page || _private->page->defersLoading())
</span><ins>+#endif
</ins><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> return !!_private->page->backForwardClient()->backItem();
</span><span class="lines">@@ -4807,7 +6363,12 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)canGoForward
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadLock();
+ if (!_private->page)
+#else
</ins><span class="cx"> if (!_private->page || _private->page->defersLoading())
</span><ins>+#endif
</ins><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> return !!_private->page->backForwardClient()->forwardItem();
</span><span class="lines">@@ -4825,12 +6386,55 @@
</span><span class="cx">
</span><span class="cx"> - (IBAction)stopLoading:(id)sender
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (WebThreadNotCurrent()) {
+ _private->isStopping = true;
+ WebThreadSetShouldYield();
+ }
+ WebThreadRun(^{
+ _private->isStopping = false;
+#endif
</ins><span class="cx"> [[self mainFrame] stopLoading];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)stopLoadingAndClear
+{
+ if (WebThreadNotCurrent() && !WebThreadIsLocked()) {
+ _private->isStopping = true;
+ WebThreadSetShouldYield();
+ }
+ WebThreadRun(^{
+ _private->isStopping = false;
+
+ WebFrame *frame = [self mainFrame];
+ [frame stopLoading];
+ core(frame)->document()->loader()->writer().end(); // End to finish parsing and display immediately
+
+ WebFrameView *mainFrameView = [frame frameView];
+ float scale = [[mainFrameView documentView] scale];
+ WebPlainWhiteView *plainWhiteView = [[WebPlainWhiteView alloc] initWithFrame:NSZeroRect];
+ [plainWhiteView setScale:scale];
+ [plainWhiteView setFrame:[mainFrameView bounds]];
+ [mainFrameView _setDocumentView:plainWhiteView];
+ [plainWhiteView setNeedsDisplay:YES];
+ [plainWhiteView release];
+ });
+}
+#endif
+
</ins><span class="cx"> - (IBAction)reload:(id)sender
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadRun(^{
+#endif
</ins><span class="cx"> [[self mainFrame] reload];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)reloadFromOrigin:(id)sender
</span><span class="lines">@@ -4870,6 +6474,7 @@
</span><span class="cx"> return [self _resetZoom:sender isTextOnly:![[NSUserDefaults standardUserDefaults] boolForKey:WebKitDebugFullPageZoomPreferenceKey]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (IBAction)toggleSmartInsertDelete:(id)sender
</span><span class="cx"> {
</span><span class="cx"> [self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
</span><span class="lines">@@ -4986,11 +6591,13 @@
</span><span class="cx"> BOOL result = [self validateUserInterfaceItemWithoutDelegate:item];
</span><span class="cx"> return CallUIDelegateReturningBoolean(result, self, @selector(webView:validateUserInterfaceItem:defaultValidation:), item, result);
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebPendingPublic)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode
</span><span class="cx"> {
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="lines">@@ -5012,6 +6619,7 @@
</span><span class="cx"> if (runLoop && mode)
</span><span class="cx"> core(self)->removeSchedulePair(SchedulePair::create(schedulePairRunLoop, (CFStringRef)mode));
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *string, WebFindOptions options)
</span><span class="cx"> {
</span><span class="lines">@@ -5094,10 +6702,12 @@
</span><span class="cx"> // we use this to tell NSTreeController to reset its observers and clear its state
</span><span class="cx"> if (_private->mainFrameDocumentReady == mainFrameDocumentReady)
</span><span class="cx"> return;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [self _willChangeValueForKey:_WebMainFrameDocumentKey];
</span><span class="cx"> _private->mainFrameDocumentReady = mainFrameDocumentReady;
</span><span class="cx"> [self _didChangeValueForKey:_WebMainFrameDocumentKey];
</span><span class="cx"> // this will cause observers to call mainFrameDocument where this flag will be checked
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements
</span><span class="lines">@@ -5147,6 +6757,7 @@
</span><span class="cx"> return coreFrame->loader().shouldClose();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSC::JSValue jsValue)
</span><span class="cx"> {
</span><span class="cx"> NSAppleEventDescriptor* aeDesc = 0;
</span><span class="lines">@@ -5214,6 +6825,7 @@
</span><span class="cx"> JSLockHolder lock(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
</span><span class="cx"> return aeDescFromJSValue(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec(), result);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (BOOL)canMarkAllTextMatches
</span><span class="cx"> {
</span><span class="lines">@@ -5324,6 +6936,13 @@
</span><span class="cx"> [[[[range startContainer] ownerDocument] webFrame] _scrollDOMRangeToVisible:range];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset
+{
+ [[[[range startContainer] ownerDocument] webFrame] _scrollDOMRangeToVisible:range withInset:inset];
+}
+#endif
+
</ins><span class="cx"> - (BOOL)allowsUndo
</span><span class="cx"> {
</span><span class="cx"> return _private->allowsUndo;
</span><span class="lines">@@ -5406,8 +7025,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)removeVisitedLink:(NSURL *)url
+{
+ core(self)->group().removeVisitedLink(url);
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @implementation WebView (WebViewPrintingPrivate)
</span><span class="cx">
</span><span class="cx"> - (float)_headerHeight
</span><span class="lines">@@ -5533,6 +7160,8 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#endif // !PLATFORM(IOS)
+
</ins><span class="cx"> //==========================================================================================
</span><span class="cx"> // Editing
</span><span class="cx">
</span><span class="lines">@@ -5561,9 +7190,11 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // FIXME: This quirk is needed due to <rdar://problem/4985321> - We can phase it out once Aperture can adopt the new behavior on their end
</span><span class="cx"> if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"])
</span><span class="cx"> return YES;
</span><ins>+#endif
</ins><span class="cx"> return [[self _editingDelegateForwarder] webView:self shouldChangeSelectedDOMRange:currentRange toDOMRange:proposedRange affinity:selectionAffinity stillSelecting:flag];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -5663,8 +7294,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> continuousSpellCheckingEnabled = flag;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSUserDefaults standardUserDefaults] setBool:continuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled];
</span><del>-
</del><ins>+#endif
</ins><span class="cx"> if ([self isContinuousSpellCheckingEnabled])
</span><span class="cx"> [[self class] _preflightSpellChecker];
</span><span class="cx"> else
</span><span class="lines">@@ -5676,6 +7308,7 @@
</span><span class="cx"> return (continuousSpellCheckingEnabled && [self _continuousCheckingAllowed]);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSInteger)spellCheckerDocumentTag
</span><span class="cx"> {
</span><span class="cx"> if (!_private->hasSpellCheckerDocumentTag) {
</span><span class="lines">@@ -5684,17 +7317,22 @@
</span><span class="cx"> }
</span><span class="cx"> return _private->spellCheckerDocumentTag;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (NSUndoManager *)undoManager
</span><span class="cx"> {
</span><span class="cx"> if (!_private->allowsUndo)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSUndoManager *undoManager = [[self _editingDelegateForwarder] undoManagerForWebView:self];
</span><span class="cx"> if (undoManager)
</span><span class="cx"> return undoManager;
</span><span class="cx">
</span><span class="cx"> return [super undoManager];
</span><ins>+#else
+ return [[self _editingDelegateForwarder] undoManagerForWebView:self];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)registerForEditingDelegateNotification:(NSString *)name selector:(SEL)selector
</span><span class="lines">@@ -5745,6 +7383,7 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @implementation WebView (WebViewGrammarChecking)
</span><span class="cx">
</span><span class="cx"> // FIXME: This method should be merged into WebViewEditing when we're not in API freeze
</span><span class="lines">@@ -5777,34 +7416,57 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> @implementation WebView (WebViewTextChecking)
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticQuoteSubstitutionEnabled
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return automaticQuoteSubstitutionEnabled;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticLinkDetectionEnabled
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return automaticLinkDetectionEnabled;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticDashSubstitutionEnabled
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return automaticDashSubstitutionEnabled;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticTextReplacementEnabled
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return automaticTextReplacementEnabled;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticSpellingCorrectionEnabled
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ return NO;
+#else
</ins><span class="cx"> return automaticSpellingCorrectionEnabled;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
+
</ins><span class="cx"> - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag
</span><span class="cx"> {
</span><span class="cx"> if (automaticQuoteSubstitutionEnabled == flag)
</span><span class="lines">@@ -5875,6 +7537,8 @@
</span><span class="cx"> [self setAutomaticSpellingCorrectionEnabled:![self isAutomaticSpellingCorrectionEnabled]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#endif // !PLATFORM(IOS)
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebViewUndoableEditing)
</span><span class="lines">@@ -5954,6 +7618,22 @@
</span><span class="cx">
</span><span class="cx"> FOR_EACH_RESPONDER_SELECTOR(FORWARD)
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+FORWARD(clearText)
+FORWARD(toggleBold)
+FORWARD(toggleItalic)
+FORWARD(toggleUnderline)
+
+- (void)insertDictationPhrases:(NSArray *)dictationPhrases metadata:(id)metadata
+{
+ Frame* coreFrame = core([self _selectedOrMainFrame]);
+ if (!coreFrame)
+ return;
+
+ coreFrame->editor().insertDictationPhrases(vectorForDictationPhrasesArray(dictationPhrases), metadata);
+}
+#endif
+
</ins><span class="cx"> - (void)insertText:(NSString *)text
</span><span class="cx"> {
</span><span class="cx"> [self _performResponderOperation:_cmd with:text];
</span><span class="lines">@@ -6021,6 +7701,7 @@
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebFileInternal)
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (float)_deviceScaleFactor
</span><span class="cx"> {
</span><span class="cx"> if (_private->customDeviceScaleFactor != 0)
</span><span class="lines">@@ -6034,6 +7715,7 @@
</span><span class="cx"> return [hostWindow backingScaleFactor];
</span><span class="cx"> return [[NSScreen mainScreen] backingScaleFactor];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> static inline uint64_t roundUpToPowerOf2(uint64_t num)
</span><span class="cx"> {
</span><span class="lines">@@ -6062,6 +7744,9 @@
</span><span class="cx">
</span><span class="cx"> NSUInteger nsurlCacheMemoryCapacity = 0;
</span><span class="cx"> NSUInteger nsurlCacheDiskCapacity = 0;
</span><ins>+#if PLATFORM(IOS)
+ unsigned tileLayerPoolCapacity = 0;
+#endif
</ins><span class="cx">
</span><span class="cx"> switch (cacheModel) {
</span><span class="cx"> case WebCacheModelDocumentViewer: {
</span><span class="lines">@@ -6077,6 +7762,10 @@
</span><span class="cx"> cacheTotalCapacity = 32 * 1024 * 1024;
</span><span class="cx"> else if (memSize >= 512)
</span><span class="cx"> cacheTotalCapacity = 16 * 1024 * 1024;
</span><ins>+#if PLATFORM(IOS)
+ else
+ cacheTotalCapacity = 4 * 1024 * 1024;
+#endif
</ins><span class="cx">
</span><span class="cx"> cacheMinDeadCapacity = 0;
</span><span class="cx"> cacheMaxDeadCapacity = 0;
</span><span class="lines">@@ -6087,6 +7776,13 @@
</span><span class="cx"> // Foundation disk cache capacity (in bytes)
</span><span class="cx"> nsurlCacheDiskCapacity = [nsurlCache diskCapacity];
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // TileCache layer pool capacity, in bytes.
+ if (memSize >= 1024)
+ tileLayerPoolCapacity = 24 * 1024 * 1024;
+ else
+ tileLayerPoolCapacity = 12 * 1024 * 1024;
+#endif
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case WebCacheModelDocumentBrowser: {
</span><span class="lines">@@ -6133,9 +7829,20 @@
</span><span class="cx"> else
</span><span class="cx"> nsurlCacheDiskCapacity = 20 * 1024 * 1024;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // TileCache layer pool capacity, in bytes.
+ if (memSize >= 1024)
+ tileLayerPoolCapacity = 24 * 1024 * 1024;
+ else
+ tileLayerPoolCapacity = 12 * 1024 * 1024;
+#endif
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case WebCacheModelPrimaryWebBrowser: {
</span><ins>+#if PLATFORM(IOS)
+ WebPreferences *preferences = [WebPreferences standardPreferences];
+ int prefValue;
+#endif
</ins><span class="cx"> // Page cache capacity (in pages)
</span><span class="cx"> // (Research indicates that value / page drops substantially after 3 pages.)
</span><span class="cx"> if (memSize >= 2048)
</span><span class="lines">@@ -6149,6 +7856,17 @@
</span><span class="cx"> else
</span><span class="cx"> pageCacheCapacity = 1;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // Cache page less aggressively in iOS to reduce the chance of being jettisoned.
+ // FIXME (<rdar://problem/11779846>): Avoiding jettisoning should not have to require reducing the page cache capacity.
+ // Reducing the capacity by 1 reduces overall back-forward performance.
+ if (pageCacheCapacity > 0)
+ pageCacheCapacity -= 1;
+ prefValue = [preferences _pageCacheSize];
+ if (prefValue >= 0)
+ pageCacheCapacity = prefValue;
+#endif
+
</ins><span class="cx"> // Object cache capacities (in bytes)
</span><span class="cx"> // (Testing indicates that value / MB depends heavily on content and
</span><span class="cx"> // browsing pattern. Even growth above 128MB can have substantial
</span><span class="lines">@@ -6162,6 +7880,12 @@
</span><span class="cx"> else if (memSize >= 512)
</span><span class="cx"> cacheTotalCapacity = 32 * 1024 * 1024;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ prefValue = [preferences _objectCacheSize];
+ if (prefValue >= 0)
+ cacheTotalCapacity = prefValue;
+#endif
+
</ins><span class="cx"> cacheMinDeadCapacity = cacheTotalCapacity / 4;
</span><span class="cx"> cacheMaxDeadCapacity = cacheTotalCapacity / 2;
</span><span class="cx">
</span><span class="lines">@@ -6171,6 +7895,16 @@
</span><span class="cx">
</span><span class="cx"> deadDecodedDataDeletionInterval = 60;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (memSize >= 1024)
+ nsurlCacheMemoryCapacity = 16 * 1024 * 1024;
+ else
+ nsurlCacheMemoryCapacity = 8 * 1024 * 1024;
+
+ prefValue = [preferences _NSURLMemoryCacheSize];
+ if (prefValue >= 0)
+ nsurlCacheMemoryCapacity = prefValue;
+#else
</ins><span class="cx"> // Foundation memory cache capacity (in bytes)
</span><span class="cx"> // (These values are small because WebCore does most caching itself.)
</span><span class="cx"> if (memSize >= 1024)
</span><span class="lines">@@ -6181,6 +7915,7 @@
</span><span class="cx"> nsurlCacheMemoryCapacity = 1 * 1024 * 1024;
</span><span class="cx"> else
</span><span class="cx"> nsurlCacheMemoryCapacity = 512 * 1024;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> // Foundation disk cache capacity (in bytes)
</span><span class="cx"> if (diskFreeSize >= 16384)
</span><span class="lines">@@ -6196,6 +7931,17 @@
</span><span class="cx"> else
</span><span class="cx"> nsurlCacheDiskCapacity = 50 * 1024 * 1024;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ prefValue = [preferences _NSURLDiskCacheSize];
+ if (prefValue >= 0)
+ nsurlCacheDiskCapacity = prefValue;
+
+ // TileCache layer pool capacity, in bytes.
+ if (memSize >= 1024)
+ tileLayerPoolCapacity = 48 * 1024 * 1024;
+ else
+ tileLayerPoolCapacity = 24 * 1024 * 1024;
+#endif
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> default:
</span><span class="lines">@@ -6209,9 +7955,23 @@
</span><span class="cx"> memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
</span><span class="cx"> memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
</span><span class="cx"> pageCache()->setCapacity(pageCacheCapacity);
</span><ins>+#if PLATFORM(IOS)
+ pageCache()->setShouldClearBackingStores(true);
+ nsurlCacheMemoryCapacity = std::max(nsurlCacheMemoryCapacity, [nsurlCache memoryCapacity]);
+ CFURLCacheRef cfCache;
+ if ([nsurlCache respondsToSelector:@selector(_CFURLCache)] && (cfCache = [nsurlCache _CFURLCache]))
+ CFURLCacheSetMemoryCapacity(cfCache, nsurlCacheMemoryCapacity);
+ else
+ [nsurlCache setMemoryCapacity:nsurlCacheMemoryCapacity];
+#else
</ins><span class="cx"> [nsurlCache setMemoryCapacity:nsurlCacheMemoryCapacity];
</span><ins>+#endif
</ins><span class="cx"> [nsurlCache setDiskCapacity:nsurlCacheDiskCapacity];
</span><del>-
</del><ins>+
+#if PLATFORM(IOS)
+ [WebView _setTileCacheLayerPoolCapacity:tileLayerPoolCapacity];
+#endif
+
</ins><span class="cx"> s_cacheModel = cacheModel;
</span><span class="cx"> s_didSetCacheModel = YES;
</span><span class="cx"> }
</span><span class="lines">@@ -6237,6 +7997,10 @@
</span><span class="cx">
</span><span class="cx"> + (void)_cacheModelChangedNotification:(NSNotification *)notification
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ // This needs to happen on the Web Thread
+ WebThreadRun(^{
+#endif
</ins><span class="cx"> WebPreferences *preferences = (WebPreferences *)[notification object];
</span><span class="cx"> ASSERT([preferences isKindOfClass:[WebPreferences class]]);
</span><span class="cx">
</span><span class="lines">@@ -6245,6 +8009,9 @@
</span><span class="cx"> [self _setCacheModel:cacheModel];
</span><span class="cx"> else if (cacheModel < [self _cacheModel])
</span><span class="cx"> [self _setCacheModel:std::max([[WebPreferences standardPreferences] cacheModel], [self _maxCacheModelInAnyInstance])];
</span><ins>+#if PLATFORM(IOS)
+ });
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> + (void)_preferencesRemovedNotification:(NSNotification *)notification
</span><span class="lines">@@ -6279,7 +8046,12 @@
</span><span class="cx"> {
</span><span class="cx"> if (_private->closed)
</span><span class="cx"> return nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSView *view = [self hitTest:[[self superview] convertPoint:point fromView:nil]];
</span><ins>+#else
+ //[WebView superview] on iOS is nil, don't do a convertPoint
+ NSView *view = [self hitTest:point];
+#endif
</ins><span class="cx"> if (![view isDescendantOf:[[self mainFrame] frameView]])
</span><span class="cx"> return nil;
</span><span class="cx"> WebFrameView *frameView = containingFrameView(view);
</span><span class="lines">@@ -6289,17 +8061,21 @@
</span><span class="cx">
</span><span class="cx"> + (void)_preflightSpellCheckerNow:(id)sender
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSSpellChecker sharedSpellChecker] _preflightChosenSpellServer];
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> + (void)_preflightSpellChecker
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // As AppKit does, we wish to delay tickling the shared spellchecker into existence on application launch.
</span><span class="cx"> if ([NSSpellChecker sharedSpellCheckerExists]) {
</span><span class="cx"> [self _preflightSpellCheckerNow:self];
</span><span class="cx"> } else {
</span><span class="cx"> [self performSelector:@selector(_preflightSpellCheckerNow:) withObject:self afterDelay:2.0];
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_continuousCheckingAllowed
</span><span class="lines">@@ -6331,6 +8107,7 @@
</span><span class="cx"> return responder;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender
</span><span class="cx"> {
</span><span class="cx"> ASSERT_ARG(sender, [sender isKindOfClass:[NSMenuItem class]]);
</span><span class="lines">@@ -6383,6 +8160,7 @@
</span><span class="cx">
</span><span class="cx"> [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:selectedString];
</span><span class="cx"> }
</span><ins>+#endif // !PLATFORM(IOS)
</ins><span class="cx">
</span><span class="cx"> #if USE(GLIB)
</span><span class="cx"> - (void)_clearGlibLoopObserver
</span><span class="lines">@@ -6493,10 +8271,11 @@
</span><span class="cx"> // Bit 0 is set if user can set the focus to menus, the dock, and various windows using the keyboard.
</span><span class="cx"> // Bit 1 is set if controls other than text fields are included in the tab order (WebKit also always includes lists).
</span><span class="cx"> _private->_keyboardUIMode = (mode & 0x2) ? KeyboardAccessFull : KeyboardAccessDefault;
</span><del>-
</del><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // check for tabbing to links
</span><span class="cx"> if ([_private->preferences tabsToLinks])
</span><span class="cx"> _private->_keyboardUIMode = (KeyboardUIMode)(_private->_keyboardUIMode | KeyboardAccessTabsToLinks);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (KeyboardUIMode)_keyboardUIMode
</span><span class="lines">@@ -6506,9 +8285,11 @@
</span><span class="cx">
</span><span class="cx"> [self _retrieveKeyboardUIModeFromPreferences:nil];
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [[NSDistributedNotificationCenter defaultCenter]
</span><span class="cx"> addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
</span><span class="cx"> name:KeyboardUIModeDidChangeNotification object:nil];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> [[NSNotificationCenter defaultCenter]
</span><span class="cx"> addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
</span><span class="lines">@@ -6517,10 +8298,12 @@
</span><span class="cx"> return _private->_keyboardUIMode;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx"> _private->insertionPasteboard = pasteboard;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (Frame*)_mainCoreFrame
</span><span class="cx"> {
</span><span class="lines">@@ -6592,6 +8375,10 @@
</span><span class="cx"> */
</span><span class="cx"> bool LayerFlushController::flushLayers()
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ WebThreadLock();
+#endif
+#if !PLATFORM(IOS)
</ins><span class="cx"> NSWindow *window = [m_webView window];
</span><span class="cx">
</span><span class="cx"> // An NSWindow may not display in the next runloop cycle after dirtying due to delayed window display logic,
</span><span class="lines">@@ -6607,15 +8394,25 @@
</span><span class="cx">
</span><span class="cx"> if (viewsNeedDisplay)
</span><span class="cx"> return false;
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // Ensure fixed positions layers are where they should be.
+ [m_webView _synchronizeCustomFixedPositionLayoutRect];
+#endif
+
</ins><span class="cx"> [m_webView _viewWillDrawInternal];
</span><span class="cx">
</span><ins>+ [m_webView _viewWillDrawInternal];
+
</ins><span class="cx"> if ([m_webView _flushCompositingChanges]) {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> // AppKit may have disabled screen updates, thinking an upcoming window flush will re-enable them.
</span><span class="cx"> // In case setNeedsDisplayInRect() has prevented the window from needing to be flushed, re-enable screen
</span><span class="cx"> // updates here.
</span><span class="cx"> if (![window isFlushWindowDisabled])
</span><span class="cx"> [window _enableScreenUpdatesIfNeeded];
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -6625,15 +8422,28 @@
</span><span class="cx">
</span><span class="cx"> - (void)_scheduleCompositingLayerFlush
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+ if (_private->closing)
+ return;
+#endif
+
</ins><span class="cx"> if (!_private->layerFlushController)
</span><span class="cx"> _private->layerFlushController = LayerFlushController::create(self);
</span><span class="cx"> _private->layerFlushController->scheduleLayerFlush();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_scheduleLayerFlushForPendingTileCacheRepaint
+{
+ Frame* coreFrame = [self _mainCoreFrame];
+ if (FrameView* view = coreFrame->view())
+ view->scheduleLayerFlushAllowingThrottling();
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#endif
</ins><span class="cx">
</span><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx"> - (void)_enterFullscreenForNode:(WebCore::Node*)node
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isHTMLVideoElement(node));
</span><span class="lines">@@ -6671,9 +8481,9 @@
</span><span class="cx"> _private->fullscreenController = nil;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#endif
</del><ins>+#endif // ENABLE(VIDEO) && !PLATFORM(IOS)
</ins><span class="cx">
</span><del>-#if ENABLE(FULLSCREEN_API)
</del><ins>+#if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)_supportsFullScreenForElement:(const WebCore::Element*)element withKeyboard:(BOOL)withKeyboard
</span><span class="cx"> {
</span><span class="cx"> if (![[WebPreferences standardPreferences] fullScreenEnabled])
</span><span class="lines">@@ -6845,6 +8655,17 @@
</span><span class="cx"> #endif // ENABLE(GEOLOCATION)
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (void)_resetAllGeolocationPermission
+{
+#if ENABLE(GEOLOCATION)
+ Frame* frame = [self _mainCoreFrame];
+ if (frame)
+ frame->resetAllGeolocationPermission();
+#endif
+}
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebViewNotification)
</span><span class="lines">@@ -6890,6 +8711,36 @@
</span><span class="cx"> }
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@implementation WebView (WebViewIOSPDF)
+
++ (Class)_getPDFRepresentationClass
+{
+ if (s_pdfRepresentationClass)
+ return s_pdfRepresentationClass;
+ return [WebPDFView class]; // This is WebPDFRepresentation for PLATFORM(MAC).
+}
+
++ (void)_setPDFRepresentationClass:(Class)pdfRepresentationClass
+{
+ s_pdfRepresentationClass = pdfRepresentationClass;
+}
+
++ (Class)_getPDFViewClass
+{
+ if (s_pdfViewClass)
+ return s_pdfViewClass;
+ return [WebPDFView class];
+}
+
++ (void)_setPDFViewClass:(Class)pdfViewClass
+{
+ s_pdfViewClass = pdfViewClass;
+}
+
+@end
+#endif
+
</ins><span class="cx"> @implementation WebView (WebViewFullScreen)
</span><span class="cx">
</span><span class="cx"> - (NSView*)fullScreenPlaceholderView
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -38,6 +38,10 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebCaretChangeListener.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> class AlternativeTextUIController;
</span><span class="cx"> class HistoryItem;
</span><span class="lines">@@ -66,6 +70,12 @@
</span><span class="cx"> @class WebIndicateLayer;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@class WAKWindow;
+@class WebEvent;
+@class WebFixedPositionContent;
+#endif
+
</ins><span class="cx"> extern BOOL applicationIsTerminating;
</span><span class="cx"> extern int pluginDatabaseClientCount;
</span><span class="cx">
</span><span class="lines">@@ -125,6 +135,10 @@
</span><span class="cx"> id editingDelegateForwarder;
</span><span class="cx"> id scriptDebugDelegate;
</span><span class="cx"> id historyDelegate;
</span><ins>+#if PLATFORM(IOS)
+ id resourceProgressDelegateForwarder;
+ id formDelegateForwarder;
+#endif
</ins><span class="cx">
</span><span class="cx"> WebInspector *inspector;
</span><span class="cx"> WebNodeHighlight *currentNodeHighlight;
</span><span class="lines">@@ -140,6 +154,9 @@
</span><span class="cx">
</span><span class="cx"> WebPreferences *preferences;
</span><span class="cx"> BOOL useSiteSpecificSpoofing;
</span><ins>+#if PLATFORM(IOS)
+ NSURL *userStyleSheetLocation;
+#endif
</ins><span class="cx">
</span><span class="cx"> NSWindow *hostWindow;
</span><span class="cx">
</span><span class="lines">@@ -153,6 +170,9 @@
</span><span class="cx"> void *observationInfo;
</span><span class="cx">
</span><span class="cx"> BOOL closed;
</span><ins>+#if PLATFORM(IOS)
+ BOOL closing;
+#endif
</ins><span class="cx"> BOOL shouldCloseWithWindow;
</span><span class="cx"> BOOL mainFrameDocumentReady;
</span><span class="cx"> BOOL drawsBackground;
</span><span class="lines">@@ -161,7 +181,11 @@
</span><span class="cx"> BOOL becomingFirstResponderFromOutside;
</span><span class="cx"> BOOL usesPageCache;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSColor *backgroundColor;
</span><ins>+#else
+ CGColorRef backgroundColor;
+#endif
</ins><span class="cx">
</span><span class="cx"> NSString *mediaStyle;
</span><span class="cx">
</span><span class="lines">@@ -175,8 +199,29 @@
</span><span class="cx"> BOOL dashboardBehaviorAllowWheelScrolling;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ BOOL isStopping;
+
+ id UIKitDelegate;
+ id UIKitDelegateForwarder;
+
+ id WebMailDelegate;
+
+ BOOL allowsMessaging;
+ NSMutableSet *_caretChangeListeners;
+ id <WebCaretChangeListener> _caretChangeListener;
+
+ CGSize fixedLayoutSize;
+ BOOL mainViewIsScrollingOrZooming;
+ int32_t didDrawTiles;
+ WTF::Mutex pendingFixedPositionLayoutRectMutex;
+ CGRect pendingFixedPositionLayoutRect;
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> // WebKit has both a global plug-in database and a separate, per WebView plug-in database. Dashboard uses the per WebView database.
</span><span class="cx"> WebPluginDatabase *pluginDatabase;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> HashMap<unsigned long, RetainPtr<id>> identifierMap;
</span><span class="cx">
</span><span class="lines">@@ -195,7 +240,9 @@
</span><span class="cx"> RefPtr<LayerFlushController> layerFlushController;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSPasteboard *insertionPasteboard;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> NSSize lastLayoutSize;
</span><span class="cx">
</span><span class="lines">@@ -232,6 +279,9 @@
</span><span class="cx"> int validationMessageTimerMagnification;
</span><span class="cx">
</span><span class="cx"> float customDeviceScaleFactor;
</span><ins>+#if PLATFORM(IOS)
+ WebFixedPositionContent* _fixedPositionContent;
+#endif
</ins><span class="cx">
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> OwnPtr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.mm (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.mm        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.mm        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#import "WebGeolocationProviderIOS.h"
+#endif
+
</ins><span class="cx"> BOOL applicationIsTerminating = NO;
</span><span class="cx"> int pluginDatabaseClientCount = 0;
</span><span class="cx">
</span><span class="lines">@@ -72,9 +76,11 @@
</span><span class="cx">
</span><span class="cx"> + (void)initialize
</span><span class="cx"> {
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> JSC::initializeThreading();
</span><span class="cx"> WTF::initializeMainThreadToProcessMainThread();
</span><span class="cx"> RunLoop::initializeMainRunLoop();
</span><ins>+#endif
</ins><span class="cx"> WebCoreObjCFinalizeOnMainThread(self);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -99,7 +105,16 @@
</span><span class="cx"> dashboardBehaviorAllowWheelScrolling = YES;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ isStopping = NO;
+ _geolocationProvider = [WebGeolocationProviderIOS sharedGeolocationProvider];
+#endif
+
+#if !PLATFORM(IOS)
</ins><span class="cx"> shouldCloseWithWindow = objc_collectingEnabled();
</span><ins>+#else
+ shouldCloseWithWindow = false;
+#endif
</ins><span class="cx">
</span><span class="cx"> pluginDatabaseClientCount++;
</span><span class="cx">
</span><span class="lines">@@ -114,13 +129,19 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(applicationIsTerminating || !page);
</span><span class="cx"> ASSERT(applicationIsTerminating || !preferences);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!insertionPasteboard);
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> ASSERT(!fullscreenController);
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> [applicationNameForUserAgent release];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> [backgroundColor release];
</span><ins>+#else
+ CGColorRelease(backgroundColor);
+#endif
</ins><span class="cx"> [inspector release];
</span><span class="cx"> [currentNodeHighlight release];
</span><span class="cx"> [hostWindow release];
</span><span class="lines">@@ -138,13 +159,22 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [UIKitDelegateForwarder release];
+ [formDelegateForwarder release];
+ [_caretChangeListeners release];
+ [_fixedPositionContent release];
+#endif
+
</ins><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)finalize
</span><span class="cx"> {
</span><span class="cx"> ASSERT_MAIN_THREAD();
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> ASSERT(!insertionPasteboard);
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> ASSERT(!fullscreenController);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (161042 => 161043)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2013-12-24 01:24:28 UTC (rev 161042)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2013-12-24 02:07:30 UTC (rev 161043)
</span><span class="lines">@@ -124,6 +124,12 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+@interface NSObject (WebSafeForwarder)
+- (id)asyncForwarder;
+@end
+#endif
+
</ins><span class="cx"> // FIXME: Temporary way to expose methods that are in the wrong category inside WebView.
</span><span class="cx"> @interface WebView (WebViewOtherInternal)
</span><span class="cx">
</span><span class="lines">@@ -136,13 +142,25 @@
</span><span class="cx"> - (WTF::String)_userAgentString;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
</span><ins>+#endif
</ins><span class="cx"> - (id)_UIDelegateForwarder;
</span><ins>+#if PLATFORM(IOS)
+- (id)_UIDelegateForSelector:(SEL)selector;
+#endif
</ins><span class="cx"> - (id)_editingDelegateForwarder;
</span><span class="cx"> - (id)_policyDelegateForwarder;
</span><ins>+#if PLATFORM(IOS)
+- (id)_frameLoadDelegateForwarder;
+- (id)_resourceLoadDelegateForwarder;
+- (id)_UIKitDelegateForwarder;
+#endif
</ins><span class="cx"> - (void)_pushPerformingProgrammaticFocus;
</span><span class="cx"> - (void)_popPerformingProgrammaticFocus;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
</span><ins>+#endif
</ins><span class="cx"> + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
</span><span class="cx"> - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
</span><span class="cx"> + (void)_registerPluginMIMEType:(NSString *)MIMEType;
</span><span class="lines">@@ -156,16 +174,20 @@
</span><span class="cx"> - (BOOL)_isPerformingProgrammaticFocus;
</span><span class="cx"> - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
</span><span class="cx"> - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
</span><span class="cx"> - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
</span><span class="cx"> - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
</span><span class="cx"> - (void)_searchWithGoogleFromMenu:(id)sender;
</span><span class="cx"> - (void)_searchWithSpotlightFromMenu:(id)sender;
</span><ins>+#endif
</ins><span class="cx"> - (void)_progressCompleted:(WebFrame *)frame;
</span><span class="cx"> - (void)_didCommitLoadForFrame:(WebFrame *)frame;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_didFinishLoadForFrame:(WebFrame *)frame;
</span><span class="cx"> - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
</span><span class="cx"> - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
</span><ins>+#endif
</ins><span class="cx"> - (void)_willChangeValueForKey:(NSString *)key;
</span><span class="cx"> - (void)_didChangeValueForKey:(NSString *)key;
</span><span class="cx"> - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
</span><span class="lines">@@ -177,9 +199,11 @@
</span><span class="cx"> - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
</span><span class="cx"> - (WebNodeHighlight *)currentNodeHighlight;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)addPluginInstanceView:(NSView *)view;
</span><span class="cx"> - (void)removePluginInstanceView:(NSView *)view;
</span><span class="cx"> - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
</span><span class="cx"> - (id)_objectForIdentifier:(unsigned long)identifier;
</span><span class="lines">@@ -198,16 +222,26 @@
</span><span class="cx">
</span><span class="cx"> + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
</span><span class="cx">
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_isStopping;
+- (BOOL)_isClosing;
+
+- (void)_documentScaleChanged;
+- (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect;
+#endif
+
</ins><span class="cx"> - (void)_preferencesChanged:(WebPreferences *)preferences;
</span><span class="cx">
</span><del>-#if ENABLE(VIDEO) && defined(__cplusplus)
</del><ins>+#if ENABLE(VIDEO) && !PLATFORM(IOS) && defined(__cplusplus)
</ins><span class="cx"> - (void)_enterFullscreenForNode:(WebCore::Node*)node;
</span><span class="cx"> - (void)_exitFullscreen;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if ENABLE(FULLSCREEN_API) && defined(__cplusplus)
</del><ins>+#if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS) && defined(__cplusplus)
</ins><span class="cx"> - (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element withKeyboard:(BOOL)withKeyboard;
</span><span class="cx"> - (void)_enterFullScreenForElement:(WebCore::Element*)element;
</span><span class="cx"> - (void)_exitFullScreenForElement:(WebCore::Element*)element;
</span></span></pre>
</div>
</div>
</body>
</html>