summaryrefslogtreecommitdiffstats
path: root/WebKit/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac')
-rw-r--r--WebKit/mac/ChangeLog1359
-rw-r--r--WebKit/mac/Configurations/FeatureDefines.xcconfig14
-rw-r--r--WebKit/mac/Configurations/Version.xcconfig2
-rw-r--r--WebKit/mac/History/WebHistory.mm29
-rw-r--r--WebKit/mac/MigrateHeaders.make1
-rw-r--r--WebKit/mac/Misc/WebDownload.mm5
-rw-r--r--WebKit/mac/Misc/WebNSFileManagerExtras.m12
-rw-r--r--WebKit/mac/Misc/WebNSURLExtras.h11
-rw-r--r--WebKit/mac/Misc/WebNSURLExtras.mm61
-rw-r--r--WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h8
-rw-r--r--WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm39
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h3
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm60
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm26
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm5
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs6
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm10
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.h6
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm48
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm8
-rw-r--r--WebKit/mac/Plugins/WebPluginContainerCheck.mm3
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h7
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm31
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h6
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm88
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationMock.mm60
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h33
-rw-r--r--WebKit/mac/WebCoreSupport/WebInspectorClient.mm7
-rw-r--r--WebKit/mac/WebCoreSupport/WebPluginHalterClient.h42
-rw-r--r--WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm44
-rw-r--r--WebKit/mac/WebCoreSupport/WebViewFactory.mm142
-rw-r--r--WebKit/mac/WebInspector/WebInspector.mm8
-rw-r--r--WebKit/mac/WebInspector/WebInspectorPrivate.h35
-rw-r--r--WebKit/mac/WebKit.exp2
-rw-r--r--WebKit/mac/WebKitPrefix.h4
-rw-r--r--WebKit/mac/WebView/WebDelegateImplementationCaching.h13
-rw-r--r--WebKit/mac/WebView/WebDelegateImplementationCaching.mm18
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.h2
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.mm66
-rw-r--r--WebKit/mac/WebView/WebFrame.mm9
-rw-r--r--WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h39
-rw-r--r--WebKit/mac/WebView/WebFramePrivate.h2
-rw-r--r--WebKit/mac/WebView/WebFrameView.mm2
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm87
-rw-r--r--WebKit/mac/WebView/WebHTMLViewInternal.h3
-rw-r--r--WebKit/mac/WebView/WebHistoryDelegate.h42
-rw-r--r--WebKit/mac/WebView/WebJSPDFDoc.h30
-rw-r--r--WebKit/mac/WebView/WebJSPDFDoc.mm76
-rw-r--r--WebKit/mac/WebView/WebNavigationData.h46
-rw-r--r--WebKit/mac/WebView/WebNavigationData.mm108
-rw-r--r--WebKit/mac/WebView/WebPDFDocumentExtras.h32
-rw-r--r--WebKit/mac/WebView/WebPDFDocumentExtras.mm141
-rw-r--r--WebKit/mac/WebView/WebPDFRepresentation.h2
-rw-r--r--WebKit/mac/WebView/WebPDFRepresentation.mm (renamed from WebKit/mac/WebView/WebPDFRepresentation.m)51
-rw-r--r--WebKit/mac/WebView/WebPolicyDelegatePrivate.h2
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h5
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm61
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h19
-rw-r--r--WebKit/mac/WebView/WebScriptDebugger.mm7
-rw-r--r--WebKit/mac/WebView/WebTextCompletionController.mm7
-rw-r--r--WebKit/mac/WebView/WebUIDelegatePrivate.h6
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenController.h64
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenController.mm444
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h61
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm583
-rw-r--r--WebKit/mac/WebView/WebView.mm203
-rw-r--r--WebKit/mac/WebView/WebViewData.h9
-rw-r--r--WebKit/mac/WebView/WebViewData.mm3
-rw-r--r--WebKit/mac/WebView/WebViewInternal.h11
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h48
-rw-r--r--WebKit/mac/WebView/WebWindowAnimation.h59
-rw-r--r--WebKit/mac/WebView/WebWindowAnimation.m239
-rw-r--r--WebKit/mac/Workers/WebWorkersPrivate.h37
-rw-r--r--WebKit/mac/Workers/WebWorkersPrivate.mm46
74 files changed, 4709 insertions, 199 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index e35709c..63c888a 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,1362 @@
+2009-10-07 Simon Fraser <simon.fraser@apple.com>
+
+ Re-land 49269-49271 since reverting them did not fix the tests.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+
+2009-10-07 Simon Fraser <simon.fraser@apple.com>
+
+ Revert 49269-49271 to see if it fixes test failures on SnowLeopard that do not
+ reproduce locally.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+
+2009-10-07 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Factor PolicyChecker out of FrameLoader
+ https://bugs.webkit.org/show_bug.cgi?id=30155
+
+ Move the policy callback to the policy object.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchWillSubmitForm):
+ (WebFrameLoaderClient::receivedPolicyDecison):
+
+2009-10-07 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Send title changes to the global history delegate.
+ <rdar://problem/7285293> and https://webkit.org/b/29904
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::setTitle):
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebHistoryDelegate.h:
+ * WebView/WebView.mm:
+ (-[WebView _cacheHistoryDelegateImplementations]):
+
+2009-10-07 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ Make the setMetadataURL function foolproof by having it remove user info
+ https://bugs.webkit.org/show_bug.cgi?id=30178
+ rdar://problem/6544670
+
+ * Misc/WebNSFileManagerExtras.m:
+ (-[NSFileManager _webkit_setMetadataURL:referrer:atPath:]):
+ Call _web_URLByRemovingUserInfo on the passed in URL string after converting
+ it to a URL, and then convert it back to a string.
+
+ * Misc/WebNSURLExtras.h: Added _web_URLByRemovingUserInfo.
+ * Misc/WebNSURLExtras.mm: Removed unused WebKitURLComponents struct.
+ (-[NSURL _web_URLByTruncatingOneCharacterBeforeComponent:]): Renamed to be
+ clearer on what this does.
+ (-[NSURL _webkit_URLByRemovingFragment]): Changed to call new name.
+ (-[NSURL _webkit_URLByRemovingResourceSpecifier]): Ditto.
+ (-[NSURL _web_URLByRemovingComponentAndSubsequentCharacter:]): Added.
+ (-[NSURL _web_URLByRemovingUserInfo]): Added.
+
+2009-10-07 Simon Fraser <simon.fraser@apple.com>
+
+ Make Dan Bernstein happy.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+
+2009-10-07 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Avoid Obj-C message dispatch when possible by storing accessed objects
+ in local variables.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+
+2009-10-07 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Animation stalls for a few seconds partway through
+ https://bugs.webkit.org/show_bug.cgi?id=30182
+
+ Make sure that we only call -disableScreenUpdatesUntilFlush when a window
+ update is actually going to happen, otherwise screen updates are disabled
+ for too long.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+
+2009-10-06 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: default to an attached inspector window on Windows (as on Mac).
+
+ https://bugs.webkit.org/show_bug.cgi?id=30134
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (-[WebInspectorWindowController showWindow:]):
+
+2009-10-06 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move FrameLoader::canLoad to SecurityOrigin
+ https://bugs.webkit.org/show_bug.cgi?id=30111
+
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream):
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::loadRequest):
+ * Plugins/WebBaseNetscapePluginStream.mm:
+ (WebNetscapePluginStream::WebNetscapePluginStream):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
+ * Plugins/WebPluginContainerCheck.mm:
+ (-[WebPluginContainerCheck _isForbiddenFileLoad]):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _allowsFollowingLink:]):
+
+2009-10-06 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move setLocalLoadPolicy and friends to SecurityOrigin
+ https://bugs.webkit.org/show_bug.cgi?id=30110
+
+ Call the new API.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+
+2009-10-06 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ accessibility/media-element.html crashes (and has incorrect result)
+ https://bugs.webkit.org/show_bug.cgi?id=30108
+
+ Fix up the accessibilty label for the newly added fullscreen button,
+ and update the test result accordingly.
+
+ * WebCoreSupport/WebViewFactory.mm:
+ (-[WebViewFactory localizedMediaControlElementString:]):
+ Handle "ControlsPanel" which is just an empty container, to avoid
+ asserting in debug builds.
+
+2009-10-06 Daniel Bates <dbates@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30107
+
+ Fixes an issue where the Mac build does return the correct drop effect
+ with respect to the HTML 5 specification when effectAllowed == "none".
+
+ Currently, when effectAllowed == "none" and dropEffect == "copy" or
+ dropEffect == "move" the resulting drop effect is "copy" and "move",
+ respectively. However, the HTML 5 specification states that regardless
+ of the specified dropEffect, when effectAllowed == "none" the resulting
+ drop effect should be "none".
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView draggingSourceOperationMaskForLocal:]):
+
+2009-10-06 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: close inspector client view on
+ InspectorController::close API call.
+
+ In order to run batch web inspector layout tests (and not affect
+ subsequent tests) we should close inspector client's view upon
+ InspectorController::close API call.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30009
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::createPage):
+
+2009-10-05 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Moved a WebPluginHalterClient out of the WebCore namesapce.
+
+ * WebCoreSupport/WebPluginHalterClient.h:
+
+2009-10-05 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Added new PluginHalter client, delegate and few more WebPreferences keys.
+
+ * WebView/WebPreferenceKeysPrivate.h: Added two new keys.
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]): Initialize newly added key.
+ (-[WebPreferences pluginAllowedRunTime]): Added.
+ (-[WebPreferences setPluginAllowedRunTime:]): Added.
+ * WebView/WebPreferencesPrivate.h: Added above two methods.
+ * WebView/WebUIDelegatePrivate.h: Added shouldHaltPlugin delegate.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ Setup a new WebPluginHalterClient.
+ (-[WebView _preferencesChangedNotification:]): Update WebCore settings accordingly.
+ * WebCoreSupport/WebPluginHalterClient.h: Added.
+ * WebCoreSupport/WebPluginHalterClient.mm: Added.
+ (WebPluginHalterClient::WebPluginHalterClient):
+ (WebPluginHalterClient::shouldHaltPlugin): Added, invoke the delegate.
+
+2009-10-05 Simon Fraser <simon.fraser@apple.com>
+
+ More build fixes for Tiger.
+
+ * WebView/WebVideoFullscreenController.mm:
+
+2009-10-05 Simon Fraser <simon.fraser@apple.com>
+
+ More build fixes for Tiger.
+
+ * WebView/WebVideoFullscreenController.mm:
+ (-[WebVideoFullscreenWindow animationDidEnd:]):
+ * WebView/WebWindowAnimation.m:
+
+2009-10-05 Simon Fraser <simon.fraser@apple.com>
+
+ More build fixes for Tiger.
+
+ * WebView/WebVideoFullscreenController.mm:
+ * WebView/WebVideoFullscreenHUDWindowController.mm:
+ (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
+ (-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]):
+ (-[WebVideoFullscreenHUDWindowController fadeWindowIn]):
+ (-[WebVideoFullscreenHUDWindowController fadeWindowOut]):
+ (-[WebVideoFullscreenHUDWindowController closeWindow]):
+
+2009-10-05 Simon Fraser <simon.fraser@apple.com>
+
+ Build fixes for Tiger.
+
+ * WebView/WebVideoFullscreenHUDWindowController.h:
+ * WebView/WebVideoFullscreenHUDWindowController.mm:
+ (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
+ (-[WebVideoFullscreenHUDWindowController dealloc]):
+ (-[WebVideoFullscreenHUDWindowController closeWindow]):
+ (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
+
+2009-10-05 Simon Fraser <simon.fraser@apple.com>
+
+ Build fix. If you call Node::hasTagName(), you also have to include Element.h.
+
+ * WebCoreSupport/WebChromeClient.mm:
+
+2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org>
+
+ Reviewed by Simon Fraser
+
+ Support fullscreen in MediaPlayer (Mac)
+ https://bugs.webkit.org/show_bug.cgi?id=26742
+
+ Add a fullscreen button to the <video> controller if the media engine,
+ and the theme have support for fullscreen, and can show appropriate controls.
+ Clicking the button calls through the ChromeClient to the WebVideoFullscreenController
+ in WebKit to do a nice animation to fullscreen, with a custom controller.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::supportsFullscreenForNode):
+ (WebChromeClient::enterFullscreenForNode):
+ (WebChromeClient::exitFullscreenForNode):
+ New methods to ask whether fullscreen is possible for a given node, and
+ notifications on enterying and exiting fullscreen.
+
+ * WebView/WebVideoFullscreenController.h: Added.
+ * WebView/WebVideoFullscreenController.mm: Added.
+ WebVideoFullscreenController is responsible for creating the fullscreen window,
+ and coordinating the various animations when going fullscreen.
+
+ * WebView/WebVideoFullscreenHUDWindowController.h: Added.
+ * WebView/WebVideoFullscreenHUDWindowController.mm: Added.
+ This class manages the heads-up display (HUD) control bar.
+
+ * WebView/WebView.mm:
+ (-[WebView _close]):
+ Make sure we come out of fullscreen if the WebView is torn down (e.g. if
+ you close a background window).
+
+ (-[WebView _enterFullscreenForNode:WebCore::]):
+ Make a WebVideoFullscreenController and tell is to start to go fullscreen.
+
+ (-[WebView _exitFullscreen]):
+ Tell the WebVideoFullscreenController to come out of fullscreen, and clean up.
+
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate dealloc]):
+ (-[WebViewPrivate finalize]):
+ * WebView/WebViewInternal.h:
+ Keep a pointer to the WebVideoFullscreenController.
+
+ * WebView/WebWindowAnimation.h: Added.
+ * WebView/WebWindowAnimation.m: Added.
+ (WebWindowAnimationDurationFromDuration):
+ (scaledRect):
+ (squaredDistance):
+ Handle the animations used during the transitition to fullscreen.
+
+2009-10-05 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ WebKit side of <rdar://problem/7179166>
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ Add an m_pluginIsWaitingForDraw member variable.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy):
+ Initialize m_pluginIsWaitingForDraw.
+
+ (WebKit::NetscapePluginInstanceProxy::invalidateRect):
+ Set m_pluginIsWaitingForDraw to true.
+
+ (WebKit::NetscapePluginInstanceProxy::didDraw):
+ If m_pluginIsWaitingForDraw is true, call _WKPHPluginInstanceDidDraw.
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView drawRect:]):
+ Call didDraw.
+
+ * Plugins/Hosted/WebKitPluginHost.defs:
+ Add PHPluginInstanceDidDraw.
+
+2009-10-02 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Add functionality to pause/throttle CSS transitions/animations in a WebView
+ https://bugs.webkit.org/show_bug.cgi?id=29942
+
+ Added both a setter and getter function
+
+ * WebView/WebView.mm:
+ (-[WebView cssAnimationsSuspended]):
+ (-[WebView setCSSAnimationsSuspended:]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate init]):
+ * WebView/WebViewPrivate.h:
+
+2009-10-04 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/7273363> Plug-ins should use PluginHalter
+
+ * Plugins/WebBaseNetscapePluginView.h: Add WebHaltablePlugin forward declare and _haltable ivar.
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (WebHaltablePlugin::WebHaltablePlugin): Added.
+ (WebHaltablePlugin::halt): New method that stops a plug-in.
+ (WebHaltablePlugin::restart): New method that starts a plug-in.
+ (WebHaltablePlugin::node): Added. Provides the DOMNode corresponding to the plug-in in WebBaseNetscapePluginView.
+ (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
+ Initialize new _haltable ivar.
+ (-[WebBaseNetscapePluginView start]): Call the page's didStartPlugin() upon starting a plug-in.
+ (-[WebBaseNetscapePluginView stop]): Call the page's didStopPlugin() upon stopping a plug-in.
+
+2009-10-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: add testing harness for Web Inspector.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30010
+
+ * WebInspector/WebInspector.mm:
+ (-[WebInspector evaluateInFrontend:callId:script:]):
+ * WebInspector/WebInspectorPrivate.h: Added.
+
+2009-10-04 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ * WebView/WebPreferenceKeysPrivate.h: Added new key.
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]): Leave plug-in halting disabled by default.
+ (-[WebPreferences pluginHalterEnabled]): Added.
+ (-[WebPreferences setPluginHalterEnabled:]): Ditto.
+ * WebView/WebPreferencesPrivate.h: Added above new methods.
+
+2009-10-02 Dave Hyatt <hyatt@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns.
+
+ * WebView/WebView.mm:
+ (toStringVector):
+ (+[WebView _addUserScriptToGroup:source:url:worldID:whitelist:blacklist:injectionTime:]):
+ (+[WebView _addUserStyleSheetToGroup:source:url:worldID:whitelist:blacklist:]):
+ * WebView/WebViewPrivate.h:
+
+2009-10-01 Mark Rowe <mrowe@apple.com>
+
+ Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-10-01 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Turn on ENABLE_3D_CANVAS in TOT
+ https://bugs.webkit.org/show_bug.cgi?id=29906
+
+ * Configurations/FeatureDefines.xcconfig:
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences webGLEnabled]):
+ (-[WebPreferences setWebGLEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]):
+
+2009-09-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for <rdar://problem/7259706>
+ Need WebKit API or SPI on Mac and Windows to test whether it's safe to load a page in a new tab/window
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _allowsFollowingLink:]):
+ * WebView/WebFramePrivate.h:
+
+2009-09-30 Dave Hyatt <hyatt@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add the ability to remove user stylesheets and scripts by URL.
+
+ * WebView/WebView.mm:
+ (+[WebView _removeUserContentFromGroup:url:worldID:]):
+ * WebView/WebViewPrivate.h:
+
+2009-09-29 Brady Eidson <beidson@apple.com>
+
+ Rubberstamped by Dan Bernstein.
+
+ Fix license and some sorting in new files.
+
+ * WebView/WebHistoryDelegate.h:
+ * WebView/WebNavigationData.h:
+ * WebView/WebNavigationData.mm:
+
+2009-09-29 Brady Eidson <beidson@apple.com>
+
+ Reviewed by John Sullivan.
+
+ WebKit Mac API should provide a delegate interface for global history.
+ <rdar://problem/7042773> and https://webkit.org/b/29904
+
+ * WebView/WebHistoryDelegate.h: Added. New interface for WebKit clients to implement to manage
+ their own global history store.
+
+ Object to store all of the bits of data relevant to a page visit:
+ * WebView/WebNavigationData.h: Added.
+ * WebView/WebNavigationData.mm: Added.
+ (-[WebNavigationDataPrivate dealloc]):
+ (-[WebNavigationData initWithURLString:title:originalRequest:response:hasSubstituteData:clientRedirectSource:]):
+ (-[WebNavigationData url]):
+ (-[WebNavigationData title]):
+ (-[WebNavigationData originalRequest]):
+ (-[WebNavigationData response]):
+ (-[WebNavigationData hasSubstituteData]):
+ (-[WebNavigationData clientRedirectSource]):
+ (-[WebNavigationData dealloc]):
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::updateGlobalHistory): If the delegate exists, don't use the built-in WebHistory.
+ If the implementation for this method exists, call it.
+ (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Ditto
+
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebDelegateImplementationCaching.mm:
+ (WebViewGetHistoryDelegateImplementations):
+ (CallHistoryDelegate):
+
+ * WebView/WebView.mm:
+ (-[WebView _cacheHistoryDelegateImplementations]):
+ (-[WebView setHistoryDelegate:]):
+ (-[WebView historyDelegate]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewPrivate.h:
+
+2009-09-29 Kenneth Russell <kbr@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add support for run-time flag for 3D canvas
+ https://bugs.webkit.org/show_bug.cgi?id=29826
+
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]): Enable experimental
+ WebGL flag when 3D_CANVAS is enabled in the build.
+
+2009-09-28 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add experimentalWebSocketsEnabled in WebPreferences.
+ https://bugs.webkit.org/show_bug.cgi?id=28941
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences experimentalWebSocketsEnabled]):
+ (-[WebPreferences setExperimentalWebSocketsEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]):
+
+2009-09-28 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/7240911> REGRESSION (r48586): Crash occurs when loading
+ a PDF
+
+ CGPDFObjectRef is not a CFTypeRef, and cannot be retained or released.
+ Its lifetime is managed by its container. Just use a Vector to store
+ CGPDFObjectRefs, relying on the CGPDFDocument to keep them alive.
+
+ * WebView/WebPDFDocumentExtras.mm:
+ (appendValuesInPDFNameSubtreeToVector):
+ (getAllValuesInPDFNameTree):
+ (web_PDFDocumentAllScripts):
+
+2009-09-24 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Reviewed by Alice Liu.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ Pass 0 for new Page constructor argument.
+
+2009-09-14 John Gregg <johnnyg@google.com>
+
+ Reviewed by Eric Seidel.
+
+ isEnabled switch for notifications (experimental) in Page Settings
+ https://bugs.webkit.org/show_bug.cgi?id=28930
+
+ Adds support for the experimentalNotificationsEnabled flag in Settings
+ through WebPreferencesPrivate.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences experimentalNotificationsEnabled]):
+ (-[WebPreferences setExperimentalNotificationsEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]):
+
+2009-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Updated for a WebCore rename.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _cacheabilityDictionary]):
+
+2009-09-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Speed up access to history items by caching date computation.
+
+ * History/WebHistory.mm:
+ (getDayBoundaries): Refactored from timeIntervalForBeginningOfDay.
+ Returns the beginning of the day that the passed time is within and
+ the beginning of the next day.
+ (beginningOfDay): Added. Uses getDayBoundaries so it can be fast for
+ multiple dates within the same day, which is the common case.
+ (dateKey): Added. Calls beginningOfDay and converts to an integer.
+ (-[WebHistoryPrivate findKey:forDay:]): Changed to call dateKey
+ insetad of timeIntervalForBeginningOfDay.
+
+2009-09-23 David Kilzer <ddkilzer@apple.com>
+
+ Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h
+
+ Reviewed by Mark Rowe.
+
+ * WebKitPrefix.h: Removed definition of
+ WTF_USE_PLUGIN_HOST_PROCESS.
+
+2009-09-22 Timothy Hatcher <timothy@apple.com>
+
+ Prevent scrolling multiple frames during latched wheel events.
+
+ Reviewed by Anders Carlsson.
+
+ * WebView/WebDynamicScrollBarsView.h:
+ * WebView/WebDynamicScrollBarsView.mm:
+ (-[WebDynamicScrollBarsView scrollWheel:]):
+
+2009-09-22 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by John Sullivan.
+
+ <rdar://problem/7240911> REGRESSION (r48586): Crash occurs when loading
+ a PDF
+
+ * WebView/WebPDFDocumentExtras.mm:
+ (addWebPDFDocumentExtras): Made methodList static, because
+ class_addMethods() doesn't copy it.
+
+2009-09-21 Dan Bernstein <mitz@apple.com>
+
+ Attempt to fix the Tiger build
+
+ * WebView/WebPDFDocumentExtras.mm:
+ (addWebPDFDocumentExtras):
+
+2009-09-21 Dan Bernstein <mitz@apple.com>
+
+ Attempt to fix the Tiger build
+
+ * WebView/WebPDFDocumentExtras.mm:
+ (web_PDFDocumentAllScripts):
+ (addWebPDFDocumentExtras):
+
+2009-09-21 Dan Bernstein <mitz@apple.com>
+
+ Attempt to fix the Tiger build
+
+ * WebView/WebPDFDocumentExtras.mm:
+ * WebView/WebPDFRepresentation.mm:
+
+2009-09-21 Dan Bernstein <mitz@apple.com>
+
+ Attempt to fix the Leopard and Tiger builds
+
+ * WebView/WebPDFDocumentExtras.mm:
+
+2009-09-21 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/4137135> iFrame with PDF not being handled correctly on
+ usps.com
+ https://bugs.webkit.org/show_bug.cgi?id=4151
+
+ * WebView/WebJSPDFDoc.h: Added.
+ * WebView/WebJSPDFDoc.mm: Added.
+ (jsPDFDocInitialize): Retains the WebDataSource.
+ (jsPDFDocFinalize): Releases the WebDataSource.
+ (jsPDFDocPrint): Call the WebUIDelegate method -webView:printFrameView:
+ with the PDF document's view.
+ (makeJSPDFDoc): Makes and returns a JavaScript Doc instance that wraps
+ the WebDataSource.
+ * WebView/WebPDFDocumentExtras.h: Added.
+ * WebView/WebPDFDocumentExtras.mm: Added.
+ (appendValuesInPDFNameSubtreeToArray): Traverses a subtree of a PDF name
+ tree and adds all values in the subtree to an array.
+ (allValuesInPDFNameTree): Returns an array with all of the values in a
+ PDF name tree.
+ (web_PDFDocumentAllScripts): This is the implementation of -[PDFDocument
+ _web_allScripts]. It gets all values in the document-level "JavaScript"
+ name tree, which are action dictionaries, and returns an array of the
+ actions' scripts.
+ (addWebPDFDocumentExtras): Adds the -_web_allScripts method to
+ PDFDocument.
+ * WebView/WebPDFRepresentation.h:
+ * WebView/WebPDFRepresentation.m: Removed.
+ * WebView/WebPDFRepresentation.mm: Copied from WebKit/mac/WebView/WebPDFRepresentation.m.
+ (+[WebPDFRepresentation initialize]): Added. Calls
+ addWebPDFDocumentExtras().
+ (-[WebPDFRepresentation finishedLoadingWithDataSource:]): Get the
+ scripts from the PDF document, create a JavaScript Doc object for the
+ document, and a JavaScript execution context, then execute every script
+ in the context, with the Doc object as "this".
+
+2009-09-17 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Compositing layers are incorrectly positioned after scrolling with position:fixed
+ https://bugs.webkit.org/show_bug.cgi?id=29262
+
+ When scrolling a page with compositing layers inside a position:fixed element,
+ we need to update the compositing layer positions when the scroll position changes.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _frameOrBoundsChanged]):
+ Call the new FrameView::scrollPositionChanged() method rather than sending the
+ scroll event directly.
+
+2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Make PlatformWindow return something else than PlatformWidget
+ https://bugs.webkit.org/show_bug.cgi?id=29085
+
+ Reflect the rename of platformWindow and it's return type.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::platformPageClient):
+
+2009-09-17 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/7007541>
+ CrashTracer: 4800+ crashes in Safari at com.apple.WebKit • WTF::HashTableIterator...
+
+ Add null checks for m_instanceProxy (It will be null when a plug-in has crashed).
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::invoke):
+ (WebKit::ProxyInstance::supportsInvokeDefaultMethod):
+ (WebKit::ProxyInstance::supportsConstruct):
+ (WebKit::ProxyInstance::getPropertyNames):
+ (WebKit::ProxyInstance::methodsNamed):
+ (WebKit::ProxyInstance::fieldNamed):
+ (WebKit::ProxyInstance::fieldValue):
+ (WebKit::ProxyInstance::setFieldValue):
+ (WebKit::ProxyInstance::invalidate):
+
+2009-09-16 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Work around a bug in AppKit on Leopard which causes compositing layers to jitter, and
+ become misplaced when the WebHTMLView is resized or scrolled sometimes.
+ <rdar://problem/7071636>
+
+ The previous fix didn't fix the case where the layers jiggle when resizing the docked
+ inspector when the view size is over 2048px tall, on Leopard.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateLayerHostingViewPosition]):
+
+2009-09-16 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Work around a bug in AppKit on Leopard which causes compositing layers to jitter, and
+ become misplaced when the WebHTMLView is resized or scrolled sometimes.
+ <rdar://problem/7071636>
+
+ We call an internal AppKit method to make sure the layer geometry is updated correctly.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateLayerHostingViewPosition]):
+
+2009-09-15 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fixed position elements flash when CSS transforms are applied on page > 2048px tall
+ https://bugs.webkit.org/show_bug.cgi?id=27272
+
+ Update the previous workaround for misplaced compositing layers, which used a 4096px
+ threshold, to 2048px since that's the GPU max texture size on some older hardware.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateLayerHostingViewPosition]):
+
+2009-09-15 Alex Milowski <alex@milowski.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Added the ENABLE_MATHML to the feaure defines
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-15 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/7224378> REGRESSION(r48360): Dragging a tab with a plug-in out of a window, the plug-in gets slow and confused
+
+ In r48360, the fix for <rdar://problem/7090444>, I neglected to consider the case where the plug-in had already been started and
+ -start would do an early-return rather than calling -restartTimers and -addWindowObservers itself.
+
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView viewDidMoveToWindow]): Reinstate the call to -restartTimers and -addWindowObservers, but guard them
+ with a check that the view is still in the window.
+
+2009-09-14 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Safari 4 cannot be used to update firmware on Linksys routers.
+ <rdar://problem/7174050> and https://bugs.webkit.org/show_bug.cgi?id=29160
+
+ Adopt the new WebCore::CredentialStorage in WebKit/Mac.
+
+ * Misc/WebDownload.mm:
+ (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (WebKit::getAuthenticationInfo):
+
+2009-09-12 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Fix <rdar://problem/7090444> Crashes in-[WebBaseNetscapePluginView stop] handling NSWindowWillCloseNotification.
+
+ It's not valid to call -addWindowObservers when the view is not in a window, but this can happen when -start
+ initializes a plug-in and the plug-in removes itself from the document during initialization. -viewDidMoveToWindow
+ calls -start and then calls -addWindowObservers without ensuring that the view is still in a window.
+
+ If -[WebBaseNetscapePluginView addWindowObservers] is incorrectly called when the view is not in a window, it will
+ observe NSWindowWillCloseNotification on all windows. This unexpected observer registration is not balanced by an
+ unregistration so the notification can be delivered after the view is deallocated, causing the crash seen in
+ <rdar://problem/7090444>.
+
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView start]): Only call -updateAndSetWindow if we still have a current window.
+ (-[WebBaseNetscapePluginView viewDidMoveToWindow]): Remove unnecessary calls to -restartTimers and -addWindowObservers
+ from -[WebBaseNetscapePluginView viewDidMoveToWindow]. They are already called from within -start with the extra benefit
+ of ensuring that the view is still in a window when they are called.
+
+2009-09-11 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Jon Honeycutt.
+
+ Fix <rdar://problem/7145242> Crashes inside WTF::HashTable below NetscapePluginInstanceProxy::disconnectStream
+
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::cancelLoad): Canceling the load can result in calling through to disconnectStream.
+ If the plug-in instance holds the last reference to the plug-in stream this will result in the stream being deallocated.
+ This leads to HostedNetscapePluginStream::cancelLoad's call to disconnectStream being passed a deallocated stream object.
+ Since the stream was already disconnected by the call to cancel there's no need to call disconnectStream a second time.
+
+2009-09-11 Eric Seidel <eric@webkit.org>
+
+ No review, rolling out r48229.
+ http://trac.webkit.org/changeset/48229
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _dragSourceMovedTo:]):
+
+2009-09-10 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Update JavaScriptCore and WebKit's FeatureDefines.xcconfig so that they are in sync with WebCore as they need to be.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-09 Jens Alfke <snej@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Initialize DataTransfer's effectAllowed and dropEffect properties correctly
+ according to HTML5 spec (sec. 7.9.2-7.9.3).
+ https://bugs.webkit.org/show_bug.cgi?id=26700
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _dragSourceMovedTo:]):
+ Pass current drag operation (if known) to EventHandler::dragSourceMovedTo().
+
+2009-09-09 Dave Hyatt <hyatt@apple.com>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29102, add support for user stylesheet injection. This is similar
+ to user script injection but allows for user stylesheets to be added. The stylesheets are applied immediately
+ to all Frames in the PageGroup.
+
+ Added userscripts/simple-stylesheet.html test case.
+
+ * WebView/WebView.mm:
+ (+[WebView _addUserStyleSheetToGroup:source:url:worldID:patterns:]):
+ * WebView/WebViewPrivate.h:
+
+2009-09-07 Steve Block <steveblock@google.com>
+
+ Reviewed by Adam Barth.
+
+ Adds a mock Geolocation service. This will be used to provide predictable behavior of the
+ Geolocation API for use in LayoutTests. Later changes will integrate the the mock
+ Geolocation service with DumpRenderTree.
+ https://bugs.webkit.org/show_bug.cgi?id=28264
+
+ * WebCoreSupport/WebGeolocationMockPrivate.h: Added.
+ * WebCoreSupport/WebGeolocationMock.mm: Added.
+ (+[WebGeolocationMock setError:code:]): Added. Used by DumpRender tree to configure the mock Geolocation service.
+ (+[WebGeolocationMock setPosition:latitude:longitude:accuracy:]): Added. Used by DumpRender tree to configure the mock Geolocation service.
+ * WebKit.exp: Modified. Exports WebGeolocationMock.
+
+2009-09-07 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Enable SHARED_WORKERS by default.
+ https://bugs.webkit.org/show_bug.cgi?id=28959
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-06 Cameron McCormack <cam@mcc.id.au>
+
+ Reviewed by Eric Seidel.
+
+ Drop <definition-src> support
+ https://bugs.webkit.org/show_bug.cgi?id=28991
+
+ * MigrateHeaders.make: Remove reference to ObjC definition-src
+ binding class.
+
+2009-09-04 Mark Mentovai <mark@chromium.org>
+
+ Reviewed by Dave Hyatt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28614
+
+ Account for scrollbar state changes that occur during layout.
+
+ * WebView/WebDynamicScrollBarsView.mm:
+ (-[WebDynamicScrollBarsView updateScrollers]):
+
+ Perform a layout prior to checking whether the scrollbar modes are
+ off, on, or automatic. The modes may change during layout.
+
+ * WebView/WebFrameView.mm:
+ (-[WebFrameView _install]):
+
+ Eliminate duplicated (and incorrect) scrollbar mode tracking between
+ FrameView and ScrollView.
+
+2009-09-03 Dave Hyatt <hyatt@apple.com>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28890, make simple user script injection work.
+
+ This patch adds new API for adding and removing user scripts from page groups. User scripts
+ are bundled together in isolated worlds (you can have multiple scripts together in the same
+ world).
+
+ Added userscripts/ directory for holding new tests (along with a simple test of script injection).
+
+ * WebView/WebView.mm:
+ (+[WebView _addUserScriptToGroup:source:url:worldID:patterns:injectionTime:]):
+ (+[WebView _removeUserContentFromGroup:worldID:]):
+ (+[WebView _removeAllUserContentFromGroup:]):
+ * WebView/WebViewPrivate.h:
+
+2009-09-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24696
+
+ Plumb mixed content notifications to WebFrameLoadDelegatePrivate.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didDisplayInsecureContent):
+ (WebFrameLoaderClient::didRunInsecureContent):
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebFrameLoadDelegatePrivate.h: Added.
+
+2009-09-03 Adam Barth <abarth@webkit.org>
+
+ Unreviewed build fix.
+
+ Change notImplemented() to a FIXME.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didDisplayInsecureContent):
+ (WebFrameLoaderClient::didRunInsecureContent):
+
+2009-09-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by eric@webkit.org.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24696
+
+ Plumb mixed content notifications to WebFrameLoadDelegatePrivate.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didDisplayInsecureContent):
+ (WebFrameLoaderClient::didRunInsecureContent):
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebFrameLoadDelegatePrivate.h: Added.
+
+2009-09-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24696
+
+ Stub implementations of mixed content methods of FrameLoaderClient.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didDisplayInsecureContent):
+ (WebFrameLoaderClient::didRunInsecureContent):
+
+2009-09-02 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ More partial work towards "Page Cache should support pages with Frames"
+ https://bugs.webkit.org/show_bug.cgi?id=13631
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _topHTMLView]): Rework the ASSERT in this method to reflect the
+ reality of calling this method for pages currently in the PageCache.
+
+2009-08-31 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reverting http://trac.webkit.org/changeset/47904, because it caused
+ layout test failure.
+
+2009-08-31 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28852
+ Rename KURL single argument constructor to avoid confusion
+
+ * WebView/WebScriptDebugger.mm: (toNSURL): Adapt to the change.
+
+2009-08-31 Mark Mentovai <mark@chromium.org>
+
+ Reviewed by Dave Hyatt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28614
+
+ Perform a layout prior to checking whether the scrollbar modes are
+ off, on, or automatic. The modes may change during layout.
+
+ * WebView/WebDynamicScrollBarsView.mm:
+ (-[WebDynamicScrollBarsView updateScrollers]):
+
+2009-08-28 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by John Sullivan.
+
+ update-webkit-localizable-strings script can no longer complete
+ https://bugs.webkit.org/show_bug.cgi?id=28792
+
+ * WebCoreSupport/WebViewFactory.mm:
+ (-[WebViewFactory AXARIAContentGroupText:]):
+
+2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25889
+ [GTK] scrollbar policy for main frame is not implementable
+
+ Add empty implementation for new ChromeClient method.
+
+ * WebCoreSupport/WebChromeClient.h:
+ (WebChromeClient::scrollbarsModeDidChange):
+
+2009-08-25 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <video> and <audio> controller should be accessible
+ https://bugs.webkit.org/show_bug.cgi?id=28081
+
+ * WebCoreSupport/WebViewFactory.mm:
+ (-[WebViewFactory localizedMediaControlElementString:]):
+ (-[WebViewFactory localizedMediaControlElementHelpText:]):
+ (-[WebViewFactory localizedMediaTimeDescription:]):
+ New.
+
+2009-08-24 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by NOBODY (build fix)
+
+ Turn off ENABLE_3D_CANVAS in the xconfig files.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-08-22 Adam Barth <abarth@webkit.org>
+
+ Revert 47684. We're going to do this later once clients have had a
+ chance to opt into the setting they like.
+
+ * Misc/WebKitVersionChecks.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+
+2009-08-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Don't let local files access web URLs
+ https://bugs.webkit.org/show_bug.cgi?id=28480
+
+ * Misc/WebKitVersionChecks.m:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+
+2009-08-21 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7162480>
+ Sometimes WebKit does not layout correctly when a WebView is embedded in an HICocoaView
+
+ Add a null check for the current context when reflectScrolledClipView: is called from outside a
+ draw operation.
+
+ * WebView/WebDynamicScrollBarsView.mm:
+ (-[WebDynamicScrollBarsView reflectScrolledClipView:]):
+
+2009-08-20 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Enable various "grouping" ARIA roles
+ https://bugs.webkit.org/show_bug.cgi?id=28486
+
+ * WebCoreSupport/WebViewFactory.mm:
+ (-[WebViewFactory AXARIAContentGroupText:]):
+
+2009-08-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fix <http://webkit.org/b/28484> Plug-in-related leaks seen on the build bot
+
+ When the plug-in data is being loaded manually there is a reference cycle between the
+ NetscapePluginInstanceProxy and the HostedNetscapePluginStream. We need to explicitly
+ break the reference cycle in NetscapePluginInstanceProxy::cleanup so that both objects
+ will be destroyed.
+
+ Take the opportunity to add RefCountedLeakCounter support to HostedNetscapePluginStream
+ and NetscapePluginInstanceProxy to simplify tracking down leaks of these objects in the future.
+
+ * Plugins/Hosted/HostedNetscapePluginStream.h:
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream):
+ (WebKit::HostedNetscapePluginStream::~HostedNetscapePluginStream):
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy):
+ (WebKit::NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy):
+ (WebKit::NetscapePluginInstanceProxy::cleanup): Clear m_manualStream to break the reference
+ cycle.
+
+2009-08-19 Aaron Boodman <aa@chromium.org>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to
+ specify a more granular policy for cross-origin XHR access.
+
+ * WebView/WebView.mm: Add SPI to manipulate origin access whitelists.
+ (+[WebView _whiteListAccessFromOrigin:destinationProtocol:destinationHost:allowDestinationSubdomains:]): Ditto.
+ (+[WebView _resetOriginAccessWhiteLists]): Ditto.
+ * WebView/WebViewPrivate.h: Ditto.
+
+2009-08-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Mac specific part of
+
+ <rdar://problem/7135588> HTMLMediaElement should ask WebPolicyLoadDelegate before loading resource
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ Implement shouldLoadMediaElementURL by asking the policy delegate.
+
+ * WebView/WebPolicyDelegatePrivate.h:
+ Add new delegate method, remove some unused cruft.
+
+2009-08-18 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Need to extend DumpRenderTree to expose number of worker threads.
+ https://bugs.webkit.org/show_bug.cgi?id=28292
+
+ * WebKit.exp:
+ Exported WebWorkersPrivate so DumpRenderTree can access it.
+ * Workers/WebWorkersPrivate.h: Added.
+ * Workers/WebWorkersPrivate.mm: Added.
+ (+[WebWorkersPrivate workerThreadCount]):
+ Added WebWorkersPrivate::workerThreadCount() API for DumpRenderTree.
+
+2009-08-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use a HashMap instead of a list of if statements for the command
+ name exception map.
+
+ * WebView/WebHTMLView.mm:
+ (createSelectorExceptionMap): Added.
+ (commandNameForSelector): Use createSelectorExceptionMap.
+
+2009-08-16 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/28366> WebHTMLViewInternal.h: add @class CALayer declaration
+
+ Reviewed by Simon Fraser.
+
+ Without WebKitPrefix.h, the missing @class CALayer declaration
+ causes a compile-time error.
+
+ * WebView/WebHTMLViewInternal.h: Added @class CALayer
+ declaration with USE(ACCELERATED_COMPOSITING).
+
+2009-08-16 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates
+
+ Reviewed by Dan Bernstein.
+
+ * Plugins/WebBaseNetscapePluginStream.mm: Added using std::min
+ statement.
+ (WebNetscapePluginStream::deliverData): Changed MIN() to min().
+ Changed C-style cast to a static_cast.
+ * Plugins/WebNetscapePluginView.mm: Added using std::min
+ statement.
+ (-[WebNetscapePluginView _postURL:target:len:buf:file:notifyData:sendNotification:allowHeaders:]):
+ Changed MIN() to min(). Changed C-style cast to a static_cast.
+ * WebView/WebHTMLView.mm: Added using std::max statement.
+ (-[WebHTMLView _dragImageForURL:withLabel:]): Changed MAX() to
+ max().
+ (-[WebHTMLView _scaleFactorForPrintOperation:]): Ditto.
+ * WebView/WebTextCompletionController.mm: Added using std::max
+ and using std::min statements.
+ (-[WebTextCompletionController _placePopupWindow:]): Changed
+ type of maxWidth variable from float to CGFloat to prevent a
+ type mismatch on x86_64. Changed MAX() to max() and MIN() to
+ min(). Added static_cast for a constant value since CGFloat is
+ defined as a float on i386 and as a double on x86_64.
+
+2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com>
+
+ Reviewed by Sam Weinig.
+
+ Added ENABLE_EVENTSOURCE flag.
+ https://bugs.webkit.org/show_bug.cgi?id=14997
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-08-14 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate): Add the necessary .get() calls.
+
+2009-08-14 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/7091546> - Assertion failure in plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html
+ on 64-bit SnowLeopard
+
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::cancelLoad): Since this might be called while the FrameLoader is switching DocumentLoaders
+ during the brief moment where there is no activeDocumentLoader(), accept and handle a validly null DocumentLoader.
+
+2009-08-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ Fix leaks of NSNumber and NSMutableArray objects seen during layout tests.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate): Don't leak an NSMutableArray that we allocate.
+
+2009-08-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Fix leaks of HostedNetscapePluginStream and NetscapePlugInStreamLoader objects seen during layout tests.
+
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::didFail): Disconnect the stream from the plug-in instance proxy
+ when the load fails.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm: Updated includes.
+ * WebView/WebScriptDebugger.mm: Ditto.
+
+2009-08-12 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ <rdar://problem/6017913> Replace use of HISearchWindowShow in -[WebView _searchWithSpotlightFromMenu].
+
+ * WebView/WebView.mm:
+ (-[WebView _searchWithSpotlightFromMenu:]): Use -[NSWorkspace showSearchResultsForQueryString:] post-Leopard.
+
+2009-08-12 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Add delegate methods about focus and blur and state change
+ https://bugs.webkit.org/show_bug.cgi?id=27153
+
+ Have ObjC delegate methods match C++ method names in the ChromeClient.
+
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::formDidFocus):
+ (WebChromeClient::formDidBlur):
+ * WebView/WebUIDelegatePrivate.h:
+
+2009-08-11 John Gregg <johnnyg@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Desktop Notifications API
+ https://bugs.webkit.org/show_bug.cgi?id=25643
+
+ Adds ENABLE_NOTIFICATION flag.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-08-11 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove dead declarations.
+
+ * WebView/WebViewInternal.h:
+
+2009-08-11 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ Originally implemented by Glenn Wilson <gwilson@chromium.org>.
+
+ Added new methods for overriding default WebPreference values
+ and for resetting preferences to their defaults.
+ See https://bugs.webkit.org/show_bug.cgi?id=20534
+
+ * WebView/WebPreferences.mm:
+ (-[WebPreferences _setPreferenceForTestWithValue:withKey:]): added.
+ * WebView/WebPreferencesPrivate.h: same.
+
2009-08-09 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
Reviewed by George Staikos.
diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig
index 63c8190..ed387aa 100644
--- a/WebKit/mac/Configurations/FeatureDefines.xcconfig
+++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig
@@ -28,7 +28,9 @@
// Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature.
-ENABLE_3D_CANVAS = ENABLE_3D_CANVAS;
+ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(MAC_OS_X_VERSION_MAJOR));
+ENABLE_3D_CANVAS_1050 = ENABLE_3D_CANVAS;
+ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS;
ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(MAC_OS_X_VERSION_MAJOR));
ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING;
@@ -37,14 +39,18 @@ ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING;
ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING;
ENABLE_DATABASE = ENABLE_DATABASE;
ENABLE_DATAGRID = ENABLE_DATAGRID;
+ENABLE_DATALIST = ENABLE_DATALIST;
ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
+ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
ENABLE_FILTERS = ;
ENABLE_GEOLOCATION = ;
ENABLE_ICONDATABASE = ENABLE_ICONDATABASE;
ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
+ENABLE_MATHML = ;
+ENABLE_NOTIFICATIONS = ;
ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
ENABLE_RUBY = ENABLE_RUBY;
-ENABLE_SHARED_WORKERS = ;
+ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS;
ENABLE_SVG = ENABLE_SVG;
ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION;
ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE;
@@ -53,10 +59,10 @@ ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT;
ENABLE_SVG_USE = ENABLE_SVG_USE;
ENABLE_VIDEO = ENABLE_VIDEO;
-ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS
+ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
ENABLE_WML = ;
ENABLE_WORKERS = ENABLE_WORKERS;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig
index d07d57f..66d574b 100644
--- a/WebKit/mac/Configurations/Version.xcconfig
+++ b/WebKit/mac/Configurations/Version.xcconfig
@@ -22,7 +22,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MAJOR_VERSION = 532;
-MINOR_VERSION = 0;
+MINOR_VERSION = 2;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/WebKit/mac/History/WebHistory.mm b/WebKit/mac/History/WebHistory.mm
index e971aba..6304fd2 100644
--- a/WebKit/mac/History/WebHistory.mm
+++ b/WebKit/mac/History/WebHistory.mm
@@ -148,27 +148,42 @@ private:
#pragma mark MODIFYING CONTENTS
-static WebHistoryDateKey timeIntervalForBeginningOfDay(NSTimeInterval interval)
+static void getDayBoundaries(NSTimeInterval interval, NSTimeInterval& beginningOfDay, NSTimeInterval& beginningOfNextDay)
{
CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(interval, timeZone);
date.hour = 0;
date.minute = 0;
date.second = 0;
- NSTimeInterval result = CFGregorianDateGetAbsoluteTime(date, timeZone);
+ beginningOfDay = CFGregorianDateGetAbsoluteTime(date, timeZone);
+ date.day += 1;
+ beginningOfNextDay = CFGregorianDateGetAbsoluteTime(date, timeZone);
CFRelease(timeZone);
+}
- // Converting from double to int64_t is safe here as NSDate's useful range
- // is -2**48 .. 2**47 which will safely fit in an int64_t.
- return (WebHistoryDateKey)result;
+static inline NSTimeInterval beginningOfDay(NSTimeInterval date)
+{
+ static NSTimeInterval cachedBeginningOfDay = NAN;
+ static NSTimeInterval cachedBeginningOfNextDay;
+ if (!(date >= cachedBeginningOfDay && date < cachedBeginningOfNextDay))
+ getDayBoundaries(date, cachedBeginningOfDay, cachedBeginningOfNextDay);
+ return cachedBeginningOfDay;
+}
+
+static inline WebHistoryDateKey dateKey(NSTimeInterval date)
+{
+ // Converting from double (NSTimeInterval) to int64_t (WebHistoryDateKey) is
+ // safe here because all sensible dates are in the range -2**48 .. 2**47 which
+ // safely fits in an int64_t.
+ return beginningOfDay(date);
}
// Returns whether the day is already in the list of days,
// and fills in *key with the key used to access its location
- (BOOL)findKey:(WebHistoryDateKey*)key forDay:(NSTimeInterval)date
{
- ASSERT_ARG(key, key != nil);
- *key = timeIntervalForBeginningOfDay(date);
+ ASSERT_ARG(key, key);
+ *key = dateKey(date);
return _entriesByDate->contains(*key);
}
diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make
index 7211aa3..9e78367 100644
--- a/WebKit/mac/MigrateHeaders.make
+++ b/WebKit/mac/MigrateHeaders.make
@@ -242,7 +242,6 @@ all : \
$(INTERNAL_HEADERS_DIR)/DOMSVGCursorElementInternal.h \
$(PRIVATE_HEADERS_DIR)/DOMSVGDefsElement.h \
$(INTERNAL_HEADERS_DIR)/DOMSVGDefsElementInternal.h \
- $(PRIVATE_HEADERS_DIR)/DOMSVGDefinitionSrcElement.h \
$(PRIVATE_HEADERS_DIR)/DOMSVGDescElement.h \
$(INTERNAL_HEADERS_DIR)/DOMSVGDescElementInternal.h \
$(PRIVATE_HEADERS_DIR)/DOMSVGDocument.h \
diff --git a/WebKit/mac/Misc/WebDownload.mm b/WebKit/mac/Misc/WebDownload.mm
index 978465a..01ed767 100644
--- a/WebKit/mac/Misc/WebDownload.mm
+++ b/WebKit/mac/Misc/WebDownload.mm
@@ -31,6 +31,9 @@
#import <Foundation/NSURLAuthenticationChallenge.h>
#import <Foundation/NSURLDownload.h>
#import <WebCore/AuthenticationMac.h>
+#import <WebCore/Credential.h>
+#import <WebCore/CredentialStorage.h>
+#import <WebCore/ProtectionSpace.h>
#import <WebKit/WebPanelAuthenticationHandler.h>
#import <wtf/Assertions.h>
@@ -111,7 +114,7 @@ using namespace WebCore;
{
// Try previously stored credential first.
if (![challenge previousFailureCount]) {
- NSURLCredential *credential = WebCoreCredentialStorage::get([challenge protectionSpace]);
+ NSURLCredential *credential = mac(CredentialStorage::get(core([challenge protectionSpace])));
if (credential) {
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
return;
diff --git a/WebKit/mac/Misc/WebNSFileManagerExtras.m b/WebKit/mac/Misc/WebNSFileManagerExtras.m
index 5733598..fb1286f 100644
--- a/WebKit/mac/Misc/WebNSFileManagerExtras.m
+++ b/WebKit/mac/Misc/WebNSFileManagerExtras.m
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,13 +28,13 @@
#import <WebKit/WebNSFileManagerExtras.h>
+#import "WebKitNSStringExtras.h"
+#import "WebNSURLExtras.h"
#import <WebCore/FoundationExtras.h>
-#import <WebKit/WebKitNSStringExtras.h>
#import <WebKitSystemInterface.h>
-#import <wtf/Assertions.h>
-
#import <pthread.h>
#import <sys/mount.h>
+#import <JavaScriptCore/Assertions.h>
@implementation NSFileManager (WebNSFileManagerExtras)
@@ -170,6 +170,10 @@ static void *setMetaData(void* context)
{
ASSERT(URLString);
ASSERT(path);
+
+ NSURL *URL = [NSURL _web_URLWithUserTypedString:URLString];
+ if (URL)
+ URLString = [[URL _web_URLByRemovingUserInfo] _web_userVisibleString];
// Spawn a background thread for WKSetMetadataURL because this function will not return until mds has
// journaled the data we're're trying to set. Depending on what other I/O is going on, it can take some
diff --git a/WebKit/mac/Misc/WebNSURLExtras.h b/WebKit/mac/Misc/WebNSURLExtras.h
index 40f7cf7..c7b266e 100644
--- a/WebKit/mac/Misc/WebNSURLExtras.h
+++ b/WebKit/mac/Misc/WebNSURLExtras.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,6 +28,9 @@
#import <Foundation/Foundation.h>
+// FIXME: Change method names back to _web_ from _webkit_ when identically-named
+// methods are no longer present in Foundation.
+
@interface NSURL (WebNSURLExtras)
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string;
@@ -52,12 +55,10 @@
- (BOOL)_web_isEmpty;
-// FIXME: change these names back to _web_ when identically-named
-// methods are removed from Foundation
-
- (NSURL *)_webkit_canonicalize;
- (NSURL *)_webkit_URLByRemovingFragment;
- (NSURL *)_webkit_URLByRemovingResourceSpecifier;
+- (NSURL *)_web_URLByRemovingUserInfo;
- (BOOL)_webkit_isJavaScriptURL;
- (BOOL)_webkit_isFileURL;
@@ -83,8 +84,6 @@
- (NSString *)_web_decodeHostName; // turns funny-looking ASCII form into Unicode, returns self if no decoding needed, convenient cover
- (NSString *)_web_encodeHostName; // turns Unicode into funny-looking ASCII form, returns self if no decoding needed, convenient cover
-// FIXME: change these names back to _web_ when identically-named
-// methods are removed from or renamed in Foundation
- (BOOL)_webkit_isJavaScriptURL;
- (BOOL)_webkit_isFTPDirectoryURL;
- (BOOL)_webkit_isFileURL;
diff --git a/WebKit/mac/Misc/WebNSURLExtras.mm b/WebKit/mac/Misc/WebNSURLExtras.mm
index d956f09..2affbed 100644
--- a/WebKit/mac/Misc/WebNSURLExtras.mm
+++ b/WebKit/mac/Misc/WebNSURLExtras.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -619,21 +619,9 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
return result;
}
-typedef struct {
- NSString *scheme;
- NSString *user;
- NSString *password;
- NSString *host;
- CFIndex port; // kCFNotFound means ignore/omit
- NSString *path;
- NSString *query;
- NSString *fragment;
-} WebKitURLComponents;
-
-- (NSURL *)_webkit_URLByRemovingComponent:(CFURLComponentType)component
+- (NSURL *)_web_URLByTruncatingOneCharacterBeforeComponent:(CFURLComponentType)component
{
CFRange fragRg = CFURLGetByteRangeForComponent((CFURLRef)self, component, NULL);
- // Check to see if a fragment exists before decomposing the URL.
if (fragRg.location == kCFNotFound)
return self;
@@ -656,12 +644,53 @@ typedef struct {
- (NSURL *)_webkit_URLByRemovingFragment
{
- return [self _webkit_URLByRemovingComponent:kCFURLComponentFragment];
+ return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentFragment];
}
- (NSURL *)_webkit_URLByRemovingResourceSpecifier
{
- return [self _webkit_URLByRemovingComponent:kCFURLComponentResourceSpecifier];
+ return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentResourceSpecifier];
+}
+
+- (NSURL *)_web_URLByRemovingComponentAndSubsequentCharacter:(CFURLComponentType)component
+{
+ CFRange range = CFURLGetByteRangeForComponent((CFURLRef)self, component, 0);
+ if (range.location == kCFNotFound)
+ return self;
+
+ // Remove one subsequent character.
+ ++range.length;
+
+ UInt8* urlBytes;
+ UInt8 buffer[2048];
+ CFIndex numBytes = CFURLGetBytes((CFURLRef)self, buffer, 2048);
+ if (numBytes == -1) {
+ numBytes = CFURLGetBytes((CFURLRef)self, NULL, 0);
+ urlBytes = static_cast<UInt8*>(malloc(numBytes));
+ CFURLGetBytes((CFURLRef)self, urlBytes, numBytes);
+ } else
+ urlBytes = buffer;
+
+ if (numBytes < range.location)
+ return self;
+ if (numBytes < range.location + range.length)
+ range.length = numBytes - range.location;
+
+ memmove(urlBytes + range.location, urlBytes + range.location + range.length, numBytes - range.location + range.length);
+
+ NSURL *result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingUTF8, NULL));
+ if (!result)
+ result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingISOLatin1, NULL));
+
+ if (urlBytes != buffer)
+ free(urlBytes);
+
+ return result ? [result autorelease] : self;
+}
+
+- (NSURL *)_web_URLByRemovingUserInfo
+{
+ return [self _web_URLByRemovingComponentAndSubsequentCharacter:kCFURLComponentUserInfo];
}
- (BOOL)_webkit_isJavaScriptURL
diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
index 72e845b..946c8ac 100644
--- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
+++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
@@ -43,7 +43,7 @@ namespace WebCore {
namespace WebKit {
class NetscapePluginInstanceProxy;
-
+
class HostedNetscapePluginStream : public RefCounted<HostedNetscapePluginStream>
, private WebCore::NetscapePlugInStreamLoaderClient {
public:
@@ -55,9 +55,11 @@ public:
{
return adoptRef(new HostedNetscapePluginStream(instance, frameLoader));
}
-
+
+ ~HostedNetscapePluginStream();
+
uint32_t streamID() const { return m_streamID; }
-
+
void startStreamWithResponse(NSURLResponse *response);
void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char* bytes, int length);
void didFinishLoading(WebCore::NetscapePlugInStreamLoader*);
diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
index 63e18a0..5c25ef7 100644
--- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
+++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
@@ -39,12 +39,18 @@
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/WebCoreURLResponse.h>
+#import <wtf/RefCountedLeakCounter.h>
using namespace WebCore;
namespace WebKit {
+#ifndef NDEBUG
+static WTF::RefCountedLeakCounter hostedNetscapePluginStreamCounter("HostedNetscapePluginStream");
+#endif
+
HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request)
: m_instance(instance)
, m_streamID(streamID)
@@ -53,8 +59,12 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro
, m_requestURL([request URL])
, m_frameLoader(0)
{
- if (core([instance->pluginView() webFrame])->loader()->shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer()))
+ if (SecurityOrigin::shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer()))
[m_request.get() _web_setHTTPReferrer:nil];
+
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.increment();
+#endif
}
HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, WebCore::FrameLoader* frameLoader)
@@ -63,6 +73,16 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro
, m_isTerminated(false)
, m_frameLoader(frameLoader)
{
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.increment();
+#endif
+}
+
+HostedNetscapePluginStream::~HostedNetscapePluginStream()
+{
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.decrement();
+#endif
}
void HostedNetscapePluginStream::startStreamWithResponse(NSURLResponse *response)
@@ -178,8 +198,9 @@ void HostedNetscapePluginStream::didFail(WebCore::NetscapePlugInStreamLoader*, c
{
if (NetscapePluginHostProxy* hostProxy = m_instance->hostProxy())
_WKPHStreamDidFail(hostProxy->port(), m_instance->pluginID(), m_streamID, reasonForError(error));
+ m_instance->disconnectStream(this);
}
-
+
bool HostedNetscapePluginStream::wantsAllStreams() const
{
// FIXME: Implement.
@@ -218,17 +239,17 @@ void HostedNetscapePluginStream::cancelLoad(NSError *error)
ASSERT(!m_loader);
DocumentLoader* documentLoader = m_frameLoader->activeDocumentLoader();
- ASSERT(documentLoader);
-
- if (documentLoader->isLoadingMainResource())
+ if (documentLoader && documentLoader->isLoadingMainResource())
documentLoader->cancelMainResourceLoad(error);
return;
}
-
- if (!m_loader->isDone())
+
+ if (!m_loader->isDone()) {
+ // Cancelling the load will disconnect the stream so there's no need to do it explicitly.
m_loader->cancel(error);
- m_instance->disconnectStream(this);
-}
+ } else
+ m_instance->disconnectStream(this);
+}
NSError *HostedNetscapePluginStream::pluginCancelledConnectionError() const
{
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 1841afd..280f161 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -162,6 +162,8 @@ public:
void resolveURL(const char* url, const char* target, data_t& resolvedURLData, mach_msg_type_number_t& resolvedURLLength);
+ void didDraw();
+
// Reply structs
struct Reply {
enum Type {
@@ -307,6 +309,7 @@ private:
bool m_shouldStopSoon;
uint32_t m_currentRequestID;
bool m_inDestroy;
+ bool m_pluginIsWaitingForDraw;
RefPtr<HostedNetscapePluginStream> m_manualStream;
};
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index c01ae92..21f35e2 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -33,30 +33,32 @@
#import "WebDataSourceInternal.h"
#import "WebFrameInternal.h"
#import "WebHostedNetscapePluginView.h"
+#import "WebKitNSStringExtras.h"
#import "WebNSDataExtras.h"
#import "WebNSURLExtras.h"
-#import "WebKitNSStringExtras.h"
#import "WebPluginRequest.h"
-#import "WebViewInternal.h"
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
-
-#import <mach/mach.h>
-#import <WebCore/CookieJar.h>
+#import "WebViewInternal.h"
+#import <JavaScriptCore/JSLock.h>
+#import <JavaScriptCore/PropertyNameArray.h>
#import <WebCore/CString.h>
+#import <WebCore/CookieJar.h>
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameTree.h>
#import <WebCore/KURL.h>
-#import <WebCore/npruntime_impl.h>
-#import <WebCore/runtime_object.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/ScriptController.h>
#import <WebCore/ScriptValue.h>
+#import <WebCore/StringSourceProvider.h>
+#import <WebCore/npruntime_impl.h>
+#import <WebCore/runtime_object.h>
#import <WebKitSystemInterface.h>
-#import <runtime/JSLock.h>
-#import <runtime/PropertyNameArray.h>
+#import <mach/mach.h>
#import <utility>
+#import <wtf/RefCountedLeakCounter.h>
extern "C" {
#import "WebKitPluginClientServer.h"
@@ -94,6 +96,10 @@ private:
static uint32_t pluginIDCounter;
+#ifndef NDEBUG
+static WTF::RefCountedLeakCounter netscapePluginInstanceProxyCounter("NetscapePluginInstanceProxy");
+#endif
+
NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin)
: m_pluginHostProxy(pluginHostProxy)
, m_pluginView(pluginView)
@@ -108,6 +114,7 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
, m_shouldStopSoon(false)
, m_currentRequestID(0)
, m_inDestroy(false)
+ , m_pluginIsWaitingForDraw(false)
{
ASSERT(m_pluginView);
@@ -123,6 +130,10 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
} while (pluginHostProxy->pluginInstance(m_pluginID) || !m_pluginID);
pluginHostProxy->addPluginInstance(this);
+
+#ifndef NDEBUG
+ netscapePluginInstanceProxyCounter.increment();
+#endif
}
NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
@@ -131,6 +142,10 @@ NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
m_pluginID = 0;
deleteAllValues(m_replies);
+
+#ifndef NDEBUG
+ netscapePluginInstanceProxyCounter.decrement();
+#endif
}
void NetscapePluginInstanceProxy::resize(NSRect size, NSRect clipRect, bool sync)
@@ -178,6 +193,7 @@ void NetscapePluginInstanceProxy::cleanup()
(*it)->invalidate();
m_pluginView = nil;
+ m_manualStream = 0;
}
void NetscapePluginInstanceProxy::invalidate()
@@ -583,7 +599,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch
return NPERR_GENERIC_ERROR;
}
} else {
- if (!FrameLoader::canLoad(URL, String(), core([m_pluginView webFrame])->document()))
+ if (!SecurityOrigin::canLoad(URL, String(), core([m_pluginView webFrame])->document()))
return NPERR_GENERIC_ERROR;
}
@@ -1032,22 +1048,22 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
PropertyNameArray propertyNames(exec);
object->getPropertyNames(exec, propertyNames);
-
- NSMutableArray *array = [[NSMutableArray alloc] init];
+
+ RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().c_str()));
- [array addObject:[NSNumber numberWithLongLong:methodName]];
+ [array.get() addObject:[NSNumber numberWithLongLong:methodName]];
}
- NSData *data = [NSPropertyListSerialization dataFromPropertyList:array format:NSPropertyListBinaryFormat_v1_0 errorDescription:0];
+ NSData *data = [NSPropertyListSerialization dataFromPropertyList:array.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:0];
ASSERT(data);
-
+
resultLength = [data length];
mig_allocate(reinterpret_cast<vm_address_t*>(&resultData), resultLength);
-
+
memcpy(resultData, [data bytes], resultLength);
-
+
exec->clearException();
return true;
@@ -1271,9 +1287,19 @@ void NetscapePluginInstanceProxy::invalidateRect(double x, double y, double widt
{
ASSERT(m_pluginView);
+ m_pluginIsWaitingForDraw = true;
[m_pluginView invalidatePluginContentRect:NSMakeRect(x, y, width, height)];
}
+void NetscapePluginInstanceProxy::didDraw()
+{
+ if (!m_pluginIsWaitingForDraw)
+ return;
+
+ m_pluginIsWaitingForDraw = false;
+ _WKPHPluginInstanceDidDraw(m_pluginHostProxy->port(), m_pluginID);
+}
+
bool NetscapePluginInstanceProxy::getCookies(data_t urlData, mach_msg_type_number_t urlLength, data_t& cookiesData, mach_msg_type_number_t& cookiesLength)
{
ASSERT(m_pluginView);
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 75bc639..0b3a32f 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -136,6 +136,9 @@ JSC::Bindings::Class *ProxyInstance::getClass() const
JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t identifier, const JSC::ArgList& args)
{
+ if (!m_instanceProxy)
+ return jsUndefined();
+
RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args));
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -162,6 +165,9 @@ JSValue ProxyInstance::invokeMethod(ExecState* exec, const MethodList& methodLis
bool ProxyInstance::supportsInvokeDefaultMethod() const
{
+ if (!m_instanceProxy)
+ return false;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasInvokeDefaultMethod(m_instanceProxy->hostProxy()->port(),
@@ -183,6 +189,9 @@ JSValue ProxyInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args)
bool ProxyInstance::supportsConstruct() const
{
+ if (!m_instanceProxy)
+ return false;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasConstructMethod(m_instanceProxy->hostProxy()->port(),
@@ -236,6 +245,9 @@ JSValue ProxyInstance::valueOf(ExecState* exec) const
void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
+ if (!m_instanceProxy)
+ return;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectEnumerate(m_instanceProxy->hostProxy()->port(), m_instanceProxy->pluginID(), requestID, m_objectID) != KERN_SUCCESS)
@@ -266,6 +278,9 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
{
+ if (!m_instanceProxy)
+ return MethodList();
+
// If we already have an entry in the map, use it.
MethodMap::iterator existingMapEntry = m_methods.find(identifier.ustring().rep());
if (existingMapEntry != m_methods.end()) {
@@ -303,6 +318,9 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
Field* ProxyInstance::fieldNamed(const Identifier& identifier)
{
+ if (!m_instanceProxy)
+ return 0;
+
// If we already have an entry in the map, use it.
FieldMap::iterator existingMapEntry = m_fields.find(identifier.ustring().rep());
if (existingMapEntry != m_fields.end())
@@ -332,6 +350,9 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier)
JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) const
{
+ if (!m_instanceProxy)
+ return jsUndefined();
+
uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier();
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -349,6 +370,9 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons
void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue value) const
{
+ if (m_instanceProxy)
+ return;
+
uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier();
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -368,6 +392,8 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v
void ProxyInstance::invalidate()
{
+ ASSERT(m_instanceProxy);
+
if (NetscapePluginHostProxy* hostProxy = m_instanceProxy->hostProxy())
_WKPHNPObjectRelease(hostProxy->port(),
m_instanceProxy->pluginID(), m_objectID);
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 0cce014..34a2211 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -330,9 +330,10 @@ extern "C" {
{
if (_proxy) {
if (_softwareRenderer) {
- if ([NSGraphicsContext currentContextDrawingToScreen])
+ if ([NSGraphicsContext currentContextDrawingToScreen]) {
WKSoftwareCARendererRender(_softwareRenderer, (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], NSRectToCGRect(rect));
- else
+ _proxy->didDraw();
+ } else
_proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);
}
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
index 41d7498..04edf64 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
@@ -220,7 +220,7 @@ simpleroutine PHNPObjectEnumerate(pluginHostPort :mach_port_t;
pluginID :uint32_t;
requestID :uint32_t;
objectID :uint32_t);
-
+
// Replies
simpleroutine PHBooleanReply(clientPort :mach_port_t;
@@ -233,3 +233,7 @@ simpleroutine PHBooleanAndDataReply(pluginHostPort :mach_port_t;
requestID :uint32_t;
returnValue :boolean_t;
result :data_t);
+
+simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t;
+ pluginID :uint32_t);
+
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
index a5a8a2d..232a6c4 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
@@ -42,6 +42,7 @@
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/WebCoreURLResponse.h>
#import <WebKitSystemInterface.h>
@@ -49,6 +50,7 @@
#import <wtf/StdLibExtras.h>
using namespace WebCore;
+using namespace std;
#define WEB_REASON_NONE -1
@@ -159,7 +161,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug
WebNetscapePluginView *view = (WebNetscapePluginView *)plugin->ndata;
// This check has already been done by the plug-in view.
- ASSERT(FrameLoader::canLoad([request URL], String(), core([view webFrame])->document()));
+ ASSERT(SecurityOrigin::canLoad([request URL], String(), core([view webFrame])->document()));
ASSERT([request URL]);
ASSERT(plugin);
@@ -168,7 +170,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug
streams().add(&m_stream, plugin);
- if (core([view webFrame])->loader()->shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
+ if (SecurityOrigin::shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
[m_request.get() _web_setHTTPReferrer:nil];
}
@@ -522,7 +524,7 @@ void WebNetscapePluginStream::deliverData()
m_deliverDataTimer.startOneShot(0);
break;
} else {
- deliveryBytes = MIN(deliveryBytes, totalBytes - totalBytesDelivered);
+ deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered);
NSData *subdata = [m_deliveryData.get() subdataWithRange:NSMakeRange(totalBytesDelivered, deliveryBytes)];
PluginStopDeferrer deferrer(m_pluginView.get());
deliveryBytes = m_pluginFuncs->write(m_plugin, &m_stream, m_offset, [subdata length], (void *)[subdata bytes]);
@@ -531,7 +533,7 @@ void WebNetscapePluginStream::deliverData()
cancelLoadAndDestroyStreamWithError(pluginCancelledConnectionError());
return;
}
- deliveryBytes = MIN((unsigned)deliveryBytes, [subdata length]);
+ deliveryBytes = min<int32>(deliveryBytes, [subdata length]);
m_offset += deliveryBytes;
totalBytesDelivered += deliveryBytes;
LOG(Plugins, "NPP_Write responseURL=%@ bytes=%d total-delivered=%d/%d", m_responseURL.get(), deliveryBytes, m_offset, m_stream.end);
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index a9fb188..bd05ebe 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -31,6 +31,7 @@
#import "WebNetscapePluginPackage.h"
#import "WebPluginContainerCheck.h"
+#import <wtf/OwnPtr.h>
#import <wtf/PassRefPtr.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
@@ -45,6 +46,8 @@ namespace WebCore {
class HTMLPlugInElement;
}
+class WebHaltablePlugin;
+
@interface WebBaseNetscapePluginView : NSView
{
RetainPtr<WebNetscapePluginPackage> _pluginPackage;
@@ -65,6 +68,8 @@ namespace WebCore {
RetainPtr<NSURL> _baseURL;
RetainPtr<NSURL> _sourceURL;
+ OwnPtr<WebHaltablePlugin> _haltable;
+
NSTrackingRectTag _trackingTag;
}
@@ -101,6 +106,7 @@ namespace WebCore {
- (void)startTimers;
- (void)restartTimers;
+- (void)start;
- (void)stop;
- (void)addWindowObservers;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 1345fc3..e730419 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -43,13 +43,17 @@
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/AuthenticationMac.h>
+#import <WebCore/Credential.h>
+#import <WebCore/CredentialStorage.h>
#import <WebCore/CString.h>
#import <WebCore/Document.h>
#import <WebCore/Element.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/HTMLPlugInElement.h>
+#import <WebCore/HaltablePlugin.h>
#import <WebCore/Page.h>
+#import <WebCore/ProtectionSpace.h>
#import <WebCore/RenderView.h>
#import <WebKit/DOMPrivate.h>
#import <runtime/InitializeThreading.h>
@@ -60,6 +64,21 @@
using namespace WebCore;
+class WebHaltablePlugin : public HaltablePlugin {
+public:
+ WebHaltablePlugin(WebBaseNetscapePluginView* view)
+ : m_view(view)
+ {
+ }
+
+private:
+ virtual void halt() { [m_view stop]; }
+ virtual void restart() { [m_view start]; }
+ virtual Node* node() const { return [m_view element]; }
+
+ WebBaseNetscapePluginView* m_view;
+};
+
@implementation WebBaseNetscapePluginView
+ (void)initialize
@@ -111,7 +130,7 @@ using namespace WebCore;
_mode = NP_EMBED;
_loadManually = loadManually;
-
+ _haltable = new WebHaltablePlugin(self);
return self;
}
@@ -388,10 +407,13 @@ using namespace WebCore;
}
_isStarted = YES;
+ page->didStartPlugin(_haltable.get());
+
[[self webView] addPluginInstanceView:self];
-
- [self updateAndSetWindow];
-
+
+ if ([self currentWindow])
+ [self updateAndSetWindow];
+
if ([self window]) {
[self addWindowObservers];
if ([[self window] isKeyWindow]) {
@@ -414,6 +436,11 @@ using namespace WebCore;
if (!_isStarted)
return;
+
+ if (Frame* frame = core([self webFrame])) {
+ if (Page* page = frame->page())
+ page->didStopPlugin(_haltable.get());
+ }
_isStarted = NO;
@@ -478,11 +505,16 @@ using namespace WebCore;
selector:@selector(preferencesHaveChanged:)
name:WebPreferencesChangedNotification
object:nil];
-
+
// View moved to an actual window. Start it if not already started.
[self start];
- [self restartTimers];
- [self addWindowObservers];
+
+ // Starting the plug-in can result in it removing itself from the window so we need to ensure that we're still in
+ // place before doing anything that requires a window.
+ if ([self window]) {
+ [self restartTimers];
+ [self addWindowObservers];
+ }
} else if ([[self webView] hostWindow]) {
// View moved out of an actual window, but still has a host window.
// Call setWindow to explicitly "clip out" the plug-in from sight.
@@ -868,7 +900,7 @@ bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t
RetainPtr<NSURLProtectionSpace> protectionSpace(AdoptNS, [[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
- NSURLCredential *credential = WebCoreCredentialStorage::get(protectionSpace.get());
+ NSURLCredential *credential = mac(CredentialStorage::get(core(protectionSpace.get())));
if (!credential)
credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
if (!credential)
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 24c5944..5debb97 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -69,6 +69,7 @@
#import <WebCore/Page.h>
#import <WebCore/PluginMainThreadScheduler.h>
#import <WebCore/ScriptController.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/SoftLinking.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/WebCoreURLResponse.h>
@@ -78,13 +79,12 @@
#import <wtf/Assertions.h>
#import <objc/objc-runtime.h>
-using std::max;
-
#define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification"
#define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification"
using namespace WebCore;
using namespace WebKit;
+using namespace std;
static inline bool isDrawingModelQuickDraw(NPDrawingModel drawingModel)
{
@@ -1683,7 +1683,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
return NPERR_INVALID_PARAM;
}
} else {
- if (!FrameLoader::canLoad(URL, String(), core([self webFrame])->document()))
+ if (!SecurityOrigin::canLoad(URL, String(), core([self webFrame])->document()))
return NPERR_GENERIC_ERROR;
}
@@ -1794,7 +1794,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
NSString *contentLength = [header objectForKey:@"Content-Length"];
if (contentLength != nil)
- dataLength = MIN((unsigned)[contentLength intValue], dataLength);
+ dataLength = min<unsigned>([contentLength intValue], dataLength);
[header removeObjectForKey:@"Content-Length"];
if ([header count] > 0) {
diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm
index 2180b02..5609d80 100644
--- a/WebKit/mac/Plugins/WebPluginContainerCheck.mm
+++ b/WebKit/mac/Plugins/WebPluginContainerCheck.mm
@@ -40,6 +40,7 @@
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameLoaderTypes.h>
+#import <WebCore/SecurityOrigin.h>
#import <wtf/Assertions.h>
#import <objc/objc-runtime.h>
@@ -98,7 +99,7 @@ using namespace WebCore;
{
Frame* coreFrame = core([_controller webFrame]);
ASSERT(coreFrame);
- if (!coreFrame->loader()->canLoad([_request URL], String(), coreFrame->document())) {
+ if (!SecurityOrigin::canLoad([_request URL], String(), coreFrame->document())) {
[self _continueWithPolicy:PolicyIgnore];
return YES;
}
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 7a1d7b3..a8f22f6 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -93,12 +93,13 @@ public:
virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
- virtual PlatformWidget platformWindow() const;
+ virtual PlatformPageClient platformPageClient() const;
virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const;
virtual void setStatusbarText(const WebCore::String&);
+ virtual void scrollbarsModeDidChange() const { }
virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
@@ -149,6 +150,10 @@ public:
virtual void scheduleCompositingLayerSync();
#endif
+ virtual bool supportsFullscreenForNode(const WebCore::Node*);
+ virtual void enterFullscreenForNode(WebCore::Node*);
+ virtual void exitFullscreenForNode(WebCore::Node*);
+
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
private:
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 145255e..a3f004e 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -49,12 +49,14 @@
#import <Foundation/Foundation.h>
#import <WebCore/BlockExceptions.h>
#import <WebCore/Console.h>
+#import <WebCore/Element.h>
#import <WebCore/FileChooser.h>
#import <WebCore/FloatRect.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoadRequest.h>
#import <WebCore/Geolocation.h>
#import <WebCore/HitTestResult.h>
+#import <WebCore/HTMLNames.h>
#import <WebCore/IntRect.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformScreen.h>
@@ -462,7 +464,7 @@ IntRect WebChromeClient::windowToScreen(const IntRect& r) const
return enclosingIntRect(tempRect);
}
-PlatformWidget WebChromeClient::platformWindow() const
+PlatformPageClient WebChromeClient::platformPageClient() const
{
if ([m_webView _usesDocumentViews])
return 0;
@@ -670,12 +672,12 @@ void WebChromeClient::formStateDidChange(const WebCore::Node* node)
void WebChromeClient::formDidFocus(const WebCore::Node* node)
{
- CallUIDelegate(m_webView, @selector(webView:formStateDidFocusNode:), kit(const_cast<WebCore::Node*>(node)));
+ CallUIDelegate(m_webView, @selector(webView:formDidFocusNode:), kit(const_cast<WebCore::Node*>(node)));
}
void WebChromeClient::formDidBlur(const WebCore::Node* node)
{
- CallUIDelegate(m_webView, @selector(webView:formStateDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
+ CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
}
#if USE(ACCELERATED_COMPOSITING)
@@ -715,6 +717,29 @@ void WebChromeClient::scheduleCompositingLayerSync()
#endif
+#if ENABLE(VIDEO)
+
+bool WebChromeClient::supportsFullscreenForNode(const Node* node)
+{
+ return node->hasTagName(WebCore::HTMLNames::videoTag);
+}
+
+void WebChromeClient::enterFullscreenForNode(Node* node)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [m_webView _enterFullscreenForNode:node];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+void WebChromeClient::exitFullscreenForNode(Node*)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [m_webView _exitFullscreen];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+#endif
+
void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 6f0f39f..6259c80 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -144,6 +144,9 @@ private:
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
@@ -205,7 +208,8 @@ private:
NSDictionary *actionDictionary(const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>) const;
virtual bool canCachePage() const;
-
+ virtual bool shouldLoadMediaElementURL(const WebCore::KURL&) const;
+
RetainPtr<WebFrame> m_webFrame;
RetainPtr<WebFramePolicyListener> m_policyListener;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 42b7ff8..ec05572 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -56,6 +56,7 @@
#import "WebKitErrorsPrivate.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
+#import "WebNavigationData.h"
#import "WebNSURLExtras.h"
#import "WebNetscapePluginView.h"
#import "WebNetscapePluginPackage.h"
@@ -68,6 +69,7 @@
#import "WebPolicyDelegatePrivate.h"
#import "WebPreferences.h"
#import "WebResourceLoadDelegate.h"
+#import "WebSecurityOriginInternal.h"
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
@@ -716,7 +718,7 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function,
{
id <WebFormDelegate> formDelegate = [getWebView(m_webFrame.get()) _formDelegate];
if (!formDelegate) {
- (core(m_webFrame.get())->loader()->*function)(PolicyUse);
+ (core(m_webFrame.get())->loader()->policyChecker()->*function)(PolicyUse);
return;
}
@@ -809,7 +811,26 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
void WebFrameLoaderClient::updateGlobalHistory()
{
+ WebView* view = getWebView(m_webFrame.get());
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
+
+ if ([view historyDelegate]) {
+ WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
+ if (implementations->navigatedFunc) {
+ WebNavigationData *data = [[WebNavigationData alloc] initWithURLString:loader->urlForHistory()
+ title:loader->title()
+ originalRequest:loader->originalRequestCopy().nsURLRequest()
+ response:loader->response().nsURLResponse()
+ hasSubstituteData:loader->substituteData().isValid()
+ clientRedirectSource:loader->clientRedirectSourceForHistory()];
+
+ CallHistoryDelegate(implementations->navigatedFunc, view, @selector(webView:didNavigateWithNavigationData:inFrame:), data, m_webFrame.get());
+ [data release];
+ }
+
+ return;
+ }
+
[[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory()
withTitle:loader->title()
method:loader->originalRequestCopy().httpMethod()
@@ -819,16 +840,29 @@ void WebFrameLoaderClient::updateGlobalHistory()
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
+ WebView* view = getWebView(m_webFrame.get());
+ WebHistoryDelegateImplementationCache* implementations = [view historyDelegate] ? WebViewGetHistoryDelegateImplementations(view) : 0;
+
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->clientRedirectFunc) {
+ CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:),
+ loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory());
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->serverRedirectFunc) {
+ CallHistoryDelegate(implementations->serverRedirectFunc, view, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:),
+ loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->serverRedirectDestinationForHistory());
}
}
@@ -841,6 +875,24 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:webItem];
}
+void WebFrameLoaderClient::didDisplayInsecureContent()
+{
+ WebView *webView = getWebView(m_webFrame.get());
+ WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
+ if (implementations->didDisplayInsecureContentFunc)
+ CallFrameLoadDelegate(implementations->didDisplayInsecureContentFunc, webView, @selector(webViewDidDisplayInsecureContent:));
+}
+
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin)
+{
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+
+ WebView *webView = getWebView(m_webFrame.get());
+ WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
+ if (implementations->didRunInsecureContentFunc)
+ CallFrameLoadDelegate(implementations->didRunInsecureContentFunc, webView, @selector(webView:didRunInsecureContent:), webSecurityOrigin.get());
+}
+
ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request)
{
return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()];
@@ -1012,15 +1064,25 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso
return loader.release();
}
-// FIXME: <rdar://problem/4880065> - Push Global History into WebCore
-// Once that task is complete, this will go away
-void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL)
+void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
- NSURL* nsURL = URL;
+ WebView* view = getWebView(m_webFrame.get());
+
+ if ([view historyDelegate]) {
+ WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
+ if (!implementations->setTitleFunc)
+ return;
+
+ CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title, (NSString *)url);
+ return;
+ }
+
+ NSURL* nsURL = url;
nsURL = [nsURL _webkit_canonicalize];
if(!nsURL)
return;
NSString *titleNSString = title;
+
[[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
}
@@ -1145,7 +1207,7 @@ void WebFrameLoaderClient::receivedPolicyDecison(PolicyAction action)
m_policyListener = nil;
m_policyFunction = 0;
- (core(m_webFrame.get())->loader()->*function)(action);
+ (core(m_webFrame.get())->loader()->policyChecker()->*function)(action);
}
String WebFrameLoaderClient::userAgent(const KURL& url)
@@ -1676,6 +1738,16 @@ jobject WebFrameLoaderClient::javaApplet(NSView* view)
}
#endif
+bool WebFrameLoaderClient::shouldLoadMediaElementURL(const KURL& 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;
+}
+
@implementation WebFramePolicyListener
+ (void)initialize
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm
new file mode 100644
index 0000000..95b4301
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebGeolocationMockPrivate.h"
+
+#import "WebGeolocationInternal.h"
+#import <WebCore/GeolocationServiceMock.h>
+#import <WebCore/Geoposition.h>
+#import <WebCore/PositionError.h>
+#import <wtf/CurrentTime.h>
+
+
+using namespace WebCore;
+using namespace WTF;
+
+@implementation WebGeolocationMock
+
++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy
+{
+ RefPtr<Coordinates> coordinates = Coordinates::create(latitude,
+ longitude,
+ false, 0.0, // altitude
+ accuracy,
+ false, 0.0, // altitudeAccuracy
+ false, 0.0, // heading
+ false, 0.0); // speed
+ RefPtr<Geoposition> position = Geoposition::create(coordinates.release(), currentTime() * 1000.0);
+ GeolocationServiceMock::setPosition(position.release());
+}
+
++ (void)setError:(int)code:(NSString *)message
+{
+ PositionError::ErrorCode codeEnum = static_cast<PositionError::ErrorCode>(code);
+ RefPtr<PositionError> error = PositionError::create(codeEnum, message);
+ GeolocationServiceMock::setError(error.release());
+}
+
+@end
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h
new file mode 100644
index 0000000..28895f2
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface WebGeolocationMock : NSObject {
+}
+
++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy;
++ (void)setError:(int)code:(NSString *)message;
+@end
diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index 3f0b43d..6a4f67d 100644
--- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -81,8 +81,9 @@ void WebInspectorClient::inspectorDestroyed()
Page* WebInspectorClient::createPage()
{
- if (!m_windowController)
- m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
+ if (m_windowController)
+ [[m_windowController.get() webView] close];
+ m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
return core([m_windowController.get() webView]);
}
@@ -325,7 +326,7 @@ void WebInspectorClient::inspectorWindowObjectCleared()
_visible = YES;
- // If no preference is set - default to an attached window
+ // If no preference is set - default to an attached window. This is important for inspector LayoutTests.
InspectorController::Setting shouldAttach = [_inspectedWebView page]->inspectorController()->setting(inspectorStartsAttachedName);
_shouldAttach = (shouldAttach.type() == InspectorController::Setting::BooleanType) ? shouldAttach.booleanValue() : true;
diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h
new file mode 100644
index 0000000..48c655d
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/PluginHalterClient.h>
+
+namespace WebCore {
+ class Node;
+}
+
+@class WebView;
+
+class WebPluginHalterClient : public WebCore::PluginHalterClient {
+public:
+ WebPluginHalterClient(WebView *);
+
+ virtual bool shouldHaltPlugin(WebCore::Node*) const;
+
+private:
+ WebView *m_webView;
+};
diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm
new file mode 100644
index 0000000..2384d0b
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebPluginHalterClient.h"
+
+#import "DOMNodeInternal.h"
+#import "WebDelegateImplementationCaching.h"
+#import "WebView.h"
+
+using namespace WebCore;
+
+WebPluginHalterClient::WebPluginHalterClient(WebView *webView)
+ : m_webView(webView)
+{
+ ASSERT_ARG(webView, webView);
+}
+
+bool WebPluginHalterClient::shouldHaltPlugin(Node* pluginNode) const
+{
+ ASSERT_ARG(pluginNode, pluginNode);
+ return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webView:shouldHaltPlugin:), kit(pluginNode));
+}
diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm
index 96ebaa4..79b2959 100644
--- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm
+++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2009 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -553,6 +553,43 @@
return UI_STRING("definition", "definition phrase");
}
+- (NSString *)AXARIAContentGroupText:(NSString *)ariaType
+{
+ if ([ariaType isEqualToString:@"ARIAApplicationLog"])
+ return UI_STRING("log", "An ARIA accessibility group that acts as a console log.");
+ if ([ariaType isEqualToString:@"ARIAApplicationMarquee"])
+ return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee.");
+ if ([ariaType isEqualToString:@"ARIAApplicationStatus"])
+ return UI_STRING("application status", "An ARIA accessibility group that acts as a status update.");
+ if ([ariaType isEqualToString:@"ARIAApplicationTimer"])
+ return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer.");
+ if ([ariaType isEqualToString:@"ARIADocument"])
+ return UI_STRING("document", "An ARIA accessibility group that acts as a document.");
+ if ([ariaType isEqualToString:@"ARIADocumentArticle"])
+ return UI_STRING("article", "An ARIA accessibility group that acts as an article.");
+ if ([ariaType isEqualToString:@"ARIADocumentNote"])
+ return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document.");
+ if ([ariaType isEqualToString:@"ARIADocumentRegion"])
+ return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document.");
+ if ([ariaType isEqualToString:@"ARIALandmarkApplication"])
+ return UI_STRING("application", "An ARIA accessibility group that acts as an application.");
+ if ([ariaType isEqualToString:@"ARIALandmarkBanner"])
+ return UI_STRING("banner", "An ARIA accessibility group that acts as a banner.");
+ if ([ariaType isEqualToString:@"ARIALandmarkComplementary"])
+ return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information.");
+ if ([ariaType isEqualToString:@"ARIALandmarkContentInfo"])
+ return UI_STRING("content", "An ARIA accessibility group that contains content.");
+ if ([ariaType isEqualToString:@"ARIALandmarkMain"])
+ return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website.");
+ if ([ariaType isEqualToString:@"ARIALandmarkNavigation"])
+ return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website.");
+ if ([ariaType isEqualToString:@"ARIALandmarkSearch"])
+ return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website.");
+ if ([ariaType isEqualToString:@"ARIAUserInterfaceTooltip"])
+ return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip.");
+ return nil;
+}
+
- (NSString *)AXButtonActionVerb
{
return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
@@ -608,4 +645,107 @@
return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast");
}
+- (NSString*)localizedMediaControlElementString:(NSString*)name
+{
+ if ([name isEqualToString:@"AudioElement"])
+ return UI_STRING("audio element controller", "accessibility role description for audio element controller");
+ if ([name isEqualToString:@"VideoElement"])
+ return UI_STRING("video element controller", "accessibility role description for video element controller");
+
+ // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
+ if ([name isEqualToString:@"ControlsPanel"])
+ return @"";
+
+ if ([name isEqualToString:@"MuteButton"])
+ return UI_STRING("mute", "accessibility role description for mute button");
+ if ([name isEqualToString:@"UnMuteButton"])
+ return UI_STRING("unmute", "accessibility role description for turn mute off button");
+ if ([name isEqualToString:@"PlayButton"])
+ return UI_STRING("play", "accessibility role description for play button");
+ if ([name isEqualToString:@"PauseButton"])
+ return UI_STRING("pause", "accessibility role description for pause button");
+ if ([name isEqualToString:@"Slider"])
+ return UI_STRING("movie time", "accessibility role description for timeline slider");
+ if ([name isEqualToString:@"SliderThumb"])
+ return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb");
+ if ([name isEqualToString:@"RewindButton"])
+ return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button");
+ if ([name isEqualToString:@"ReturnToRealtimeButton"])
+ return UI_STRING("return to realtime", "accessibility role description for return to real time button");
+ if ([name isEqualToString:@"CurrentTimeDisplay"])
+ return UI_STRING("elapsed time", "accessibility role description for elapsed time display");
+ if ([name isEqualToString:@"TimeRemainingDisplay"])
+ return UI_STRING("remaining time", "accessibility role description for time remaining display");
+ if ([name isEqualToString:@"StatusDisplay"])
+ return UI_STRING("status", "accessibility role description for movie status");
+ if ([name isEqualToString:@"FullscreenButton"])
+ return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button");
+ if ([name isEqualToString:@"SeekForwardButton"])
+ return UI_STRING("fast forward", "accessibility role description for fast forward button");
+ if ([name isEqualToString:@"SeekBackButton"])
+ return UI_STRING("fast reverse", "accessibility role description for fast reverse button");
+ ASSERT_NOT_REACHED();
+ return @"";
+}
+
+- (NSString*)localizedMediaControlElementHelpText:(NSString*)name
+{
+ if ([name isEqualToString:@"AudioElement"])
+ return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller");
+ if ([name isEqualToString:@"VideoElement"])
+ return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller");
+
+ if ([name isEqualToString:@"MuteButton"])
+ return UI_STRING("mute audio tracks", "accessibility help text for mute button");
+ if ([name isEqualToString:@"UnMuteButton"])
+ return UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
+ if ([name isEqualToString:@"PlayButton"])
+ return UI_STRING("begin playback", "accessibility help text for play button");
+ if ([name isEqualToString:@"PauseButton"])
+ return UI_STRING("pause playback", "accessibility help text for pause button");
+ if ([name isEqualToString:@"Slider"])
+ return UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
+ if ([name isEqualToString:@"SliderThumb"])
+ return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
+ if ([name isEqualToString:@"RewindButton"])
+ return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
+ if ([name isEqualToString:@"ReturnToRealtimeButton"])
+ return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
+ if ([name isEqualToString:@"CurrentTimeDisplay"])
+ return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
+ if ([name isEqualToString:@"TimeRemainingDisplay"])
+ return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
+ if ([name isEqualToString:@"StatusDisplay"])
+ return UI_STRING("current movie status", "accessibility help text for movie status display");
+ if ([name isEqualToString:@"SeekBackButton"])
+ return UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
+ if ([name isEqualToString:@"SeekForwardButton"])
+ return UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
+ if ([name isEqualToString:@"FullscreenButton"])
+ return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
+ ASSERT_NOT_REACHED();
+ return @"";
+}
+
+- (NSString*)localizedMediaTimeDescription:(float)time
+{
+ if (!isfinite(time))
+ return UI_STRING("indefinite time", "string for an indefinite movie time");
+
+ int seconds = (int)fabsf(time);
+ int days = seconds / (60 * 60 * 24);
+ int hours = seconds / (60 * 60);
+ int minutes = (seconds / 60) % 60;
+ seconds %= 60;
+
+ if (days)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"), days, hours, minutes, seconds];
+ else if (hours)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"), hours, minutes, seconds];
+ else if (minutes)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.minutes", "string for minutes & seconds"), minutes, seconds];
+
+ return [NSString stringWithFormat:UI_STRING("date.format.for.seconds", "string for seconds"), seconds];
+}
+
@end
diff --git a/WebKit/mac/WebInspector/WebInspector.mm b/WebKit/mac/WebInspector/WebInspector.mm
index c04a56c..ccb09c5 100644
--- a/WebKit/mac/WebInspector/WebInspector.mm
+++ b/WebKit/mac/WebInspector/WebInspector.mm
@@ -27,7 +27,9 @@
*/
#import "WebInspector.h"
+
#import "WebFrameInternal.h"
+#import "WebInspectorPrivate.h"
#include <WebCore/Document.h>
#include <WebCore/Frame.h>
@@ -163,6 +165,12 @@ using namespace WebCore;
if (Page* page = core(_webView))
page->inspectorController()->detachWindow();
}
+
+- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script
+{
+ if (Page* page = core(_webView))
+ page->inspectorController()->evaluateForTestInFrontend(callId, script);
+}
@end
@implementation WebInspector (Obsolete)
diff --git a/WebKit/mac/WebInspector/WebInspectorPrivate.h b/WebKit/mac/WebInspector/WebInspectorPrivate.h
new file mode 100644
index 0000000..c82bb92
--- /dev/null
+++ b/WebKit/mac/WebInspector/WebInspectorPrivate.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This header contains the WebInspector SPI.
+
+#import "WebInspector.h"
+
+@interface WebInspector (WebPrivate)
+- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script;
+@end
diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp
index f32d1a8..12507d0 100644
--- a/WebKit/mac/WebKit.exp
+++ b/WebKit/mac/WebKit.exp
@@ -12,6 +12,7 @@
.objc_class_name_WebFormDelegate
.objc_class_name_WebFrame
.objc_class_name_WebFrameView
+.objc_class_name_WebGeolocationMock
.objc_class_name_WebHTMLRepresentation
.objc_class_name_WebHTMLView
.objc_class_name_WebHistory
@@ -32,6 +33,7 @@
.objc_class_name_WebTextIterator
.objc_class_name_WebURLsWithTitles
.objc_class_name_WebView
+.objc_class_name_WebWorkersPrivate
_HIWebViewCreate
_HIWebViewGetWebView
_WebActionButtonKey
diff --git a/WebKit/mac/WebKitPrefix.h b/WebKit/mac/WebKitPrefix.h
index 0edec06..518fc1b 100644
--- a/WebKit/mac/WebKitPrefix.h
+++ b/WebKit/mac/WebKitPrefix.h
@@ -74,10 +74,6 @@ typedef float CGFloat;
#include "EmptyProtocolDefinitions.h"
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__)
-#define WTF_USE_PLUGIN_HOST_PROCESS 1
-#endif
-
/* WebKit has no way to pull settings from WebCore/config.h for now */
/* so we assume WebKit is always being compiled on top of JavaScriptCore */
#define WTF_USE_JSC 1
diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/WebKit/mac/WebView/WebDelegateImplementationCaching.h
index 41e44e0..907ba42 100644
--- a/WebKit/mac/WebView/WebDelegateImplementationCaching.h
+++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.h
@@ -67,6 +67,8 @@ struct WebFrameLoadDelegateImplementationCache {
IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
IMP didReceiveIconForFrameFunc;
IMP didFinishDocumentLoadForFrameFunc;
+ IMP didDisplayInsecureContentFunc;
+ IMP didRunInsecureContentFunc;
};
struct WebScriptDebugDelegateImplementationCache {
@@ -79,9 +81,17 @@ struct WebScriptDebugDelegateImplementationCache {
IMP exceptionWasRaisedFunc;
};
+struct WebHistoryDelegateImplementationCache {
+ IMP navigatedFunc;
+ IMP clientRedirectFunc;
+ IMP serverRedirectFunc;
+ IMP setTitleFunc;
+};
+
WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *);
WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *);
WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *);
+WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView);
id CallFormDelegate(WebView *, SEL, id, id);
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5);
@@ -119,3 +129,6 @@ id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
+
+id CallHistoryDelegate(IMP, WebView *, SEL, id, id);
+id CallHistoryDelegate(IMP, WebView *, SEL, id, id, id);
diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
index 441df92..7757fc7 100644
--- a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
+++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
@@ -60,6 +60,14 @@ WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplemen
return &webView->_private->scriptDebugDelegateImplementations;
}
+WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView)
+{
+ static WebHistoryDelegateImplementationCache empty;
+ if (!webView)
+ return &empty;
+ return &webView->_private->historyDelegateImplementations;
+}
+
// We use these functions to call the delegates and block exceptions. These functions are
// declared inside a WebView category to get direct access to the delegate data memebers,
// preventing more ObjC message dispatch and compensating for the expense of the @try/@catch.
@@ -540,6 +548,16 @@ id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id o
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
}
+id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
+{
+ return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2);
+}
+
+id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
+{
+ return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2, object3);
+}
+
// The form delegate needs to have it's own implementation, because the first argument is never the WebView
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2)
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.h b/WebKit/mac/WebView/WebDynamicScrollBarsView.h
index ce92b33..40aadc0 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.h
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.h
@@ -43,6 +43,8 @@ extern const int WebCoreScrollbarAlwaysOn;
BOOL suppressLayout;
BOOL suppressScrollers;
BOOL inUpdateScrollers;
+ BOOL verticallyPinnedByPreviousWheelEvent;
+ BOOL horizontallyPinnedByPreviousWheelEvent;
unsigned inUpdateScrollersLayoutPass;
}
- (void)setAllowsHorizontalScrolling:(BOOL)flag; // This method is used by Safari, so it cannot be removed.
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
index 0cf2a98..3c28e3c 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
@@ -89,15 +89,26 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
- (void)updateScrollers
{
- BOOL hasVerticalScroller = [self hasVerticalScroller];
+ NSView *documentView = [self documentView];
+
+ // If we came in here with the view already needing a layout, then go ahead and do that
+ // first. (This will be the common case, e.g., when the page changes due to window resizing for example).
+ // This layout will not re-enter updateScrollers and does not count towards our max layout pass total.
+ if (!suppressLayout && !suppressScrollers && [documentView isKindOfClass:[WebHTMLView class]]) {
+ WebHTMLView* htmlView = (WebHTMLView*)documentView;
+ if ([htmlView _needsLayout]) {
+ inUpdateScrollers = YES;
+ [(id <WebDocumentView>)documentView layout];
+ inUpdateScrollers = NO;
+ }
+ }
+
BOOL hasHorizontalScroller = [self hasHorizontalScroller];
+ BOOL hasVerticalScroller = [self hasVerticalScroller];
BOOL newHasHorizontalScroller = hasHorizontalScroller;
BOOL newHasVerticalScroller = hasVerticalScroller;
- BOOL needsLayout = NO;
-
- NSView *documentView = [self documentView];
if (!documentView) {
newHasHorizontalScroller = NO;
newHasVerticalScroller = NO;
@@ -122,19 +133,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
return;
}
- needsLayout = NO;
-
- // If we came in here with the view already needing a layout, then go ahead and do that
- // first. (This will be the common case, e.g., when the page changes due to window resizing for example).
- // This layout will not re-enter updateScrollers and does not count towards our max layout pass total.
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
- WebHTMLView* htmlView = (WebHTMLView*)documentView;
- if ([htmlView _needsLayout]) {
- inUpdateScrollers = YES;
- [(id <WebDocumentView>)documentView layout];
- inUpdateScrollers = NO;
- }
- }
+ BOOL needsLayout = NO;
NSSize documentSize = [documentView frame].size;
NSSize visibleSize = [self documentVisibleRect].size;
@@ -199,7 +198,8 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
// http://www.linuxpowered.com/archive/howto/Net-HOWTO-8.html.
// The underlying cause is some problem in the NSText machinery, but I was not
// able to pin it down.
- if (!inUpdateScrollers && [[NSGraphicsContext currentContext] isDrawingToScreen])
+ NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
+ if (!inUpdateScrollers && (!currentContext || [currentContext isDrawingToScreen]))
[self updateScrollers];
}
@@ -328,17 +328,41 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
BOOL isContinuous;
WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous);
+ BOOL isLatchingEvent = WKIsLatchingWheelEvent(event);
+
if (fabsf(deltaY) > fabsf(deltaX)) {
if (![self allowsVerticalScrolling]) {
[[self nextResponder] scrollWheel:event];
return;
}
- } else if (![self allowsHorizontalScrolling]) {
- [[self nextResponder] scrollWheel:event];
- return;
+
+ if (isLatchingEvent && !verticallyPinnedByPreviousWheelEvent) {
+ double verticalPosition = [[self verticalScroller] doubleValue];
+ if ((deltaY >= 0.0 && verticalPosition == 0.0) || (deltaY <= 0.0 && verticalPosition == 1.0))
+ return;
+ }
+ } else {
+ if (![self allowsHorizontalScrolling]) {
+ [[self nextResponder] scrollWheel:event];
+ return;
+ }
+
+ if (isLatchingEvent && !horizontallyPinnedByPreviousWheelEvent) {
+ double horizontalPosition = [[self horizontalScroller] doubleValue];
+ if ((deltaX >= 0.0 && horizontalPosition == 0.0) || (deltaX <= 0.0 && horizontalPosition == 1.0))
+ return;
+ }
}
[super scrollWheel:event];
+
+ if (!isLatchingEvent) {
+ double verticalPosition = [[self verticalScroller] doubleValue];
+ double horizontalPosition = [[self horizontalScroller] doubleValue];
+
+ verticallyPinnedByPreviousWheelEvent = (verticalPosition == 0.0 || verticalPosition == 1.0);
+ horizontallyPinnedByPreviousWheelEvent = (horizontalPosition == 0.0 || horizontalPosition == 1.0);
+ }
}
- (BOOL)accessibilityIsIgnored
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index c03ef58..27aac67 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -1174,7 +1174,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasPlugins];
if (DOMWindow* domWindow = _private->coreFrame->domWindow()) {
- if (domWindow->hasEventListener(eventNames().unloadEvent))
+ if (domWindow->hasEventListeners(eventNames().unloadEvent))
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasUnloadListener];
if (domWindow->optionalApplicationCache())
@@ -1195,6 +1195,13 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return result;
}
+- (BOOL)_allowsFollowingLink:(NSURL *)URL
+{
+ if (!_private->coreFrame)
+ return YES;
+ return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document());
+}
+
@end
@implementation WebFrame
diff --git a/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h
new file mode 100644
index 0000000..80fa08a
--- /dev/null
+++ b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009 Adam Barth. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WebFrameLoadDelegate.h>
+
+@class WebSecurityOrigin;
+
+@interface NSObject (WebFrameLoadDelegatePrivate)
+
+- (void)webViewDidDisplayInsecureContent:(WebView *)webView;
+
+- (void)webView:(WebView *)webView didRunInsecureContent:(WebSecurityOrigin *)origin;
+
+@end
diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h
index 8e7a2ef..7446584 100644
--- a/WebKit/mac/WebView/WebFramePrivate.h
+++ b/WebKit/mac/WebView/WebFramePrivate.h
@@ -110,4 +110,6 @@ typedef enum {
- (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
- (NSMutableDictionary *)_cacheabilityDictionary;
+
+- (BOOL)_allowsFollowingLink:(NSURL *)URL;
@end
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index 1a460ea..c300586 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -273,8 +273,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
owner->setWidget(view);
// Now the render part owns the view, so we don't any more.
}
-
- view->initScrollbars();
}
@end
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index d58c765..102f630 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -125,6 +125,7 @@
using namespace WebCore;
using namespace HTMLNames;
using namespace WTF;
+using namespace std;
@interface NSWindow (BorderViewAccess)
- (NSView*)_web_borderView;
@@ -212,6 +213,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
- (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants;
- (void)_propagateDirtyRectsToOpaqueAncestors;
- (void)_windowChangedKeyState;
+#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD)
+- (void)_updateLayerGeometryFromView;
+#endif
@end
@interface NSApplication (WebNSApplicationDetails)
@@ -979,8 +983,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
{
// FIXME: this can fail if the dataSource is nil, which happens when the WebView is tearing down from the window closing.
WebHTMLView *view = (WebHTMLView *)[[[[_private->dataSource _webView] mainFrame] frameView] documentView];
- ASSERT(view);
- ASSERT([view isKindOfClass:[WebHTMLView class]]);
+ ASSERT(!view || [view isKindOfClass:[WebHTMLView class]]);
return view;
}
@@ -1148,8 +1151,11 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
{
NSPoint origin = [[self superview] bounds].origin;
if (!NSEqualPoints(_private->lastScrollPosition, origin)) {
- if (Frame* coreFrame = core([self _frame]))
- coreFrame->eventHandler()->sendScrollEvent();
+ if (Frame* coreFrame = core([self _frame])) {
+ if (FrameView* coreView = coreFrame->view())
+ coreView->scrollPositionChanged();
+ }
+
[_private->completionController endRevertingChange:NO moveLeft:NO];
WebView *webView = [self _webView];
@@ -1649,10 +1655,10 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
urlStringSize.height = [urlFont ascender] - [urlFont descender];
imageSize.height += urlStringSize.height;
if (urlStringSize.width > MAX_DRAG_LABEL_WIDTH) {
- imageSize.width = MAX(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2.0f, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP);
+ imageSize.width = max(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP);
clipURLString = YES;
} else {
- imageSize.width = MAX(labelSize.width + DRAG_LABEL_BORDER_X * 2.0f, urlStringSize.width + DRAG_LABEL_BORDER_X * 2.0f);
+ imageSize.width = max(labelSize.width + DRAG_LABEL_BORDER_X * 2, urlStringSize.width + DRAG_LABEL_BORDER_X * 2);
}
}
NSImage *dragImage = [[[NSImage alloc] initWithSize: imageSize] autorelease];
@@ -2299,24 +2305,36 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension
return [[webView _editingDelegateForwarder] webView:webView doCommandBySelector:selector];
}
+typedef HashMap<SEL, String> SelectorNameMap;
+
+// Map selectors into Editor command names.
+// This is not needed for any selectors that have the same name as the Editor command.
+static const SelectorNameMap* createSelectorExceptionMap()
+{
+ SelectorNameMap* map = new HashMap<SEL, String>;
+
+ map->add(@selector(insertNewlineIgnoringFieldEditor:), "InsertNewline");
+ map->add(@selector(insertParagraphSeparator:), "InsertNewline");
+ map->add(@selector(insertTabIgnoringFieldEditor:), "InsertTab");
+ map->add(@selector(pageDown:), "MovePageDown");
+ map->add(@selector(pageDownAndModifySelection:), "MovePageDownAndModifySelection");
+ map->add(@selector(pageUp:), "MovePageUp");
+ map->add(@selector(pageUpAndModifySelection:), "MovePageUpAndModifySelection");
+
+ return map;
+}
+
static String commandNameForSelector(SEL selector)
{
- // Change a few command names into ones supported by WebCore::Editor.
- // If this list gets too long we might decide we need to use a hash table.
- if (selector == @selector(insertParagraphSeparator:) || selector == @selector(insertNewlineIgnoringFieldEditor:))
- return "InsertNewline";
- if (selector == @selector(insertTabIgnoringFieldEditor:))
- return "InsertTab";
- if (selector == @selector(pageDown:))
- return "MovePageDown";
- if (selector == @selector(pageDownAndModifySelection:))
- return "MovePageDownAndModifySelection";
- if (selector == @selector(pageUp:))
- return "MovePageUp";
- if (selector == @selector(pageUpAndModifySelection:))
- return "MovePageUpAndModifySelection";
+ // Check the exception map first.
+ static const SelectorNameMap* exceptionMap = createSelectorExceptionMap();
+ SelectorNameMap::const_iterator it = exceptionMap->find(selector);
+ if (it != exceptionMap->end())
+ return it->second;
// Remove the trailing colon.
+ // No need to capitalize the command name since Editor command names are
+ // not case sensitive.
const char* selectorName = sel_getName(selector);
size_t selectorNameLength = strlen(selectorName);
if (selectorNameLength < 2 || selectorName[selectorNameLength - 1] != ':')
@@ -3160,7 +3178,8 @@ WEBCORE_COMMAND(yankAndSelect)
double start = CFAbsoluteTimeGetCurrent();
#endif
- if ([[self _webView] _mustDrawUnionedRect:rect singleRects:rects count:count])
+ WebView *webView = [self _webView];
+ if ([webView _mustDrawUnionedRect:rect singleRects:rects count:count])
[self drawSingleRect:rect];
else
for (int i = 0; i < count; ++i)
@@ -3175,16 +3194,19 @@ WEBCORE_COMMAND(yankAndSelect)
[self _setAsideSubviews];
#if USE(ACCELERATED_COMPOSITING)
- if ([[self _webView] _needsOneShotDrawingSynchronization]) {
+ if ([webView _needsOneShotDrawingSynchronization]) {
// Disable screen updates so that any layer changes committed here
// don't show up on the screen before the window flush at the end
- // of the current window display.
- [[self window] disableScreenUpdatesUntilFlush];
+ // of the current window display, but only if a window flush is actually
+ // going to happen.
+ NSWindow *window = [self window];
+ if ([window viewsNeedDisplay])
+ [window disableScreenUpdatesUntilFlush];
// Make sure any layer changes that happened as a result of layout
// via -viewWillDraw are committed.
[CATransaction flush];
- [[self _webView] _setNeedsOneShotDrawingSynchronization:NO];
+ [webView _setNeedsOneShotDrawingSynchronization:NO];
}
#endif
}
@@ -3407,10 +3429,6 @@ done:
if (!page)
return NSDragOperationNone;
- // FIXME: Why do we override the source provided operation here? Why not in DragController::startDrag
- if (page->dragController()->sourceDragOperation() == DragOperationNone)
- return NSDragOperationGeneric | NSDragOperationCopy;
-
return (NSDragOperation)page->dragController()->sourceDragOperation();
}
@@ -3715,7 +3733,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
#ifdef __LP64__
// If the new bottom is equal to the old bottom (when both are treated as floats), we just copy
// oldBottom over to newBottom. This prevents rounding errors that can occur when converting newBottomFloat to a double.
- if (fabs((float)oldBottom - newBottomFloat) <= std::numeric_limits<float>::epsilon())
+ if (fabs((float)oldBottom - newBottomFloat) <= numeric_limits<float>::epsilon())
*newBottom = oldBottom;
else
#endif
@@ -3750,7 +3768,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
float maxShrinkToFitScaleFactor = 1.0f / PrintingMaximumShrinkFactor;
float shrinkToFitScaleFactor = [self _availablePaperWidthForPrintOperation:printOperation]/viewWidth;
float shrinkToAvoidOrphan = _private->avoidingPrintOrphan ? (1.0f / PrintingOrphanShrinkAdjustment) : 1.0f;
- return userScaleFactor * MAX(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan;
+ return userScaleFactor * max(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan;
}
// FIXME 3491344: This is a secret AppKit-internal method that we need to override in order
@@ -5450,13 +5468,13 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
if (!_private->layerHostingView)
return;
- const CGFloat maxHeight = 4096;
+ const CGFloat maxHeight = 2048;
NSRect layerViewFrame = [self bounds];
if (layerViewFrame.size.height > maxHeight) {
CGFloat documentHeight = layerViewFrame.size.height;
- // Clamp the size of the view to <= 4096px to avoid the bug.
+ // Clamp the size of the view to <= maxHeight to avoid the bug.
layerViewFrame.size.height = maxHeight;
NSRect visibleRect = [[self enclosingScrollView] documentVisibleRect];
@@ -5468,7 +5486,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
CGFloat bottomOffset = documentHeight - layerViewFrame.size.height - topOffset;
[[_private->layerHostingView layer] setSublayerTransform:CATransform3DMakeTranslation(0, -bottomOffset, 0)];
}
-
+
+ [_private->layerHostingView _updateLayerGeometryFromView]; // Workaround for <rdar://problem/7071636>
[_private->layerHostingView setFrame:layerViewFrame];
}
#endif // defined(BUILDING_ON_LEOPARD)
diff --git a/WebKit/mac/WebView/WebHTMLViewInternal.h b/WebKit/mac/WebView/WebHTMLViewInternal.h
index b5ec1c0..3f1f50d 100644
--- a/WebKit/mac/WebView/WebHTMLViewInternal.h
+++ b/WebKit/mac/WebView/WebHTMLViewInternal.h
@@ -30,6 +30,9 @@
#import "WebHTMLViewPrivate.h"
+#if USE(ACCELERATED_COMPOSITING)
+@class CALayer;
+#endif
@class WebFrame;
namespace WebCore {
diff --git a/WebKit/mac/WebView/WebHistoryDelegate.h b/WebKit/mac/WebView/WebHistoryDelegate.h
new file mode 100644
index 0000000..4029eb0
--- /dev/null
+++ b/WebKit/mac/WebView/WebHistoryDelegate.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+@class WebFrame;
+@class WebNavigationData;
+@class WebView;
+
+@interface NSObject (WebHistoryDelegate)
+
+- (void)webView:(WebView *)webView didNavigateWithNavigationData:(WebNavigationData *)navigationData inFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView didPerformClientRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url;
+
+@end
diff --git a/WebKit/mac/WebView/WebJSPDFDoc.h b/WebKit/mac/WebView/WebJSPDFDoc.h
new file mode 100644
index 0000000..d3e756c
--- /dev/null
+++ b/WebKit/mac/WebView/WebJSPDFDoc.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/JSBase.h>
+
+@class WebDataSource;
+
+JSObjectRef makeJSPDFDoc(JSContextRef, WebDataSource *);
diff --git a/WebKit/mac/WebView/WebJSPDFDoc.mm b/WebKit/mac/WebView/WebJSPDFDoc.mm
new file mode 100644
index 0000000..24169fe
--- /dev/null
+++ b/WebKit/mac/WebView/WebJSPDFDoc.mm
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebJSPDFDoc.h"
+
+#import "WebDataSource.h"
+#import "WebDelegateImplementationCaching.h"
+#import "WebFrame.h"
+#import "WebView.h"
+#import <JavaScriptCore/JSObjectRef.h>
+
+static void jsPDFDocInitialize(JSContextRef ctx, JSObjectRef object)
+{
+ WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object);
+ CFRetain(dataSource);
+}
+
+static void jsPDFDocFinalize(JSObjectRef object)
+{
+ WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object);
+ CFRelease(dataSource);
+}
+
+static JSValueRef jsPDFDocPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(thisObject);
+
+ WebView *webView = [[dataSource webFrame] webView];
+ CallUIDelegate(webView, @selector(webView:printFrameView:), [[dataSource webFrame] frameView]);
+
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSStaticFunction jsPDFDocStaticFunctions[] = {
+ { "print", jsPDFDocPrint, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { 0, 0, 0 },
+};
+
+static JSClassDefinition jsPDFDocClassDefinition = {
+ 0,
+ kJSClassAttributeNone,
+ "Doc",
+ 0,
+ 0,
+ jsPDFDocStaticFunctions,
+ jsPDFDocInitialize, jsPDFDocFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+JSObjectRef makeJSPDFDoc(JSContextRef ctx, WebDataSource *dataSource)
+{
+ static JSClassRef jsPDFDocClass = JSClassCreate(&jsPDFDocClassDefinition);
+
+ return JSObjectMake(ctx, jsPDFDocClass, dataSource);
+}
diff --git a/WebKit/mac/WebView/WebNavigationData.h b/WebKit/mac/WebView/WebNavigationData.h
new file mode 100644
index 0000000..227df16
--- /dev/null
+++ b/WebKit/mac/WebView/WebNavigationData.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+@class WebFrame;
+@class WebNavigationDataPrivate;
+@class WebView;
+
+@interface WebNavigationData : NSObject
+{
+@private
+ WebNavigationDataPrivate *_private;
+}
+
+- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource;
+- (NSString *)url;
+- (NSString *)title;
+- (NSURLRequest *)originalRequest;
+- (NSURLResponse *)response;
+- (BOOL)hasSubstituteData;
+- (NSString *)clientRedirectSource;
+
+@end
diff --git a/WebKit/mac/WebView/WebNavigationData.mm b/WebKit/mac/WebView/WebNavigationData.mm
new file mode 100644
index 0000000..290d8b1
--- /dev/null
+++ b/WebKit/mac/WebView/WebNavigationData.mm
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebNavigationData.h"
+
+@interface WebNavigationDataPrivate : NSObject
+{
+@public
+ NSString *url;
+ NSString *title;
+ NSURLRequest *originalRequest;
+ NSURLResponse *response;
+ BOOL hasSubstituteData;
+ NSString *clientRedirectSource;
+}
+
+@end
+
+@implementation WebNavigationDataPrivate
+
+- (void)dealloc
+{
+ [url release];
+ [title release];
+ [originalRequest release];
+ [response release];
+ [clientRedirectSource release];
+
+ [super dealloc];
+}
+
+@end
+
+@implementation WebNavigationData
+
+- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource;
+{
+ _private = [[WebNavigationDataPrivate alloc] init];
+
+ _private->url = [url retain];
+ _private->title = [title retain];
+ _private->originalRequest = [request retain];
+ _private->response = [response retain];
+ _private->hasSubstituteData = hasSubstituteData;
+ _private->clientRedirectSource = [redirectSource retain];
+
+ return self;
+}
+
+- (NSString *)url
+{
+ return _private->url;
+}
+
+- (NSString *)title
+{
+ return _private->title;
+}
+
+- (NSURLRequest *)originalRequest
+{
+ return _private->originalRequest;
+}
+
+- (NSURLResponse *)response
+{
+ return _private->response;
+}
+
+- (BOOL)hasSubstituteData
+{
+ return _private->hasSubstituteData;
+}
+
+- (NSString *)clientRedirectSource
+{
+ return _private->clientRedirectSource;
+}
+
+- (void)dealloc
+{
+ [_private release];
+ [super dealloc];
+}
+
+@end
diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.h b/WebKit/mac/WebView/WebPDFDocumentExtras.h
new file mode 100644
index 0000000..5a33ccf
--- /dev/null
+++ b/WebKit/mac/WebView/WebPDFDocumentExtras.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <PDFKit/PDFDocument.h>
+
+@interface PDFDocument (WebPDFDocumentExtras)
+- (NSArray *)_web_allScripts;
+@end
+
+void addWebPDFDocumentExtras(Class);
diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/WebKit/mac/WebView/WebPDFDocumentExtras.mm
new file mode 100644
index 0000000..ec580ec
--- /dev/null
+++ b/WebKit/mac/WebView/WebPDFDocumentExtras.mm
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebPDFDocumentExtras.h"
+
+#import "WebTypesInternal.h"
+#import <JavaScriptCore/Vector.h>
+#import <JavaScriptCore/RetainPtr.h>
+#import <PDFKit/PDFDocument.h>
+#import <objc/objc-runtime.h>
+
+#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD)
+@interface PDFDocument (Internal)
+- (CGPDFDocumentRef)documentRef;
+@end
+#endif
+
+static void appendValuesInPDFNameSubtreeToVector(CGPDFDictionaryRef subtree, Vector<CGPDFObjectRef>& values)
+{
+ CGPDFArrayRef names;
+ if (CGPDFDictionaryGetArray(subtree, "Names", &names)) {
+ size_t nameCount = CGPDFArrayGetCount(names) / 2;
+ for (size_t i = 0; i < nameCount; ++i) {
+ CGPDFObjectRef object;
+ CGPDFArrayGetObject(names, 2 * i + 1, &object);
+ values.append(object);
+ }
+ return;
+ }
+
+ CGPDFArrayRef kids;
+ if (!CGPDFDictionaryGetArray(subtree, "Kids", &kids))
+ return;
+
+ size_t kidCount = CGPDFArrayGetCount(kids);
+ for (size_t i = 0; i < kidCount; ++i) {
+ CGPDFDictionaryRef kid;
+ if (!CGPDFArrayGetDictionary(kids, i, &kid))
+ continue;
+ appendValuesInPDFNameSubtreeToVector(kid, values);
+ }
+}
+
+static void getAllValuesInPDFNameTree(CGPDFDictionaryRef tree, Vector<CGPDFObjectRef>& allValues)
+{
+ appendValuesInPDFNameSubtreeToVector(tree, allValues);
+}
+
+static NSArray *web_PDFDocumentAllScripts(id self, SEL _cmd)
+{
+ NSMutableArray *scripts = [NSMutableArray array];
+ CGPDFDocumentRef pdfDocument = [self documentRef];
+ if (!pdfDocument)
+ return scripts;
+
+ CGPDFDictionaryRef pdfCatalog = CGPDFDocumentGetCatalog(pdfDocument);
+ if (!pdfCatalog)
+ return scripts;
+
+ // Get the dictionary of all document-level name trees.
+ CGPDFDictionaryRef namesDictionary;
+ if (!CGPDFDictionaryGetDictionary(pdfCatalog, "Names", &namesDictionary))
+ return scripts;
+
+ // Get the document-level "JavaScript" name tree.
+ CGPDFDictionaryRef javaScriptNameTree;
+ if (!CGPDFDictionaryGetDictionary(namesDictionary, "JavaScript", &javaScriptNameTree))
+ return scripts;
+
+ // The names are aribtrary. We are only interested in the values.
+ Vector<CGPDFObjectRef> objects;
+ getAllValuesInPDFNameTree(javaScriptNameTree, objects);
+ size_t objectCount = objects.size();
+
+ for (size_t i = 0; i < objectCount; ++i) {
+ CGPDFDictionaryRef javaScriptAction;
+ if (!CGPDFObjectGetValue(reinterpret_cast<CGPDFObjectRef>(objects[i]), kCGPDFObjectTypeDictionary, &javaScriptAction))
+ continue;
+
+ // A JavaScript action must have an action type of "JavaScript".
+ const char* actionType;
+ if (!CGPDFDictionaryGetName(javaScriptAction, "S", &actionType) || strcmp(actionType, "JavaScript"))
+ continue;
+
+ const UInt8* bytes = 0;
+ CFIndex length;
+ CGPDFStreamRef stream;
+ CGPDFStringRef string;
+ RetainPtr<CFDataRef> data;
+ if (CGPDFDictionaryGetStream(javaScriptAction, "JS", &stream)) {
+ CGPDFDataFormat format;
+ data.adoptCF(CGPDFStreamCopyData(stream, &format));
+ bytes = CFDataGetBytePtr(data.get());
+ length = CFDataGetLength(data.get());
+ } else if (CGPDFDictionaryGetString(javaScriptAction, "JS", &string)) {
+ bytes = CGPDFStringGetBytePtr(string);
+ length = CGPDFStringGetLength(string);
+ }
+ if (!bytes)
+ continue;
+
+ NSStringEncoding encoding = (length > 1 && bytes[0] == 0xFE && bytes[1] == 0xFF) ? NSUnicodeStringEncoding : NSUTF8StringEncoding;
+ NSString *script = [[NSString alloc] initWithBytes:bytes length:length encoding:encoding];
+ [scripts addObject:script];
+ [script release];
+ }
+
+ return scripts;
+}
+
+void addWebPDFDocumentExtras(Class pdfDocumentClass)
+{
+#ifndef BUILDING_ON_TIGER
+ class_addMethod(pdfDocumentClass, @selector(_web_allScripts), (IMP)web_PDFDocumentAllScripts, "@@:");
+#else
+ static struct objc_method_list methodList = { 0, 1, { @selector(_web_allScripts), (char*)"@@:", (IMP)web_PDFDocumentAllScripts } };
+ class_addMethods(pdfDocumentClass, &methodList);
+#endif
+}
diff --git a/WebKit/mac/WebView/WebPDFRepresentation.h b/WebKit/mac/WebView/WebPDFRepresentation.h
index 6b60d4c..be40ae1 100644
--- a/WebKit/mac/WebView/WebPDFRepresentation.h
+++ b/WebKit/mac/WebView/WebPDFRepresentation.h
@@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Foundation/Foundation.h>
+#import "WebDocument.h"
@protocol WebDocumentRepresentation;
diff --git a/WebKit/mac/WebView/WebPDFRepresentation.m b/WebKit/mac/WebView/WebPDFRepresentation.mm
index 7eae380..924bda8 100644
--- a/WebKit/mac/WebView/WebPDFRepresentation.m
+++ b/WebKit/mac/WebView/WebPDFRepresentation.mm
@@ -26,15 +26,19 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebFrame.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebNSObjectExtras.h>
-#import <WebKit/WebPDFRepresentation.h>
-#import <WebKit/WebPDFView.h>
-#import <wtf/Assertions.h>
-
-#import <PDFKit/PDFDocument.h>
+#import "WebPDFRepresentation.h"
+
+#import "WebDataSourcePrivate.h"
+#import "WebFrame.h"
+#import "WebJSPDFDoc.h"
+#import "WebNSObjectExtras.h"
+#import "WebPDFDocumentExtras.h"
+#import "WebPDFView.h"
+#import "WebTypesInternal.h"
+#import <JavaScriptCore/Assertions.h>
+#import <JavaScriptCore/JSContextRef.h>
+#import <JavaScriptCore/JSStringRef.h>
+#import <JavaScriptCore/JSStringRefCF.h>
@implementation WebPDFRepresentation
@@ -66,6 +70,16 @@
return PDFDocumentClass;
}
++ (void)initialize
+{
+ if (self != [WebPDFRepresentation class])
+ return;
+
+ Class pdfDocumentClass = [self PDFDocumentClass];
+ if (pdfDocumentClass)
+ addWebPDFDocumentExtras(pdfDocumentClass);
+}
+
- (void)setDataSource:(WebDataSource *)dataSource;
{
}
@@ -121,9 +135,26 @@
WebPDFView *view = (WebPDFView *)[[[dataSource webFrame] frameView] documentView];
PDFDocument *doc = [[[[self class] PDFDocumentClass] alloc] initWithData:data];
[view setPDFDocument:doc];
+
+ NSArray *scripts = [doc _web_allScripts];
[doc release];
-}
+ doc = nil;
+
+ NSUInteger scriptCount = [scripts count];
+ if (!scriptCount)
+ return;
+
+ JSGlobalContextRef ctx = JSGlobalContextCreate(0);
+ JSObjectRef jsPDFDoc = makeJSPDFDoc(ctx, dataSource);
+ for (NSUInteger i = 0; i < scriptCount; ++i) {
+ JSStringRef script = JSStringCreateWithCFString((CFStringRef)[scripts objectAtIndex:i]);
+ JSEvaluateScript(ctx, script, jsPDFDoc, 0, 0, 0);
+ JSStringRelease(script);
+ }
+
+ JSGlobalContextRelease(ctx);
+}
- (BOOL)canProvideDocumentSource
{
diff --git a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h
index 45f8f45..efdf007 100644
--- a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h
+++ b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h
@@ -49,4 +49,6 @@ typedef enum {
@interface NSObject (WebPolicyDelegatePrivate)
// Needed for <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls
- (BOOL)webView:(WebView *)webView shouldGoToHistoryItem:(WebHistoryItem *)item;
+
+- (BOOL)webView:(WebView *)webView shouldLoadMediaURL:(NSURL *)url inFrame:(WebFrame *)frame;
@end
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 6565c09..d6c9d3c 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -55,6 +55,8 @@
#define WebKitPluginsEnabledPreferenceKey @"WebKitPluginsEnabled"
#define WebKitDatabasesEnabledPreferenceKey @"WebKitDatabasesEnabledPreferenceKey"
#define WebKitLocalStorageEnabledPreferenceKey @"WebKitLocalStorageEnabledPreferenceKey"
+#define WebKitExperimentalNotificationsEnabledPreferenceKey @"WebKitExperimentalNotificationsEnabledPreferenceKey"
+#define WebKitExperimentalWebSocketsEnabledPreferenceKey @"WebKitExperimentalWebSocketsEnabledPreferenceKey"
#define WebKitAllowAnimatedImagesPreferenceKey @"WebKitAllowAnimatedImagesPreferenceKey"
#define WebKitAllowAnimatedImageLoopingPreferenceKey @"WebKitAllowAnimatedImageLoopingPreferenceKey"
#define WebKitDisplayImagesKey @"WebKitDisplayImagesKey"
@@ -84,6 +86,9 @@
#define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly"
#define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled"
#define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled"
+#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
+#define WebKitPluginHalterEnabledPreferenceKey @"WebKitPluginHalterEnabled"
+#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 378b280..2910d27 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -320,6 +320,8 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitLocalStorageEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitExperimentalNotificationsEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitExperimentalWebSocketsEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAllowAnimatedImageLoopingPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDisplayImagesKey,
@@ -350,6 +352,9 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey,
[NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitPluginHalterEnabledPreferenceKey,
+ [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
@@ -1011,6 +1016,26 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];
}
+- (BOOL)experimentalNotificationsEnabled
+{
+ return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
+}
+
+- (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled
+{
+ [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
+}
+
+- (BOOL)experimentalWebSocketsEnabled
+{
+ return [self _boolValueForKey:WebKitExperimentalWebSocketsEnabledPreferenceKey];
+}
+
+- (void)setExperimentalWebSocketsEnabled:(BOOL)experimentalWebSocketsEnabled
+{
+ [self _setBoolValue:experimentalWebSocketsEnabled forKey:WebKitExperimentalWebSocketsEnabledPreferenceKey];
+}
+
+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
{
LOG(Encoding, "requesting for %@\n", ident);
@@ -1138,6 +1163,36 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
}
+- (BOOL)webGLEnabled
+{
+ return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
+}
+
+- (void)setWebGLEnabled:(BOOL)enabled
+{
+ [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
+}
+
+- (BOOL)pluginHalterEnabled
+{
+ return [self _boolValueForKey:WebKitPluginHalterEnabledPreferenceKey];
+}
+
+- (void)setPluginHalterEnabled:(BOOL)enabled
+{
+ [self _setBoolValue:enabled forKey:WebKitPluginHalterEnabledPreferenceKey];
+}
+
+- (unsigned)pluginAllowedRunTime
+{
+ return [self _integerValueForKey:WebKitPluginAllowedRunTimePreferenceKey];
+}
+
+- (void)setPluginAllowedRunTime:(unsigned)allowedRunTime
+{
+ return [self _setIntegerValue:allowedRunTime forKey:WebKitPluginAllowedRunTimePreferenceKey];
+}
+
- (void)didRemoveFromWebView
{
ASSERT(_private->numWebViews);
@@ -1152,6 +1207,12 @@ static NSString *classIBCreatorID = nil;
{
++_private->numWebViews;
}
+
+- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key
+{
+ [self _setStringValue:value forKey:key];
+}
+
@end
@implementation WebPreferences (WebInternal)
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index d571869..6a25921 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -107,6 +107,18 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)isXSSAuditorEnabled;
- (void)setXSSAuditorEnabled:(BOOL)flag;
+- (BOOL)experimentalNotificationsEnabled;
+- (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled;
+
+- (BOOL)experimentalWebSocketsEnabled;
+- (void)setExperimentalWebSocketsEnabled:(BOOL)websocketsEnabled;
+
+- (BOOL)pluginHalterEnabled;
+- (void)setPluginHalterEnabled:(BOOL)enabled;
+
+- (unsigned)pluginAllowedRunTime;
+- (void)setPluginAllowedRunTime:(unsigned)allowedRunTime;
+
// zero means do AutoScale
- (float)PDFScaleFactor;
- (void)setPDFScaleFactor:(float)scale;
@@ -117,6 +129,10 @@ extern NSString *WebPreferencesRemovedNotification;
- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
+// Used to set preference specified in the test via LayoutTestController.overridePreference(..).
+// For use with DumpRenderTree only.
+- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key;
+
// If site-specific spoofing is enabled, some pages that do inappropriate user-agent string checks will be
// passed a nonstandard user-agent string to get them to work correctly. This method might be removed in
// the future when there's no more need for it.
@@ -139,6 +155,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)acceleratedCompositingEnabled;
- (void)setAcceleratedCompositingEnabled:(BOOL)enabled;
+- (BOOL)webGLEnabled;
+- (void)setWebGLEnabled:(BOOL)enabled;
+
// Other private methods
- (void)_postPreferencesChangesNotification;
+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier;
diff --git a/WebKit/mac/WebView/WebScriptDebugger.mm b/WebKit/mac/WebView/WebScriptDebugger.mm
index 76bdf58..8deccff 100644
--- a/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -32,13 +32,14 @@
#import "WebFrameInternal.h"
#import "WebScriptDebugDelegate.h"
#import "WebViewInternal.h"
+#import <JavaScriptCore/DebuggerCallFrame.h>
+#import <JavaScriptCore/JSGlobalObject.h>
+#import <JavaScriptCore/SourceCode.h>
#import <WebCore/DOMWindow.h>
#import <WebCore/Frame.h>
#import <WebCore/JSDOMWindow.h>
#import <WebCore/KURL.h>
#import <WebCore/ScriptController.h>
-#import <debugger/DebuggerCallFrame.h>
-#import <runtime/JSGlobalObject.h>
using namespace JSC;
using namespace WebCore;
@@ -68,7 +69,7 @@ static NSURL *toNSURL(const UString& s)
{
if (s.isEmpty())
return nil;
- return KURL(s);
+ return KURL(ParsedURLString, s);
}
static WebFrame *toWebFrame(JSGlobalObject* globalObject)
diff --git a/WebKit/mac/WebView/WebTextCompletionController.mm b/WebKit/mac/WebView/WebTextCompletionController.mm
index f7c172f..6c37b98 100644
--- a/WebKit/mac/WebView/WebTextCompletionController.mm
+++ b/WebKit/mac/WebView/WebTextCompletionController.mm
@@ -39,6 +39,7 @@
@end
using namespace WebCore;
+using namespace std;
// This class handles the complete: operation.
// It counts on its host view to call endRevertingChange: whenever the current completion needs to be aborted.
@@ -131,7 +132,7 @@ using namespace WebCore;
windowFrame.size.height = numberToShow * [_tableView rowHeight] + (numberToShow + 1) * [_tableView intercellSpacing].height;
windowFrame.origin.y -= windowFrame.size.height;
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:12.0f], NSFontAttributeName, nil];
- float maxWidth = 0.0f;
+ CGFloat maxWidth = 0;
int maxIndex = -1;
int i;
for (i = 0; i < numberToShow; i++) {
@@ -146,8 +147,8 @@ using namespace WebCore;
maxWidth = ceilf([NSScrollView frameSizeForContentSize:NSMakeSize(maxWidth, 100.0f) hasHorizontalScroller:NO hasVerticalScroller:YES borderType:NSNoBorder].width);
maxWidth = ceilf([NSWindow frameRectForContentRect:NSMakeRect(0.0f, 0.0f, maxWidth, 100.0f) styleMask:NSBorderlessWindowMask].size.width);
maxWidth += 5.0f;
- windowFrame.size.width = MAX(maxWidth, windowFrame.size.width);
- maxWidth = MIN(400.0f, windowFrame.size.width);
+ windowFrame.size.width = max(maxWidth, windowFrame.size.width);
+ maxWidth = min<CGFloat>(400, windowFrame.size.width);
}
[_popupWindow setFrame:windowFrame display:NO];
diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h
index 717cf01..0715475 100644
--- a/WebKit/mac/WebView/WebUIDelegatePrivate.h
+++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h
@@ -109,7 +109,7 @@ enum {
- (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu;
- (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element;
- (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel;
-
+- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode;
/*!
@method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:
@param sender The WebView sending the delegate method.
@@ -127,8 +127,8 @@ enum {
- (BOOL)webView:(WebView *)sender frame:(WebFrame *)frame requestGeolocationPermission:(WebGeolocation *)geolocation securityOrigin:(WebSecurityOrigin *)origin;
- (void)webView:(WebView *)sender formStateDidChangeForNode:(DOMNode *)node;
-- (void)webView:(WebView *)sender formStateDidFocusNode:(DOMNode *)node;
-- (void)webView:(WebView *)sender formStateDidBlurNode:(DOMNode *)node;
+- (void)webView:(WebView *)sender formDidFocusNode:(DOMNode *)node;
+- (void)webView:(WebView *)sender formDidBlurNode:(DOMNode *)node;
/*!
@method webView:printFrame:
diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.h b/WebKit/mac/WebView/WebVideoFullscreenController.h
new file mode 100644
index 0000000..bb6a083
--- /dev/null
+++ b/WebKit/mac/WebView/WebVideoFullscreenController.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(VIDEO)
+
+#import <Cocoa/Cocoa.h>
+#import <wtf/RefPtr.h>
+#import <WebCore/HTMLMediaElement.h>
+
+@protocol WebVideoFullscreenControllerDelegate;
+@class WebVideoFullscreenHUDWindowController;
+@class WebWindowFadeAnimation;
+
+@interface WebVideoFullscreenController : NSWindowController
+{
+@private
+ RefPtr<WebCore::HTMLMediaElement> _mediaElement; // (retain)
+ id<WebVideoFullscreenControllerDelegate> _delegate; // (assign)
+
+ NSWindow *_backgroundFullscreenWindow; // (retain)
+ WebVideoFullscreenHUDWindowController* _hudController; // (retain)
+
+ WebWindowFadeAnimation *_fadeAnimation; // (retain)
+
+ BOOL _isEndingFullscreen;
+ BOOL _isWindowLoaded;
+ BOOL _forceDisableAnimation;
+}
+
+- (id<WebVideoFullscreenControllerDelegate>)delegate;
+- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate;
+
+- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
+- (WebCore::HTMLMediaElement*)mediaElement;
+
+- (void)enterFullscreen:(NSScreen *)screen;
+- (void)exitFullscreen;
+
+@end
+
+#endif
+
diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm
new file mode 100644
index 0000000..6592ad2
--- /dev/null
+++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm
@@ -0,0 +1,444 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(VIDEO)
+
+#import <QTKit/QTKit.h>
+#import <objc/objc-runtime.h>
+#import <HIToolbox/HIToolbox.h>
+
+#import <wtf/UnusedParam.h>
+#import <WebCore/SoftLinking.h>
+#import <WebCore/IntRect.h>
+
+#import "WebVideoFullscreenController.h"
+#import "WebVideoFullscreenHUDWindowController.h"
+#import "WebKitSystemInterface.h"
+#import "WebTypesInternal.h"
+#import "WebWindowAnimation.h"
+
+SOFT_LINK_FRAMEWORK(QTKit)
+SOFT_LINK_CLASS(QTKit, QTMovieView)
+
+@interface WebVideoFullscreenWindow : NSWindow
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER)
+<NSAnimationDelegate>
+#endif
+{
+ SEL _controllerActionOnAnimationEnd;
+ WebWindowScaleAnimation *_fullscreenAnimation; // (retain)
+ QTMovieView *_movieView; // (retain)
+}
+- (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction;
+- (QTMovieView *)movieView;
+- (void)setMovieView:(QTMovieView *)movieView;
+@end
+
+@interface WebVideoFullscreenController(HUDWindowControllerDelegate) <WebVideoFullscreenHUDWindowControllerDelegate>
+@end
+
+@implementation WebVideoFullscreenController
+- (id)init
+{
+ // Do not defer window creation, to make sure -windowNumber is created (needed by WebWindowScaleAnimation).
+ NSWindow *window = [[WebVideoFullscreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ self = [super initWithWindow:window];
+ [window release];
+ if (!self)
+ return nil;
+ [self windowDidLoad];
+ return self;
+
+}
+- (void)dealloc
+{
+ ASSERT(!_backgroundFullscreenWindow);
+ ASSERT(!_fadeAnimation);
+ [super dealloc];
+}
+
+- (WebVideoFullscreenWindow *)fullscreenWindow
+{
+ return (WebVideoFullscreenWindow *)[super window];
+}
+
+- (void)windowDidLoad
+{
+ WebVideoFullscreenWindow *window = [self fullscreenWindow];
+ QTMovieView *view = [[getQTMovieViewClass() alloc] init];
+ [view setFillColor:[NSColor clearColor]];
+ [window setMovieView:view];
+ [view setControllerVisible:NO];
+ [view setPreservesAspectRatio:YES];
+ if (_mediaElement)
+ [view setMovie:_mediaElement->platformMedia().qtMovie];
+ [window setHasShadow:YES]; // This is nicer with a shadow.
+ [window setLevel:NSPopUpMenuWindowLevel-1];
+ [view release];
+}
+
+- (WebCore::HTMLMediaElement*)mediaElement;
+{
+ return _mediaElement.get();
+}
+
+- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
+{
+ _mediaElement = mediaElement;
+ if ([self isWindowLoaded]) {
+ QTMovieView *movieView = [[self fullscreenWindow] movieView];
+ [movieView setMovie:_mediaElement->platformMedia().qtMovie];
+ }
+}
+
+- (id<WebVideoFullscreenControllerDelegate>)delegate
+{
+ return _delegate;
+}
+
+- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate;
+{
+ _delegate = delegate;
+}
+
+- (CGFloat)clearFadeAnimation
+{
+ [_fadeAnimation stopAnimation];
+ CGFloat previousAlpha = [_fadeAnimation currentAlpha];
+ [_fadeAnimation setWindow:nil];
+ [_fadeAnimation release];
+ _fadeAnimation = nil;
+ return previousAlpha;
+}
+
+- (void)windowDidExitFullscreen
+{
+ [self clearFadeAnimation];
+ [[self window] close];
+ [self setWindow:nil];
+ SetSystemUIMode(kUIModeNormal, 0);
+ [_hudController setDelegate:nil];
+ [_hudController release];
+ _hudController = nil;
+ [_backgroundFullscreenWindow close];
+ [_backgroundFullscreenWindow release];
+ _backgroundFullscreenWindow = nil;
+
+ [self autorelease]; // Associated -retain is in -exitFullscreen.
+ _isEndingFullscreen = NO;
+}
+
+- (void)windowDidEnterFullscreen
+{
+ [self clearFadeAnimation];
+
+ ASSERT(!_hudController);
+ _hudController = [[WebVideoFullscreenHUDWindowController alloc] init];
+ [_hudController setDelegate:self];
+
+ SetSystemUIMode(kUIModeAllSuppressed , 0);
+ [NSCursor setHiddenUntilMouseMoves:YES];
+
+ // Give the HUD keyboard focus initially
+ [_hudController fadeWindowIn];
+}
+
+- (NSRect)mediaElementRect
+{
+ return _mediaElement->screenRect();
+}
+
+#pragma mark -
+#pragma mark Exposed Interface
+
+static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame)
+{
+ // Keep a constrained aspect ratio for the destination window
+ double originalRatio = frame->size.width / frame->size.height;
+ double newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
+ if (newRatio > originalRatio) {
+ double newWidth = originalRatio * frameToConstrain->size.height;
+ double diff = frameToConstrain->size.width - newWidth;
+ frameToConstrain->size.width = newWidth;
+ frameToConstrain->origin.x += diff / 2;
+ } else {
+ double newHeight = frameToConstrain->size.width / originalRatio;
+ double diff = frameToConstrain->size.height - newHeight;
+ frameToConstrain->size.height = newHeight;
+ frameToConstrain->origin.y += diff / 2;
+ }
+}
+
+static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
+{
+ NSWindow *window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ [window setOpaque:YES];
+ [window setBackgroundColor:[NSColor blackColor]];
+ [window setLevel:level];
+ [window setHidesOnDeactivate:YES];
+ [window setReleasedWhenClosed:NO];
+ return window;
+}
+
+- (void)setupFadeAnimationIfNeededAndFadeIn:(BOOL)fadeIn
+{
+ CGFloat initialAlpha = fadeIn ? 0 : 1;
+ if (_fadeAnimation) {
+ // Make sure we support queuing animation if the previous one isn't over yet
+ initialAlpha = [self clearFadeAnimation];
+ }
+ if (!_forceDisableAnimation)
+ _fadeAnimation = [[WebWindowFadeAnimation alloc] initWithDuration:0.2 window:_backgroundFullscreenWindow initialAlpha:initialAlpha finalAlpha:fadeIn ? 1 : 0];
+}
+
+- (void)enterFullscreen:(NSScreen *)screen;
+{
+ if (!screen)
+ screen = [NSScreen mainScreen];
+
+ NSRect frame = [self mediaElementRect];
+ NSRect endFrame = [screen frame];
+ constrainFrameToRatioOfFrame(&endFrame, &frame);
+
+ // Create a black window if needed
+ if (!_backgroundFullscreenWindow)
+ _backgroundFullscreenWindow = createBackgroundFullscreenWindow([screen frame], [[self window] level]-1);
+ else
+ [_backgroundFullscreenWindow setFrame:[screen frame] display:NO];
+
+ [self setupFadeAnimationIfNeededAndFadeIn:YES];
+ if (_forceDisableAnimation) {
+ // This will disable scale animation
+ frame = NSZeroRect;
+ }
+ [[self fullscreenWindow] animateFromRect:frame toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidEnterFullscreen)];
+
+ [_backgroundFullscreenWindow orderWindow:NSWindowBelow relativeTo:[[self fullscreenWindow] windowNumber]];
+}
+
+- (void)exitFullscreen
+{
+ if (_isEndingFullscreen)
+ return;
+ _isEndingFullscreen = YES;
+ [_hudController closeWindow];
+
+ NSRect endFrame = [self mediaElementRect];
+
+ [self setupFadeAnimationIfNeededAndFadeIn:NO];
+ if (_forceDisableAnimation) {
+ // This will disable scale animation
+ endFrame = NSZeroRect;
+ }
+
+ // We have to retain ourselves because we want to be alive for the end of the animation.
+ // If our owner releases us we could crash if this is not the case.
+ // Balanced in windowDidExitFullscreen
+ [self retain];
+
+ [[self fullscreenWindow] animateFromRect:[[self window] frame] toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)];
+}
+
+#pragma mark -
+#pragma mark Window callback
+
+- (void)requestExitFullscreenWithAnimation:(BOOL)animation
+{
+ if (_isEndingFullscreen)
+ return;
+
+ _forceDisableAnimation = !animation;
+ _mediaElement->exitFullscreen();
+ _forceDisableAnimation = NO;
+}
+
+- (void)requestExitFullscreen
+{
+ [self requestExitFullscreenWithAnimation:YES];
+}
+
+- (void)fadeHUDIn
+{
+ [_hudController fadeWindowIn];
+}
+@end
+
+@implementation WebVideoFullscreenWindow
+
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
+{
+ UNUSED_PARAM(aStyle);
+ self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
+ if (!self)
+ return nil;
+ [self setOpaque:NO];
+ [self setBackgroundColor:[NSColor clearColor]];
+ [self setHidesOnDeactivate:YES];
+ [self setIgnoresMouseEvents:NO];
+ [self setAcceptsMouseMovedEvents:YES];
+ return self;
+}
+
+- (void)dealloc
+{
+ ASSERT(!_fullscreenAnimation);
+ [super dealloc];
+}
+
+- (QTMovieView *)movieView
+{
+ return _movieView;
+}
+
+- (void)setMovieView:(QTMovieView *)movieView
+{
+ if (_movieView == movieView)
+ return;
+ [_movieView release];
+ _movieView = [movieView retain];
+ [self setContentView:_movieView];
+}
+
+- (BOOL)resignFirstResponder
+{
+ return NO;
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return NO;
+}
+
+- (void)mouseDown:(NSEvent *)theEvent
+{
+ UNUSED_PARAM(theEvent);
+}
+
+- (void)cancelOperation:(id)sender
+{
+ UNUSED_PARAM(sender);
+ [[self windowController] requestExitFullscreen];
+}
+
+- (void)animatedResizeDidEnd
+{
+ // Call our windowController.
+ if (_controllerActionOnAnimationEnd)
+ [[self windowController] performSelector:_controllerActionOnAnimationEnd];
+ _controllerActionOnAnimationEnd = NULL;
+}
+
+//
+// This function will animate a change of frame rectangle
+// We support queuing animation, that means that we'll correctly
+// interrupt the running animation, and queue the next one.
+//
+- (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction
+{
+ _controllerActionOnAnimationEnd = controllerAction;
+
+ BOOL wasAnimating = NO;
+ if (_fullscreenAnimation) {
+ wasAnimating = YES;
+
+ // Interrupt any running animation.
+ [_fullscreenAnimation stopAnimation];
+
+ // Save the current rect to ensure a smooth transition.
+ startRect = [_fullscreenAnimation currentFrame];
+ [_fullscreenAnimation release];
+ _fullscreenAnimation = nil;
+ }
+
+ if (NSIsEmptyRect(startRect) || NSIsEmptyRect(endRect)) {
+ // Fakely end the subanimation.
+ [subAnimation setCurrentProgress:1.0];
+ // And remove the weak link to the window.
+ [subAnimation stopAnimation];
+
+ [self setFrame:endRect display:NO];
+ [self makeKeyAndOrderFront:self];
+ [self animatedResizeDidEnd];
+ return;
+ }
+
+ if (!wasAnimating) {
+ // We'll downscale the window during the animation based on the higher resolution rect
+ BOOL higherResolutionIsEndRect = startRect.size.width < endRect.size.width && startRect.size.height < endRect.size.height;
+ [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO];
+ }
+
+ ASSERT(!_fullscreenAnimation);
+ _fullscreenAnimation = [[WebWindowScaleAnimation alloc] initWithHintedDuration:0.2 window:self initalFrame:startRect finalFrame:endRect];
+ [_fullscreenAnimation setSubAnimation:subAnimation];
+ [_fullscreenAnimation setDelegate:self];
+
+ // Make sure the animation has scaled the window before showing it.
+ [_fullscreenAnimation setCurrentProgress:0];
+ [self makeKeyAndOrderFront:self];
+
+ [_fullscreenAnimation startAnimation];
+}
+
+- (void)animationDidEnd:(NSAnimation *)animation
+{
+#if !defined(BUILDING_ON_TIGER) // Animations are never threaded on Tiger.
+ if (![NSThread isMainThread]) {
+ [self performSelectorOnMainThread:@selector(animationDidEnd:) withObject:animation waitUntilDone:NO];
+ return;
+ }
+#endif
+ if (animation != _fullscreenAnimation)
+ return;
+
+ // The animation is not really over and was interrupted
+ // Don't send completion events.
+ if ([animation currentProgress] < 1.0)
+ return;
+
+ // Ensure that animation (and subanimation) don't keep
+ // the weak reference to the window ivar that may be destroyed from
+ // now on.
+ [_fullscreenAnimation setWindow:nil];
+
+ [_fullscreenAnimation autorelease];
+ _fullscreenAnimation = nil;
+
+ [self animatedResizeDidEnd];
+}
+
+- (void)mouseMoved:(NSEvent *)theEvent
+{
+ [[self windowController] fadeHUDIn];
+}
+
+- (void)resignKeyWindow
+{
+ [super resignKeyWindow];
+ [[self windowController] requestExitFullscreenWithAnimation:NO];
+}
+@end
+
+#endif /* ENABLE(VIDEO) */
diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h
new file mode 100644
index 0000000..8b06c1c
--- /dev/null
+++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(VIDEO)
+
+#import <Cocoa/Cocoa.h>
+#import <WebCore/HTMLMediaElement.h>
+
+@protocol WebVideoFullscreenHUDWindowControllerDelegate;
+
+@interface WebVideoFullscreenHUDWindowController : NSWindowController {
+@private
+ id<WebVideoFullscreenHUDWindowControllerDelegate> _delegate;
+ NSTimer *_timelineUpdateTimer;
+#if !defined(BUILDING_ON_TIGER)
+ NSTrackingArea *_area;
+#endif
+ BOOL _mouseIsInHUD;
+
+ NSControl *_timeline;
+ NSTextField *_remainingTimeText;
+ NSTextField *_elapsedTimeText;
+ NSControl *_volumeSlider;
+ NSControl *_playButton;
+}
+- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
+- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
+- (void)fadeWindowIn;
+- (void)fadeWindowOut;
+- (void)closeWindow;
+
+@end
+
+@protocol WebVideoFullscreenHUDWindowControllerDelegate <NSObject>
+- (void)requestExitFullscreen;
+- (WebCore::HTMLMediaElement*)mediaElement;
+@end
+
+#endif
diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm
new file mode 100644
index 0000000..2edfccc
--- /dev/null
+++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm
@@ -0,0 +1,583 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(VIDEO)
+
+#import "WebVideoFullscreenHUDWindowController.h"
+
+#import <QTKit/QTKit.h>
+#import "WebKitSystemInterface.h"
+#import "WebTypesInternal.h"
+#import <wtf/RetainPtr.h>
+
+#define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
+
+@interface WebVideoFullscreenHUDWindowController (Private) <NSWindowDelegate>
+
+- (void)updateTime;
+- (void)timelinePositionChanged:(id)sender;
+- (float)currentTime;
+- (void)setCurrentTime:(float)currentTime;
+- (double)duration;
+
+- (double)maxVolume;
+- (void)volumeChanged:(id)sender;
+- (double)volume;
+- (void)setVolume:(double)volume;
+
+- (void)playingChanged:(id)sender;
+- (BOOL)playing;
+- (void)setPlaying:(BOOL)playing;
+
+- (void)rewind:(id)sender;
+- (void)fastForward:(id)sender;
+
+- (NSString *)remainingTimeText;
+- (NSString *)elapsedTimeText;
+
+- (void)exitFullscreen:(id)sender;
+@end
+
+
+//
+// HUD Window
+//
+
+@interface WebVideoFullscreenHUDWindow : NSWindow
+@end
+
+@implementation WebVideoFullscreenHUDWindow
+
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
+{
+ UNUSED_PARAM(aStyle);
+ self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
+ if (!self)
+ return nil;
+
+ [self setOpaque:NO];
+ [self setBackgroundColor:[NSColor clearColor]];
+ [self setLevel:NSPopUpMenuWindowLevel];
+ [self setAcceptsMouseMovedEvents:YES];
+ [self setIgnoresMouseEvents:NO];
+ [self setMovableByWindowBackground:YES];
+ [self setHidesOnDeactivate:YES];
+
+ return self;
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (void)cancelOperation:(id)sender
+{
+ [[self windowController] exitFullscreen:self];
+}
+
+- (void)center
+{
+ NSRect hudFrame = [self frame];
+ NSRect screenFrame = [[NSScreen mainScreen] frame];
+ [self setFrameTopLeftPoint:NSMakePoint(screenFrame.origin.x + (screenFrame.size.width - hudFrame.size.width) / 2,
+ screenFrame.origin.y + (screenFrame.size.height - hudFrame.size.height) / 6)];
+}
+
+- (void)keyDown:(NSEvent *)event
+{
+ [super keyDown:event];
+ [[self windowController] fadeWindowIn];
+}
+
+@end
+
+//
+// HUD Window Controller
+//
+
+static const CGFloat windowHeight = 59;
+static const CGFloat windowWidth = 438;
+
+static const NSTimeInterval HUDWindowFadeOutDelay = 3;
+
+@implementation WebVideoFullscreenHUDWindowController
+
+- (id)init
+{
+ NSWindow* window = [[WebVideoFullscreenHUDWindow alloc] initWithContentRect:NSMakeRect(0, 0, windowWidth, windowHeight)
+ styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ self = [super initWithWindow:window];
+ [window setDelegate:self];
+ [window release];
+ if (!self)
+ return nil;
+ [self windowDidLoad];
+ return self;
+}
+
+- (void)dealloc
+{
+ ASSERT(!_timelineUpdateTimer);
+#if !defined(BUILDING_ON_TIGER)
+ ASSERT(!_area);
+#endif
+ [_timeline release];
+ [_remainingTimeText release];
+ [_elapsedTimeText release];
+ [_volumeSlider release];
+ [_playButton release];
+ [super dealloc];
+}
+
+#if !defined(BUILDING_ON_TIGER)
+- (void)setArea:(NSTrackingArea *)area
+{
+ if (area == _area)
+ return;
+ [_area release];
+ _area = [area retain];
+}
+#endif
+
+- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate
+{
+ return _delegate;
+}
+
+- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate
+{
+ _delegate = delegate;
+}
+
+- (void)scheduleTimeUpdate
+{
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(unscheduleTimeUpdate) object:self];
+
+ // First, update right away, then schedule future update
+ [self updateTime];
+
+ [_timelineUpdateTimer invalidate];
+ [_timelineUpdateTimer release];
+
+ // Note that this creates a retain cycle between the window and us.
+ _timelineUpdateTimer = [[NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(updateTime) userInfo:nil repeats:YES] retain];
+#if defined(BUILDING_ON_TIGER)
+ [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:(NSString*)kCFRunLoopCommonModes];
+#else
+ [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:NSRunLoopCommonModes];
+#endif
+}
+
+- (void)unscheduleTimeUpdate
+{
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(unscheduleTimeUpdate) object:nil];
+
+ [_timelineUpdateTimer invalidate];
+ [_timelineUpdateTimer release];
+ _timelineUpdateTimer = nil;
+}
+
+- (void)fadeWindowIn
+{
+ NSWindow *window = [self window];
+ if (![window isVisible])
+ [window setAlphaValue:0];
+
+ [window makeKeyAndOrderFront:self];
+#if defined(BUILDING_ON_TIGER)
+ [window setAlphaValue:1];
+#else
+ [[window animator] setAlphaValue:1];
+#endif
+ [self scheduleTimeUpdate];
+
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil];
+ if (!_mouseIsInHUD && [self playing]) // Don't fade out when paused.
+ [self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay];
+}
+
+- (void)fadeWindowOut
+{
+ [NSCursor setHiddenUntilMouseMoves:YES];
+#if defined(BUILDING_ON_TIGER)
+ [[self window] setAlphaValue:0];
+#else
+ [[[self window] animator] setAlphaValue:0];
+#endif
+ [self performSelector:@selector(unscheduleTimeUpdate) withObject:nil afterDelay:1];
+}
+
+- (void)closeWindow
+{
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil];
+ [self unscheduleTimeUpdate];
+ NSWindow *window = [self window];
+#if !defined(BUILDING_ON_TIGER)
+ [[window contentView] removeTrackingArea:_area];
+ [self setArea:nil];
+#endif
+ [window close];
+ [window setDelegate:nil];
+ [self setWindow:nil];
+}
+
+#ifndef HAVE_MEDIA_CONTROL
+enum {
+ WKMediaUIControlPlayPauseButton,
+ WKMediaUIControlRewindButton,
+ WKMediaUIControlFastForwardButton,
+ WKMediaUIControlExitFullscreenButton,
+ WKMediaUIControlVolumeDownButton,
+ WKMediaUIControlSlider,
+ WKMediaUIControlVolumeUpButton,
+ WKMediaUIControlTimeline
+};
+#endif
+
+static NSControl *createControlWithMediaUIControlType(int controlType, NSRect frame)
+{
+#ifdef HAVE_MEDIA_CONTROL
+ NSControl *control = WKCreateMediaUIControl(controlType);
+ [control setFrame:frame];
+ return control;
+#else
+ if (controlType == WKMediaUIControlSlider)
+ return [[NSSlider alloc] initWithFrame:frame];
+ return [[NSControl alloc] initWithFrame:frame];
+#endif
+}
+
+static NSTextField *createTimeTextField(NSRect frame)
+{
+ NSTextField *textField = [[NSTextField alloc] initWithFrame:frame];
+ [textField setTextColor:[NSColor whiteColor]];
+ [textField setBordered:NO];
+ [textField setFont:[NSFont systemFontOfSize:10]];
+ [textField setDrawsBackground:NO];
+ [textField setBezeled:NO];
+ [textField setEditable:NO];
+ [textField setSelectable:NO];
+ return textField;
+}
+
+- (void)windowDidLoad
+{
+ static const CGFloat kMargin = 9;
+ static const CGFloat kMarginTop = 9;
+ static const CGFloat kButtonSize = 25;
+ static const CGFloat kButtonMiniSize = 16;
+
+ NSWindow *window = [self window];
+ ASSERT(window);
+
+#ifdef HAVE_MEDIA_CONTROL
+ NSView *background = WKCreateMediaUIBackgroundView();
+#else
+ NSView *background = [[NSView alloc] init];
+#endif
+ [window setContentView:background];
+#if !defined(BUILDING_ON_TIGER)
+ _area = [[NSTrackingArea alloc] initWithRect:[background bounds] options:NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways owner:self userInfo:nil];
+ [background addTrackingArea:_area];
+#endif
+ [background release];
+
+ NSView *contentView = [[self window] contentView];
+
+ CGFloat top = windowHeight - kMarginTop;
+ CGFloat center = (windowWidth - kButtonSize) / 2;
+ _playButton = createControlWithMediaUIControlType(WKMediaUIControlPlayPauseButton, NSMakeRect(center, top - kButtonSize, kButtonSize, kButtonSize));
+ [_playButton setTarget:self];
+ [_playButton setAction:@selector(playingChanged:)];
+ [contentView addSubview:_playButton];
+
+ CGFloat closeToRight = windowWidth - 2 * kMargin - kButtonMiniSize;
+ NSControl *exitFullscreenButton = createControlWithMediaUIControlType(WKMediaUIControlExitFullscreenButton, NSMakeRect(closeToRight, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize));
+ [exitFullscreenButton setAction:@selector(exitFullscreen:)];
+ [exitFullscreenButton setTarget:self];
+ [contentView addSubview:exitFullscreenButton];
+ [exitFullscreenButton release];
+
+ CGFloat left = kMargin;
+ NSControl *volumeDownButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeDownButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize));
+ [contentView addSubview:volumeDownButton];
+ [volumeDownButton release];
+
+ static const int volumeSliderWidth = 50;
+
+ left = kMargin + kButtonMiniSize;
+ _volumeSlider = createControlWithMediaUIControlType(WKMediaUIControlSlider, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, volumeSliderWidth, kButtonMiniSize));
+ [_volumeSlider setValue:[NSNumber numberWithDouble:[self maxVolume]] forKey:@"maxValue"];
+ [_volumeSlider setTarget:self];
+ [_volumeSlider setAction:@selector(volumeChanged:)];
+ [contentView addSubview:_volumeSlider];
+
+ left = kMargin + kButtonMiniSize + volumeSliderWidth + kButtonMiniSize / 2;
+ NSControl *button = createControlWithMediaUIControlType(WKMediaUIControlVolumeUpButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize));
+ [contentView addSubview:button];
+ [button release];
+
+ static const int timeTextWidth = 50;
+ static const int sliderHeight = 13;
+ static const int sliderMarginFixup = 4;
+
+#ifdef HAVE_MEDIA_CONTROL
+ _timeline = WKCreateMediaUIControl(WKMediaUIControlTimeline);
+#else
+ _timeline = [[NSSlider alloc] init];
+#endif
+ [_timeline setTarget:self];
+ [_timeline setAction:@selector(timelinePositionChanged:)];
+ [_timeline setFrame:NSMakeRect(kMargin + timeTextWidth + kMargin/2, kMargin - sliderMarginFixup, windowWidth - 2 * (kMargin - sliderMarginFixup) - kMargin * 2 - 2 * timeTextWidth, sliderHeight)];
+ [contentView addSubview:_timeline];
+
+ static const int timeTextHeight = 11;
+
+ _elapsedTimeText = createTimeTextField(NSMakeRect(kMargin, kMargin, timeTextWidth, timeTextHeight));
+ [contentView addSubview:_elapsedTimeText];
+
+ _remainingTimeText = createTimeTextField(NSMakeRect(windowWidth - kMargin - timeTextWidth, kMargin, timeTextWidth, timeTextHeight));
+ [contentView addSubview:_remainingTimeText];
+
+ [window recalculateKeyViewLoop];
+ [window setInitialFirstResponder:_playButton];
+ [window center];
+}
+
+/*
+ * Bindings
+ *
+ */
+
+- (void)updateVolume
+{
+ [_volumeSlider setDoubleValue:[self volume]];
+}
+
+- (void)updateTime
+{
+ [self updateVolume];
+
+ [_timeline setFloatValue:[self currentTime]];
+ [(NSSlider*)_timeline setMaxValue:[self duration]];
+
+ [_remainingTimeText setStringValue:[self remainingTimeText]];
+ [_elapsedTimeText setStringValue:[self elapsedTimeText]];
+}
+
+- (void)fastForward
+{
+}
+
+- (void)timelinePositionChanged:(id)sender
+{
+ [self setCurrentTime:[_timeline floatValue]];
+}
+
+- (float)currentTime
+{
+ return [_delegate mediaElement] ? [_delegate mediaElement]->currentTime() : 0;
+}
+
+- (void)setCurrentTime:(float)currentTime
+{
+ if (![_delegate mediaElement])
+ return;
+ WebCore::ExceptionCode e;
+ [_delegate mediaElement]->setCurrentTime(currentTime, e);
+}
+
+- (double)duration
+{
+ return [_delegate mediaElement] ? [_delegate mediaElement]->duration() : 0;
+}
+
+- (double)maxVolume
+{
+ // Set the volume slider resolution
+ return 100;
+}
+
+- (void)volumeChanged:(id)sender
+{
+ [self setVolume:[_volumeSlider doubleValue]];
+}
+
+- (double)volume
+{
+ return [_delegate mediaElement] ? [_delegate mediaElement]->volume() * [self maxVolume] : 0;
+}
+
+- (void)setVolume:(double)volume
+{
+ if (![_delegate mediaElement])
+ return;
+ WebCore::ExceptionCode e;
+ [_delegate mediaElement]->setVolume(volume / [self maxVolume], e);
+}
+
+- (void)playingChanged:(id)sender
+{
+ [self setPlaying:![self playing]];
+
+ // Keep HUD visible when paused
+ if (![self playing])
+ [self fadeWindowIn];
+ else if (!_mouseIsInHUD) {
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil];
+ [self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay];
+ }
+}
+
+- (BOOL)playing
+{
+ if (![_delegate mediaElement])
+ return false;
+ return ![_delegate mediaElement]->canPlay();
+}
+
+- (void)setPlaying:(BOOL)playing
+{
+ if (![_delegate mediaElement])
+ return;
+
+ if (playing)
+ [_delegate mediaElement]->play();
+ else
+ [_delegate mediaElement]->pause();
+}
+
+static NSString *timeToString(double time)
+{
+ if (!isfinite(time))
+ time = 0;
+ int seconds = (int)fabsf(time);
+ int hours = seconds / (60 * 60);
+ int minutes = (seconds / 60) % 60;
+ seconds %= 60;
+ if (hours) {
+ if (hours > 9)
+ return [NSString stringWithFormat:@"%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds];
+ else
+ return [NSString stringWithFormat:@"%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds];
+ }
+ else
+ return [NSString stringWithFormat:@"%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds];
+
+}
+
+static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment align)
+{
+ NSShadow *blackShadow = [[NSShadow alloc] init];
+ [blackShadow setShadowColor:[NSColor blackColor]];
+ [blackShadow setShadowBlurRadius:0];
+ [blackShadow setShadowOffset:NSMakeSize(0, -1)];
+ NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
+ [style setAlignment:align];
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:blackShadow, NSShadowAttributeName, style, NSParagraphStyleAttributeName, nil];
+ [style release];
+ [blackShadow release];
+
+ NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:string attributes:dict];
+ return [attrString autorelease];
+}
+
+- (NSString *)remainingTimeText
+{
+ if (![_delegate mediaElement])
+ return @"";
+
+ // Negative number
+ return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime() - [_delegate mediaElement]->duration()), NSLeftTextAlignment);
+}
+
+- (NSString *)elapsedTimeText
+{
+ if (![_delegate mediaElement])
+ return @"";
+
+ return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime()), NSRightTextAlignment);
+}
+
+/*
+ * Tracking area callbacks
+ *
+ */
+
+- (void)mouseEntered:(NSEvent *)theEvent
+{
+ // Make sure the HUD won't be hidden from now
+ _mouseIsInHUD = YES;
+ [self fadeWindowIn];
+}
+
+- (void)mouseExited:(NSEvent *)theEvent
+{
+ _mouseIsInHUD = NO;
+ [self fadeWindowIn];
+}
+
+/*
+ * Other Interface callbacks
+ *
+ */
+
+- (void)rewind:(id)sender
+{
+ if (![_delegate mediaElement])
+ return;
+ [_delegate mediaElement]->rewind(30);
+}
+
+- (void)fastForward:(id)sender
+{
+ if (![_delegate mediaElement])
+ return;
+}
+
+- (void)exitFullscreen:(id)sender
+{
+ [_delegate requestExitFullscreen];
+}
+
+/*
+ * Window callback
+ *
+ */
+
+- (void)windowDidExpose:(NSNotification *)notification
+{
+ [self scheduleTimeUpdate];
+}
+
+- (void)windowDidClose:(NSNotification *)notification
+{
+ [self unscheduleTimeUpdate];
+}
+
+@end
+
+#endif
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 20f2712..83c7e20 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -84,6 +84,7 @@
#import "WebPanelAuthenticationHandler.h"
#import "WebPasteboardHelper.h"
#import "WebPluginDatabase.h"
+#import "WebPluginHalterClient.h"
#import "WebPolicyDelegate.h"
#import "WebPreferenceKeysPrivate.h"
#import "WebPreferencesPrivate.h"
@@ -93,6 +94,7 @@
#import "WebTextIterator.h"
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
+#import "WebVideoFullscreenController.h"
#import <CoreFoundation/CFSet.h>
#import <Foundation/NSURLConnection.h>
#import <WebCore/ApplicationCacheStorage.h>
@@ -619,7 +621,7 @@ static bool runningTigerMail()
didOneTimeInitialization = true;
}
- _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self));
+ _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self));
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
@@ -661,11 +663,11 @@ static bool runningTigerMail()
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
// Originally, we allowed all local loads.
- FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll);
+ SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForAll);
} else if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
// Later, we allowed local loads for local URLs and documents loaded
// with substitute data.
- FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForLocalAndSubstituteData);
+ SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
}
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_CONTENT_SNIFFING_FOR_FILE_URLS))
@@ -997,6 +999,8 @@ static bool fastDocumentTeardownEnabled()
return;
}
+ [self _exitFullscreen];
+
if (Frame* mainFrame = [self _mainCoreFrame])
mainFrame->loader()->detachFromParent();
@@ -1277,6 +1281,8 @@ static bool fastDocumentTeardownEnabled()
settings->setPluginsEnabled([preferences arePlugInsEnabled]);
settings->setDatabasesEnabled([preferences databasesEnabled]);
settings->setLocalStorageEnabled([preferences localStorageEnabled]);
+ settings->setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]);
+ settings->setExperimentalWebSocketsEnabled([preferences experimentalWebSocketsEnabled]);
settings->setPrivateBrowsingEnabled([preferences privateBrowsingEnabled]);
settings->setSansSerifFontFamily([preferences sansSerifFontFamily]);
settings->setSerifFontFamily([preferences serifFontFamily]);
@@ -1311,6 +1317,9 @@ static bool fastDocumentTeardownEnabled()
settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1));
settings->setAcceleratedCompositingEnabled([preferences acceleratedCompositingEnabled]);
+ settings->setPluginHalterEnabled([preferences pluginHalterEnabled]);
+ settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]);
+ settings->setWebGLEnabled([preferences webGLEnabled]);
}
static inline IMP getMethod(id o, SEL s)
@@ -1371,6 +1380,8 @@ static inline IMP getMethod(id o, SEL s)
cache->willCloseFrameFunc = getMethod(delegate, @selector(webView:willCloseFrame:));
cache->willPerformClientRedirectToURLDelayFireDateForFrameFunc = getMethod(delegate, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:));
cache->windowScriptObjectAvailableFunc = getMethod(delegate, @selector(webView:windowScriptObjectAvailable:));
+ cache->didDisplayInsecureContentFunc = getMethod(delegate, @selector(webViewDidDisplayInsecureContent:));
+ cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:));
}
- (void)_cacheScriptDebugDelegateImplementations
@@ -1396,6 +1407,22 @@ static inline IMP getMethod(id o, SEL s)
cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
}
+- (void)_cacheHistoryDelegateImplementations
+{
+ WebHistoryDelegateImplementationCache *cache = &_private->historyDelegateImplementations;
+ id delegate = _private->historyDelegate;
+
+ if (!delegate) {
+ bzero(cache, sizeof(WebHistoryDelegateImplementationCache));
+ return;
+ }
+
+ cache->navigatedFunc = getMethod(delegate, @selector(webView:didNavigateWithNavigationData:inFrame:));
+ cache->clientRedirectFunc = getMethod(delegate, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:));
+ cache->serverRedirectFunc = getMethod(delegate, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:));
+ cache->setTitleFunc = getMethod(delegate, @selector(webView:updateHistoryTitle:forURL:));
+}
+
- (id)_policyDelegateForwarder
{
if (!_private->policyDelegateForwarder)
@@ -2092,6 +2119,15 @@ static inline IMP getMethod(id o, SEL s)
return _private ? _private->insertionPasteboard : nil;
}
++ (void)_whiteListAccessFromOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains
+{
+ SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
+}
+
++(void)_resetOriginAccessWhiteLists
+{
+ SecurityOrigin::resetOriginAccessWhiteLists();
+}
- (void)_updateActiveState
{
@@ -2099,6 +2135,108 @@ static inline IMP getMethod(id o, SEL s)
_private->page->focusController()->setActive([[self window] isKeyWindow]);
}
+static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
+{
+ // Convert the patterns into Vectors.
+ NSUInteger count = [patterns count];
+ if (count == 0)
+ return 0;
+ Vector<String>* patternsVector = new Vector<String>;
+ for (NSUInteger i = 0; i < count; ++i) {
+ id entry = [patterns objectAtIndex:i];
+ if ([entry isKindOfClass:[NSString class]])
+ patternsVector->append(String((NSString*)entry));
+ }
+ return patternsVector;
+}
+
++ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID
+ whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime
+{
+ String group(groupName);
+ if (group.isEmpty() || worldID == UINT_MAX)
+ return;
+
+ PageGroup* pageGroup = PageGroup::pageGroup(group);
+ if (!pageGroup)
+ return;
+
+ pageGroup->addUserScript(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID,
+ injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
+}
+
++ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID
+ whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist
+{
+ String group(groupName);
+ if (group.isEmpty() || worldID == UINT_MAX)
+ return;
+
+ PageGroup* pageGroup = PageGroup::pageGroup(group);
+ if (!pageGroup)
+ return;
+
+ pageGroup->addUserStyleSheet(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID);
+}
+
++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID
+{
+ String group(groupName);
+ if (group.isEmpty())
+ return;
+
+ PageGroup* pageGroup = PageGroup::pageGroup(group);
+ if (!pageGroup)
+ return;
+
+ pageGroup->removeUserContentWithURLForWorld(url, worldID);
+}
+
++ (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID
+{
+ String group(groupName);
+ if (group.isEmpty())
+ return;
+
+ PageGroup* pageGroup = PageGroup::pageGroup(group);
+ if (!pageGroup)
+ return;
+
+ pageGroup->removeUserContentForWorld(worldID);
+}
+
++ (void)_removeAllUserContentFromGroup:(NSString *)groupName
+{
+ String group(groupName);
+ if (group.isEmpty())
+ return;
+
+ PageGroup* pageGroup = PageGroup::pageGroup(group);
+ if (!pageGroup)
+ return;
+
+ pageGroup->removeAllUserContent();
+}
+
+- (BOOL)cssAnimationsSuspended
+{
+ return _private->cssAnimationsSuspended;
+}
+
+- (void)setCSSAnimationsSuspended:(BOOL)suspended
+{
+ if (suspended == _private->cssAnimationsSuspended)
+ return;
+
+ _private->cssAnimationsSuspended = suspended;
+
+ Frame* frame = core([self mainFrame]);
+ if (suspended)
+ frame->animation()->suspendAnimations(frame->document());
+ else
+ frame->animation()->resumeAnimations(frame->document());
+}
+
@end
@implementation _WebSafeForwarder
@@ -3875,6 +4013,17 @@ done:
{
return _private->scriptDebugDelegate;
}
+
+- (void)setHistoryDelegate:(id)delegate
+{
+ _private->historyDelegate = delegate;
+ [self _cacheHistoryDelegateImplementations];
+}
+
+- (id)historyDelegate
+{
+ return _private->historyDelegate;
+}
- (BOOL)shouldClose
{
@@ -5091,13 +5240,16 @@ static WebFrameView *containingFrameView(NSView *view)
id documentView = [[[self selectedFrame] frameView] documentView];
if (![documentView conformsToProtocol:@protocol(WebDocumentText)])
return;
-
+
NSString *selectedString = [(id <WebDocumentText>)documentView selectedString];
- if ([selectedString length] == 0) {
+ if (![selectedString length])
return;
- }
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:selectedString];
+#else
(void)HISearchWindowShow((CFStringRef)selectedString, kNilOptions);
+#endif
}
#if USE(ACCELERATED_COMPOSITING)
@@ -5469,6 +5621,45 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi
#endif
+#if ENABLE(VIDEO)
+
+- (void)_enterFullscreenForNode:(WebCore::Node*)node
+{
+ ASSERT(node->hasTagName(WebCore::HTMLNames::videoTag));
+ HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node);
+
+ if (_private->fullscreenController) {
+ if ([_private->fullscreenController mediaElement] == videoElement) {
+ // The backend may just warn us that the underlaying plaftormMovie()
+ // has changed. Just force an update.
+ [_private->fullscreenController setMediaElement:videoElement];
+ return; // No more to do.
+ }
+
+ // First exit Fullscreen for the old mediaElement.
+ [_private->fullscreenController mediaElement]->exitFullscreen();
+ // This previous call has to trigger _exitFullscreen,
+ // which has to clear _private->fullscreenController.
+ ASSERT(!_private->fullscreenController);
+ }
+ if (!_private->fullscreenController) {
+ _private->fullscreenController = [[WebVideoFullscreenController alloc] init];
+ [_private->fullscreenController setMediaElement:videoElement];
+ [_private->fullscreenController enterFullscreen:[[self window] screen]];
+ }
+ else
+ [_private->fullscreenController setMediaElement:videoElement];
+}
+
+- (void)_exitFullscreen
+{
+ [_private->fullscreenController exitFullscreen];
+ [_private->fullscreenController release];
+ _private->fullscreenController = nil;
+}
+
+#endif
+
@end
#ifdef BUILDING_ON_LEOPARD
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 91d83a7..6ec94a7 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -43,6 +43,9 @@ namespace WebCore {
@class WebPreferences;
@class WebTextCompletionController;
@protocol WebFormDelegate;
+#if ENABLE(VIDEO)
+@class WebVideoFullscreenController;
+#endif
extern BOOL applicationIsTerminating;
extern int pluginDatabaseClientCount;
@@ -64,6 +67,7 @@ extern int pluginDatabaseClientCount;
id editingDelegate;
id editingDelegateForwarder;
id scriptDebugDelegate;
+ id historyDelegate;
WebInspector *inspector;
WebNodeHighlight *currentNodeHighlight;
@@ -86,6 +90,7 @@ extern int pluginDatabaseClientCount;
WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
WebFrameLoadDelegateImplementationCache frameLoadDelegateImplementations;
WebScriptDebugDelegateImplementationCache scriptDebugDelegateImplementations;
+ WebHistoryDelegateImplementationCache historyDelegateImplementations;
void *observationInfo;
@@ -100,6 +105,7 @@ extern int pluginDatabaseClientCount;
BOOL hoverFeedbackSuspended;
BOOL usesPageCache;
BOOL catchesDelegateExceptions;
+ BOOL cssAnimationsSuspended;
NSColor *backgroundColor;
@@ -157,5 +163,8 @@ extern int pluginDatabaseClientCount;
NSEvent *autoscrollTriggerEvent;
CFRunLoopTimerRef updateMouseoverTimer;
+#if ENABLE(VIDEO)
+ WebVideoFullscreenController *fullscreenController;
+#endif
}
@end
diff --git a/WebKit/mac/WebView/WebViewData.mm b/WebKit/mac/WebView/WebViewData.mm
index 48e7f6c..835f46e 100644
--- a/WebKit/mac/WebView/WebViewData.mm
+++ b/WebKit/mac/WebView/WebViewData.mm
@@ -57,6 +57,7 @@ int pluginDatabaseClientCount = 0;
allowsUndo = YES;
usesPageCache = YES;
shouldUpdateWhileOffscreen = YES;
+ cssAnimationsSuspended = NO;
zoomMultiplier = 1;
@@ -80,6 +81,7 @@ int pluginDatabaseClientCount = 0;
ASSERT(applicationIsTerminating || !page);
ASSERT(applicationIsTerminating || !preferences);
ASSERT(!insertionPasteboard);
+ ASSERT(!fullscreenController);
[applicationNameForUserAgent release];
[backgroundColor release];
@@ -99,6 +101,7 @@ int pluginDatabaseClientCount = 0;
{
ASSERT_MAIN_THREAD();
ASSERT(!insertionPasteboard);
+ ASSERT(!fullscreenController);
[super finalize];
}
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index b8266c5..521aeee 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -41,6 +41,7 @@ namespace WebCore {
class KURL;
class KeyboardEvent;
class Page;
+ class Node;
}
#endif
@@ -110,10 +111,6 @@ namespace WebCore {
- (id)_policyDelegateForwarder;
- (void)_pushPerformingProgrammaticFocus;
- (void)_popPerformingProgrammaticFocus;
-- (void)_incrementProgressForIdentifier:(id)identifier response:(NSURLResponse *)response;
-- (void)_incrementProgressForIdentifier:(id)identifier length:(int)length;
-- (void)_completeProgressForIdentifier:(id)identifer;
-- (void)_progressStarted:(WebFrame *)frame;
- (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
- (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
@@ -138,7 +135,6 @@ namespace WebCore {
- (void)_didChangeValueForKey:(NSString *)key;
- (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
- (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
-- (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType;
- (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
- (WebNodeHighlight *)currentNodeHighlight;
@@ -168,4 +164,9 @@ namespace WebCore {
- (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
+#if ENABLE(VIDEO) && defined(__cplusplus)
+- (void)_enterFullscreenForNode:(WebCore::Node*)node;
+- (void)_exitFullscreen;
+#endif
+
@end
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 362b2e6..fa5d28c 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -76,6 +76,11 @@ typedef enum {
} WebDashboardBehavior;
#endif
+typedef enum {
+ WebInjectAtDocumentStart,
+ WebInjectAtDocumentEnd,
+} WebUserScriptInjectionTime;
+
@interface WebController : NSTreeController {
IBOutlet WebView *webView;
}
@@ -134,6 +139,20 @@ typedef enum {
*/
- (id)scriptDebugDelegate;
+/*!
+ @method setHistoryDelegate:
+ @abstract Set the WebView's WebHistoryDelegate delegate.
+ @param delegate The WebHistoryDelegate to set as the delegate.
+*/
+- (void)setHistoryDelegate:(id)delegate;
+
+/*!
+ @method historyDelegate
+ @abstract Return the WebView's WebHistoryDelegate delegate.
+ @result The WebView's WebHistoryDelegate delegate.
+*/
+- (id)historyDelegate;
+
- (BOOL)shouldClose;
/*!
@@ -443,6 +462,35 @@ Could be worth adding to the API.
// Which pasteboard text is coming from in editing delegate methods such as shouldInsertNode.
- (NSPasteboard *)_insertionPasteboard;
+// Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters:
+// - destinationProtocol: The protocol to grant access to.
+// - destinationHost: The host to grant access to.
+// - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively.
++ (void)_whiteListAccessFromOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
+
+// Removes all white list entries created with _whiteListAccessFromOrigin.
++ (void)_resetOriginAccessWhiteLists;
+
++ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime;
++ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist;
++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID;
++ (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID;
++ (void)_removeAllUserContentFromGroup:(NSString *)groupName;
+
+/*!
+ @method cssAnimationsSuspended
+ @abstract Returns whether or not CSS Animations are suspended.
+ @result YES if CSS Animations are suspended.
+*/
+- (BOOL)cssAnimationsSuspended;
+
+/*!
+ @method setCSSAnimationsSuspended
+ @param paused YES to suspend animations, NO to resume animations.
+ @discussion Suspends or resumes all running animations and transitions in the page.
+*/
+- (void)setCSSAnimationsSuspended:(BOOL)suspended;
+
@end
@interface WebView (WebViewPrintingPrivate)
diff --git a/WebKit/mac/WebView/WebWindowAnimation.h b/WebKit/mac/WebView/WebWindowAnimation.h
new file mode 100644
index 0000000..c73dcce
--- /dev/null
+++ b/WebKit/mac/WebView/WebWindowAnimation.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@interface WebWindowScaleAnimation : NSAnimation {
+@private
+ NSRect _initialFrame, _finalFrame, _realFrame;
+ NSWindow *_window; // (assign)
+ NSAnimation *_subAnimation; // (retain)
+ NSTimeInterval _hintedDuration;
+}
+- (id)initWithHintedDuration:(NSTimeInterval)duration window:(NSWindow *)window initalFrame:(NSRect)initialFrame finalFrame:(NSRect)finalFrame;
+
+- (void)setSubAnimation:(NSAnimation *)animation;
+
+- (NSRect)currentFrame;
+
+// Be sure to call setWindow:nil to clear the weak link _window when appropriate
+- (void)setWindow:(NSWindow *)window;
+@end
+
+
+@interface WebWindowFadeAnimation : NSAnimation {
+@private
+ CGFloat _initialAlpha, _finalAlpha;
+ NSWindow *_window; // (retain)
+ BOOL _isStopped;
+
+}
+- (id)initWithDuration:(NSTimeInterval)duration window:(NSWindow *)window initialAlpha:(CGFloat)initialAlpha finalAlpha:(CGFloat)finalAlpha;
+
+- (CGFloat)currentAlpha;
+
+// Be sure to call setWindow:nil to clear the weak link _window when appropriate
+- (void)setWindow:(NSWindow *)window;
+@end
diff --git a/WebKit/mac/WebView/WebWindowAnimation.m b/WebKit/mac/WebView/WebWindowAnimation.m
new file mode 100644
index 0000000..3ab64bf
--- /dev/null
+++ b/WebKit/mac/WebView/WebWindowAnimation.m
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebWindowAnimation.h"
+#import "WebKitSystemInterface.h"
+#import <wtf/Assertions.h>
+
+static const CGFloat slowMotionFactor = 10.;
+
+static NSTimeInterval WebWindowAnimationDurationFromDuration(NSTimeInterval duration)
+{
+ return ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) ? duration * slowMotionFactor : duration;
+}
+
+static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, double factor)
+{
+ NSRect currentRect = _initialFrame;
+ currentRect.origin.x += (NSMinX(_finalFrame) - NSMinX(_initialFrame)) * factor;
+ currentRect.origin.y += (NSMinY(_finalFrame) - NSMinY(_initialFrame)) * factor;
+ currentRect.size.width += (NSWidth(_finalFrame) - NSWidth(_initialFrame)) * factor;
+ currentRect.size.height += (NSHeight(_finalFrame) - NSHeight(_initialFrame)) * factor;
+ return currentRect;
+}
+
+static CGFloat squaredDistance(NSPoint point1, NSPoint point2)
+{
+ CGFloat deltaX = point1.x - point2.x;
+ CGFloat deltaY = point1.y - point2.y;
+ return deltaX * deltaX + deltaY * deltaY;
+}
+
+@implementation WebWindowScaleAnimation
+
+- (id)init
+{
+ self = [super init];
+ if (!self)
+ return nil;
+#ifndef BUILDING_ON_TIGER
+ [self setAnimationBlockingMode:NSAnimationNonblockingThreaded];
+#endif
+ [self setFrameRate:60.];
+ return self;
+}
+
+- (id)initWithHintedDuration:(NSTimeInterval)duration window:(NSWindow *)window initalFrame:(NSRect)initialFrame finalFrame:(NSRect)finalFrame
+{
+ self = [self init];
+ if (!self)
+ return nil;
+ _hintedDuration = duration;
+ _window = window;
+ _initialFrame = initialFrame;
+ _finalFrame = finalFrame;
+ _realFrame = [window frame];
+ return self;
+}
+
+- (void) dealloc
+{
+ [_window release];
+ [_subAnimation release];
+ [super dealloc];
+}
+
+- (void)setDuration:(NSTimeInterval)duration
+{
+ [super setDuration:WebWindowAnimationDurationFromDuration(duration)];
+}
+
+- (void)setWindow:(NSWindow *)window
+{
+ _window = window;
+}
+
+- (float)currentValue
+{
+ return 0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress]));
+}
+
+- (NSRect)currentFrame
+{
+ return scaledRect(_finalFrame, _initialFrame, [self currentValue]);
+}
+
+- (void)setCurrentProgress:(NSAnimationProgress)progress
+{
+ if (!_window)
+ return;
+
+ [super setCurrentProgress:progress];
+
+ NSRect currentRect = [self currentFrame];
+#ifndef BUILDING_ON_TIGER
+ WKWindowSetScaledFrame(_window, currentRect, _realFrame);
+#else
+ [_window setFrame:currentRect display:YES];
+#endif
+ [_subAnimation setCurrentProgress:progress];
+}
+
+- (void)setSubAnimation:(NSAnimation *)animation
+{
+ id oldAnimation = _subAnimation;
+ _subAnimation = [animation retain];
+ [oldAnimation release];
+}
+
+- (NSTimeInterval)additionalDurationNeededToReachFinalFrame
+{
+ static const CGFloat maxAdditionalDuration = 1.0;
+ static const CGFloat speedFactor = 0.0001;
+
+ CGFloat maxDist = squaredDistance(_initialFrame.origin, _finalFrame.origin);
+ CGFloat dist;
+
+ dist = squaredDistance(NSMakePoint(NSMaxX(_initialFrame), NSMinY(_initialFrame)), NSMakePoint(NSMaxX(_finalFrame), NSMinY(_finalFrame)));
+ if (dist > maxDist)
+ maxDist = dist;
+
+ dist = squaredDistance(NSMakePoint(NSMaxX(_initialFrame), NSMaxY(_initialFrame)), NSMakePoint(NSMaxX(_finalFrame), NSMaxY(_finalFrame)));
+ if (dist > maxDist)
+ maxDist = dist;
+
+ dist = squaredDistance(NSMakePoint(NSMinX(_initialFrame), NSMinY(_initialFrame)), NSMakePoint(NSMinX(_finalFrame), NSMinY(_finalFrame)));
+ if (dist > maxDist)
+ maxDist = dist;
+
+ return MIN(sqrt(maxDist) * speedFactor, maxAdditionalDuration);
+}
+
+- (void)startAnimation
+{
+ // Compute extra time
+ if (_hintedDuration)
+ [self setDuration:_hintedDuration + [self additionalDurationNeededToReachFinalFrame]];
+ [super startAnimation];
+}
+
+- (void)stopAnimation
+{
+ _window = nil;
+ [super stopAnimation];
+ [_subAnimation stopAnimation];
+}
+
+@end
+
+@implementation WebWindowFadeAnimation
+
+- (id)init
+{
+ self = [super init];
+ if (!self)
+ return nil;
+#ifndef BUILDING_ON_TIGER
+ [self setAnimationBlockingMode:NSAnimationNonblockingThreaded];
+#endif
+ [self setFrameRate:60];
+ [self setAnimationCurve:NSAnimationEaseInOut];
+ return self;
+}
+
+- (id)initWithDuration:(NSTimeInterval)duration window:(NSWindow *)window initialAlpha:(CGFloat)initialAlpha finalAlpha:(CGFloat)finalAlpha
+{
+ self = [self init];
+ if (!self)
+ return nil;
+ _window = window;
+ _initialAlpha = initialAlpha;
+ _finalAlpha = finalAlpha;
+ return self;
+}
+
+- (void)setDuration:(NSTimeInterval)duration
+{
+ [super setDuration:WebWindowAnimationDurationFromDuration(duration)];
+}
+
+- (CGFloat)currentAlpha
+{
+ return MAX(0.0, MIN(1.0, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha)));
+}
+
+- (void)setCurrentProgress:(NSAnimationProgress)progress
+{
+ if (_isStopped)
+ return;
+
+ ASSERT(_window);
+ [super setCurrentProgress:progress];
+
+#ifndef BUILDING_ON_TIGER
+ WKWindowSetAlpha(_window, [self currentAlpha]);
+#else
+ [_window setAlphaValue:[self currentAlpha]];
+#endif
+}
+
+- (void)setWindow:(NSWindow*)window
+{
+ _window = window;
+}
+
+- (void)stopAnimation
+{
+ // This is relevant when we are a sub animation of a scale animation.
+ // In this case we are hosted in the animated thread of the parent
+ // and even after [super stopAnimation], the parent might call
+ // setCurrrentProgress.
+ _isStopped = YES;
+
+ [super stopAnimation];
+}
+
+@end
+
diff --git a/WebKit/mac/Workers/WebWorkersPrivate.h b/WebKit/mac/Workers/WebWorkersPrivate.h
new file mode 100644
index 0000000..0ff60d5
--- /dev/null
+++ b/WebKit/mac/Workers/WebWorkersPrivate.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@interface WebWorkersPrivate : NSObject {
+}
+
+// Returns the total number of currently executing worker threads (shared + dedicated).
++ (unsigned) workerThreadCount;
+
+@end
diff --git a/WebKit/mac/Workers/WebWorkersPrivate.mm b/WebKit/mac/Workers/WebWorkersPrivate.mm
new file mode 100644
index 0000000..2c14ad1
--- /dev/null
+++ b/WebKit/mac/Workers/WebWorkersPrivate.mm
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebWorkersPrivate.h"
+
+#import <WebCore/WorkerThread.h>
+
+@implementation WebWorkersPrivate
+
++ (unsigned) workerThreadCount
+{
+#if ENABLE_WORKERS
+ return WebCore::WorkerThread::workerThreadCount();
+#else
+ return 0;
+#endif
+}
+
+@end