<!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 &lt;Cocoa/Cocoa.h&gt; were generally replaced with an include
of &lt;Foundation/Foundation.h&gt; followed by an include of
&lt;AppKit/AppKit.h&gt; on non-iOS platforms. This assumes that nobody was
relying on &lt;Cocoa/Cocoa.h&gt;'s inclusion of &lt;CoreData/CoreData.h&gt;.

- Includes of &lt;Cocoa/Cocoa.h&gt; and &lt;Foundation/Foundation.h&gt; 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  &lt;aestes@apple.com&gt;
+
+        [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  &lt;mrobinson@igalia.com&gt;
</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 = &quot;&lt;group&gt;&quot;; 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 = &quot;&lt;group&gt;&quot;; 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 = &quot;&lt;group&gt;&quot;; tabWidth = 8; usesTabs = 0; };
</span><ins>+                51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCachedFramePlatformData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</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 = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = &quot;&lt;group&gt;&quot;; 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 = &quot;&lt;group&gt;&quot;; tabWidth = 8; usesTabs = 0; };
</span><ins>+                FEE7D6910D99B06A005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = &quot;&lt;group&gt;&quot;; };
</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  &lt;aestes@apple.com&gt;
+
+        [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  &lt;burg@cs.washington.edu&gt;
</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  &lt;aestes@apple.com&gt;
+
+        [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 &lt;Cocoa/Cocoa.h&gt; were generally replaced with an include
+        of &lt;Foundation/Foundation.h&gt; followed by an include of
+        &lt;AppKit/AppKit.h&gt; on non-iOS platforms. This assumes that nobody was
+        relying on &lt;Cocoa/Cocoa.h&gt;'s inclusion of &lt;CoreData/CoreData.h&gt;.
+
+        - Includes of &lt;Cocoa/Cocoa.h&gt; and &lt;Foundation/Foundation.h&gt; 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  &lt;oliver@apple.com&gt;
</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  &lt;aestes@apple.com&gt;
</del><ins>+2013-12-14  Andy Estes  &lt;aestes@apple.com&gt;
</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 &quot;iOS.xcconfig&quot;
+
</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 &quot;${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit&quot; $(HEADER_SEARCH_PATHS);
</del><ins>+HEADER_SEARCH_PATHS = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu &quot;$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit&quot; &quot;$(BUILT_PRODUCTS_DIR)/usr/local/include&quot; $(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 &quot;&lt;DEVELOPER_DIR&gt;/AppleInternal/XcodeConfig/AspenFamily.xcconfig&quot;
</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-&gt;renderer();
+    if (!renderer)
+        return YES;
+    
+    return renderer-&gt;style().isHorizontalWritingMode();
+}
+
+- (void)hidePlaceholder
+{
+    if (![self isKindOfClass:[DOMHTMLInputElement class]]
+        &amp;&amp; ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
+        return;
+    
+    Node *node = core(self);
+    HTMLTextFormControlElement *formControl = static_cast&lt;HTMLTextFormControlElement *&gt;(node);
+    formControl-&gt;hidePlaceholder();
+}
+
+- (void)showPlaceholderIfNecessary
+{
+    if (![self isKindOfClass:[DOMHTMLInputElement class]]
+        &amp;&amp; ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
+        return;
+    
+    HTMLTextFormControlElement *formControl = static_cast&lt;HTMLTextFormControlElement *&gt;(core(self));
+    formControl-&gt;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 &quot;WebDefaultContextMenuDelegate.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebDOMOperations.h&quot;
</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 &lt;Cocoa/Cocoa.h&gt;
-
</del><span class="cx"> #import &lt;WebKit/WebDefaultEditingDelegate.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebKit/DOM.h&gt;
</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 &lt;Cocoa/Cocoa.h&gt;
</del><ins>+#import &quot;WebDefaultUIDelegate.h&quot;
</ins><span class="cx"> 
</span><del>-#import &lt;Foundation/NSURLRequest.h&gt;
-
-#import &lt;WebKit/WebDefaultUIDelegate.h&gt;
-#import &lt;WebKit/WebJavaScriptTextInputPanel.h&gt;
-#import &lt;WebKit/WebView.h&gt;
-#import &lt;WebKit/WebUIDelegatePrivate.h&gt;
-#import &lt;WebKit/DOM.h&gt;
</del><ins>+#import &quot;WebJavaScriptTextInputPanel.h&quot;
</ins><span class="cx"> #import &quot;WebTypesInternal.h&quot;
</span><ins>+#import &quot;WebUIDelegatePrivate.h&quot;
+#import &quot;WebView.h&quot;
</ins><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WKViewPrivate.h&gt;
+#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&lt;WebOpenPanelResultListener&gt;)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)-&gt;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 @&quot;entries&quot;
+#define WebBackForwardListDictionaryCapacityKey @&quot;capacity&quot;
+#define WebBackForwardListDictionaryCurrentKey @&quot;current&quot;
+
+- (NSDictionary *)dictionaryRepresentation
+{
+    BackForwardList *coreBFList = core(self);
+    
+    HistoryItemVector historyItems = coreBFList-&gt;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-&gt;current()], WebBackForwardListDictionaryCurrentKey,
+        [NSNumber numberWithInt:coreBFList-&gt;capacity()], WebBackForwardListDictionaryCapacityKey,
+        nil];
+        
+    [entriesArray release];
+    
+    return dictionary;
+}
+
+- (void)setToMatchDictionaryRepresentation:(NSDictionary *)dictionary
+{
+    BackForwardList *coreBFList = core(self);
+    
+    coreBFList-&gt;setCapacity([[dictionary objectForKey:WebBackForwardListDictionaryCapacityKey] intValue]);
+    
+    for (NSDictionary *itemDictionary in [dictionary objectForKey:WebBackForwardListDictionaryEntriesKey]) {
+        WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemDictionary];
+        coreBFList-&gt;addItem(core(item));
+        [item release];
+    }
+
+    unsigned currentIndex = [[dictionary objectForKey:WebBackForwardListDictionaryCurrentKey] unsignedIntValue];
+    size_t listSize = coreBFList-&gt;entries().size();
+    if (currentIndex &gt;= listSize)
+        currentIndex = listSize - 1;
+    coreBFList-&gt;setCurrent(currentIndex);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (BOOL)containsItem:(WebHistoryItem *)item
</span><span class="cx"> {
</span><span class="cx">     return core(self)-&gt;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:@&quot;com.freeverse.bumpercar&quot;] &amp;&amp; 
</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 &lt;WebCore/HistoryItem.h&gt;
</span><span class="cx"> #import &lt;WebCore/PageGroup.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#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&amp; beginningOfDay, NSTimeInterval&amp; beginningOfNextDay)
</span><span class="cx"> {
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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] &lt; [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 &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+
+NSString *WebViewportInitialScaleKey = @&quot;initial-scale&quot;;
+NSString *WebViewportMinimumScaleKey = @&quot;minimum-scale&quot;;
+NSString *WebViewportMaximumScaleKey = @&quot;maximum-scale&quot;;
+NSString *WebViewportUserScalableKey = @&quot;user-scalable&quot;;
+NSString *WebViewportWidthKey        = @&quot;width&quot;;
+NSString *WebViewportHeightKey       = @&quot;height&quot;;
+NSString *WebViewportMinimalUIKey    = @&quot;minimal-ui&quot;;
+
+static NSString *scaleKey = @&quot;scale&quot;;
+static NSString *scaleIsInitialKey = @&quot;scaleIsInitial&quot;;
+static NSString *scrollPointXKey = @&quot;scrollPointX&quot;;
+static NSString *scrollPointYKey = @&quot;scrollPointY&quot;;
+
+static NSString * const bookmarkIDKey = @&quot;bookmarkID&quot;;
+static NSString * const sharedLinkUniqueIdentifierKey = @&quot;sharedLinkUniqueIdentifier&quot;;
+#endif
+
</ins><span class="cx"> // Private keys used in the WebHistoryItem's dictionary representation.
</span><span class="cx"> // see 3245793 for explanation of &quot;lastVisitedDate&quot;
</span><span class="cx"> static NSString *lastVisitedTimeIntervalKey = @&quot;lastVisitedDate&quot;;
</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)-&gt;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 &amp;&amp; scaleIsInitialValue)
+        core(_private)-&gt;setScale([scaleValue floatValue], [scaleIsInitialValue boolValue]);
+
+    if (id viewportArguments = [dict objectForKey:@&quot;WebViewportArguments&quot;])
+        [self _setViewportArguments:viewportArguments];
+
+    NSNumber *scrollPointXValue = [dict objectForKey:scrollPointXKey];
+    NSNumber *scrollPointYValue = [dict objectForKey:scrollPointYKey];
+    if (scrollPointXValue &amp;&amp; scrollPointYValue)
+        core(_private)-&gt;setScrollPoint(IntPoint([scrollPointXValue intValue], [scrollPointYValue intValue]));
+
+    uint32_t bookmarkIDValue = [[dict objectForKey:bookmarkIDKey] unsignedIntValue];
+    if (bookmarkIDValue)
+        core(_private)-&gt;setBookmarkID(bookmarkIDValue);
+
+    NSString *sharedLinkUniqueIdentifierValue = [dict objectForKey:sharedLinkUniqueIdentifierKey];
+    if (sharedLinkUniqueIdentifierValue)
+        core(_private)-&gt;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 &amp;&amp; coreItem-&gt;children().size()) {
+#else
</ins><span class="cx">     if (coreItem-&gt;children().size()) {
</span><ins>+#endif
</ins><span class="cx">         const HistoryItemVector&amp; children = coreItem-&gt;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)-&gt;scale()] forKey:scaleKey];
+    [dict setObject:[NSNumber numberWithBool:core(_private)-&gt;scaleIsInitial()] forKey:scaleIsInitialKey];
+
+    NSDictionary *viewportArguments = [self _viewportArguments];
+    if (viewportArguments)
+        [dict setObject:viewportArguments forKey:@&quot;WebViewportArguments&quot;];
+
+    IntPoint scrollPoint = core(_private)-&gt;scrollPoint();
+    [dict setObject:[NSNumber numberWithInt:scrollPoint.x()] forKey:scrollPointXKey];
+    [dict setObject:[NSNumber numberWithInt:scrollPoint.y()] forKey:scrollPointYKey];
+
+    uint32_t bookmarkID = core(_private)-&gt;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)-&gt;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-&gt;weeklyVisitCounts().size();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (void)_setScale:(float)scale isInitial:(BOOL)aFlag
+{
+    core(_private)-&gt;setScale(scale, aFlag);
+}
+
+- (float)_scale
+{
+    return core(_private)-&gt;scale();
+}
+
+- (BOOL)_scaleIsInitial
+{
+    return core(_private)-&gt;scaleIsInitial();
+}
+
+- (NSDictionary *)_viewportArguments
+{
+    const ViewportArguments&amp; viewportArguments = core(_private)-&gt;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)-&gt;setViewportArguments(viewportArguments);
+}
+
+- (CGPoint)_scrollPoint
+{
+    return core(_private)-&gt;scrollPoint();
+}
+
+- (void)_setScrollPoint:(CGPoint)scrollPoint
+{
+    core(_private)-&gt;setScrollPoint(IntPoint(scrollPoint));
+}
+
+- (uint32_t)_bookmarkID
+{
+    return core(_private)-&gt;bookmarkID();
+}
+
+- (void)_setBookmarkID:(uint32_t)bookmarkID
+{
+    core(_private)-&gt;setBookmarkID(bookmarkID);
+}
+
+- (NSString *)_sharedLinkUniqueIdentifier
+{
+    return nsStringNilIfEmpty(core(_private)-&gt;sharedLinkUniqueIdentifier());
+}
+
+- (void)_setSharedLinkUniqueIdentifier:(NSString *)identifier
+{
+    core(_private)-&gt;setSharedLinkUniqueIdentifier(identifier);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> - (BOOL)_isInPageCache
</span><span class="cx"> {
</span><span class="cx">     return core(_private)-&gt;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 &quot;WebURLsWithTitles.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebKit/WebNSURLExtras.h&gt;
</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 &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;MemoryMeasure.h&quot;
+#import &quot;WebFrameInternal.h&quot;
+#import &lt;WebCore/CachedImage.h&gt;
+#import &lt;WebCore/CredentialStorage.h&gt;
+#import &lt;WebCore/Frame.h&gt;
+#import &lt;WebCore/PageCache.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#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(&quot;[WebCache emptyInMemoryResources]&quot;);
+
+        // 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()-&gt;pruneLiveResources(true);
+    });
+}
+
++ (void)sizeOfDeadResources:(int *)resources
+{
+    WebCore::MemoryCache::Statistics stats = WebCore::memoryCache()-&gt;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)-&gt;document()-&gt;topOrigin();
+#endif
+    return WebCore::memoryCache()-&gt;addImageToCache(image, url, topOrigin ? topOrigin-&gt;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)-&gt;document()-&gt;topOrigin();
+#endif
+    WebCore::memoryCache()-&gt;removeImageFromCache(url, topOrigin ? topOrigin-&gt;cachePartition() : emptyString());
+}
+
++ (CGImageRef)imageForURL:(NSURL *)url
+{
+    if (!url)
+        return nullptr;
+    
+    WebCore::CachedResource* cachedResource = WebCore::memoryCache()-&gt;resourceForURL(url);
+    if (!cachedResource || cachedResource-&gt;type() != WebCore::CachedResource::ImageResource)
+        return nullptr;
+    WebCore::CachedImage* cachedImage = static_cast&lt;WebCore::CachedImage*&gt;(cachedResource);
+    if (!cachedImage || !cachedImage-&gt;hasImage())
+        return nullptr;
+    return cachedImage-&gt;image()-&gt;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-&gt;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 &quot;WebIconDatabaseInternal.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebIconDatabaseClient.h&quot;
</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 &quot;WebIconDatabasePrivate.h&quot;
</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 &lt;unicode/uchar.h&gt;
</span><span class="cx"> #import &lt;sys/param.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebKit/DOM.h&gt;
+#import &lt;WebKit/WebFrame.h&gt;
+#import &lt;WebKit/WebFrameView.h&gt;
+#import &lt;WebKit/WebViewPrivate.h&gt;
+#endif
+
</ins><span class="cx"> NSString *WebKitLocalCacheDefaultsKey = @&quot;WebKitLocalCache&quot;;
</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:@&quot;Library/Caches&quot;];
+#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(&amp;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
+// &lt;rdar://problem/6627758&gt; 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 &quot;C&quot; {
</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() &gt;= version);
</span><ins>+#else
+    int32_t linkTimeVersion = WebKitLinkTimeVersion();
+    int32_t majorVersion = linkTimeVersion &gt;&gt; 16 &amp; 0x0000FFFF;
+    
+    // The application was not linked against UIKit so assume most recent WebKit
+    if (linkTimeVersion == -1)
+        return YES;
+    
+    return (majorVersion &gt;= 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(&quot;WebKit&quot;);
</span><ins>+#else
+    // &lt;rdar://problem/6627758&gt; Need to implement WebKitLinkedOnOrAfter
+    // Third party applications do not link against WebKit, but rather against UIKit.
+    return NSVersionOfLinkTimeLibrary(&quot;UIKit&quot;);
+#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 &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/MainThread.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebLocalizableStringsInternal.h&quot;
+#import &lt;dispatch/dispatch.h&gt;
+#endif
+
</ins><span class="cx"> WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { &quot;com.apple.WebKit&quot;, 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, &quot;could not find localizable string %s in bundle&quot;, key);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><ins>+
+#if PLATFORM(IOS)
+// See &lt;rdar://problem/7902473&gt; 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(&quot;Typing&quot;, &quot;Typing (Undo action name)&quot;, &quot;We don't care if we find this string, but searching for it will load the plist and save the results.&quot;);
+    });
+}
+
+void LoadWebLocalizedStrings(void)
+{
+    CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, &amp;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 &quot;WebTypesInternal.h&quot;
</span><del>-#import &lt;Cocoa/Cocoa.h&gt;
</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 &lt;Cocoa/Cocoa.h&gt;
</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 &quot;WebNSControlExtras.h&quot;
</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 &lt;WebKit/WebNSEventExtras.h&gt;
</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 &lt;wtf/ObjcRuntimeExtras.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/FileSystemIOS.h&gt;
+#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 &lt;Cocoa/Cocoa.h&gt;
</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 &lt;WebKit/WebNSImageExtras.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebKit/WebKitLogging.h&gt;
</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 &quot;WebNSPasteboardExtras.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;DOMElementInternal.h&quot;
</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 &lt;Cocoa/Cocoa.h&gt;
</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 &quot;WebNSPrintOperationExtras.h&quot;
</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 &lt;unicode/uchar.h&gt;
</span><span class="cx"> #import &lt;unicode/uscript.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;Foundation/NSString_NSURLExtras.h&gt;
+#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 @&quot;webkit-fake-url&quot;
+#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:[@&quot;file:&quot; 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 &amp;&amp; [videoID length] &gt; 0 &amp;&amp; ![videoID isEqualToString:@&quot;/&quot;]);
+
+    if ([timeID length])
+        return [NSURL URLWithString:[NSString stringWithFormat:@&quot;youtube:%@?t=%@&quot;, videoID, timeID]];
+    return [NSURL URLWithString:[NSString stringWithFormat:@&quot;youtube:%@&quot;, 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:@&quot;http&quot;] &amp;&amp; ![scheme isEqualToString:@&quot;https&quot;])
+        return nil;
+
+    NSString *hostName = [[self host] lowercaseString];
+    BOOL isYouTubeMobileWebAppURL = [hostName isEqualToString:@&quot;m.youtube.com&quot;];
+    BOOL isYouTubeShortenedURL = [hostName isEqualToString:@&quot;youtu.be&quot;];
+    if (!isYouTubeMobileWebAppURL
+        &amp;&amp; !isYouTubeShortenedURL
+        &amp;&amp; ![hostName isEqualToString:@&quot;www.youtube.com&quot;]
+        &amp;&amp; ![hostName isEqualToString:@&quot;youtube.com&quot;])
+        return nil;
+
+    NSString *path = [self path];
+
+    // Short URL of the form: http://youtu.be/v1d301D
+    if (isYouTubeShortenedURL) {
+        NSString *videoID = [path lastPathComponent];
+        if (videoID &amp;&amp; ![videoID isEqualToString:@&quot;/&quot;])
+            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 &lt;rdar://problem/9550639&gt;).
+    if (isYouTubeMobileWebAppURL) {
+        NSRange range = [fragment rangeOfString:@&quot;?&quot;];
+        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:@&quot;/watch&quot;]) {
+        if ([query length]) {
+            NSString *videoID = [[query _webkit_queryKeysAndValues] objectForKey:@&quot;v&quot;];
+            if (videoID) {
+                NSDictionary *fragmentDict = [[self fragment] _webkit_queryKeysAndValues];
+                NSString *timeID = [fragmentDict objectForKey:@&quot;t&quot;];
+                return createYouTubeURL(videoID, timeID);
+            }
+        }
+
+        // May be a new-style link (see &lt;rdar://problem/7733692&gt;).
+        if ([fragment hasPrefix:@&quot;!&quot;]) {
+            query = [fragment substringFromIndex:1];
+
+            if ([query length]) {
+                NSDictionary *queryDict = [query _webkit_queryKeysAndValues];
+                NSString *videoID = [queryDict objectForKey:@&quot;v&quot;];
+                if (videoID) {
+                    NSString *timeID = [queryDict objectForKey:@&quot;t&quot;];
+                    return createYouTubeURL(videoID, timeID);
+                }
+            }
+        }
+    } else if ([path _web_hasCaseInsensitivePrefix:@&quot;/v/&quot;] || [path _web_hasCaseInsensitivePrefix:@&quot;/e/&quot;]) {
+        NSString *videoID = [path lastPathComponent];
+
+        // These URLs are funny - they don't have a ? for the first query parameter.
+        // Strip all characters after and including '&amp;' to remove extraneous parameters after the video ID.
+        NSRange ampersand = [videoID rangeOfString:@&quot;&amp;&quot;];
+        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:@&quot;%@://%@/%@&quot;, 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:@&quot;+&quot; withString:@&quot; &quot; 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 &lt; queryLength - 1 &amp;&amp; equalSearchRange.length) {
+        
+        // Search for &quot;=&quot;.
+        NSRange equalRange = [self rangeOfString:@&quot;=&quot; options:NSLiteralSearch range:equalSearchRange];
+        if (equalRange.location == NSNotFound)
+            break;
+        
+        unsigned indexAfterEqual = equalRange.location + 1;
+        if (indexAfterEqual &gt; queryLength - 1)
+            break;
+                        
+        // Get the key before the &quot;=&quot;.
+        NSRange keyRange = NSMakeRange(equalSearchRange.location, equalRange.location - equalSearchRange.location);
+        
+        // Seach for the ampersand.
+        NSRange ampersandSearchRange = NSMakeRange(indexAfterEqual, queryLength - indexAfterEqual);
+        NSRange ampersandRange = [self rangeOfString:@&quot;&amp;&quot; options:NSLiteralSearch range:ampersandSearchRange];
+        
+        // Get the value after the &quot;=&quot;, 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 &amp;&amp; valueRange.length) {
+            if (queryKeysAndValues == nil)
+                queryKeysAndValues = [NSMutableDictionary dictionary];
+            NSString *key = [[self substringWithRange:keyRange] lowercaseString];
+            NSString *value = [[self substringWithRange:valueRange] _webkit_unescapedQueryValue];
+            if ([key length] &amp;&amp; [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 &lt;WebKit/WebNSURLExtras.h&gt;
</span><span class="cx"> #import &lt;WebKit/WebView.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#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 &quot;WebNSWindowExtras.h&quot;
</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 &lt;Cocoa/Cocoa.h&gt;
</span><span class="cx"> #import &lt;Foundation/NSURLCredentialStorage.h&gt;
</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 &lt;WebKit/WebAuthenticationPanel.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebLocalizableStringsInternal.h&quot;
</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 &lt;WebKit/WebPanelAuthenticationHandler.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;Foundation/NSURLAuthenticationChallenge.h&gt;
</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 &lt;WebCore/WAKAppKitStubs.h&gt;
+#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 &lt;JavaVM/jni.h&gt;
</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 &lt;WebPluginContainerCheckController&gt;)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 &lt;WebPluginManualLoader, WebPluginContainerCheckController&gt;
</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 &lt;runtime/JSLock.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;DOMElementInternal.h&quot;
+#import &quot;WebUIKitDelegate.h&quot;
+#import &lt;WebCore/FrameView.h&gt;
+#import &lt;WebCore/GraphicsLayer.h&gt;
+#import &lt;WebCore/Page.h&gt;
+#import &lt;WebCore/RuntimeApplicationChecksIOS.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#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 &amp;&amp; pluginViewCount;
+}
+
+- (CALayer *)superlayerForPluginView:(NSView *)view
+{
+#if USE(ACCELERATED_COMPOSITING)
+    Frame* coreFrame = core([self webFrame]);
+    FrameView* coreView = coreFrame ? coreFrame-&gt;view() : nullptr;
+    if (!coreView)
+        return nil;
+
+    // Get a GraphicsLayer;
+    GraphicsLayer* layerForWidget = coreView-&gt;graphicsLayerForPlatformWidget(view);
+    if (!layerForWidget)
+        return nil;
+    
+    return layerForWidget-&gt;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 &gt; 0)
+        LOG(Plugins, &quot;stopping WebKit plugins for PageCache: %@&quot;, [_views description]);
+
+    for (NSUInteger i = 0; i &lt; 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 &lt; viewsNotInDocumentCount; ++i)
+        [self stopOnePluginForPageCache:[_viewsNotInDocument objectAtIndex:i]];
+#endif
+
+    _started = NO;
+}
+
+- (void)restorePluginsFromCache
+{
+    WebView *webView = [_documentView _webView];
+
+    NSUInteger viewsCount = [_views count];
+    if (viewsCount &gt; 0)
+        LOG(Plugins, &quot;restoring WebKit plugins from PageCache: %@&quot;, [_views description]);
+
+    for (NSUInteger i = 0; i &lt; 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 &lt; 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, @&quot;WmvPlugin&quot;))
</span><span class="cx">             installFlip4MacPlugInWorkaroundIfNecessary();
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">         LOG(Plugins, &quot;initializing plug-in %@&quot;, 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, &quot;starting plug-in %@&quot;, 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-&gt;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-&gt;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 &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebUIKitSupport.h&quot;
+#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">         @&quot;/Library/Internet Plug-Ins&quot;,
</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:@&quot;System/Library&quot;];
+#endif
+    return [NSArray arrayWithObject:[systemDir stringByAppendingPathComponent:@&quot;Internet Plug-Ins&quot;]];
+#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 &quot;WebPluginsPrivate.h&quot;
</span><span class="cx"> 
</span><span class="cx"> NSString *WebPluginWillPresentNativeUserInterfaceNotification = @&quot;WebPluginWillPresentNativeUserInterface&quot;;
</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 &lt;WebCore/DatabaseManager.h&gt;
</span><span class="cx"> #import &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebDatabaseManagerInternal.h&quot;
+#import &lt;WebCore/DatabaseTracker.h&gt;
+#import &lt;WebCore/WebCoreThread.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> NSString *WebDatabaseDirectoryDefaultsKey = @&quot;WebDatabaseDirectory&quot;;
</span><span class="lines">@@ -49,6 +55,10 @@
</span><span class="cx"> NSString *WebDatabaseDidModifyDatabaseNotification = @&quot;WebDatabaseDidModifyDatabaseNotification&quot;;
</span><span class="cx"> NSString *WebDatabaseIdentifierKey = @&quot;WebDatabaseIdentifierKey&quot;;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+CFStringRef WebDatabaseOriginsDidChangeNotification = CFSTR(&quot;WebDatabaseOriginsDidChangeNotification&quot;);
+#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: &lt;rdar://problem/9567500&gt; 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 &lt; 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:&amp;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 &lt; 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:&amp;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&amp; 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(&amp;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&amp; 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 &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #import &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WebCoreThread.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+static CFStringRef WebDatabaseOriginWasAddedNotification = CFSTR(&quot;com.apple.MobileSafariSettings.WebDatabaseOriginWasAddedNotification&quot;);
+static CFStringRef WebDatabaseWasDeletedNotification = CFSTR(&quot;com.apple.MobileSafariSettings.WebDatabaseWasDeletedNotification&quot;);
+static CFStringRef WebDatabaseOriginWasDeletedNotification = CFSTR(&quot;com.apple.MobileSafariSettings.WebDatabaseOriginWasDeletedNotification&quot;);
+#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&lt;WebDatabaseManagerClient*&gt;(observer);
+    client-&gt;newDatabaseOriginWasAdded();
+}
+
+static void onDatabaseDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+    ASSERT(observer);
+    
+    WebDatabaseManagerClient* client = reinterpret_cast&lt;WebDatabaseManagerClient*&gt;(observer);
+    client-&gt;databaseWasDeleted();
+}
+
+static void onDatabaseOriginDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+{
+    ASSERT(observer);
+    
+    WebDatabaseManagerClient* client = reinterpret_cast&lt;WebDatabaseManagerClient*&gt;(observer);
+    client-&gt;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. (&quot;Apple&quot;) 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 &quot;AS IS&quot; 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 &quot;WebDatabaseManagerPrivate.h&quot;
+
+#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&lt;RefPtr&lt;SecurityOrigin&gt;&gt; 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: &lt;rdar://problem/9567500&gt; 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 &lt;AppKit/NSSpellChecker.h&gt;
</span><span class="cx"> #import &lt;WebCore/AlternativeTextClient.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</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&lt;String&gt; 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) &amp;&amp; __has_warning(&quot;-Wunused-private-field&quot;)
+#pragma clang diagnostic ignored &quot;-Wunused-private-field&quot;
+#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 &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebKitNSStringExtras.h&quot;
+#import &quot;WebSQLiteDatabaseTrackerClient.h&quot;
+#import &lt;WebCore/SQLiteDatabaseTracker.h&gt;
+#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 &lt;WebCore/FocusDirection.h&gt;
</span><span class="cx"> #import &lt;wtf/Forward.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;wtf/Platform.h&gt;
+#import &lt;wtf/text/WTFString.h&gt;
+#import &lt;WebCore/Chrome.h&gt;
+
+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&lt;WebCore::FileChooser&gt;) OVERRIDE;
</span><span class="cx">     virtual void loadIconForFiles(const Vector&lt;WTF::String&gt;&amp;, WebCore::FileIconLoader*) OVERRIDE;
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     virtual void setCursor(const WebCore::Cursor&amp;) 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&amp; type, const WebCore::FloatRect&amp; lineRect) OVERRIDE;
</span><span class="cx">     virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString&amp; type, const WebCore::FloatRect&amp; boxRect, const WebCore::FloatRect&amp; 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: &lt;rdar://problem/7830677&gt;
+#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) &amp;&amp; !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 &quot;NetscapePluginHostManager.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS) &amp;&amp; ENABLE(GEOLOCATION)
+#import &lt;WebCore/Geolocation.h&gt;
+#endif
+
+#if PLATFORM(IOS)
+#import &lt;WebCore/Console.h&gt;
+#import &lt;WebCore/WAKClipView.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#endif
+
</ins><span class="cx"> NSString *WebConsoleMessageXMLMessageSource = @&quot;XMLMessageSource&quot;;
</span><span class="cx"> NSString *WebConsoleMessageJSMessageSource = @&quot;JSMessageSource&quot;;
</span><span class="cx"> NSString *WebConsoleMessageNetworkMessageSource = @&quot;NetworkMessageSource&quot;;
</span><span class="lines">@@ -109,9 +120,11 @@
</span><span class="cx"> NSString *WebConsoleMessageErrorMessageLevel = @&quot;ErrorMessageLevel&quot;;
</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&amp; 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&amp; message, unsigned int lineNumber, unsigned columnNumber, const String&amp; 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), @&quot;MessageLevel&quot;,
</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&amp;, 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&amp; 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-&gt;document()-&gt;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(@&quot;com.apple.Safari&quot;, -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-&gt;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&amp; 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&amp; path, String&amp; generatedFilename)
</span><span class="lines">@@ -850,18 +904,30 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;WebCore::PopupMenu&gt; 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&lt;WebCore::SearchPopupMenu&gt; 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) &amp;&amp; !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&lt;WebCore::Element*&gt;(element)), withKeyboard);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     return [m_webView _supportsFullScreenForElement:const_cast&lt;WebCore::Element*&gt;(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 &quot;WebContextMenuClient.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebDelegateImplementationCaching.h&quot;
</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&amp;) OVERRIDE;
</span><span class="cx">     virtual void learnWord(const WTF::String&amp;) 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&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; guesses) OVERRIDE;
</span><ins>+#else
+    virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const OVERRIDE { return true; }
+    virtual void ignoreWordInSpellDocument(const WTF::String&amp;) OVERRIDE { }
+    virtual void learnWord(const WTF::String&amp;) OVERRIDE { }
+    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) OVERRIDE { }
+    virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&amp;) OVERRIDE { return &quot;&quot;; }
+    virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector&lt;WebCore::GrammarDetail&gt;&amp;, int* badGrammarLocation, int* badGrammarLength) OVERRIDE { }
+    // Note: checkTextOfParagraph() is implemented. 
+    virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, WTF::Vector&lt;WebCore::TextCheckingResult&gt;&amp; results) OVERRIDE;
+    virtual void updateSpellingUIWithGrammarString(const WTF::String&amp;, const WebCore::GrammarDetail&amp;) OVERRIDE { }
+    virtual void updateSpellingUIWithMisspelledWord(const WTF::String&amp;) OVERRIDE { }
+    virtual void showSpellingUI(bool show) OVERRIDE { }
+    virtual bool spellingUIIsShowing() OVERRIDE { return false; }
+    virtual void getGuessesForWord(const WTF::String&amp; word, const WTF::String&amp; context, WTF::Vector&lt;WTF::String&gt;&amp; 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&lt;WebCore::TextCheckingRequest&gt;) OVERRIDE;
</span><span class="lines">@@ -154,4 +194,9 @@
</span><span class="cx">     RetainPtr&lt;WebEditorUndoTarget&gt; m_undoTarget;
</span><span class="cx">     bool m_haveUndoRedoOperations;
</span><span class="cx">     RefPtr&lt;WebCore::TextCheckingRequest&gt; 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 &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#import &quot;DOMElementInternal.h&quot;
+#import &quot;WebFrameView.h&quot;
+#import &quot;WebUIKitDelegate.h&quot;
+#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-&gt;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 &lt;WebDocumentView&gt; *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 &lt;rdar://problem/5009625&gt; - 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) &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;com.apple.Aperture&quot;])
</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] &amp;&amp; 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 = @&quot;ExcludedElements&quot;;
+#endif
+
</ins><span class="cx"> DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt;&amp; 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&amp; 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(&quot;Outdent&quot;, &quot;Outdent (Undo action name)&quot;, &quot;Undo action name&quot;);
</span><span class="cx">         case EditActionBold: return UI_STRING_KEY_INTERNAL(&quot;Bold&quot;, &quot;Bold (Undo action name)&quot;, &quot;Undo action name&quot;);
</span><span class="cx">         case EditActionItalics: return UI_STRING_KEY_INTERNAL(&quot;Italics&quot;, &quot;Italics (Undo action name)&quot;, &quot;Undo action name&quot;);
</span><ins>+#if PLATFORM(IOS)
+        case EditActionDelete: return UI_STRING_KEY_INTERNAL(&quot;Delete&quot;, &quot;Delete (Undo action name)&quot;, &quot;Undo action name (Used only by PLATFORM(IOS) code)&quot;);
+        case EditActionDictation: return UI_STRING_KEY_INTERNAL(&quot;Dictation&quot;, &quot;Dictation (Undo action name)&quot;, &quot;Undo action name (Used only by PLATFORM(IOS) code)&quot;);
+#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] &amp;&amp; !isRedo) || ([undoManager isRedoing] &amp;&amp; isRedo))
+        return;
+#endif
</ins><span class="cx">     NSString *actionName = undoNameForEditAction(step-&gt;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-&gt;target()-&gt;toNode()-&gt;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-&gt;setDefaultHandled();
</span><ins>+#else
+    WebHTMLView *webHTMLView = (WebHTMLView *)[[kit(frame) frameView] documentView];
+    if ([webHTMLView _handleEditingKeyEvent:event])
+        event-&gt;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-&gt;target()-&gt;toNode()-&gt;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-&gt;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, &quot;control=%@&quot;, 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-&gt;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 &lt; 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&lt;TextCheckingResult&gt;&amp; results)
+{
+    ASSERT(checkingTypes &amp; NSTextCheckingTypeSpelling);
+    NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(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 &amp;&amp; resultRange.length &gt; 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-&gt;didSucceed(core(results, m_textCheckingRequest-&gt;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&lt;WebCore::TextCheckingRequest&gt; 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&amp;) OVERRIDE;
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+    virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
+#endif
+
</ins><span class="cx">     virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&amp;) 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&amp;) OVERRIDE;
</span><span class="cx">     virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&amp;, const WebCore::ResourceResponse&amp;, 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&amp;) 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 &quot;WebHostedNetscapePluginView.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/HTMLPlugInImageElement.h&gt;
+#import &lt;WebCore/WAKClipView.h&gt;
+#import &lt;WebCore/WAKScrollView.h&gt;
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#import &quot;WebKitVersionChecks.h&quot;
+#import &quot;WebMailDelegate.h&quot;
+#import &quot;WebUIKitDelegate.h&quot;
+#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 = @&quot;WebPluginBaseURL&quot;;
</span><span class="cx"> NSString *WebPluginAttributesKey = @&quot;WebPluginAttributes&quot;;
</span><span class="lines">@@ -161,6 +179,7 @@
</span><span class="cx">     return loader ? static_cast&lt;WebDocumentLoaderMac*&gt;(loader)-&gt;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 &lt;script&gt; element in its &lt;head&gt; 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&amp; 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:@&quot;com.apple.Dictionary&quot;];
</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 &lt;WebDocumentView&gt; *view = [m_webFrame-&gt;_private-&gt;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 &amp;&amp; coreFrame-&gt;view()) {
+        IntSize newSize([webView _fixedLayoutSize]);
+        coreFrame-&gt;view()-&gt;setFixedLayoutSize(newSize);
+        coreFrame-&gt;view()-&gt;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 &lt;WebDocumentView&gt; *view = [m_webFrame-&gt;_private-&gt;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 &amp;&amp; coreFrame-&gt;view()) {
+        IntSize newSize([webView _fixedLayoutSize]);
+        coreFrame-&gt;view()-&gt;setFixedLayoutSize(newSize);
+        coreFrame-&gt;view()-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;webThreadDidLoadResourceFromMemoryCacheFunc) {
+        CallResourceLoadDelegateInWebThread(implementations-&gt;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-&gt;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-&gt;webThreadIdentifierForRequestFunc) {
+        object = CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadIdentifierForRequestFunc, webView, @selector(webThreadWebView:identifierForInitialRequest:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), dataSource(loader));
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;identifierForRequestFunc)
</span><span class="cx">         object = CallResourceLoadDelegate(implementations-&gt;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-&gt;webThreadWillSendRequestFunc) {
+        newURLRequest = (NSURLRequest *)CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadWillSendRequestFunc, webView, @selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;willSendRequestFunc)
</span><span class="cx">         newURLRequest = (NSURLRequest *)CallResourceLoadDelegate(implementations-&gt;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() &lt; ProtectionSpaceAuthenticationSchemeClientCertificateRequested);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+RetainPtr&lt;CFDictionaryRef&gt; 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-&gt;connectionPropertiesFunc)
+        return (CFDictionaryRef)CallResourceLoadDelegate(implementations-&gt;connectionPropertiesFunc, webView, @selector(webView:connectionPropertiesForResource:dataSource:), resource, dataSource(loader));
+
+    return nullptr;
+}
+#endif
+
</ins><span class="cx"> bool WebFrameLoaderClient::shouldPaintBrokenImage(const URL&amp; 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&amp; 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-&gt;webThreadDidReceiveResponseFunc) {
+        if (id resource = [webView _objectForIdentifier:identifier])
+            CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadDidReceiveResponseFunc, webView, @selector(webThreadWebView:resource:didReceiveResponse:fromDataSource:), resource, response.nsURLResponse(), dataSource(loader));
+        
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;didReceiveResponseFunc) {
</span><span class="cx">         if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx">             CallResourceLoadDelegate(implementations-&gt;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-&gt;webThreadWillCacheResponseFunc) {
+        if (id resource = [webView _objectForIdentifier:identifier])
+            return CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadWillCacheResponseFunc, webView, @selector(webThreadWebView:resource:willCacheResponse:fromDataSource:), resource, response, dataSource(loader));
+        
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;willCacheResponseFunc) {
</span><span class="cx">         if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx">             return CallResourceLoadDelegate(implementations-&gt;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-&gt;webThreadDidReceiveContentLengthFunc) {
+        if (id resource = [webView _objectForIdentifier:identifier])
+            CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadDidReceiveContentLengthFunc, webView, @selector(webThreadWebView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader));
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;didReceiveContentLengthFunc) {
</span><span class="cx">         if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx">             CallResourceLoadDelegate(implementations-&gt;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-&gt;webThreadDidFinishLoadingFromDataSourceFunc) {
+        if (id resource = [webView _objectForIdentifier:identifier])
+            CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadDidFinishLoadingFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFinishLoadingFromDataSource:), resource, dataSource(loader));
+    } else
+#endif
+
</ins><span class="cx">     if (implementations-&gt;didFinishLoadingFromDataSourceFunc) {
</span><span class="cx">         if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx">             CallResourceLoadDelegate(implementations-&gt;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-&gt;webThreadDidFailLoadingWithErrorFromDataSourceFunc) {
+        if (id resource = [webView _objectForIdentifier:identifier])
+            CallResourceLoadDelegateInWebThread(implementations-&gt;webThreadDidFailLoadingWithErrorFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFailLoadingWithError:fromDataSource:), resource, (NSError *)error, dataSource(loader));
+    } else
+#endif
</ins><span class="cx">     if (implementations-&gt;didFailLoadingWithErrorFromDataSourceFunc) {
</span><span class="cx">         if (id resource = [webView _objectForIdentifier:identifier])
</span><span class="cx">             CallResourceLoadDelegate(implementations-&gt;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-&gt;didChangeLocationWithinPageForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;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-&gt;willCloseFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;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-&gt;_private-&gt;provisionalURL = core(m_webFrame.get())-&gt;loader().provisionalDocumentLoader()-&gt;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-&gt;didStartProvisionalLoadForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;didStartProvisionalLoadForFrameFunc, webView, @selector(webView:didStartProvisionalLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -635,6 +778,10 @@
</span><span class="cx">     m_webFrame-&gt;_private-&gt;url = m_webFrame-&gt;_private-&gt;provisionalURL;
</span><span class="cx">     m_webFrame-&gt;_private-&gt;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-&gt;didCommitLoadForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;didCommitLoadForFrameFunc, webView, @selector(webView:didCommitLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -645,7 +792,9 @@
</span><span class="cx">     m_webFrame-&gt;_private-&gt;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-&gt;didFailProvisionalLoadWithErrorForFrameFunc)
</span><span class="lines">@@ -659,11 +808,16 @@
</span><span class="cx">     ASSERT(!m_webFrame-&gt;_private-&gt;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-&gt;didFailLoadWithErrorForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;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-&gt;_private-&gt;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-&gt;didFinishDocumentLoadForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;didFinishDocumentLoadForFrameFunc, webView, @selector(webView:didFinishDocumentLoadForFrame:), m_webFrame.get());
</span><span class="lines">@@ -681,8 +843,17 @@
</span><span class="cx">     ASSERT(!m_webFrame-&gt;_private-&gt;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-&gt;didFinishLoadForFrameFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;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-&gt;webThreadDidLayoutFunc)
+        CallFrameLoadDelegateInWebThread(implementations-&gt;webThreadDidLayoutFunc, webView, @selector(webThreadWebView:didLayout:), kitLayoutMilestones(milestones));
+#else
</ins><span class="cx">     if (implementations-&gt;didLayoutFunc)
</span><span class="cx">         CallFrameLoadDelegate(implementations-&gt;didLayoutFunc, webView, @selector(webView:didLayout:), kitLayoutMilestones(milestones));
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     if (milestones &amp; 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-&gt;didFirstLayoutInFrameFunc)
</span><span class="cx">             CallFrameLoadDelegate(implementations-&gt;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-&gt;_private-&gt;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 &amp; 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-&gt;didFirstVisuallyNonEmptyLayoutInFrameFunc)
</span><span class="cx">             CallFrameLoadDelegate(implementations-&gt;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, &amp;kCFTypeDictionaryKeyCallBacks, &amp;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())-&gt;loader().documentLoader();
</span><ins>+#if PLATFORM(IOS)
+    if (loader-&gt;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 &lt;WebDocumentView&gt; *docView = [m_webFrame-&gt;_private-&gt;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 &lt;WebDocumentView&gt; *docView = [m_webFrame-&gt;_private-&gt;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-&gt;_private-&gt;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]] &amp;&amp; [(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&lt;DocumentLoader&gt; WebFrameLoaderClient::createDocumentLoader(const ResourceRequest&amp; request, const SubstituteData&amp; 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:@&quot;about:blank&quot;])
+        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&lt;WebCachedFramePlatformData&gt; webPlatformData = adoptPtr(new WebCachedFramePlatformData([m_webFrame-&gt;_private-&gt;webFrameView documentView]));
</span><span class="cx">     cachedFrame-&gt;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-&gt;documentLoader());
</span><span class="cx">     [cachedView setDataSource:dataSource(cachedFrame-&gt;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-&gt;_private-&gt;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]-&gt;responseMIMEType() == &quot;text/html&quot;)
+        willProduceHTMLView = true;
+    else
+        willProduceHTMLView = [m_webFrame-&gt;_private-&gt;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-&gt;_private-&gt;webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
</span><ins>+#endif
</ins><span class="cx">     bool canSkipCreation = core(m_webFrame.get())-&gt;loader().stateMachine()-&gt;committingFirstRealLoad() &amp;&amp; willProduceHTMLView;
</span><span class="cx">     if (canSkipCreation) {
</span><span class="cx">         [[m_webFrame-&gt;_private-&gt;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-&gt;_private-&gt;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 &lt;WebDocumentView&gt; *documentView = [m_webFrame-&gt;_private-&gt;webFrameView _makeDocumentViewForDataSource:dataSource];
</span><ins>+#else
+    NSView &lt;WebDocumentView&gt; *documentView = nil;
+
+    // Fast path that skips initialization of objc class objects.
+    if (willProduceHTMLView) {
+        documentView = [[WebHTMLView alloc] initWithFrame:[m_webFrame-&gt;_private-&gt;webFrameView bounds]];
+        [m_webFrame-&gt;_private-&gt;webFrameView _setDocumentView:documentView];
+        [documentView release];
+    } else
+        documentView = [m_webFrame-&gt;_private-&gt;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-&gt;_private-&gt;webFrameView _install];
</span><span class="cx"> 
</span><del>-    if (isMainFrame)
</del><ins>+    if (isMainFrame) {
+#if PLATFORM(IOS)
+        coreView-&gt;setDelegatesScrolling(true);
+#endif
</ins><span class="cx">         coreView-&gt;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&lt;Event*&gt;(event))) {
</span><span class="cx">         if (keyStateEvent-&gt;ctrlKey())
</span><span class="cx">             modifierFlags |= NSControlKeyMask;
</span><span class="lines">@@ -1351,6 +1648,10 @@
</span><span class="cx">         if (keyStateEvent-&gt;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)]
+            &amp;&amp; [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())-&gt;document();
</span><span class="cx">     NSURL *baseURL = document-&gt;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 &amp;&amp; frame-&gt;settings().needsSiteSpecificQuirks() &amp;&amp; equalIgnoringCase(mimeType, &quot;application/x-snkp&quot;)) {
</span><span class="cx">         for (NSUInteger i = 0; i &lt; [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 &amp;&amp; [extension length]) {
+#else
</ins><span class="cx">     if (!pluginPackage &amp;&amp; [extension length] &amp;&amp; ![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:@&quot;application/x-shockwave-flash&quot;]) {
+            NSDictionary *attributes = [NSDictionary dictionaryWithObjects:kit(paramValues) forKeys:kit(paramNames)];
+            NSString *srcString = [attributes objectForKey:@&quot;src&quot;];
+            if (srcString) {
+                NSURL *srcURL = [NSURL URLWithString:srcString];
+                NSURL *youtubeURL = [srcURL _webkit_youTubeURL];
+                if (srcURL &amp;&amp; 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 &amp;&amp; !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 &quot;http://www.youtube.com&quot;.
+                        // See: &lt;rdar://problem/11517502&gt; 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 &amp;&amp; [query length] &amp;&amp; [query rangeOfString:@&quot;showinfo&quot;].location == NSNotFound)
+                        query = [query stringByAppendingFormat:@&quot;&amp;showinfo=0&quot;];
+                    else
+                        query = @&quot;showinfo=0&quot;;
+
+                    // Append the query string if it is valid.  Some sites apparently forget to add &quot;?&quot; for the query string, in that case,
+                    // we will discard the parameters in the url.
+                    // See: &lt;rdar://problem/11535155&gt; [Bincompat] Regression: SC2Casts app: Videos don't play in SC2Casts
+                    NSString *embedSrc = query ? [srcURLPrefix stringByAppendingFormat:@&quot;/embed/%@?%@&quot;, videoID, query] : [srcURLPrefix stringByAppendingFormat:@&quot;/embed/%@&quot;, videoID];
+
+                    if (element-&gt;hasTagName(HTMLNames::embedTag) || element-&gt;hasTagName(HTMLNames::objectTag)) {
+                        // Create a shadow subtree for the plugin element, the iframe player is injected in the shadow tree.
+                        HTMLPlugInImageElement* pluginElement = static_cast&lt;HTMLPlugInImageElement*&gt;(element);
+                        pluginElement-&gt;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:@&quot;application/x-apple-fake-youtube-plugin&quot;];
+                    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())-&gt;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&amp; 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.
+    // &lt;rdar://problem/10075665&gt; 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 &lt;WebCore/Settings.h&gt;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;CFNetwork/CFHTTPCookiesPriv.h&gt;
+#import &lt;WebCore/WebCoreThread.h&gt;
+#import &lt;WebKit/WebFrameLoadDelegate.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> static std::unique_ptr&lt;NetworkStorageSession&gt;&amp; 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()-&gt;cookieStorage().get());
+}
+#endif
+
</ins><span class="cx"> bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
</span><span class="cx"> {
</span><span class="cx">     return frame() &amp;&amp; frame()-&gt;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 &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/Geolocation.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/WAKResponder.h&gt;
+#import &lt;WebKit/WebCoreThreadRun.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> @interface WebGeolocationPolicyListener : NSObject &lt;WebAllowDenyPolicyListener&gt;
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Geolocation&gt; _geolocation;
</span><span class="cx"> }
</span><span class="cx"> - (id)initWithGeolocation:(Geolocation*)geolocation;
</span><span class="cx"> @end
</span><ins>+#else
+@interface WebGeolocationPolicyListener : NSObject &lt;WebAllowDenyPolicyListener&gt;
+{
+    RefPtr&lt;Geolocation&gt; _geolocation;
+    RetainPtr&lt;WebView *&gt; _webView;
+    RetainPtr&lt;id&lt;WebGeolocationProvider&gt; &gt; _geolocationProvider;
+}
+- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView provider:(id&lt;WebGeolocationProvider&gt;)provider;
+@end
+#endif
</ins><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+@interface WebGeolocationProviderInitializationListener : NSObject &lt;WebGeolocationProviderInitializationListener&gt; {
+@private
+    RefPtr&lt;Geolocation&gt; 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-&gt;frame();
</span><span class="cx">     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame-&gt;document()-&gt;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&lt;WebGeolocationProviderInitializationListener&gt; 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&lt;WebGeolocationProvider&gt;)provider
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    _geolocation = geolocation;
+    _webView = webView;
+    _geolocationProvider = provider;
+    return self;
+}
+
+- (void)allow
+{
+    WebThreadRun(^{
+        _geolocation-&gt;setIsAllowed(true);
+    });
+}
+
+- (void)deny
+{
+    WebThreadRun(^{
+        _geolocation-&gt;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-&gt;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&lt;WebGeolocationProvider&gt;)provider
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    Frame* frame = m_geolocation-&gt;frame();
+    if (!frame) {
+        [provider cancelWarmUpForWebView:webView];
+        return;
+    }
+    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame-&gt;document()-&gt;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&lt;WebGeolocationProvider&gt;)provider
+{
+    m_geolocation-&gt;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 &quot;WebJavaScriptTextInputPanel.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</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 &lt;WebKit/WebKeyGenerator.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</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&lt;Icon&gt; icon = Icon::createIconForImage(imageRef);
+
+    NSUInteger count = [filenames count];
+    Vector&lt;String&gt; names(count);
+    for (NSUInteger i = 0; i &lt; count; ++i)
+        names[i] = [filenames objectAtIndex:i];
+    _chooser-&gt;chooseMediaFiles(names, displayString, icon.get());
+    
+    // FIXME: we shouldn't be manually deref()'ing here.
+    _chooser-&gt;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&lt;SecurityOrigin*&gt;(_private)-&gt;databaseIdentifier();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (NSString *)toString
+{
+    return reinterpret_cast&lt;SecurityOrigin*&gt;(_private)-&gt;toString();
+}
+#endif
+
</ins><span class="cx"> - (NSString *)stringValue
</span><span class="cx"> {
</span><span class="cx">     return reinterpret_cast&lt;SecurityOrigin*&gt;(_private)-&gt;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 &gt;= 1080
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1080
</ins><span class="cx">     INIT(CGContextDrawsWithCorrectShadowOffsets);
</span><span class="cx"> #endif
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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) &amp;&amp; !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 &gt;= 1090
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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 &gt;= 1080
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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 &lt;wtf/Platform.h&gt;
+
</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 &lt;ApplicationServices/ApplicationServices.h&gt;
</span><span class="cx"> #import &lt;Carbon/Carbon.h&gt;
</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 &lt;Cocoa/Cocoa.h&gt;
</span><ins>+#else
+#import &lt;Foundation/Foundation.h&gt;
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Platform.h&gt;
</span><span class="cx"> #include &lt;wtf/ExportMacros.h&gt;
</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 &lt;AppKit/AppKit.h&gt;
</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 &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebPDFViewIOS.h&quot;
+#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-&gt;loader);
</span><span class="cx">     }
</span><span class="lines">@@ -90,6 +97,9 @@
</span><span class="cx">     RetainPtr&lt;id&lt;WebDocumentRepresentation&gt; &gt; representation;
</span><span class="cx">     BOOL representationFinishedLoading;
</span><span class="cx">     BOOL includedInWebKitStatistics;
</span><ins>+#if PLATFORM(IOS)
+    NSObject&lt;WebDataSourcePrivateDelegate&gt; *_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)-&gt;loader-&gt;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)-&gt;loader-&gt;setDeferMainResourceDataLoad(flag);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (void)_setOverrideTextEncodingName:(NSString *)encoding
+{
+    toPrivate(_private)-&gt;loader-&gt;setOverrideEncoding([encoding UTF8String]);
+}
+#endif
+
</ins><span class="cx"> - (void)_setAllowToBeMemoryMapped
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DISK_IMAGE_CACHE) &amp;&amp; PLATFORM(IOS)
</span><span class="lines">@@ -298,7 +319,13 @@
</span><span class="cx">         // Since this is a &quot;secret default&quot; we don't both registering it.
</span><span class="cx">         BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@&quot;WebKitOmitPDFSupport&quot;];
</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 &amp;&amp; !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&lt;WebDocumentRepresentation&gt; representation = toPrivate(_private)-&gt;representation.get();
</span><span class="cx">     [representation setDataSource:self];
</span><ins>+#if PLATFORM(IOS)
+    toPrivate(_private)-&gt;loader-&gt;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 &quot;WebTypesInternal.h&quot;
</span><span class="cx"> #import &lt;JavaScriptCore/JSBase.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebKit/WAKAppKitStubs.h&gt;
+#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 &quot;WebViewData.h&quot;
</span><span class="cx"> #import &lt;wtf/ObjcRuntimeExtras.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebViewInternal.h&quot;
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#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&lt;ObjCMsgSendFPRet&gt;(objc_msgSend_fpret);
</span><span class="cx"> #else
</span><span class="cx"> static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast&lt;ObjCMsgSendFPRet&gt;(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:&amp;self atIndex:2];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;rect atIndex:3];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+    [invocation setArgument:&amp;boolean atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+    [invocation setArgument:&amp;object3 atIndex:5];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+    [invocation setArgument:&amp;integer atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+
+    float returnValue = 0.0f;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+    [invocation setArgument:&amp;boolean atIndex:4];
+
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+    [invocation setArgument:&amp;boolean atIndex:5];
+    
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;integer atIndex:3];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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&lt;id&gt;(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&lt;id&gt;(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&lt;id&gt;(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&lt;id&gt;(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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object atIndex:3];
+    [invocation setArgument:&amp;double1 atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+    [invocation setArgument:&amp;object3 atIndex:5];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+    [invocation setArgument:&amp;object3 atIndex:5];
+    [invocation setArgument:&amp;object4 atIndex:6];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;integer atIndex:4];
+    [invocation setArgument:&amp;object2 atIndex:5];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+    [invocation setArgument:&amp;integer atIndex:5];
+    [invocation setArgument:&amp;object3 atIndex:6];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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&lt;id&gt;(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&lt;id&gt;(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:&amp;self atIndex:2];
+    [invocation setArgument:&amp;object1 atIndex:3];
+    [invocation setArgument:&amp;interval atIndex:4];
+    [invocation setArgument:&amp;object2 atIndex:5];
+    [invocation setArgument:&amp;object3 atIndex:6];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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&lt;BOOL (*)(id, SEL, WebView *)&gt;(objc_msgSend)(self-&gt;_private-&gt;frameLoadDelegate, selector, self);
</span><ins>+#else
+        return reinterpret_cast&lt;BOOL (*)(id, SEL, WebView *)&gt;(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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;resourceProgressDelegate, selector, object1, object2);
+}
+
+id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
+{
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;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-&gt;_private-&gt;resourceProgressDelegate, selector, object1, object2, integer, object3);
+}
+
+id CallFrameLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
+{
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;scriptDebugDelegate, selector, object1, object2, integer, object3);
</span><ins>+#else
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
</span><ins>+#else
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
</span><ins>+#else
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;scriptDebugDelegate, selector, object1, integer1, integer2, object2);
</span><ins>+#else
+    return CallDelegateInWebThread(implementation, self, self-&gt;_private-&gt;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-&gt;_private-&gt;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:&amp;object1 atIndex:2];
+    [invocation setArgument:&amp;object2 atIndex:3];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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-&gt;_private-&gt;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:&amp;object1 atIndex:2];
+    [invocation setArgument:&amp;object2 atIndex:3];
+    [invocation setArgument:&amp;object3 atIndex:4];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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-&gt;_private-&gt;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:&amp;object1 atIndex:2];
+    [invocation setArgument:&amp;object2 atIndex:3];
+    [invocation setArgument:&amp;object3 atIndex:4];
+    [invocation setArgument:&amp;object4 atIndex:5];
+    [invocation setArgument:&amp;object5 atIndex:6];
+
+    id returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        if ([[invocation methodSignature] methodReturnLength] == 0) {
+            return nil;
+        }
+        [invocation getReturnValue:&amp;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-&gt;_private-&gt;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:&amp;object1 atIndex:2];
+    [invocation setArgument:&amp;selectorArg atIndex:3];
+    [invocation setArgument:&amp;object2 atIndex:4];
+
+    BOOL returnValue;
+    @try {
+        WebThreadCallDelegate(invocation);
+        [invocation getReturnValue:&amp;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 &lt;WebKit/WebHTMLView.h&gt;
</span><span class="cx"> #import &lt;WebKit/WebViewPrivate.h&gt;
</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">                                   &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;com.adobe.Installers.Setup&quot;];
</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 &quot;WebDynamicScrollBarsView.h&quot;
</span><span class="cx"> #import &lt;WebCore/WebCoreFrameView.h&gt;
</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 &lt;WebFormSubmissionListener&gt;)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 &lt;runtime/JSCJSValue.h&gt;
</span><span class="cx"> #import &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebMailDelegate.h&quot;
+#import &quot;WebResource.h&quot;
+#import &quot;WebUIKitDelegate.h&quot;
+#import &lt;JavaScriptCore/APIShims.h&gt;
+#import &lt;WebCore/Document.h&gt;
+#import &lt;WebCore/Editor.h&gt;
+#import &lt;WebCore/EditorClient.h&gt;
+#import &lt;WebCore/FocusController.h&gt;
+#import &lt;WebCore/FrameSelection.h&gt;
+#import &lt;WebCore/HistoryController.h&gt;
+#import &lt;WebCore/NodeTraversal.h&gt;
+#import &lt;WebCore/RenderLayer.h&gt;
+#import &lt;WebCore/SimpleFontData.h&gt;
+#import &lt;WebCore/TextResourceDecoder.h&gt;
+#import &lt;WebCore/WAKScrollView.h&gt;
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WKGraphics.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#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 &amp;&amp; _private-&gt;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-&gt;_private-&gt;coreFrame = &amp;page-&gt;mainFrame();
+    static_cast&lt;WebFrameLoaderClient&amp;&gt;(page-&gt;mainFrame().loader().client()).setWebFrame(frame);
+    [frame release];
+
+    frame-&gt;_private-&gt;coreFrame-&gt;initWithSimpleHTMLDocument(style, createUniqueWebDataURL());
+}
+#endif
+
</ins><span class="cx"> - (void)_attachScriptDebugger
</span><span class="cx"> {
</span><span class="cx">     ScriptController&amp; scriptController = _private-&gt;coreFrame-&gt;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-&gt;coreFrame;
</span><span class="cx">     for (Frame* frame = coreFrame; frame; frame = frame-&gt;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-&gt;view()) {
</span><span class="cx">             view-&gt;setTransparent(!drawsBackground);
</span><del>-            view-&gt;setBaseBackgroundColor(colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]));
</del><ins>+#if !PLATFORM(IOS)
+            Color color = colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
+#else
+            Color color = Color(backgroundColor);
+#endif
+            view-&gt;setBaseBackgroundColor(color);
</ins><span class="cx">             view-&gt;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-&gt;coreFrame;
</span><span class="cx">     for (Frame* frame = coreFrame; frame; frame = frame-&gt;tree().traverseNext(coreFrame)) {
</span><span class="cx">         if (Document* document = frame-&gt;document())
</span><span class="cx">             document-&gt;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-&gt;coreFrame-&gt;loader().documentLoader());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_isCommitting
+{
+    return _private-&gt;isCommitting;
+}
+
+- (void)_setIsCommitting:(BOOL)value
+{
+    _private-&gt;isCommitting = value;
+}
+#endif
+
</ins><span class="cx"> - (NSArray *)_nodesFromList:(Vector&lt;Node*&gt; *)nodesVector
</span><span class="cx"> {
</span><span class="cx">     size_t size = nodesVector-&gt;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&lt;CGContextRef&gt;([[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 &lt;rdar://problem/9034977&gt; is fixed there will be no need to do this here.
+    WebCore::Frame *frame = core(self);
+    if (WebCore::Page* page = frame-&gt;page())
+        context.setIsAcceleratedContext(page-&gt;settings().acceleratedDrawingEnabled());
+#endif
+
</ins><span class="cx">     FrameView* view = _private-&gt;coreFrame-&gt;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-&gt;coreFrame-&gt;document());
</span><span class="cx">     RetainPtr&lt;WebFrame&gt; protect(self); // Executing arbitrary JavaScript can destroy the frame.
</span><span class="cx">     
</span><ins>+#if PLATFORM(IOS)
+    ASSERT(WebThreadIsLockedOrDisabled());
+    JSC::ExecState* exec = _private-&gt;coreFrame-&gt;script().globalObject(mainThreadNormalWorld())-&gt;globalExec();
+    // Need to use the full entry shim to prevent crashes arising from the UI thread being unknown
+    // to the JSC GC: &lt;rdar://problem/11553172&gt; Crash when breaking in the Web Inspector during stringByEvaluatingJavaScriptFromString:
+    JSC::APIEntryShim jscLock(exec);
+#endif
+
</ins><span class="cx">     JSC::JSValue result = _private-&gt;coreFrame-&gt;script().executeScript(string, forceUserGesture).jsValue();
</span><span class="cx"> 
</span><span class="cx">     if (!_private-&gt;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() &amp;&amp; !result.isString() &amp;&amp; !result.isNumber()))
</span><span class="cx">         return @&quot;&quot;;
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     JSC::ExecState* exec = _private-&gt;coreFrame-&gt;script().globalObject(mainThreadNormalWorld())-&gt;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 &amp;&amp; startNode-&gt;renderer())
</del><ins>+    if (startNode &amp;&amp; startNode-&gt;renderer()) {
+#if !PLATFORM(IOS)
</ins><span class="cx">         startNode-&gt;renderer()-&gt;scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
</span><ins>+#else
+        RenderLayer* layer = startNode-&gt;renderer()-&gt;enclosingLayer();
+        if (layer) {
+            layer-&gt;setAdjustForIOSCaretWhenScrolling(true);
+            startNode-&gt;renderer()-&gt;scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+            layer-&gt;setAdjustForIOSCaretWhenScrolling(false);
+            _private-&gt;coreFrame-&gt;selection().setCaretRectNeedsUpdate();
+            _private-&gt;coreFrame-&gt;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 &amp;&amp; startNode-&gt;renderer()) {
+        RenderLayer* layer = startNode-&gt;renderer()-&gt;enclosingLayer();
+        if (layer) {
+            layer-&gt;setAdjustForIOSCaretWhenScrolling(true);
+            startNode-&gt;renderer()-&gt;scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+            layer-&gt;setAdjustForIOSCaretWhenScrolling(false);
+
+            Frame *coreFrame = core(self);
+            if (coreFrame) {
+                FrameSelection&amp; frameSelection = coreFrame-&gt;selection();
+                frameSelection.setCaretRectNeedsUpdate();
+                frameSelection.updateAppearance();
+            }
+        }
+    }
+}
+#endif
+
</ins><span class="cx"> - (BOOL)_needsLayout
</span><span class="cx"> {
</span><span class="cx">     return _private-&gt;coreFrame-&gt;view() ? _private-&gt;coreFrame-&gt;view()-&gt;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-&gt;coreFrame-&gt;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-&gt;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-&gt;coreFrame-&gt;document();
</span><span class="cx">     if (!document)
</span><span class="lines">@@ -872,7 +999,11 @@
</span><span class="cx">     Color color = bodyRenderer-&gt;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-&gt;coreFrame-&gt;loader().loadType();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)needsLayout
+{
+    // Needed for Mail &lt;rdar://problem/6228038&gt;
+    return _private-&gt;coreFrame ? [self _needsLayout] : NO;
+}
+
+- (void)_setLoadsSynchronously:(BOOL)flag
+{
+    _private-&gt;coreFrame-&gt;loader().setLoadsSynchronously(flag);
+}
+
+- (BOOL)_loadsSynchronously
+{
+    return _private-&gt;coreFrame-&gt;loader().loadsSynchronously();
+}
+
+// FIXME: selection
+
+- (NSArray *)_rectsForRange:(DOMRange *)domRange
+{
+    Range *range = core(domRange);
+    
+    
+    Vector&lt;IntRect&gt; intRects;
+    range-&gt;textRects(intRects, NO);
+    unsigned size = intRects.size();
+    
+    NSMutableArray *rectArray = [NSMutableArray arrayWithCapacity:size];
+    for (unsigned i = 0; i &lt; 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-&gt;coreFrame-&gt;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-&gt;formElementsCharacterCount();
+}
+
+- (void)setTimeoutsPaused:(BOOL)flag
+{
+    id documentView = [_private-&gt;webFrameView documentView];    
+    if ([documentView isKindOfClass:[WebHTMLView class]]) {
+        if (Frame* coreFrame = _private-&gt;coreFrame)
+            coreFrame-&gt;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-&gt;webFrameView documentView];    
+    if ([documentView isKindOfClass:[WebHTMLView class]]) {
+        if (Frame* coreFrame = _private-&gt;coreFrame)
+            coreFrame-&gt;dispatchPageHideEventBeforePause();
+    }
+}
+
+- (void)resumeFromPause
+{
+    id documentView = [_private-&gt;webFrameView documentView];    
+    if ([documentView isKindOfClass:[WebHTMLView class]]) {
+        if (Frame* coreFrame = _private-&gt;coreFrame)
+            coreFrame-&gt;dispatchPageShowEventBeforeResume();
+    }
+}
+
+- (void)selectNSRange:(NSRange)range
+{
+    [self _selectNSRange:range];
+}
+
+- (void)selectWithoutClosingTypingNSRange:(NSRange)range
+{
+    RefPtr&lt;Range&gt; domRange = [self _convertToDOMRange:range];
+    if (domRange) {
+        const VisibleSelection&amp; newSelection = VisibleSelection(domRange.get(), SEL_DEFAULT_AFFINITY);
+        _private-&gt;coreFrame-&gt;selection().setSelection(newSelection, 0);
+        
+        _private-&gt;coreFrame-&gt;editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
+    }
+}
+
+- (NSRange)selectedNSRange
+{
+    return [self _selectedNSRange];
+}
+
+- (void)forceLayoutAdjustingViewSize:(BOOL)adjust
+{
+    _private-&gt;coreFrame-&gt;view()-&gt;forceLayout(!adjust);
+    if (adjust)
+        _private-&gt;coreFrame-&gt;view()-&gt;adjustViewSize();
+}
+
+- (void)_handleKeyEvent:(WebEvent *)event
+{
+    core(self)-&gt;eventHandler().keyEvent(event);
+}
+
+- (void)_selectAll
+{
+    core(self)-&gt;selection().selectAll();
+}
+
+- (void)_setSelectionFromNone
+{
+    core(self)-&gt;selection().setSelectionFromNone();
+}
+
+- (void)_restoreViewState
+{
+    ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
+    _private-&gt;coreFrame-&gt;loader().client().restoreViewState();
+}
+
+- (void)_saveViewState
+{
+    ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
+    FrameLoader&amp; frameLoader = _private-&gt;coreFrame-&gt;loader();
+    frameLoader.client().saveViewStateToItem(frameLoader.history().currentItem());
+}
+
+- (void)sendOrientationChangeEvent:(int)newOrientation
+{
+    WebThreadRun(^{
+        WebCore::Frame *frame = core(self);
+        if (frame)
+            frame-&gt;sendOrientationChangeEvent(newOrientation);
+    });
+}
+
+- (void)setNeedsLayout
+{
+    WebCore::Frame *frame = core(self);
+    if (frame-&gt;view())
+        frame-&gt;view()-&gt;setNeedsLayout();
+}
+
+- (CGSize)renderedSizeOfNode:(DOMNode *)node constrainedToWidth:(float)width
+{
+    Node *n = core(node);
+    RenderObject *r = n ? n-&gt;renderer() : 0;
+    float w = std::min((float)r-&gt;maxPreferredLogicalWidth(), width);
+    return r &amp;&amp; r-&gt;isBox() ? CGSizeMake(w, toRenderBox(r)-&gt;height()) : CGSizeMake(0,0);
+}
+
+- (DOMNode *)deepestNodeAtViewportLocation:(CGPoint)aViewportLocation
+{
+    WebCore::Frame *frame = core(self);
+    return kit(frame-&gt;deepestNodeAtLocation(FloatPoint(aViewportLocation)));
+}
+
+- (DOMNode *)scrollableNodeAtViewportLocation:(CGPoint)aViewportLocation
+{
+    WebCore::Frame *frame = core(self);
+    WebCore::Node *node = frame-&gt;nodeRespondingToScrollWheelEvents(FloatPoint(aViewportLocation));
+    return kit(node);
+}
+
+- (DOMNode *)approximateNodeAtViewportLocation:(CGPoint *)aViewportLocation
+{
+    WebCore::Frame *frame = core(self);
+    FloatPoint viewportLocation(*aViewportLocation);
+    FloatPoint adjustedLocation;
+    WebCore::Node *node = frame-&gt;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-&gt;renderRectForPoint(point, &amp;replaced, fontSize);
+    *isReplaced = replaced;
+    return rect;
+}
+
+- (void)_setProhibitsScrolling:(BOOL)flag
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;view()-&gt;setProhibitsScrolling(flag);
+}
+
+- (void)revealSelectionAtExtent:(BOOL)revealExtent
+{
+    WebCore::Frame *frame = core(self);
+    RevealExtentOption revealExtentOption = revealExtent ? RevealExtent : DoNotRevealExtent;
+    frame-&gt;selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);
+}
+
+- (void)resetSelection
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;selection().setSelection(frame-&gt;selection().selection());
+}
+
+- (BOOL)hasEditableSelection
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;selection().isContentEditable();
+}
+
+- (int)preferredHeight
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;preferredHeight();
+}
+
+- (int)innerLineHeight:(DOMNode *)node
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;innerLineHeight(node);
+}
+
+- (void)updateLayout
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;updateLayout();
+}
+
+- (void)setIsActive:(BOOL)flag
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;page()-&gt;focusController().setActive(flag);
+}
+
+- (void)setSelectionChangeCallbacksDisabled:(BOOL)flag
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;setSelectionChangeCallbacksDisabled(flag);
+}
+
+- (NSRect)caretRect
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;caretRect();
+}
+
+- (NSRect)rectForScrollToVisible
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;rectForScrollToVisible();
+}
+
+- (void)setCaretColor:(CGColorRef)color
+{
+    Color qColor = color ? Color(color) : Color::black;
+    WebCore::Frame *frame = core(self);
+    frame-&gt;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-&gt;view())
+        return 0;
+    return frame-&gt;view()-&gt;layoutCount();
+}
+
+- (BOOL)isTelephoneNumberParsingAllowed
+{
+    Document *document = core(self)-&gt;document();
+    return document-&gt;isTelephoneNumberParsingAllowed();
+}
+
+- (BOOL)isTelephoneNumberParsingEnabled
+{
+    Document *document = core(self)-&gt;document();
+    return document-&gt;isTelephoneNumberParsingEnabled();
+}
+
+- (BOOL)mediaDataLoadsAutomatically
+{
+    WebCore::Frame *frame = core(self);
+    if (WebCore::Page* page = frame-&gt;page())
+        return page-&gt;settings().mediaDataLoadsAutomatically();
+
+    return NO;
+}
+
+- (void)setMediaDataLoadsAutomatically:(BOOL)flag
+{
+    WebCore::Frame *frame = core(self);
+    if (WebCore::Page* page = frame-&gt;page())
+        page-&gt;settings().setMediaDataLoadsAutomatically(flag);
+}
+
+- (DOMRange *)selectedDOMRange
+{
+    WebCore::Frame *frame = core(self);
+    RefPtr&lt;WebCore::Range&gt; range = frame-&gt;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-&gt;view()) {
+        if (NSView *documentView = frameView-&gt;documentView()) {
+            Page* page = frame-&gt;page();
+            if (!page)
+                return;
+            page-&gt;chrome().focusNSView(documentView);
+        }
+    }
+#endif
+    frame-&gt;selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping);
+    if (!closeTyping)
+        frame-&gt;editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
+}
+
+- (NSSelectionAffinity)selectionAffinity
+{
+    WebCore::Frame *frame = core(self);
+    return (NSSelectionAffinity)(frame-&gt;selection().affinity());
+}
+
+- (void)expandSelectionToElementContainingCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;selection().expandSelectionToElementContainingCaretSelection();
+}
+
+- (DOMRange *)elementRangeContainingCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    RefPtr&lt;WebCore::Range&gt; range = frame-&gt;selection().elementRangeContainingCaretSelection();
+    return kit(range.get());
+}
+
+- (void)expandSelectionToWordContainingCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;selection().expandSelectionToWordContainingCaretSelection();
+}
+
+- (void)expandSelectionToStartOfWordContainingCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    frame-&gt;selection().expandSelectionToStartOfWordContainingCaretSelection();
+}
+
+- (unichar)characterInRelationToCaretSelection:(int)amount
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;selection().characterInRelationToCaretSelection(amount);
+}
+
+- (unichar)characterBeforeCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;selection().characterBeforeCaretSelection();
+}
+
+- (unichar)characterAfterCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;selection().characterAfterCaretSelection();
+}
+
+- (DOMRange *)wordRangeContainingCaretSelection
+{
+    WebCore::Frame *frame = core(self);
+    RefPtr&lt;WebCore::Range&gt; range = frame-&gt;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-&gt;selection().wordOffsetInRange(core(range));
+}
+
+- (BOOL)spaceFollowsWordInRange:(DOMRange *)range
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;selection().spaceFollowsWordInRange(core(range));
+}
+
+- (NSArray *)wordsInCurrentParagraph
+{
+    WebCore::Frame *frame = core(self);
+    return frame-&gt;wordsInCurrentParagraph();
+}
+
+- (BOOL)selectionAtDocumentStart
+{
+    WebCore::Frame *frame = core(self);
+    
+    if (frame-&gt;selection().selection().isNone())
+        return NO;
+        
+    frame-&gt;document()-&gt;updateLayout();
+    
+    return frame-&gt;selection().selectionAtDocumentStart();
+}
+
+- (BOOL)selectionAtSentenceStart
+{
+    WebCore::Frame *frame = core(self);
+    
+    if (frame-&gt;selection().selection().isNone())
+        return NO;
+        
+    frame-&gt;document()-&gt;updateLayout();
+    
+    return frame-&gt;selection().selectionAtSentenceStart();
+}
+
+- (BOOL)selectionAtWordStart
+{
+    WebCore::Frame *frame = core(self);
+    
+    if (frame-&gt;selection().selection().isNone())
+        return NO;
+        
+    frame-&gt;document()-&gt;updateLayout();
+    
+    return frame-&gt;selection().selectionAtWordStart();
+}
+
+- (DOMRange *)rangeByMovingCurrentSelection:(int)amount
+{
+    WebCore::Frame *frame = core(self);
+    RefPtr&lt;WebCore::Range&gt; range = frame-&gt;selection().rangeByMovingCurrentSelection(amount);
+    return kit(range.get());
+}
+
+- (DOMRange *)rangeByExtendingCurrentSelection:(int)amount
+{
+    WebCore::Frame *frame = core(self);
+    RefPtr&lt;WebCore::Range&gt; range = frame-&gt;selection().rangeByExtendingCurrentSelection(amount);
+    return kit(range.get());
+}
+
+- (void)selectNSRange:(NSRange)range onElement:(DOMElement *)element
+{
+    WebCore::Frame *frame = core(self);
+
+    Document *doc = frame-&gt;document();
+    if (!doc)
+        return;
+
+    Node *node = core(element);
+    if (!node-&gt;inDocument())
+        return;
+        
+    frame-&gt;selection().selectRangeOnElement(range.location, range.length, node);
+}
+
+- (DOMRange *)markedTextDOMRange
+{
+    WebCore::Frame *frame = core(self);
+    if (!frame)
+        return nil;
+
+    return kit(frame-&gt;editor().compositionRange().get());
+}
+
+- (void)setMarkedText:(NSString *)text selectedRange:(NSRange)newSelRange
+{
+    WebCore::Frame *frame = core(self);
+    if (!frame)
+        return;
+    
+    Vector&lt;CompositionUnderline&gt; underlines;
+    frame-&gt;page()-&gt;chrome().client().suppressFormNotifications();
+    frame-&gt;editor().setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
+    frame-&gt;page()-&gt;chrome().client().restoreFormNotifications();
+}
+
+- (void)setMarkedText:(NSString *)text forCandidates:(BOOL)forCandidates
+{
+    WebCore::Frame *frame = core(self);
+    if (!frame)
+        return;
+        
+    Vector&lt;CompositionUnderline&gt; underlines;
+    frame-&gt;editor().setComposition(text, underlines, 0, [text length]);
+}
+
+- (void)confirmMarkedText:(NSString *)text
+{
+    WebCore::Frame *frame = core(self);
+    if (!frame || !frame-&gt;editor().client())
+        return;
+    
+    frame-&gt;page()-&gt;chrome().client().suppressFormNotifications();
+    if (text)
+        frame-&gt;editor().confirmComposition(text);
+    else
+        frame-&gt;editor().confirmMarkedText();
+    frame-&gt;page()-&gt;chrome().client().restoreFormNotifications();
+}
+
+- (void)setText:(NSString *)text asChildOfElement:(DOMElement *)element
+{
+    if (!element)
+        return;
+        
+    WebCore::Frame *frame = core(self);
+    if (!frame || !frame-&gt;document())
+        return;
+        
+    frame-&gt;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-&gt;editor().setDictationPhrasesAsChildOfElement(vectorForDictationPhrasesArray(dictationPhrases), metadata, core(element));
+}
+
+- (NSArray *)interpretationsForCurrentRoot
+{
+    return core(self)-&gt;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-&gt;document();
+    
+    Element *root = frame-&gt;selection().selectionType() == VisibleSelection::NoSelection ? frame-&gt;document()-&gt;body() : frame-&gt;selection().rootEditableElement();
+    
+    DOMRange *previousDOMRange = nil;
+    id previousMetadata = nil;
+    
+    for (Node* node = root; node; node = NodeTraversal::next(node)) {
+        Vector&lt;DocumentMarker*&gt; markers = document-&gt;markers().markersFor(node);
+        Vector&lt;DocumentMarker*&gt;::const_iterator end = markers.end();
+        for (Vector&lt;DocumentMarker*&gt;::const_iterator it = markers.begin(); it != end; ++it) {
+            
+            if ((*it)-&gt;type() != DocumentMarker::DictationResult)
+                continue;
+            
+            const DocumentMarker* marker = *it;
+            id metadata = marker-&gt;metadata();
+            
+            // All result markers should have metadata.
+            ASSERT(metadata);
+            if (!metadata)
+                continue;
+            
+            RefPtr&lt;Range&gt; range = Range::create(*document, node, marker-&gt;startOffset(), node, marker-&gt;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&lt;DocumentMarker*&gt; markers = core(self)-&gt;document()-&gt;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() &lt;= 1);
+    if (markers.size() == 0)
+        return nil;
+    
+    return markers[0]-&gt;metadata();
+}
+
+- (void)recursiveSetUpdateAppearanceEnabled:(BOOL)enabled
+{
+    WebCore::Frame *frame = core(self);
+    if (frame)
+        frame-&gt;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&lt;const char*&gt;([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-&gt;coreFrame) {
+        const SimpleFontData* fd = _private-&gt;coreFrame-&gt;editor().fontForSelection(multipleFonts);
+        if (fd)
+            font = fd-&gt;getCTFont();
+    }
+    
+    if (hasMultipleFonts)
+        *hasMultipleFonts = multipleFonts;
+    return font;
+}
+
+- (void)sendScrollEvent
+{
+    ASSERT(WebThreadIsLockedOrDisabled());
+    _private-&gt;coreFrame-&gt;eventHandler().sendScrollEvent();
+}
+
+- (void)_userScrolled
+{
+    ASSERT(WebThreadIsLockedOrDisabled());
+    if (FrameView* view = _private-&gt;coreFrame-&gt;view())
+        view-&gt;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&lt;Range&gt; range = _private-&gt;coreFrame-&gt;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-&gt;coreFrame-&gt;editor().replaceSelectionWithFragment(core(fragment), selectReplacement, smartReplace, matchStyle);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (void)removeUnchangeableStyles
+{
+    _private-&gt;coreFrame-&gt;editor().removeUnchangeableStyles();
+}
+
+- (BOOL)hasRichlyEditableSelection
+{
+    return _private-&gt;coreFrame-&gt;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&lt;Range&gt; range = _private-&gt;coreFrame-&gt;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 &amp;&amp; addTrailingSpace &amp;&amp; !hasWhitespaceAtEnd)
</span><span class="cx">         *afterString = @&quot; &quot;;
</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-&gt;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-&gt;coreFrame-&gt;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-&gt;coreFrame;
+   
+    Element* root;
+    if (coreFrame-&gt;selection().isNone() || !coreFrame-&gt;selection().isContentEditable())
+        root = coreFrame-&gt;document()-&gt;body();
+    else {
+        // Can't use the focusedNode here because we want the root of the shadow tree for form elements.
+        root = coreFrame-&gt;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-&gt;hasChildNodes())
+        return NO;
+
+    VisiblePosition first(createLegacyEditingPosition(root, 0));
+    VisiblePosition last(createLegacyEditingPosition(root, root-&gt;childNodeCount()));
+    return first != last;
+}
+
+- (void)_dispatchDidReceiveTitle:(NSString *)title
+{
+    Frame* coreFrame = _private-&gt;coreFrame;
+    if (!coreFrame)
+        return;
+    coreFrame-&gt;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-&gt;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:@&quot;&quot; forKey:@&quot;WebDataRequest&quot; 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) &amp;&amp; applicationIsSafari())
</span><span class="cx">         _private-&gt;coreFrame-&gt;loader().reload(GetCurrentKeyModifiers() &amp; shiftKey);
</span><span class="cx">     else
</span><ins>+#endif
</ins><span class="cx">         _private-&gt;coreFrame-&gt;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&lt;NSString&gt; url;
</span><span class="cx">     RetainPtr&lt;NSString&gt; 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&amp;)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&lt;WebCore::Range&gt;)_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 &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebFrameInternal.h&quot;
+#import &quot;WebPDFViewIOS.h&quot;
+#import &quot;WebUIKitDelegate.h&quot;
+#import &lt;Foundation/NSURLRequest.h&gt;
+#import &lt;WebCore/GraphicsContext.h&gt;
+#import &lt;WebCore/KeyEventCodesIOS.h&gt;
+#import &lt;WebCore/MainFrame.h&gt;
+#import &lt;WebCore/WAKClipView.h&gt;
+#import &lt;WebCore/WAKScrollView.h&gt;
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WKGraphics.h&gt;
+#import &lt;WebCore/WebEvent.h&gt;
+#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 &gt;= 1090
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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])-&gt;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-&gt;webFrame);
+
+    Frame* frame = core(_private-&gt;webFrame);
+
+    ASSERT(frame);
+    ASSERT(frame-&gt;page());
+
+    if (frame == &amp;frame-&gt;page()-&gt;mainFrame())
+        [[self window] makeFirstResponder:[self documentView]];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> -(NSView &lt;WebDocumentView&gt; *)_makeDocumentViewForDataSource:(WebDataSource *)dataSource
</span><span class="lines">@@ -243,7 +275,13 @@
</span><span class="cx">         // Since this is a &quot;secret default&quot; we don't bother registering it.
</span><span class="cx">         BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@&quot;WebKitOmitPDFSupport&quot;];
</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 &amp;&amp; !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-&gt;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-&gt;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 &gt;= 1090
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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] &amp; NSShiftKeyMask) {
</del><ins>+                if (modifierFlags &amp; 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] &amp; NSShiftKeyMask) {
</del><ins>+                if (modifierFlags &amp; 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] &amp; (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+                if (modifierFlags &amp; (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] &amp;&amp; ![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] &amp; NSCommandKeyMask) {
</del><ins>+#endif
+                if (modifierFlags &amp; NSCommandKeyMask) {
</ins><span class="cx">                     [self scrollToBeginningOfDocument:nil];
</span><del>-                } else if ([event modifierFlags] &amp; NSAlternateKeyMask) {
</del><ins>+                } else if (modifierFlags &amp; 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] &amp; (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+                if (modifierFlags &amp; (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] &amp;&amp; ![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] &amp; NSCommandKeyMask) {
</del><ins>+#endif
+                if (modifierFlags &amp; NSCommandKeyMask) {
</ins><span class="cx">                     [self scrollToEndOfDocument:nil];
</span><del>-                } else if ([event modifierFlags] &amp; NSAlternateKeyMask) {
</del><ins>+                } else if (modifierFlags &amp; 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] &amp; (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+                if (modifierFlags &amp; (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] &amp; NSCommandKeyMask) {
</del><ins>+                if (modifierFlags &amp; 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] &amp; NSAlternateKeyMask) {
</del><ins>+                    if (modifierFlags &amp; 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] &amp; (NSShiftKeyMask | NSControlKeyMask)) {
</del><ins>+                if (modifierFlags &amp; (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] &amp; NSCommandKeyMask) {
</del><ins>+                if (modifierFlags &amp; 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] &amp; NSAlternateKeyMask) {
</del><ins>+                    if (modifierFlags &amp; 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-&gt;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) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx"> 
</span><span class="cx"> #import &lt;WebCore/IntPoint.h&gt;
</span><span class="cx"> #import &lt;wtf/OwnPtr.h&gt;
</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) &amp;&amp; !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) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;WebFullScreenController.h&quot;
</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) &amp;&amp; !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-&gt;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)-&gt;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 &quot;WebTypesInternal.h&quot;
</span><span class="cx"> #import &quot;WebUIDelegatePrivate.h&quot;
</span><span class="cx"> #import &quot;WebViewInternal.h&quot;
</span><del>-#import &lt;AppKit/NSAccessibility.h&gt;
-#import &lt;ApplicationServices/ApplicationServices.h&gt;
</del><span class="cx"> #import &lt;WebCore/CSSStyleDeclaration.h&gt;
</span><span class="cx"> #import &lt;WebCore/CachedImage.h&gt;
</span><span class="cx"> #import &lt;WebCore/CachedResourceClient.h&gt;
</span><span class="lines">@@ -106,7 +104,6 @@
</span><span class="cx"> #import &lt;WebCore/MIMETypeRegistry.h&gt;
</span><span class="cx"> #import &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #import &lt;WebCore/Page.h&gt;
</span><del>-#import &lt;WebCore/PlatformEventFactoryMac.h&gt;
</del><span class="cx"> #import &lt;WebCore/Range.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderWidget.h&gt;
</span><span class="lines">@@ -136,10 +133,34 @@
</span><span class="cx"> #import &lt;QuartzCore/QuartzCore.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
+#import &lt;AppKit/NSAccessibility.h&gt;
+#import &lt;ApplicationServices/ApplicationServices.h&gt;
+#import &lt;WebCore/PlatformEventFactoryMac.h&gt;
+#endif
+
+#if PLATFORM(IOS)
+#import &quot;WebUIKitDelegate.h&quot;
+#import &lt;WebCore/KeyEventCodesIOS.h&gt;
+#import &lt;WebCore/PlatformEventFactoryIOS.h&gt;
+#import &lt;WebCore/WAKScrollView.h&gt;
+#import &lt;WebCore/WAKViewPrivate.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WebEvent.h&gt;
+#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 &quot;top WebHTMLView&quot; 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&lt;id&gt;(oldSetCursorForMouseLocationIMP, self, cmd, point);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> extern &quot;C&quot; {
</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 = @&quot;WebMarkedTextUpdated&quot;;
+#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) &lt;NSTextInput&gt;
</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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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 &amp;&amp; coreFrame-&gt;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-&gt;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-&gt;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-&gt;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: &lt;rdar://problem/2981619&gt; 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-&gt;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-&gt;subviewsSetAside);
</span><span class="cx">     ASSERT(_private-&gt;savedSubviews == nil);
</span><span class="cx">     _private-&gt;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-&gt;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-&gt;subviewsSetAside);
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx">     if (_private-&gt;layerHostingView) {
</span><span class="lines">@@ -1246,6 +1398,7 @@
</span><span class="cx"> #endif    
</span><span class="cx">     _private-&gt;savedSubviews = nil;
</span><span class="cx">     _private-&gt;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-&gt;dataSource &amp;&amp; [self _isTopHTMLView])
</span><span class="cx">         [self _web_updateLayoutAndStyleIfNeededRecursive];
</span><ins>+
+#if PLATFORM(IOS)
+    if (Frame* coreFrame = core([self _frame])) {
+        if (FrameView* coreView = coreFrame-&gt;view())
+            coreView-&gt;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 &gt;= 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-&gt;closed)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    // Preserve &lt;rdar://problem/7992472&gt; behavior for third party applications. See &lt;rdar://problem/8463725&gt;.
+    if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_MULTIPLE_IFRAME_TOUCH_EVENT_DISPATCH)) {
+        WebEvent *event = [WAKWindow currentEvent];
+        if (event != NULL &amp;&amp; event.type == WebEventMouseDown &amp;&amp; [self mouse:point inRect:[self frame]])
+            return self;
+        NSView *view = [super hitTest:point];
+        
+        // Find the clicked document view
+        while (view &amp;&amp; ![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-&gt;trackingRectOwner == nil);
</span><span class="lines">@@ -1540,9 +1723,11 @@
</span><span class="cx">         userData:_private-&gt;trackingRectUserData];
</span><span class="cx">     [_private-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;page())
+        page-&gt;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-&gt;autoscrollTimer == nil) {
</span><span class="cx">         _private-&gt;autoscrollTimer = [[NSTimer scheduledTimerWithTimeInterval:AUTOSCROLL_INTERVAL
</span><span class="lines">@@ -1736,7 +1953,12 @@
</span><span class="cx"> {
</span><span class="cx">     NSTimer *timer = _private-&gt;autoscrollTimer;
</span><span class="cx">     _private-&gt;autoscrollTimer = nil;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     [_private-&gt;autoscrollTriggerEvent release];
</span><ins>+#else
+    if (_private-&gt;autoscrollTriggerEvent)
+        CFRelease (_private-&gt;autoscrollTriggerEvent);
+#endif
</ins><span class="cx">     _private-&gt;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 &quot;-Wdeprecated-declarations&quot;
</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-&gt;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-&gt;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-&gt;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-&gt;pluginController destroyAllPlugins];
</span><span class="cx">     [_private-&gt;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-&gt;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 &amp;&amp; document-&gt;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 &lt; 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-&gt;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-&gt;selection().revealSelection(ScrollAlignment::alignCenterAlways);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> - (BOOL)validateUserInterfaceItemWithoutDelegate:(id &lt;NSValidatedUserInterfaceItem&gt;)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">             &amp;&amp; !_private-&gt;handlingMouseDownEvent
</span><span class="cx">             &amp;&amp; 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 &amp;&amp; event.type == WebEventMouseDown
+            &amp;&amp; !_private-&gt;handlingMouseDownEvent
+            &amp;&amp; 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 &amp;&amp; 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-&gt;dataSource || ![self _isTopHTMLView] || _private-&gt;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-&gt;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 &lt;rdar://problem/5023545&gt;. 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(&quot;Exception caught while drawing: %@&quot;, 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, &quot;%@ drawing&quot;, 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:&amp;rects count:&amp;count];
</span><span class="lines">@@ -3283,11 +3597,13 @@
</span><span class="cx">     BOOL subviewsWereSetAside = _private-&gt;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">     // &lt;rdar://problem/3908282&gt; 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 &lt; 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, &quot;%s draw seconds = %f&quot;, widget-&gt;part()-&gt;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) &amp;&amp; !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] &amp;&amp; [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-&gt;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-&gt;eventHandler().wheelEvent(event))
</span><span class="cx">         [super scrollWheel:event];
</span><ins>+#else
+    if (frame)
+        frame-&gt;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&lt;WebHTMLView&gt; protector = self;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if ([[self inputContext] wantsToHandleMouseEvents] &amp;&amp; [[self inputContext] handleMouseEvent:event])
</span><span class="cx">         return;
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     _private-&gt;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-&gt;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-&gt;eventHandler().mouseDown(event);
+#else
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
</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-&gt;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 &quot;-Wdeprecated-declarations&quot;
</span><span class="cx">     NSInputManager *currentInputManager = [NSInputManager currentInputManager];
</span><span class="cx">     if ([currentInputManager wantsToHandleMouseEvents] &amp;&amp; [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-&gt;page())
</span><span class="cx">             page-&gt;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:@&quot;NSEvent&quot;]];
</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 &quot;tab to all controls&quot; 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 &amp;&amp; !coreFrame-&gt;selection().isNone() &amp;&amp; coreFrame-&gt;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 &amp;&amp; coreFrame-&gt;selection().isInPasswordField();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> static PassRefPtr&lt;KeyboardEvent&gt; 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-&gt;document();
+        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), document ? document-&gt;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) &amp;&amp; !isInPasswordField(frame);
</span><span class="cx">     if (exposeInputContext != _private-&gt;exposeInputContext) {
</span><span class="cx">         _private-&gt;exposeInputContext = exposeInputContext;
</span><span class="lines">@@ -3819,6 +4215,7 @@
</span><span class="cx">     _private-&gt;_forceUpdateSecureInputState = YES;
</span><span class="cx">     [self _updateSecureInputState];
</span><span class="cx">     _private-&gt;_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-&gt;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-&gt;isInSecureInputState) {
</span><span class="cx">             DisableSecureEventInput();
</span><span class="cx">             _private-&gt;isInSecureInputState = NO;
</span><span class="cx">         }
</span><span class="cx">         [_private-&gt;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-&gt;document()) {
+            document-&gt;markers().removeMarkers(DocumentMarker::DictationPhraseWithAlternatives);
+            document-&gt;markers().removeMarkers(DocumentMarker::DictationResult);
+        }
+#endif
+
</ins><span class="cx">         Page* page = coreFrame-&gt;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">             &amp;&amp; [nextResponder isDescendantOf:[[[self _webView] mainFrame] frameView]];
</span><span class="cx">         if (!nextResponderIsInWebView)
</span><span class="cx">             page-&gt;focusController().setFocused(false);
</span><ins>+#else
+        NSView* nextResponder = [[self window] _newFirstResponderAfterResigning];
+        if (nextResponder &amp;&amp; ![nextResponder isDescendantOf:[[[self _webView] mainFrame] frameView]])
+            page-&gt;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-&gt;dataSource != dataSource) {
</span><span class="cx">         ASSERT(!_private-&gt;closed);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         BOOL hadDataSource = _private-&gt;dataSource != nil;
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">         [dataSource retain];
</span><span class="cx">         [_private-&gt;dataSource release];
</span><span class="cx">         _private-&gt;dataSource = dataSource;
</span><span class="cx">         [_private-&gt;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&lt;WebHTMLView&gt; selfProtector = self;
</span><span class="cx">     BOOL eventWasSentToWebCore = (_private-&gt;keyDownEvent == event);
</span><span class="lines">@@ -4142,6 +4569,7 @@
</span><span class="cx">     [_private-&gt;keyDownEvent release];
</span><span class="cx">     _private-&gt;keyDownEvent = [event retain];
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     BOOL completionPopupWasOpen = _private-&gt;completionController &amp;&amp; [_private-&gt;completionController popupWindowIsOpen];
</span><span class="cx">     Frame* coreFrame = core([self _frame]);
</span><span class="cx">     if (!eventWasSentToWebCore &amp;&amp; coreFrame &amp;&amp; coreFrame-&gt;eventHandler().keyEvent(event)) {
</span><span class="lines">@@ -4153,18 +4581,30 @@
</span><span class="cx">         [_private-&gt;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 &amp;&amp; coreFrame)
+        coreFrame-&gt;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-&gt;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 &quot;-Wdeprecated-declarations&quot;
</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-&gt;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 &gt;= 1080
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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. &lt;rdar://problem/5136760&gt;
</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 &amp;&amp; coreFrame-&gt;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-&gt;mouseDownEvent;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> - (id&lt;WebHTMLHighlighter&gt;)_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-&gt;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-&gt;target()-&gt;toNode()-&gt;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-&gt;keyEvent()) {
+        WebEvent *event = platformEvent-&gt;event();
+        if (![[self _webView] isEditable] &amp;&amp; event.isTabKey) 
+            return NO;
+        
+        // Now process the key normally
+        BOOL shift = platformEvent-&gt;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-&gt;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:@&quot;\n&quot; fromVariantKey:NO];
+                            [[[self _webView] _UIKitDelegateForwarder] addInputString:@&quot;\n&quot; withFlags:0];
+                            return YES;
+                        }
+                        return NO;
+                    case kWebDeleteForwardKey:
+                        [self deleteForward:self];
+                        return YES;
+                    default: {                    
+                        if (platformEvent-&gt;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-&gt;promisedDragTIFFDataSource;
</span><span class="lines">@@ -5377,12 +5948,15 @@
</span><span class="cx">         _private-&gt;promisedDragTIFFDataSource-&gt;removeClient(promisedDataClient());
</span><span class="cx">     _private-&gt;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-&gt;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-&gt;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-&gt;layerHostingView) {
</span><span class="cx">         [_private-&gt;layerHostingView setLayer:nil];
</span><span class="cx">         [_private-&gt;layerHostingView setWantsLayer:NO];
</span><span class="cx">         [_private-&gt;layerHostingView removeFromSuperview];
</span><span class="cx">         _private-&gt;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-&gt;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:@&quot;&quot;] 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, &quot;attributedSubstringFromRange:(%u, %u) -&gt; \&quot;%@\&quot;&quot;, 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-&gt;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&lt;CompositionUnderline&gt;&amp; 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, &quot;setMarkedText:\&quot;%@\&quot; selectedRange:(%u, %u)&quot;, 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-&gt;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-&gt;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, &quot;doCommandBySelector:\&quot;%s\&quot;&quot;, 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-&gt;selectorForDoCommandBySelector = selector;
</span><span class="lines">@@ -5787,6 +6389,7 @@
</span><span class="cx"> 
</span><span class="cx">                 _private-&gt;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, &quot;insertText:\&quot;%@\&quot;&quot;, isAttributedString ? [string string] : string);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     WebHTMLViewInterpretKeyEventsParameters* parameters = _private-&gt;interpretKeyEventsParameters;
</span><span class="cx">     if (parameters)
</span><span class="lines">@@ -5813,6 +6418,7 @@
</span><span class="cx">     bool isFromInputMethod = coreFrame &amp;&amp; coreFrame-&gt;editor().hasComposition();
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;DictationAlternative&gt; 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&lt;WebCore::TextAlternativeWithRange&gt; 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-&gt;event : 0;
</span><span class="lines">@@ -5872,6 +6479,7 @@
</span><span class="cx">         parameters-&gt;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 &amp;&amp; !_private-&gt;_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-&gt;editor()-&gt;getCompositionSelection(start, end))
+    //          coreFrame-&gt;editor()-&gt;confirmCompositionWithoutDisturbingSelection();
+    //
+    //
+    // would work if getCompositionSelection returned false when composition != selection.
+    // Why doesn't it?  See &lt;rdar://problem/6837252&gt; 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])-&gt;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 &lt;WebHTMLHighlighter&gt;)_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 &quot;WebTypesInternal.h&quot;
</span><span class="cx"> #import &lt;wtf/Vector.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><ins>+
+#if !PLATFORM(IOS)
</ins><span class="cx"> #import &lt;PDFKit/PDFDocument.h&gt;
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> static void appendValuesInPDFNameSubtreeToVector(CGPDFDictionaryRef subtree, Vector&lt;CGPDFObjectRef&gt;&amp; 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 &quot;WebDocument.h&quot;
</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 &lt;WebDocumentRepresentation&gt;
</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 &quot;WebPDFRepresentation.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebDataSourcePrivate.h&quot;
</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 &lt;WebKit/WebDocumentInternal.h&gt;
</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 &quot;WebPDFView.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</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 &lt;WebCore/GraphicsContext.h&gt;
+#import &lt;WebCore/ImageSource.h&gt;
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#endif
+
</ins><span class="cx"> NSString *WebPreferencesChangedNotification = @&quot;WebPreferencesChangedNotification&quot;;
</span><span class="cx"> NSString *WebPreferencesRemovedNotification = @&quot;WebPreferencesRemovedNotification&quot;;
</span><span class="cx"> NSString *WebPreferencesChangedInternalNotification = @&quot;WebPreferencesChangedInternalNotification&quot;;
</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(&quot;com.apple.WebPreferences.ReadWriteQueue&quot;, 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&lt;NSMutableDictionary&gt; values;
</span><span class="cx">     RetainPtr&lt;NSString&gt; 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-&gt;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-&gt;identifier.get() forKey:@&quot;Identifier&quot;];
</span><ins>+#if PLATFORM(IOS)
+        dispatch_sync(_private-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">         [encoder encodeObject:_private-&gt;values.get() forKey:@&quot;Values&quot;];
</span><span class="cx">         LOG (Encoding, &quot;Identifier = %@, Values = %@\n&quot;, _private-&gt;identifier.get(), _private-&gt;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:&amp;version];
</span><span class="cx">         [encoder encodeObject:_private-&gt;identifier.get()];
</span><ins>+#if PLATFORM(IOS)
+        dispatch_sync(_private-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">         [encoder encodeObject:_private-&gt;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(&amp;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">         @&quot;Times&quot;,                       WebKitStandardFontPreferenceKey,
</span><span class="cx">         @&quot;Courier&quot;,                     WebKitFixedFontPreferenceKey,
</span><span class="cx">         @&quot;Times&quot;,                       WebKitSerifFontPreferenceKey,
</span><span class="cx">         @&quot;Helvetica&quot;,                   WebKitSansSerifFontPreferenceKey,
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         @&quot;Apple Chancery&quot;,              WebKitCursiveFontPreferenceKey,
</span><ins>+#else
+        @&quot;Snell Roundhand&quot;,             WebKitCursiveFontPreferenceKey,
+#endif
</ins><span class="cx">         @&quot;Papyrus&quot;,                     WebKitFantasyFontPreferenceKey,
</span><ins>+#if PLATFORM(IOS)
+        @&quot;AppleColorEmoji&quot;,             WebKitPictographFontPreferenceKey,
+#else
</ins><span class="cx">         @&quot;Apple Color Emoji&quot;,           WebKitPictographFontPreferenceKey,
</span><ins>+#endif
</ins><span class="cx">         @&quot;0&quot;,                           WebKitMinimumFontSizePreferenceKey,
</span><span class="cx">         @&quot;9&quot;,                           WebKitMinimumLogicalFontSizePreferenceKey, 
</span><span class="cx">         @&quot;16&quot;,                          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">         @&quot;&quot;,                            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">         @&quot;1800&quot;,                        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">         @&quot;1&quot;,                           WebKitPDFDisplayModePreferenceKey,
</span><span class="cx">         @&quot;0&quot;,                           WebKitPDFScaleFactorPreferenceKey,
</span><ins>+#endif
</ins><span class="cx">         @&quot;0&quot;,                           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) &amp;&amp; !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 &gt;= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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,
+        @&quot;&quot;,                              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-&gt;readWriteQueue, ^{
+        o = [_private-&gt;values.get() objectForKey:_key];
+    });
+#else
</ins><span class="cx">     id o = [_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() setObject:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() _webkit_setInt:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;readWriteQueue, ^{
+    [_private-&gt;values.get() _webkit_setUnsignedInt:value forKey:_key];
+    });
+    if (_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() _webkit_setFloat:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() _webkit_setBool:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() _webkit_setLongLong:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;readWriteQueue, ^{
+#endif
</ins><span class="cx">     [_private-&gt;values.get() _webkit_setUnsignedLongLong:value forKey:_key];
</span><ins>+#if PLATFORM(IOS)
+    });
+#endif
</ins><span class="cx">     if (_private-&gt;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-&gt;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) &amp;&amp; !(__IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 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 &gt; 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-&gt;readWriteQueue, ^{
+        if (_private-&gt;values)
+            _private-&gt;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 &gt;= 1090
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</ins><span class="cx">     static bool is1PasswordNeedingScreenFontsQuirk = WKExecutableWasLinkedOnOrBeforeMountainLion()
</span><span class="cx">         &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;ws.agile.1Password&quot;];
</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:@&quot;&lt;%@ %@&gt;&quot;, [self className], [self URL]];
</span><ins>+#else
+    return [NSString stringWithFormat:@&quot;&lt;%@ %@&gt;&quot;, 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 &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> #import &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;MemoryMeasure.h&quot;
+#import &quot;WebCaretChangeListener.h&quot;
+#import &quot;WebChromeClientIOS.h&quot;
+#import &quot;WebDefaultFormDelegate.h&quot;
+#import &quot;WebDefaultFrameLoadDelegate.h&quot;
+#import &quot;WebDefaultResourceLoadDelegate.h&quot;
+#import &quot;WebDefaultUIKitDelegate.h&quot;
+#import &quot;WebFixedPositionContent.h&quot;
+#import &quot;WebMailDelegate.h&quot;
+#import &quot;WebNSUserDefaultsExtras.h&quot;
+#import &quot;WebPDFViewIOS.h&quot;
+#import &quot;WebPlainWhiteView.h&quot;
+#import &quot;WebPluginController.h&quot;
+#import &quot;WebPolicyDelegatePrivate.h&quot;
+#import &quot;WebSQLiteDatabaseTrackerClient.h&quot;
+#import &quot;WebStorageManagerPrivate.h&quot;
+#import &quot;WebUIKitSupport.h&quot;
+#import &quot;WebVisiblePosition.h&quot;
+#import &lt;CFNetwork/CFURLCachePriv.h&gt;
+#import &lt;MobileGestalt.h&gt;
+#import &lt;WebCore/EventNames.h&gt;
+#import &lt;WebCore/FontCache.h&gt;
+#import &lt;WebCore/IconController.h&gt;
+#import &lt;WebCore/NetworkStateNotifier.h&gt;
+#import &lt;WebCore/RuntimeApplicationChecksIOS.h&gt;
+#import &lt;WebCore/SQLiteDatabaseTracker.h&gt;
+#import &lt;WebCore/SmartReplace.h&gt;
+#import &lt;WebCore/TextRun.h&gt;
+#import &lt;WebCore/WAKWindow.h&gt;
+#import &lt;WebCore/WebCoreThread.h&gt;
+#import &lt;WebCore/WebCoreThreadMessage.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#import &lt;WebCore/WebEvent.h&gt;
+#import &lt;dispatch/private.h
+#import &lt;wtf/FastMalloc.h&gt;
+
+#if USE(ACCELERATED_COMPOSITING)
+#import &lt;WebCore/GraphicsLayer.h&gt;
+#endif
+#endif
+
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx"> #import &lt;WebKit/WebDashboardRegion.h&gt;
</span><span class="cx"> #endif
</span><span class="lines">@@ -221,6 +263,7 @@
</span><span class="cx"> #import &lt;glib.h&gt;
</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 &quot;Intel&quot;
</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[] = &quot;At least one WebView is still open.&quot;;
</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 &lt;NSValidatedUserInterfaceItem&gt;)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 =          @&quot;WebProgressStartedNotification&quot;;
</span><span class="cx"> NSString *WebViewProgressEstimateChangedNotification =  @&quot;WebProgressEstimateChangedNotification&quot;;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> NSString *WebViewProgressFinishedNotification =         @&quot;WebProgressFinishedNotification&quot;;
</span><ins>+#else
+NSString * const WebViewProgressEstimatedProgressKey = @&quot;WebProgressEstimatedProgressKey&quot;;
+NSString * const WebViewProgressBackgroundColorKey =   @&quot;WebProgressBackgroundColorKey&quot;;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> NSString * const WebViewDidBeginEditingNotification =         @&quot;WebViewDidBeginEditingNotification&quot;;
</span><span class="cx"> NSString * const WebViewDidChangeNotification =               @&quot;WebViewDidChangeNotification&quot;;
</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 =            @&quot;canGoBack&quot;;
</span><span class="cx"> NSString *_WebCanGoForwardKey =         @&quot;canGoForward&quot;;
</span><span class="cx"> NSString *_WebEstimatedProgressKey =    @&quot;estimatedProgress&quot;;
</span><span class="lines">@@ -511,6 +600,7 @@
</span><span class="cx"> NSString *_WebMainFrameTitleKey =       @&quot;mainFrameTitle&quot;;
</span><span class="cx"> NSString *_WebMainFrameURLKey =         @&quot;mainFrameURL&quot;;
</span><span class="cx"> NSString *_WebMainFrameDocumentKey =    @&quot;mainFrameDocument&quot;;
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> NSString *_WebViewDidStartAcceleratedCompositingNotification = @&quot;_WebViewDidStartAcceleratedCompositing&quot;;
</span><span class="cx"> NSString * const WebViewWillCloseNotification = @&quot;WebViewWillCloseNotification&quot;;
</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:@&quot;.&quot; withString:@&quot;_&quot;];
</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:@&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko) %@&quot;, osVersion, webKitVersion, applicationName];
</span><span class="cx">     return [NSString stringWithFormat:@&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko)&quot;, 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(&quot;UserAgent&quot;), CFSTR(&quot;com.apple.WebFoundation&quot;));
+    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:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko) %@&quot;, WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion, webKitVersion, applicationName];
+    return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko)&quot;, WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion,  webKitVersion];
+}
+
++ (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName
+{
+    static NSString *osMarketingVersion;
+    if (!osMarketingVersion) {
+#if !PLATFORM(IOS_SIMULATOR)
+        NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:@&quot;/System/Library/CoreServices/SystemVersion.plist&quot;];
+#else
+        NSString *rootDirectory = [NSString stringWithUTF8String:WebKitPlatformSystemRootDirectory()];
+        NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:[rootDirectory stringByAppendingPathComponent:@&quot;System/Library/CoreServices/SystemVersion.plist&quot;]];
+#endif
+        NSString *productVersion = [systemInfo objectForKey:@&quot;ProductVersion&quot;];
+        // Due to &lt;rdar://problem/3787996&gt;, we must use something other than periods to delimit the marketing version.  Using underscores to match Leopard's new convention.
+        osMarketingVersion = !productVersion ? @&quot;&quot; : [[productVersion stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;] retain];
+        [systemInfo release];
+    }
+    return [self _standardUserAgentWithApplicationName:applicationName osMarketingVersion:osMarketingVersion];
+}
+
+- (void)_setBrowserUserAgentProductVersion:(NSString *)productVersion buildVersion:(NSString *)buildVersion bundleVersion:(NSString *)bundleVersion
+{
+    [self setApplicationNameForUserAgent:[NSString stringWithFormat:@&quot;Version/%@ Mobile/%@ Safari/%@&quot;, productVersion, buildVersion, bundleVersion]];
+}
+
+- (void)_setUIWebViewUserAgentWithBuildVersion:(NSString *)buildVersion
+{
+    [self setApplicationNameForUserAgent:[@&quot;Mobile/&quot; 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 = @&quot;com.apple.WebAppCache&quot;;
+#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()-&gt;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)-&gt;group().addUserScriptToWorld(*core([WebScriptWorld world]),
</span><span class="cx">         outlookQuirksScriptContents, URL(), Vector&lt;String&gt;(), Vector&lt;String&gt;(), 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)
+        &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;com.lexcycle.stanza&quot;];
+    return isStanzaNeedingAttributeSetterQuirk;
+#else
</ins><span class="cx">     static bool isIAdProducerNeedingAttributeSetterQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY)
</span><span class="cx">         &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;com.apple.iAdProducer&quot;];
</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">         &amp;&amp; !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-&gt;preferences = [standardPreferences retain];
</span><span class="cx">     _private-&gt;mainFrameDocumentReady = NO;
</span><span class="cx">     _private-&gt;drawsBackground = YES;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     _private-&gt;backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
</span><ins>+#else
+    _private-&gt;backgroundColor = CGColorRetain(cachedCGColor(Color::white, ColorSpaceDeviceRGB));
+#endif
</ins><span class="cx">     _private-&gt;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) &amp;&amp; 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-&gt;page = new Page(pageClients);
</span><span class="lines">@@ -778,8 +983,10 @@
</span><span class="cx">     WebCore::provideNotification(_private-&gt;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-&gt;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-&gt;page, new WebUserMediaClient(self));
</span><span class="cx"> #endif
</span><span class="lines">@@ -792,22 +999,37 @@
</span><span class="cx">     _private-&gt;page-&gt;settings().setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
</span><span class="cx">     _private-&gt;page-&gt;settings().setUseLegacyBackgroundSizeShorthandBehavior(shouldUseLegacyBackgroundSizeShorthandBehavior());
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if (needsOutlookQuirksScript()) {
</span><span class="cx">         _private-&gt;page-&gt;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 &lt;rdar://problem/7580867&gt;
+    // by enforcing a 5MB limit for session storage.
+    _private-&gt;page-&gt;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-&gt;_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-&gt;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 &lt;rdar://problem/5841558&gt;
+    [self _preferencesChanged:prefs];
+    _private-&gt;page-&gt;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-&gt;page-&gt;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() &amp;&amp; !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-&gt;preferences = [preferences retain];
+    _private-&gt;mainFrameDocumentReady = NO;
+    _private-&gt;drawsBackground = YES;
+    _private-&gt;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-&gt;allowsRemoteInspection = NO;
+    else {
+        static BOOL textFieldInspectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitTextFieldRemoteInspectionEnabledPreferenceKey];
+        _private-&gt;allowsRemoteInspection = textFieldInspectionEnabled;
+        if (_private-&gt;allowsRemoteInspection &amp;&amp; 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-&gt;page = new Page(pageClients);
+    
+    [self setSmartInsertDeleteEnabled:YES];
+    
+    // FIXME: &lt;rdar://problem/6851451&gt; 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, &lt;rdar://problem/6850611&gt;.
+    // This should be revisited later. There is some risk involved, _preferencesChanged used to show up badly in Shark.
+    _private-&gt;page-&gt;settings().setMinimumLogicalFontSize(9);
+    _private-&gt;page-&gt;settings().setDefaultFontSize([_private-&gt;preferences defaultFontSize]);
+    _private-&gt;page-&gt;settings().setDefaultFixedFontSize(13);
+    _private-&gt;page-&gt;settings().setDownloadableBinaryFontsEnabled(false);
+    _private-&gt;page-&gt;settings().setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]);
+    _private-&gt;page-&gt;settings().setScreenFontSubstitutionEnabled(false);
+    
+    // FIXME: &lt;rdar://problem/7394370&gt; Always use primary font baseline in text field base line calculation, ignore fallback fonts.
+    _private-&gt;page-&gt;settings().setAlwaysUseBaselineOfPrimaryFont([preferences _alwaysUseBaselineOfPrimaryFont]);
+
+    _private-&gt;page-&gt;settings().setFontFallbackPrefersPictographs(true);
+    _private-&gt;page-&gt;settings().setPictographFontFamily(&quot;AppleColorEmoji&quot;);
+    
+    // FIXME: this is a workaround for &lt;rdar://problem/11518688&gt; REGRESSION: Quoted text font changes when replying to certain email
+    _private-&gt;page-&gt;settings().setStandardFontFamily([_private-&gt;preferences standardFontFamily]);
+    
+    // FIXME: this is a workaround for &lt;rdar://problem/11820090&gt; Quoted text changes in size when replying to certain email
+    _private-&gt;page-&gt;settings().setMinimumFontSize([_private-&gt;preferences minimumFontSize]);
+
+    _private-&gt;page-&gt;setGroupName(groupName);
+
+    [WebFrame _createMainFrameWithSimpleHTMLDocumentWithPage:_private-&gt;page frameView:frameView style:style];
+    
+    [self _addToAllWebViewsSet];
+    
+    ++WebViewCount;
+    
+    SecurityPolicy::setLocalLoadPolicy(SecurityPolicy::AllowLocalLoadsForLocalAndSubstituteData);
+    
+    return self;
+}
+
++ (void)_handleMemoryWarning
+{
+    ASSERT(WebThreadIsCurrent());
+    WebKit::MemoryMeasure totalMemory(&quot;Memory warning: Overall memory change from [WebView _handleMemoryWarning].&quot;);
+
+    // 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(&quot;Memory warning: flushing images to disk.&quot;);
+        WebCore::memoryCache()-&gt;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-&gt;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(&quot;Memory warning: Releasing fast malloc memory to system.&quot;);
+    WTF::releaseFastMallocFreeMemory();
+}
+
++ (void)garbageCollectNow
+{
+    ASSERT(WebThreadIsCurrent());
+    WebKit::MemoryMeasure measurer(&quot;Memory warning: Calling JavaScript GC.&quot;);
+    gcController().garbageCollectNow();
+}
+
++ (void)purgeInactiveFontData
+{
+    ASSERT(WebThreadIsCurrent());
+    WebKit::MemoryMeasure measurer(&quot;Memory warning: Purging inactive font data.&quot;);
+    fontCache()-&gt;purgeInactiveFontData();
+}
+
++ (void)drainLayerPool
+{
+    ASSERT(WebThreadIsCurrent());
+    WebKit::MemoryMeasure measurer(&quot;Memory warning: Draining layer pool.&quot;);
+    WebCore::TileCache::drainLayerPool();
+}
+
++ (void)discardAllCompiledCode
+{
+    ASSERT(WebThreadIsCurrent());
+    WebKit::MemoryMeasure measurer(&quot;Memory warning: Discarding JIT'ed code.&quot;);
+    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-&gt;tree().traverseNext()) {
+            Document *document = frame-&gt;document();
+            if (document)
+                document-&gt;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-&gt;preferences arePlugInsEnabled]])
</span><span class="cx">         return YES;
</span><del>-
</del><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if (_private-&gt;pluginDatabase) {
</span><span class="cx">         WebBasePluginPackage *pluginPackage = [_private-&gt;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-&gt;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-&gt;document();
+            if (document)
+                document-&gt;dispatchWindowEvent(Event::create(eventNames().unloadEvent, false, false));
+        }
+    });
+}
+
+- (DOMCSSStyleDeclaration *)styleAtSelectionStart
+{
+    WebFrame *mainFrame = [self mainFrame];
+    Frame *coreMainFrame = core(mainFrame);
+    if (!coreMainFrame)
+        return nil;
+    return coreMainFrame-&gt;styleAtSelectionStart();
+}
+
+- (NSUInteger)_renderTreeSize
+{
+    if (!_private-&gt;page)
+        return 0;
+    return _private-&gt;page-&gt;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, &amp;_private-&gt;didDrawTiles))
+        return;
+
+    WebThreadLock();
+
+    [[[self _UIKitDelegateForwarder] asyncForwarder] webViewDidDrawTiles:self];
+}
+
+- (void)_willStartScrollingOrZooming
+{
+    // Pause timers during top level interaction
+    if (_private-&gt;mainViewIsScrollingOrZooming)
+        return;
+    _private-&gt;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-&gt;mainViewIsScrollingOrZooming)
+        return;
+    _private-&gt;mainViewIsScrollingOrZooming = NO;
+    [self setDefersCallbacks:NO];
+    [[self mainFrame] setTimeoutsPaused:NO];
+}
+
+- (void)_setResourceLoadSchedulerSuspended:(BOOL)suspend
+{
+    if (suspend)
+        resourceLoadScheduler()-&gt;suspendPendingRequests();
+    else
+        resourceLoadScheduler()-&gt;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-&gt;pluginDatabase) {
</span><span class="cx">         [_private-&gt;pluginDatabase destroyAllPluginInstanceViews];
</span><span class="lines">@@ -1062,6 +1679,7 @@
</span><span class="cx">         [_private-&gt;pluginDatabase release];
</span><span class="cx">         _private-&gt;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 &amp;&amp; applicationIsTerminating)
</span><span class="lines">@@ -1074,7 +1692,9 @@
</span><span class="cx">     WTF::RefCountedLeakCounter::suppressMessages(&quot;At least one WebView was closed with fast teardown.&quot;);
</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 &lt;rdar://problem/11540972&gt;).
+
+    [self _clearDelegates];
+
+    // Fix for problems such as &lt;rdar://problem/5774587&gt; Crash closing tab in WebCore::Frame::page() from -[WebCoreFrameBridge pauseTimeouts]
+    WebThreadRun(^{
+#endif            
+
</ins><span class="cx">     if (!_private || _private-&gt;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) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">     [self _exitFullscreen];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    _private-&gt;closing = YES;
+#endif
+
</ins><span class="cx">     if (Frame* mainFrame = [self _mainCoreFrame])
</span><span class="cx">         mainFrame-&gt;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-&gt;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-&gt;page = 0;
</span><span class="cx">     delete page;
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     if (_private-&gt;hasSpellCheckerDocumentTag) {
</span><span class="cx">         [[NSSpellChecker sharedSpellChecker] closeSpellDocumentWithTag:_private-&gt;spellCheckerDocumentTag];
</span><span class="cx">         _private-&gt;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-&gt;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 &lt;rdar://problem/5774587&gt; 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:@&quot;application/octet-stream&quot;]) {
</span><span class="lines">@@ -1351,6 +2001,7 @@
</span><span class="cx">     return _private-&gt;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&lt;WebFormDelegate&gt;)delegate
</span><span class="cx"> {
</span><span class="cx">     _private-&gt;formDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+    [_private-&gt;formDelegateForwarder clearTarget];
+    [_private-&gt;formDelegateForwarder release];
+    _private-&gt;formDelegateForwarder = nil;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id&lt;WebFormDelegate&gt;)_formDelegate
</span><span class="lines">@@ -1435,6 +2092,32 @@
</span><span class="cx">     return _private-&gt;formDelegate;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (id)_formDelegateForwarder
+{
+    if (_private-&gt;closing)
+        return nil;
+
+    if (!_private-&gt;formDelegateForwarder)
+        _private-&gt;formDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self _formDelegate] defaultTarget:[WebDefaultFormDelegate sharedFormDelegate]];
+    return _private-&gt;formDelegateForwarder;
+}
+
+- (id)_formDelegateForSelector:(SEL)selector
+{
+    id delegate = self-&gt;_private-&gt;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(@&quot;com.adobe.Acrobat&quot;, -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-&gt;page &amp;&amp; _private-&gt;page-&gt;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) &amp;&amp; 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) &amp;&amp; applicationIsSafari();
</span><span class="cx">     return needsUnrestrictedGetMatchedCSSRules;
</span><ins>+#else
+    // FIXME: &lt;rdar://problem/8963684&gt; 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-&gt;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&amp; settings = _private-&gt;page-&gt;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 &gt;= 1090
</del><ins>+#if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</ins><span class="cx">         [[NSUserDefaults standardUserDefaults] boolForKey:@&quot;NSFontDefaultScreenFontSubstitutionEnabled&quot;] ||
</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:@&quot;apple-dashboard://stylesheet&quot;])
</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-&gt;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(@&quot;com.apple.iWeb&quot;, -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 &lt;rdar://problem/15290404&gt;?
</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-&gt;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 &lt;rdar://problem/9813262&gt; 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(), &quot;PageCacheSupportsPlugins should be enabled on iOS.&quot;);
+
+    // 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-&gt;closing)
+        return nil;
+        
+    if (!_private-&gt;UIKitDelegateForwarder)
+        _private-&gt;UIKitDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private-&gt;UIKitDelegate defaultTarget:[WebDefaultUIKitDelegate sharedUIKitDelegate]];
+    return _private-&gt;UIKitDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)_cacheResourceLoadDelegateImplementations
</span><span class="cx"> {
</span><span class="cx">     WebResourceDelegateImplementationCache *cache = &amp;_private-&gt;resourceLoadDelegateImplementations;
</span><span class="lines">@@ -1754,6 +2550,19 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx">     cache-&gt;canAuthenticateAgainstProtectionSpaceFunc = getMethod(delegate, @selector(webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:));
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(IOS)
+    cache-&gt;connectionPropertiesFunc = getMethod(delegate, @selector(webView:connectionPropertiesForResource:dataSource:));
+    cache-&gt;webThreadDidFinishLoadingFromDataSourceFunc = getMethod(delegate, @selector(webThreadWebView:resource:didFinishLoadingFromDataSource:));
+    cache-&gt;webThreadDidFailLoadingWithErrorFromDataSourceFunc = getMethod(delegate, @selector(webThreadWebView:resource:didFailLoadingWithError:fromDataSource:));
+    cache-&gt;webThreadIdentifierForRequestFunc = getMethod(delegate, @selector(webThreadWebView:identifierForInitialRequest:fromDataSource:));
+    cache-&gt;webThreadDidLoadResourceFromMemoryCacheFunc = getMethod(delegate, @selector(webThreadWebView:didLoadResourceFromMemoryCache:response:length:fromDataSource:));
+    cache-&gt;webThreadWillSendRequestFunc = getMethod(delegate, @selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:));
+    cache-&gt;webThreadDidReceiveResponseFunc = getMethod(delegate, @selector(webThreadWebView:resource:didReceiveResponse:fromDataSource:));
+    cache-&gt;webThreadDidReceiveContentLengthFunc = getMethod(delegate, @selector(webThreadWebView:resource:didReceiveContentLength:fromDataSource:));
+    cache-&gt;webThreadWillCacheResponseFunc = getMethod(delegate, @selector(webThreadWebView:resource:willCacheResponse:fromDataSource:));
+#endif
+
</ins><span class="cx">     cache-&gt;didReceiveContentLengthFunc = getMethod(delegate, @selector(webView:resource:didReceiveContentLength:fromDataSource:));
</span><span class="cx">     cache-&gt;didReceiveResponseFunc = getMethod(delegate, @selector(webView:resource:didReceiveResponse:fromDataSource:));
</span><span class="cx">     cache-&gt;identifierForRequestFunc = getMethod(delegate, @selector(webView:identifierForInitialRequest:fromDataSource:));
</span><span class="lines">@@ -1805,6 +2614,9 @@
</span><span class="cx">     cache-&gt;didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:));
</span><span class="cx">     cache-&gt;didDetectXSSFunc = getMethod(delegate, @selector(webView:didDetectXSS:));
</span><span class="cx">     cache-&gt;didRemoveFrameFromHierarchyFunc = getMethod(delegate, @selector(webView:didRemoveFrameFromHierarchy:));
</span><ins>+#if PLATFORM(IOS)
+    cache-&gt;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-&gt;didFirstVisuallyNonEmptyLayoutInFrameFunc)
</span><span class="cx">             milestones |= DidFirstVisuallyNonEmptyLayout;
</span><ins>+#endif
</ins><span class="cx">         page-&gt;addLayoutMilestones(static_cast&lt;LayoutMilestones&gt;(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-&gt;closing)
+        return nil;
+#endif
</ins><span class="cx">     if (!_private-&gt;policyDelegateForwarder)
</span><span class="cx">         _private-&gt;policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private-&gt;policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate]];
</span><span class="cx">     return _private-&gt;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-&gt;closing)
+        return nil;
+#endif
</ins><span class="cx">     if (!_private-&gt;UIDelegateForwarder)
</span><span class="cx">         _private-&gt;UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private-&gt;UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate]];
</span><span class="cx">     return _private-&gt;UIDelegateForwarder;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (id)_UIDelegateForSelector:(SEL)selector
+{
+    id delegate = self-&gt;_private-&gt;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-&gt;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-&gt;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, &quot;calling didChangeValueForKey: %@&quot;, 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-&gt;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 @&quot;control&quot;
</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-&gt;UIKitDelegate = delegate;
+    [_private-&gt;UIKitDelegateForwarder clearTarget];
+    [_private-&gt;UIKitDelegateForwarder release];
+    _private-&gt;UIKitDelegateForwarder = nil;
+}
+
+- (id)_UIKitDelegate
+{
+    return _private-&gt;UIKitDelegate;
+}
+
+- (void)setWebMailDelegate:(id)delegate
+{
+    _private-&gt;WebMailDelegate = delegate;
+}
+
+- (id)_webMailDelegate
+{
+    return _private-&gt;WebMailDelegate;
+}
+
+- (id &lt;WebCaretChangeListener&gt;)caretChangeListener
+{
+    return _private-&gt;_caretChangeListener;
+}
+
+- (void)setCaretChangeListener:(id &lt;WebCaretChangeListener&gt;)listener
+{
+    _private-&gt;_caretChangeListener = listener;
+}
+
+- (NSSet *)caretChangeListeners
+{
+    return _private-&gt;_caretChangeListeners;
+}
+
+- (void)addCaretChangeListener:(id &lt;WebCaretChangeListener&gt;)listener
+{
+    if (_private-&gt;_caretChangeListeners == nil) {
+        _private-&gt;_caretChangeListeners = [[NSMutableSet alloc] init];
+    }
+    
+    [_private-&gt;_caretChangeListeners addObject:listener];
+}
+
+- (void)removeCaretChangeListener:(id &lt;WebCaretChangeListener&gt;)listener
+{
+    [_private-&gt;_caretChangeListeners removeObject:listener];
+}
+
+- (void)removeAllCaretChangeListeners
+{
+    [_private-&gt;_caretChangeListeners removeAllObjects];
+}
+
+- (void)caretChanged
+{
+    [_private-&gt;_caretChangeListener caretChanged];
+    NSSet *copy = [_private-&gt;_caretChangeListeners copy];
+    for (id &lt;WebCaretChangeListener&gt; 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: &lt;rdar://problem/6362369&gt; 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] &amp;&amp; [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-&gt;page-&gt;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-&gt;pluginDatabase)
</span><span class="lines">@@ -2459,7 +3424,131 @@
</span><span class="cx">     [_private-&gt;pluginDatabase setPlugInPaths:newPaths];
</span><span class="cx">     [_private-&gt;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 &lt;WebDocumentView&gt; documentView = [[frame frameView] documentView];
+    if (documentView &amp;&amp; [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 &lt; 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 &lt;WebDocumentView&gt; documentView = [[frame frameView] documentView];
+    if (documentView &amp;&amp; [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 &lt; 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(&quot;[WebView _clearBackForwardCache]&quot;);
+        BackForwardList* bfList = core([self backForwardList]);
+        if (!bfList)
+            return;
+
+        BOOL didClearBFCache = bfList-&gt;clearAllPageCaches();
+        if (WebKit::MemoryMeasure::isLoggingEnabled())
+            NSLog(@&quot;[WebView _clearBackForwardCache] %@ empty cache\n&quot;, (didClearBFCache ? @&quot;DID&quot; : @&quot;did NOT&quot;));
+    });
+}
+
+- (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-&gt;tree().traverseNext()) {
+        FrameView* coreView = frame ? frame-&gt;view() : 0;
+        if (!coreView)
+            continue;
+
+        // Get the GraphicsLayer for this widget.
+        GraphicsLayer* layerForWidget = coreView-&gt;graphicsLayerForPlatformWidget(pluginView);
+        if (!layerForWidget)
+            continue;
+        
+        if (layerForWidget-&gt;contentsLayerForMedia() != layer) {
+            layerForWidget-&gt;setContentsToMedia(layer);
+            // We need to make sure the layer hierachy change is applied immediately.
+            if (mainCoreFrame-&gt;view())
+                mainCoreFrame-&gt;view()-&gt;flushCompositingStateIncludingSubframes();
+            return YES;
+        }
+    }
+#endif
+    return NO;
+}
+
+- (void)_setNeedsUnrestrictedGetMatchedCSSRules:(BOOL)flag
+{
+    if (_private-&gt;page)
+        _private-&gt;page-&gt;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-&gt;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-&gt;backgroundColor isEqual:backgroundColor])
</span><span class="lines">@@ -2488,7 +3578,26 @@
</span><span class="cx"> {
</span><span class="cx">     return _private-&gt;backgroundColor;
</span><span class="cx"> }
</span><ins>+#else
+- (void)setBackgroundColor:(CGColorRef)backgroundColor
+{
+   if (!backgroundColor || CFEqual(_private-&gt;backgroundColor, backgroundColor))
+        return;
</ins><span class="cx"> 
</span><ins>+    CFTypeRef old = _private-&gt;backgroundColor;
+    CFRetain(backgroundColor);
+    _private-&gt;backgroundColor = backgroundColor;
+    CFRelease(old);
+
+    [[self mainFrame] _updateBackgroundAndUpdatesWhileOffscreen];
+}
+
+- (CGColorRef)backgroundColor
+{
+    return _private-&gt;backgroundColor;
+}
+#endif
+
</ins><span class="cx"> - (BOOL)defersCallbacks
</span><span class="cx"> {
</span><span class="cx">     if (!_private-&gt;page)
</span><span class="lines">@@ -2503,6 +3612,131 @@
</span><span class="cx">     return _private-&gt;page-&gt;setDefersLoading(defer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (BOOL)_isStopping
+{
+    return _private-&gt;isStopping;
+}
+
+- (BOOL)_isClosing
+{
+    return _private-&gt;closing;
+}
+
++ (NSArray *)_productivityDocumentMIMETypes
+{
+#if USE(QUICK_LOOK)
+    return [QLPreviewGetSupportedMIMETypesSet() allObjects];
+#else
+    return nil;
+#endif
+}
+
+- (void)_setAllowsMessaging:(BOOL)aFlag
+{
+    _private-&gt;allowsMessaging = aFlag;
+}
+
+- (BOOL)_allowsMessaging
+{
+    return _private-&gt;allowsMessaging;
+}
+
+- (void)_setNetworkStateIsOnline:(BOOL)isOnLine
+{
+    WebThreadRun(^{
+        networkStateNotifier().setIsOnLine(isOnLine);
+    });
+}
+
+- (void)_setFixedLayoutSize:(CGSize)size
+{
+    ASSERT(WebThreadIsLocked());
+    _private-&gt;fixedLayoutSize = size;
+    if (Frame* mainFrame = core([self mainFrame])) {
+        IntSize newSize(size);
+        mainFrame-&gt;view()-&gt;setFixedLayoutSize(newSize);
+        mainFrame-&gt;view()-&gt;setUseFixedLayout(!newSize.isEmpty());
+        [self setNeedsDisplay:YES];
+    }
+}
+
+- (CGSize)_fixedLayoutSize
+{
+    return _private-&gt;fixedLayoutSize;
+}
+
+- (void)_synchronizeCustomFixedPositionLayoutRect
+{
+    ASSERT(WebThreadIsLocked());
+
+    IntRect newRect;
+    {
+        MutexLocker locker(_private-&gt;pendingFixedPositionLayoutRectMutex);
+        if (CGRectIsNull(_private-&gt;pendingFixedPositionLayoutRect))
+            return;
+        newRect = enclosingIntRect(_private-&gt;pendingFixedPositionLayoutRect);
+        _private-&gt;pendingFixedPositionLayoutRect = CGRectNull;
+    }
+
+    if (Frame* mainFrame = core([self mainFrame]))
+        mainFrame-&gt;view()-&gt;setCustomFixedPositionLayoutRect(newRect);
+}
+
+- (void)_setCustomFixedPositionLayoutRectInWebThread:(CGRect)rect synchronize:(BOOL)synchronize
+{
+    {
+        MutexLocker locker(_private-&gt;pendingFixedPositionLayoutRectMutex);
+        _private-&gt;pendingFixedPositionLayoutRect = rect;
+    }
+    if (!synchronize)
+        return;
+    WebThreadRun(^{
+        [self _synchronizeCustomFixedPositionLayoutRect];
+    });
+}
+
+- (void)_setCustomFixedPositionLayoutRect:(CGRect)rect
+{
+    ASSERT(WebThreadIsLocked());
+    {
+        MutexLocker locker(_private-&gt;pendingFixedPositionLayoutRectMutex);
+        _private-&gt;pendingFixedPositionLayoutRect = rect;
+    }
+    [self _synchronizeCustomFixedPositionLayoutRect];
+}
+
+- (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect
+{
+    MutexLocker locker(_private-&gt;pendingFixedPositionLayoutRectMutex);
+    if (CGRectIsNull(_private-&gt;pendingFixedPositionLayoutRect))
+        return false;
+
+    *rect = _private-&gt;pendingFixedPositionLayoutRect;
+    _private-&gt;pendingFixedPositionLayoutRect = CGRectNull;
+    return true;
+}
+
+- (void)_viewGeometryDidChange
+{
+    ASSERT(WebThreadIsLocked());
+    
+    if (Frame* coreFrame = [self _mainCoreFrame])
+        coreFrame-&gt;viewportOffsetChanged(Frame::IncrementalScrollOffset);
+}
+
+- (void)_overflowScrollPositionChangedTo:(CGPoint)offset forNode:(DOMNode *)domNode isUserScroll:(BOOL)userScroll
+{
+    // Find the frame
+    Node* node = core(domNode);
+    Frame* frame = node-&gt;document().frame();
+    if (!frame)
+        return;
+
+    frame-&gt;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-&gt;page)
</span><span class="cx">         return;
</span><span class="cx">     _private-&gt;page-&gt;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-&gt;page-&gt;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-&gt;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 &amp;&amp; _private-&gt;page)
</span><ins>+#if PLATFORM(IOS)
+        _private-&gt;page-&gt;focusController().setActive([[self window] isKeyWindow]);
+#else
</ins><span class="cx">         _private-&gt;page-&gt;focusController().setActive([[self window] _hasKeyAppearance]);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Vector&lt;String&gt; toStringVector(NSArray* patterns)
</span><span class="lines">@@ -3006,6 +4250,7 @@
</span><span class="cx">         view-&gt;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-&gt;setFixedLayoutSize(IntSize(size));
</span><span class="cx">     view-&gt;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-&gt;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-&gt;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-&gt;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-&gt;page-&gt;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-&gt;_fixedPositionContent : nil;
+}
+
+- (void)_documentScaleChanged
+{
+    if (WebNodeHighlight *currentHighlight = [self currentNodeHighlight])
+        [currentHighlight setNeedsDisplay];
+
+    if (_private-&gt;indicateLayer) {
+        [_private-&gt;indicateLayer setNeedsLayout];
+        [_private-&gt;indicateLayer setNeedsDisplay];
+    }
+}
+
+- (BOOL)_wantsTelephoneNumberParsing
+{
+    if (!_private-&gt;page)
+        return NO;
+    return _private-&gt;page-&gt;settings().telephoneNumberParsingEnabled();
+}
+
+- (void)_setWantsTelephoneNumberParsing:(BOOL)flag
+{
+    if (_private-&gt;page)
+        _private-&gt;page-&gt;settings().setTelephoneNumberParsingEnabled(flag);
+}
+
+- (BOOL)_webGLEnabled
+{
+    if (!_private-&gt;page)
+        return NO;
+    return _private-&gt;page-&gt;settings().webGLEnabled();
+}
+
+- (void)_setWebGLEnabled:(BOOL)enabled
+{
+    if (_private-&gt;page)
+        _private-&gt;page-&gt;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-&gt;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(&amp;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 &gt;= 1090
</del><ins>+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 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-&gt;pluginDatabase)
</span><span class="cx">         return [_private-&gt;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-&gt;pluginDatabase)
</span><span class="cx">         return [_private-&gt;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-&gt;pluginDatabase)
</span><span class="cx">         return [_private-&gt;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-&gt;pluginDatabase)
</span><span class="lines">@@ -3510,6 +4902,7 @@
</span><span class="cx">     if (_private-&gt;pluginDatabase)
</span><span class="cx">         [_private-&gt;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-&gt;pluginDatabase &amp;&amp; [_private-&gt;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: &lt;rdar://problem/7961656&gt; +[WebView canShowMIMETypeAsHTML:] regressed significantly in iOS 4.0
+    // Fast path for the common case to avoid creating the MIME type registry.
+    if ([MIMEType isEqualToString:@&quot;text/html&quot;])
+        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:@&quot;decoder&quot;];
</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:@&quot;frame&quot;]);
</span><span class="cx">         NSValue *frameValue = [arguments objectForKey:@&quot;frame&quot;];
</span><span class="cx">         NSRect frame = (frameValue ? [frameValue rectValue] : NSZeroRect);
</span><span class="cx">         NSString *frameName = [arguments objectForKey:@&quot;frameName&quot;];
</span><span class="cx">         NSString *groupName = [arguments objectForKey:@&quot;groupName&quot;];
</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 &amp;&amp; !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, &quot;FrameName = %@, GroupName = %@, useBackForwardList = %d\n&quot;, [[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-&gt;_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-&gt;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) &amp;&amp; USE(ACCELERATED_COMPOSITING)
+    if (_private-&gt;layerFlushController) {
+        _private-&gt;layerFlushController-&gt;invalidate();
+        _private-&gt;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-&gt;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 = @&quot;NSWindowDidChangeBackingPropertiesNotification&quot;;
</span><span class="cx"> static NSString * const backingPropertyOldScaleFactorKey = @&quot;NSBackingPropertyOldScaleFactorKey&quot;; 
</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-&gt;page-&gt;setCanStartMedia(true);
</span><span class="cx">         _private-&gt;page-&gt;didMoveOnscreen();
</span><span class="cx">         _private-&gt;page-&gt;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-&gt;page-&gt;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 &amp;&amp; _private-&gt;page)
</span><span class="lines">@@ -3944,7 +5384,30 @@
</span><span class="cx"> 
</span><span class="cx">     _private-&gt;page-&gt;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-&gt;page-&gt;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-&gt;UIDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+    [_private-&gt;UIDelegateForwarder clearTarget];
+#endif
</ins><span class="cx">     [_private-&gt;UIDelegateForwarder release];
</span><span class="cx">     _private-&gt;UIDelegateForwarder = nil;
</span><span class="cx"> }
</span><span class="lines">@@ -4004,8 +5470,25 @@
</span><span class="cx">     return _private-&gt;UIDelegate;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (id)_resourceLoadDelegateForwarder
+{
+    if (_private-&gt;closing)
+        return nil;
+
+    if (!_private-&gt;resourceProgressDelegateForwarder)
+        _private-&gt;resourceProgressDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self resourceLoadDelegate] defaultTarget:[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate]];
+    return _private-&gt;resourceProgressDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)setResourceLoadDelegate: delegate
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    [_private-&gt;resourceProgressDelegateForwarder clearTarget];
+    [_private-&gt;resourceProgressDelegateForwarder release];
+    _private-&gt;resourceProgressDelegateForwarder = nil;
+#endif
</ins><span class="cx">     _private-&gt;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-&gt;policyDelegate = delegate;
</span><ins>+#if PLATFORM(IOS)
+    [_private-&gt;policyDelegateForwarder clearTarget];
+#endif
</ins><span class="cx">     [_private-&gt;policyDelegateForwarder release];
</span><span class="cx">     _private-&gt;policyDelegateForwarder = nil;
</span><span class="cx"> }
</span><span class="lines">@@ -4038,17 +5524,35 @@
</span><span class="cx">     return _private-&gt;policyDelegate;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (id)_frameLoadDelegateForwarder
+{
+    if (_private-&gt;closing)
+        return nil;
+
+    if (!_private-&gt;frameLoadDelegateForwarder)
+        _private-&gt;frameLoadDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:[self frameLoadDelegate] defaultTarget:[WebDefaultFrameLoadDelegate sharedFrameLoadDelegate]];
+    return _private-&gt;frameLoadDelegateForwarder;
+}
+#endif
+
</ins><span class="cx"> - (void)setFrameLoadDelegate:delegate
</span><span class="cx"> {
</span><span class="cx">     // &lt;rdar://problem/6950660&gt; - 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-&gt;frameLoadDelegate release];
</span><span class="cx">     }
</span><del>-    
</del><ins>+#else
+    [_private-&gt;frameLoadDelegateForwarder clearTarget];
+    [_private-&gt;frameLoadDelegateForwarder release];
+    _private-&gt;frameLoadDelegateForwarder = nil;
+#endif
+
</ins><span class="cx">     _private-&gt;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-&gt;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-&gt;page-&gt;goBack();
</span><ins>+#if PLATFORM(IOS)
+    WebThreadRun(^{
+        _private-&gt;page-&gt;goBack();
+    });
+    // FIXME: &lt;rdar://problem/9157572&gt; -[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-&gt;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-&gt;page-&gt;goForward();
</span><ins>+#if PLATFORM(IOS)
+    WebThreadRun(^{
+        _private-&gt;page-&gt;goForward();
+    });
+    // FIXME: &lt;rdar://problem/9157572&gt; -[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 (&lt;rdar://problems/5103720&amp;4616860&gt;) 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 &amp;&amp; !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-&gt;tree().traverseNext(coreFrame))
</span><span class="cx">         [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow];
</span><span class="cx">     if (_private-&gt;hostWindow &amp;&amp; [self window] != _private-&gt;hostWindow)
</span><span class="cx">         [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_private-&gt;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-&gt;hostWindow release];
</span><span class="cx">     _private-&gt;hostWindow = [hostWindow retain];
</span><span class="cx">     for (Frame* frame = coreFrame; frame; frame = frame-&gt;tree().traverseNext(coreFrame))
</span><span class="cx">         [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow];
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     _private-&gt;page-&gt;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] &amp;&amp; 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-&gt;becomingFirstResponder = YES;
</span><span class="cx">         _private-&gt;becomingFirstResponderFromOutside = fromOutside;
</span><span class="cx">         [window makeFirstResponder:mainFrameView];
</span><span class="cx">         _private-&gt;becomingFirstResponderFromOutside = NO;
</span><span class="cx">         _private-&gt;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-&gt;page-&gt;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 &lt;WebDocumentView&gt; *documentView = [[[self _selectedOrMainFrame] frameView] documentView];
</span><span class="lines">@@ -4669,6 +6206,7 @@
</span><span class="cx">         page-&gt;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 *)@&quot;&quot;;
</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-&gt;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-&gt;page)
+#else
</ins><span class="cx">     if (!_private-&gt;page || _private-&gt;page-&gt;defersLoading())
</span><ins>+#endif
</ins><span class="cx">         return NO;
</span><span class="cx"> 
</span><span class="cx">     return !!_private-&gt;page-&gt;backForwardClient()-&gt;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-&gt;page)
+#else
</ins><span class="cx">     if (!_private-&gt;page || _private-&gt;page-&gt;defersLoading())
</span><ins>+#endif
</ins><span class="cx">         return NO;
</span><span class="cx"> 
</span><span class="cx">     return !!_private-&gt;page-&gt;backForwardClient()-&gt;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-&gt;isStopping = true;
+        WebThreadSetShouldYield();
+    }
+    WebThreadRun(^{
+        _private-&gt;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() &amp;&amp; !WebThreadIsLocked()) {
+        _private-&gt;isStopping = true;
+        WebThreadSetShouldYield();
+    }
+    WebThreadRun(^{
+        _private-&gt;isStopping = false;
+
+        WebFrame *frame = [self mainFrame];
+        [frame stopLoading];
+        core(frame)-&gt;document()-&gt;loader()-&gt;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 &amp;&amp; mode)
</span><span class="cx">         core(self)-&gt;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 &lt;WebDocumentSearching&gt; *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-&gt;mainFrameDocumentReady == mainFrameDocumentReady)
</span><span class="cx">         return;
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">     [self _willChangeValueForKey:_WebMainFrameDocumentKey];
</span><span class="cx">     _private-&gt;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-&gt;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-&gt;script().globalObject(mainThreadNormalWorld())-&gt;globalExec());
</span><span class="cx">     return aeDescFromJSValue(coreFrame-&gt;script().globalObject(mainThreadNormalWorld())-&gt;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-&gt;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)-&gt;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 &lt;rdar://problem/4985321&gt; - 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) &amp;&amp; [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@&quot;com.apple.Aperture&quot;])
</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 &amp;&amp; [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-&gt;hasSpellCheckerDocumentTag) {
</span><span class="lines">@@ -5684,17 +7317,22 @@
</span><span class="cx">     }
</span><span class="cx">     return _private-&gt;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-&gt;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-&gt;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-&gt;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 &gt;= 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 &gt;= 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 &gt;= 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 &gt;= 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 (&lt;rdar://problem/11779846&gt;): Avoiding jettisoning should not have to require reducing the page cache capacity.
+        // Reducing the capacity by 1 reduces overall back-forward performance.
+        if (pageCacheCapacity &gt; 0)
+            pageCacheCapacity -= 1;
+        prefValue = [preferences _pageCacheSize];
+        if (prefValue &gt;= 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 &gt;= 512)
</span><span class="cx">             cacheTotalCapacity = 32 * 1024 * 1024;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+        prefValue = [preferences _objectCacheSize];
+        if (prefValue &gt;= 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 &gt;= 1024)
+            nsurlCacheMemoryCapacity = 16 * 1024 * 1024;
+        else
+            nsurlCacheMemoryCapacity = 8 * 1024 * 1024;
+        
+        prefValue = [preferences _NSURLMemoryCacheSize];
+        if (prefValue &gt;= 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 &gt;= 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 &gt;= 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 &gt;= 0)
+            nsurlCacheDiskCapacity = prefValue;
+
+        // TileCache layer pool capacity, in bytes.
+        if (memSize &gt;= 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()-&gt;setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
</span><span class="cx">     memoryCache()-&gt;setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
</span><span class="cx">     pageCache()-&gt;setCapacity(pageCacheCapacity);
</span><ins>+#if PLATFORM(IOS)
+    pageCache()-&gt;setShouldClearBackingStores(true);
+    nsurlCacheMemoryCapacity = std::max(nsurlCacheMemoryCapacity, [nsurlCache memoryCapacity]);
+    CFURLCacheRef cfCache;
+    if ([nsurlCache respondsToSelector:@selector(_CFURLCache)] &amp;&amp; (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 &lt; [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-&gt;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-&gt;_keyboardUIMode = (mode &amp; 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-&gt;preferences tabsToLinks])
</span><span class="cx">         _private-&gt;_keyboardUIMode = (KeyboardUIMode)(_private-&gt;_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-&gt;_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-&gt;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-&gt;closing)
+        return;
+#endif
+
</ins><span class="cx">     if (!_private-&gt;layerFlushController)
</span><span class="cx">         _private-&gt;layerFlushController = LayerFlushController::create(self);
</span><span class="cx">     _private-&gt;layerFlushController-&gt;scheduleLayerFlush();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+- (void)_scheduleLayerFlushForPendingTileCacheRepaint
+{
+    Frame* coreFrame = [self _mainCoreFrame];
+    if (FrameView* view = coreFrame-&gt;view())
+        view-&gt;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) &amp;&amp; !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-&gt;fullscreenController = nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // ENABLE(VIDEO) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx"> 
</span><del>-#if ENABLE(FULLSCREEN_API)
</del><ins>+#if ENABLE(FULLSCREEN_API) &amp;&amp; !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-&gt;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 &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebCaretChangeListener.h&quot;
+#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 &lt;WebCaretChangeListener&gt; _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&lt;unsigned long, RetainPtr&lt;id&gt;&gt; identifierMap;
</span><span class="cx"> 
</span><span class="lines">@@ -195,7 +240,9 @@
</span><span class="cx">     RefPtr&lt;LayerFlushController&gt; 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&lt;WebCore::AlternativeTextUIController&gt; 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 &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;WebGeolocationProviderIOS.h&quot;
+#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) &amp;&amp; defined(__cplusplus)
</del><ins>+#if ENABLE(VIDEO) &amp;&amp; !PLATFORM(IOS) &amp;&amp; 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) &amp;&amp; defined(__cplusplus)
</del><ins>+#if ENABLE(FULLSCREEN_API) &amp;&amp; !PLATFORM(IOS) &amp;&amp; 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>