diff options
Diffstat (limited to 'WebKit/mac')
48 files changed, 1481 insertions, 485 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index c6151ad..ea2393a 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,779 @@ +2010-06-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + Full-screened content doesn't keep the display on: Safari not grabbing a power assertion? + https://bugs.webkit.org/show_bug.cgi?id=40939 + rdar://problem/7996172 + + Take a IOKit power assertion when playing video in fullscreen mode. Release the + assertion when paused in fullscreen mode, and when exiting fullscreen mode. + + * WebView/WebVideoFullscreenController.h: + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController windowDidExitFullscreen]): Call updatePowerAssertions. + (-[WebVideoFullscreenController windowDidEnterFullscreen]): Call updatePowerAssertions. + (-[WebVideoFullscreenController _disableIdleDisplaySleep]): + (-[WebVideoFullscreenController _enableIdleDisplaySleep]): + (-[WebVideoFullscreenController _disableIdleSystemSleep]): + (-[WebVideoFullscreenController _enableIdleSystemSleep]): + (-[WebVideoFullscreenController updatePowerAssertions]): Call _(enable|disable)Idle(System|Display)sleep depending on current playback rate and fullscreen status. + (-[WebVideoFullscreenController rateChanged:]): Call updatePowerAssertions. + +2010-06-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Playing movie full screen on second monitor hides menu bar and title bar on main monitor + https://bugs.webkit.org/show_bug.cgi?id=40933 + rdar://problem/7858452 + + Remove all references to GetSystemUIMode and SetSystemUIMode. Replace these calls with + [NSApplication setPresentationOptions:]. Do not auto-hide the menu bar if the fullscreen + screen is does not contain the menu-bar. Do not auto-hide the dock if the fullscreen screen + is both not the menu-bar screen and not the dock screen. + + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController windowDidLoad]): Register the applicationDidChangeScreenParameters: listener. + (-[WebVideoFullscreenController windowDidExitFullscreen]): Calls updateMenuAndDockForFullscreen. + (-[WebVideoFullscreenController windowDidEnterFullscreen]): Calls updateMenuAndDockForFullscreen. + (-[WebVideoFullscreenController applicationDidChangeScreenParameters:]): New notification handler; catches NSApplicationDidChangeScreenParameters. + (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Hide/show the menu-bar and dock according to the fullscreen window's screen. + +2010-06-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + Full screen video in Safari exits full-screen if you switch to another app + https://bugs.webkit.org/show_bug.cgi?id=40635 + rdar://problem/7885101 + + Implement the following rules for exiting full screen when switching apps: + 1. If the system has a single screen, switching apps will cause Safari to exit full-screen. + 2. Otherwise, if the full-screen screen is the "main screen" (the one with the title bar), + switching apps will cause Safari to exit full-screen. + 3. Overriding rules 1 & 2, if the full-screen screen is not on the "current space", + switching apps will NOT cause Safari to exit full-screen. + + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController windowDidLoad]): + (-[WebVideoFullscreenController applicationDidResignActive:]): + +2010-06-24 Adele Peterson <adele@apple.com> + + Reviewed by Sam Weinig. + + Updated fix for <rdar://problem/8093680> "Paste and Match Style" should fire paste events + https://bugs.webkit.org/show_bug.cgi?id=41085 + + * WebView/WebHTMLView.mm: Use the WebCore command system for the pasteAsPlainText selector. + Also remove internal methods that no one is using. + +2010-06-24 Damian Kaleta <dkaleta@apple.com> + + Reviewed by Sam Weinig. + + Added an ObjC wrapper to Node::renderRect(bool&). + + * DOM/WebDOMOperations.mm: + (-[DOMNode _renderRect:]): + * DOM/WebDOMOperationsPrivate.h: + +2010-06-24 Adele Peterson <adele@apple.com> + + Reviewed by Eric Carlson. + + Fix for <rdar://problem/8093680> "Paste and Match Style" should fire paste events + https://bugs.webkit.org/show_bug.cgi?id=41085 + + * WebView/WebHTMLView.mm: (-[WebHTMLView pasteAsPlainText:]): Reuse code in WebCore + which does everything done here and also fires paste events. + +2010-06-23 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Implement page format data programming interface. + Add methods for testing. + https://bugs.webkit.org/show_bug.cgi?id=37538 + + * Misc/WebCoreStatistics.h: + * Misc/WebCoreStatistics.mm: + (-[WebFrame isPageBoxVisible:]): + (-[WebFrame pageAreaRectInPixels:]): + (-[WebFrame preferredPageSizeInPixels:]): + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get rid of more USE_LIBDISPATCH code. + + * Plugins/Hosted/NetscapePluginHostProxy.h: + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get rid of the USE_LIBDISPATCH code. + + * Plugins/Hosted/NetscapePluginHostProxy.mm: + (WebKit::NetscapePluginHostProxy::NetscapePluginHostProxy): + (WebKit::NetscapePluginHostProxy::~NetscapePluginHostProxy): + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Wean NetscapePluginHostManager of any knowledge about WebNetscapePluginPackage + https://bugs.webkit.org/show_bug.cgi?id=41006 + + * Plugins/Hosted/NetscapePluginHostManager.h: + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::hostForPlugin): + (WebKit::NetscapePluginHostManager::spawnPluginHost): + (WebKit::NetscapePluginHostManager::instantiatePlugin): + (WebKit::NetscapePluginHostManager::createPropertyListFile): + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (-[WebHostedNetscapePluginView createPlugin]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage createPropertyListFile]): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix an off-by-one bug I introduced. + + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + +2010-06-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + FrameLoader cleanup: Split high level subframe and plugin + loading functions into a separate class. + https://bugs.webkit.org/show_bug.cgi?id=40453 + + * WebView/WebFrame.mm: + (-[WebFrame _cacheabilityDictionary]): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Another Tiger build fix. + + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage _tryLoad]): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More WebBasePluginPackage cleanup + https://bugs.webkit.org/show_bug.cgi?id=40944 + + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::pluginCancelledConnectionError): + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::spawnPluginHost): + * Plugins/WebBaseNetscapePluginStream.mm: + (WebNetscapePluginStream::pluginCancelledConnectionError): + * Plugins/WebBaseNetscapePluginView.mm: + (WebHaltablePlugin::pluginName): + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage _objectForInfoDictionaryKey:]): + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage load]): + (-[WebBasePluginPackage dealloc]): + (-[WebBasePluginPackage finalize]): + (-[WebBasePluginPackage pluginInfo]): + (-[WebBasePluginPackage supportsExtension:]): + (-[WebBasePluginPackage supportsMIMEType:WebCore::]): + (-[WebBasePluginPackage MIMETypeForExtension:]): + (-[WebBasePluginPackage isJavaPlugIn]): + (-[WebBasePluginPackage versionNumber]): + (-[WebBasePluginPackage WebCore::]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage openResourceFile]): + (-[WebNetscapePluginPackage closeResourceFile:]): + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + (-[WebNetscapePluginPackage _initWithPath:]): + (-[WebNetscapePluginPackage _applyDjVuWorkaround]): + (-[WebNetscapePluginPackage _tryLoad]): + (-[WebNetscapePluginPackage supportsSnapshotting]): + (-[WebNetscapePluginPackage _unloadWithShutdown:]): + * Plugins/WebPluginDatabase.mm: + (-[WebPluginDatabase refresh]): + (-[WebPluginDatabase _removePlugin:]): + * Plugins/WebPluginPackage.mm: + (-[WebPluginPackage initWithPath:]): + (-[WebPluginPackage load]): + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::createPlugin): + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::getPluginInfo): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Another PowerPC build fix. + + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage openResourceFile]): + (-[WebNetscapePluginPackage _tryLoad]): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Try to fix the PowerPC build. + + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage _tryLoad]): + +2010-06-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Update relevant calls into FrameLoader to make use of + FrameLoaderStateMachine. + https://bugs.webkit.org/show_bug.cgi?id=39695 + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::transitionToCommittedForNewPage): + * WebView/WebFrame.mm: + (-[WebFrame _firstLayoutDone]): + +2010-06-21 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Dan Bernstein. + + Chromium/Mac build fix. + + * WebCoreSupport/WebSystemInterface.mm: Change the order of wtf/Platform.h include to let other + headers smell it. + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Make all of WebKit build with clang++ + + * DefaultDelegates/WebDefaultPolicyDelegate.m: + (-[WebDefaultPolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]): + * Plugins/Hosted/NetscapePluginHostManager.mm: + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView resolvedURLStringForURL:target:]): + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView setSuppressLayout:]): + * WebView/WebHTMLRepresentation.mm: + * WebView/WebNavigationData.mm: + (-[WebNavigationData initWithURLString:title:originalRequest:response:hasSubstituteData:clientRedirectSource:]): + * WebView/WebPDFRepresentation.mm: + (-[WebPDFRepresentation setDataSource:]): + (-[WebPDFRepresentation receivedData:withDataSource:]): + (-[WebPDFRepresentation receivedError:withDataSource:]): + * WebView/WebResource.mm: + (-[WebResource description]): + * WebView/WebSerializedJSValue.mm: + (-[WebSerializedJSValue initWithValue:context:exception:]): + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController WebCore::]): + (-[WebVideoFullscreenController setMediaElement:WebCore::]): + (-[WebVideoFullscreenController setDelegate:]): + (-[WebVideoFullscreenController enterFullscreen:]): + * WebView/WebView.mm: + (-[WebView _openFrameInNewWindowFromMenu:]): + (-[WebView _geolocationDidChangePosition:]): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove unused dictionary ivars from WebBasePluginPackage + https://bugs.webkit.org/show_bug.cgi?id=40928 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage dealloc]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + +2010-06-21 Dan Bernstein <mitz@apple.com> + + Build fix + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2010-06-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + WebKit part of implementing the 'hyphens' and 'hyphenate-character' properties + https://bugs.webkit.org/show_bug.cgi?id=10228 + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Initialize wkGetHyphenationLocationBeforeIndex. + +2010-06-21 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Speech Input Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=40878 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Fix Tiger build. + + * Plugins/WebNetscapePluginPackage.mm: + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Get rid of the old MIMETypes getter method + https://bugs.webkit.org/show_bug.cgi?id=40898 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage supportsExtension:]): + (-[WebBasePluginPackage supportsMIMEType:WebCore::]): + (-[WebBasePluginPackage MIMETypeForExtension:]): + * Plugins/WebPluginDatabase.mm: + (-[WebPluginDatabase refresh]): + (-[WebPluginDatabase _removePlugin:]): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Remove bogus const qualifiers. + + * WebCoreSupport/WebPasteboardHelper.h: + * WebCoreSupport/WebPasteboardHelper.mm: + (WebPasteboardHelper::urlFromPasteboard): + (WebPasteboardHelper::plainTextFromPasteboard): + (WebPasteboardHelper::fragmentFromPasteboard): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Get rid of the extensionToMIME mapping in WebBasePluginPackage + https://bugs.webkit.org/show_bug.cgi?id=40897 + + Instead of using the extensionToMIME mutable dictionary, use the MIME types vector. + While this makes lookup of MIME types based on extensions linear instead of constant, + the number of extensions per plug-in is too small for it to matter. + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage dealloc]): + (-[WebBasePluginPackage supportsExtension:]): + (-[WebBasePluginPackage MIMETypeForExtension:]): + (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add a MimeClassInfo Vector to WebBasePluginPackage + https://bugs.webkit.org/show_bug.cgi?id=40896 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage WebCore::]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::getPluginInfo): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Move the NSBundle ivar to WebPluginPackage + https://bugs.webkit.org/show_bug.cgi?id=40894 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage _objectForInfoDictionaryKey:]): + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage load]): + (-[WebBasePluginPackage dealloc]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage _initWithPath:]): + * Plugins/WebPluginPackage.h: + * Plugins/WebPluginPackage.mm: + (-[WebPluginPackage initWithPath:]): + (-[WebPluginPackage dealloc]): + (-[WebPluginPackage viewFactory]): + (-[WebPluginPackage load]): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove -[WebBasePluginPackage bundle] + https://bugs.webkit.org/show_bug.cgi?id=40892 + + Add -[WebBasePluginPackage bundleIdentifier] and switch clients over to it. + + Move the supportsSnapshotting method over to the plug-in package. + + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::hostForPackage): + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]): + (-[WebBaseNetscapePluginView supportsSnapshotting]): + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage isQuickTimePlugIn]): + (-[WebBasePluginPackage isJavaPlugIn]): + (-[WebBasePluginPackage WebCore::]): + Call bundleIdentifier directly instead of asking the bundle + * Plugins/WebNetscapePluginPackage.h: + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage supportsSnapshotting]): + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView setAttributeKeys:andValues:]): + (-[WebNetscapePluginView _createPlugin]): + * Plugins/WebPluginDatabase.mm: + (checkCandidate): + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Change some WebPluginDabase ivars to use WebCore::String instead of NSString. + https://bugs.webkit.org/show_bug.cgi?id=40869 + + Re-land r61459, with extra null-checks in WebFrameLoaderClient. + + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::spawnPluginHost): + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage dealloc]): + (-[WebBasePluginPackage name]): + (-[WebBasePluginPackage path]): + (-[WebBasePluginPackage filename]): + (-[WebBasePluginPackage pluginDescription]): + (-[WebBasePluginPackage description]): + (-[WebBasePluginPackage isJavaPlugIn]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + (-[WebNetscapePluginPackage _tryLoad]): + (-[WebNetscapePluginPackage _unloadWithShutdown:]): + * Plugins/WebPluginPackage.mm: + (-[WebPluginPackage load]): + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::createPlugin): + +2010-06-18 Adam Barth <abarth@webkit.org> + + Unreviewed, rolling out r61459. + http://trac.webkit.org/changeset/61459 + https://bugs.webkit.org/show_bug.cgi?id=40869 + + Seems to have broken two tests on the Tiger buildbot: + + dom/html/level2/html/AppletsCollection.html + plugins/qt-qwidget-plugin.html + + Anders wasn't on #webkit... + + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::spawnPluginHost): + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage dealloc]): + (-[WebBasePluginPackage name]): + (-[WebBasePluginPackage path]): + (-[WebBasePluginPackage filename]): + (-[WebBasePluginPackage pluginDescription]): + (-[WebBasePluginPackage setName:]): + (-[WebBasePluginPackage setPath:]): + (-[WebBasePluginPackage setPluginDescription:]): + (-[WebBasePluginPackage description]): + (-[WebBasePluginPackage isJavaPlugIn]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + (-[WebNetscapePluginPackage _tryLoad]): + (-[WebNetscapePluginPackage _unloadWithShutdown:]): + * Plugins/WebPluginPackage.mm: + (-[WebPluginPackage load]): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Fix Tiger build. + + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage isJavaPlugIn]): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Change some WebPluginDabase ivars to use WebCore::String instead of NSString. + https://bugs.webkit.org/show_bug.cgi?id=40869 + + * Plugins/Hosted/NetscapePluginHostManager.mm: + (WebKit::NetscapePluginHostManager::spawnPluginHost): + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage initWithPath:]): + (-[WebBasePluginPackage getPluginInfoFromPLists]): + (-[WebBasePluginPackage dealloc]): + (-[WebBasePluginPackage name]): + (-[WebBasePluginPackage path]): + (-[WebBasePluginPackage filename]): + (-[WebBasePluginPackage pluginDescription]): + (-[WebBasePluginPackage description]): + (-[WebBasePluginPackage isJavaPlugIn]): + * Plugins/WebNetscapePluginPackage.mm: + (-[WebNetscapePluginPackage getPluginInfoFromResources]): + (-[WebNetscapePluginPackage _tryLoad]): + (-[WebNetscapePluginPackage _unloadWithShutdown:]): + * Plugins/WebPluginPackage.mm: + (-[WebPluginPackage load]): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename WebPluginPackage.m to make it an Objective-C++ file. + + * Plugins/WebPluginPackage.m: Removed. + * Plugins/WebPluginPackage.mm: Copied from Plugins/WebPluginPackage.m. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get rid of the NSEnumerators from WebBasePluginPackage + https://bugs.webkit.org/show_bug.cgi?id=40868 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage MIMETypes]): + (-[WebBasePluginPackage supportsExtension:]): + (-[WebBasePluginPackage supportsMIMEType:]): + * Plugins/WebPluginDatabase.mm: + (-[WebPluginDatabase pluginForMIMEType:]): + (-[WebPluginDatabase pluginForExtension:]): + (-[WebPluginDatabase refresh]): + (-[WebPluginDatabase _removePlugin:]): + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::getPluginInfo): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make WebCoreSystemInterface.h a C++ only header + https://bugs.webkit.org/show_bug.cgi?id=40867 + + * WebCoreSupport/WebSystemInterface.h: + * WebCoreSupport/WebSystemInterface.m: Removed. + * WebCoreSupport/WebSystemInterface.mm: Copied from WebKit/mac/WebCoreSupport/WebSystemInterface.m. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Clean up WebPluginDatabase.mm + https://bugs.webkit.org/show_bug.cgi?id=40866 + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (pathByResolvingSymlinksAndAliases): + (-[WebBasePluginPackage initWithPath:]): + Change an instance method into a static function. + + * Plugins/WebPluginDatabase.mm: + (PluginPackageCandidates::PluginPackageCandidates): + (PluginPackageCandidates::update): + (PluginPackageCandidates::bestCandidate): + Add a new PluginPackageCandidates class. + + (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]): + Use PluginPackageCandidates here. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Fix Tiger build. + + * WebCoreSupport/WebPlatformStrategies.mm: + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Get rid of PluginDataMac.mm and use the plug-in strategy instead + https://bugs.webkit.org/show_bug.cgi?id=40860 + + * Plugins/WebBasePluginPackage.h: + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::createPluginStrategy): + (WebPlatformStrategies::refreshPlugins): + (WebPlatformStrategies::getPluginInfo): + * WebCoreSupport/WebViewFactory.mm: + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add stubbed out WebPlatformStrategies class to WebKit. + https://bugs.webkit.org/show_bug.cgi?id=40851 + + * WebCoreSupport/WebPlatformStrategies.h: Added. + * WebCoreSupport/WebPlatformStrategies.mm: Added. + (WebPlatformStrategies::initialize): + (WebPlatformStrategies::WebPlatformStrategies): + (WebPlatformStrategies::createPluginStrategy): + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2010-06-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Move isAvailable()/setIsAvailable() from Database/DatabaseSync to AbstractDatabase. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-06-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Use adoptRef and create functions in more code paths + https://bugs.webkit.org/show_bug.cgi?id=40760 + + * Plugins/Hosted/NetscapePluginInstanceProxy.h: Made create no longer + be an inline function. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy): + Moved the call to addPluginInstance out of here. + (WebKit::NetscapePluginInstanceProxy::create): Move it in here. + This makes sure we call adoptRef on the new proxy before any caller + calls ref on it. + +2010-06-16 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Enable HTML5 Parser in Safari on Mac + https://bugs.webkit.org/show_bug.cgi?id=40739 + + The HTML5 parser is probably off on all webkit ports. + We should either flip the meaning of the default so that + "false" means HTML5 on all ports, or we'll have to write + more code like this for all the other ports. + + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + +2010-06-15 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Don't leak WebGeolocationPositionInternal and GeolocationPosition instances for every WebGeolocationPosition created. + + * WebView/WebGeolocationPosition.mm: + (-[WebGeolocationPosition dealloc]): Implement -dealloc and release our WebGeolocationPositionInternal instance. + +2010-06-10 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Implement render style selection for pages to support CSS3 Paged Media. + https://bugs.webkit.org/show_bug.cgi?id=35961 + + * Misc/WebCoreStatistics.h: + * Misc/WebCoreStatistics.mm: + (-[WebFrame pageProperty:propertyName:]): + +2010-06-15 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions out of Frame class that were marked "move to Chrome" + https://bugs.webkit.org/show_bug.cgi?id=39636 + + * WebView/WebView.mm: + (-[WebView shouldClose]): Call shouldClose on FrameLoader instead of + going through Frame. + +2010-06-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Remove getPluginInfoFromBundleAndMIMEDictionary: + + * Plugins/WebBasePluginPackage.mm: + +2010-06-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Fold getPluginInfoFromBundleAndMIMEDictionary: into its sole caller. + + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage getPluginInfoFromPLists]): + +2010-06-11 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8084721> Pages using accelerated compositing fail to update correctly in Carbon apps + + The run loop observer used to commit compositing layer changes does not do + updates if [window viewsNeedDisplay] is true, because this indicates that a delayed window + update is pending (added in r58623). + + However, Carbon apps don't use the NSWindow updating mechanism, so [window viewsNeedDisplay] always returns YES. + This caused us to never sync compositing layers. + + So detect if the current window is wrapping a carbon window, and in that case consult the root + HIView to detect if display is pending. + + * WebView/WebView.mm: + (layerSyncRunLoopObserverCallBack): + +2010-06-15 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/8077032> REGRESSION (r50796): Black background on AppleScript generated email + + Test: platform/mac/editing/input/NSBackgroundColor-transparent.html + + r50796 changed the initial background color from invalid to transparent. As a result, + NSAttributedStrings returned from +_web_attributedStringFromRange started including the + NSBackgroundColor attribute, with a transparent color as the value. This caused problems for + components in the system that ignore the alpha component, turning the color into opaque black. + + * Misc/WebNSAttributedStringExtras.mm: + (+[NSAttributedString _web_attributedStringFromRange:]): Change to not include the background + and foreground color attributes if the color are transparent. + 2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> Reviewed by Pavel Feldman. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 5b52793..08d9ef9 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -57,6 +57,7 @@ ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; +ENABLE_INPUT_SPEECH = ; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; ENABLE_METER_TAG = ENABLE_METER_TAG; @@ -81,4 +82,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 6f999af..f775a54 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 = 534; -MINOR_VERSION = 1; +MINOR_VERSION = 2; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/DOM/WebDOMOperations.mm b/WebKit/mac/DOM/WebDOMOperations.mm index 2bda67a..194a000 100644 --- a/WebKit/mac/DOM/WebDOMOperations.mm +++ b/WebKit/mac/DOM/WebDOMOperations.mm @@ -53,11 +53,20 @@ using namespace WebCore; return [[[WebArchive alloc] _initWithCoreLegacyWebArchive:LegacyWebArchive::create(core(self))] autorelease]; } +@end + +@implementation DOMNode (WebDOMNodeOperationsPendingPublic) + - (NSString *)markupString { return createFullMarkup(core(self)); } +- (NSRect)_renderRect:(bool *)isReplaced +{ + return NSRect(core(self)->renderRect(isReplaced)); +} + @end /* This doesn't appear to be used by anyone. We should consider removing this. */ diff --git a/WebKit/mac/DOM/WebDOMOperationsPrivate.h b/WebKit/mac/DOM/WebDOMOperationsPrivate.h index 013a687..826aa7d 100644 --- a/WebKit/mac/DOM/WebDOMOperationsPrivate.h +++ b/WebKit/mac/DOM/WebDOMOperationsPrivate.h @@ -34,4 +34,5 @@ @interface DOMNode (WebDOMNodeOperationsPendingPublic) - (NSString *)markupString; +- (NSRect)_renderRect:(bool *)isReplaced; @end diff --git a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m index 6de2792..bad87d5 100644 --- a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m +++ b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m @@ -60,7 +60,7 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil; - (void)webView: (WebView *)wv decidePolicyForMIMEType:(NSString *)type request:(NSURLRequest *)request frame:(WebFrame *)frame - decisionListener:(id <WebPolicyDecisionListener>)listener; + decisionListener:(id <WebPolicyDecisionListener>)listener { if ([[request URL] isFileURL]) { BOOL isDirectory = NO; diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h index a11c064..e357b72 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.h +++ b/WebKit/mac/Misc/WebCoreStatistics.h @@ -87,4 +87,8 @@ - (NSString *)counterValueForElement:(DOMElement*)element; - (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels; - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels; +- (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber; +- (bool)isPageBoxVisible:(int)pageNumber; +- (NSString *)pageAreaRectInPixels:(int)pageNumber; +- (NSString *)preferredPageSizeInPixels:(int)pageNumber; @end diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index c3fc23e..9112d21 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -275,4 +275,23 @@ using namespace WebCore; return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels)); } +- (NSString *)pageProperty:(const char *)propertyName:(int)pageNumber +{ + return PrintContext::pageProperty(_private->coreFrame, propertyName, pageNumber); +} + +- (bool)isPageBoxVisible:(int)pageNumber +{ + return PrintContext::isPageBoxVisible(_private->coreFrame, pageNumber); +} + +- (NSString *)pageAreaRectInPixels:(int)pageNumber +{ + return PrintContext::pageAreaRectInPixels(_private->coreFrame, pageNumber); +} + +- (NSString *)preferredPageSizeInPixels:(int)pageNumber; +{ + return PrintContext::preferredPageSizeInPixels(_private->coreFrame, pageNumber); +} @end diff --git a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm index 35b2524..2469da8 100644 --- a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm +++ b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm @@ -154,11 +154,11 @@ static NSFileWrapper *fileWrapperForElement(Element* e) RenderStyle* style = renderer->style(); NSFont *font = style->font().primaryFont()->getNSFont(); [attrs.get() setObject:font forKey:NSFontAttributeName]; - if (style->visitedDependentColor(CSSPropertyColor).isValid()) + if (style->visitedDependentColor(CSSPropertyColor).alpha()) [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; else [attrs.get() removeObjectForKey:NSForegroundColorAttributeName]; - if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) + if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; else [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName]; diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm index 98b5a7e..25e5462 100644 --- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm @@ -256,7 +256,7 @@ NSError *HostedNetscapePluginStream::pluginCancelledConnectionError() const return [[[NSError alloc] _initWithPluginErrorCode:WebKitErrorPlugInCancelledConnection contentURL:m_responseURL ? m_responseURL.get() : m_requestURL.get() pluginPageURL:nil - pluginName:[[m_instance->pluginView() pluginPackage] name] + pluginName:[[m_instance->pluginView() pluginPackage] pluginInfo].name MIMEType:m_mimeType.get()] autorelease]; } diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h index e62d87a..e1f02ac 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h @@ -28,11 +28,12 @@ #ifndef NetscapePluginHostManager_h #define NetscapePluginHostManager_h +#import <WebCore/PlatformString.h> +#import <WebCore/StringHash.h> #import <wtf/HashMap.h> #import <wtf/PassRefPtr.h> @class WebHostedNetscapePluginView; -@class WebNetscapePluginPackage; namespace WebKit { @@ -43,28 +44,28 @@ class NetscapePluginHostManager { public: static NetscapePluginHostManager& shared(); - PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled); + PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const WebCore::String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled); void pluginHostDied(NetscapePluginHostProxy*); - static void createPropertyListFile(WebNetscapePluginPackage *); + static void createPropertyListFile(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture); void didCreateWindow(); private: - NetscapePluginHostProxy* hostForPackage(WebNetscapePluginPackage *, bool useProxiedOpenPanel); + NetscapePluginHostProxy* hostForPlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const WebCore::String& bundleIdentifier, bool useProxiedOpenPanel); NetscapePluginHostManager(); ~NetscapePluginHostManager(); - bool spawnPluginHost(WebNetscapePluginPackage *, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel); + bool spawnPluginHost(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel); bool initializeVendorPort(); mach_port_t m_pluginVendorPort; // FIXME: This should really be a HashMap of RetainPtrs, but that doesn't work right now. - typedef HashMap<WebNetscapePluginPackage*, NetscapePluginHostProxy*> PluginHostMap; + typedef HashMap<WebCore::String, NetscapePluginHostProxy*> PluginHostMap; PluginHostMap m_pluginHosts; }; diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm index e4177f5..baec6ba 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm @@ -48,6 +48,7 @@ extern "C" { } using namespace std; +using namespace WebCore; namespace WebKit { @@ -58,7 +59,7 @@ NetscapePluginHostManager& NetscapePluginHostManager::shared() return pluginHostManager; } -static const NSString *pluginHostAppName = @"WebKitPluginHost.app"; +static NSString * const pluginHostAppName = @"WebKitPluginHost.app"; NetscapePluginHostManager::NetscapePluginHostManager() : m_pluginVendorPort(MACH_PORT_NULL) @@ -69,9 +70,9 @@ NetscapePluginHostManager::~NetscapePluginHostManager() { } -NetscapePluginHostProxy* NetscapePluginHostManager::hostForPackage(WebNetscapePluginPackage *package, bool useProxiedOpenPanel) +NetscapePluginHostProxy* NetscapePluginHostManager::hostForPlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, bool useProxiedOpenPanel) { - pair<PluginHostMap::iterator, bool> result = m_pluginHosts.add(package, 0); + pair<PluginHostMap::iterator, bool> result = m_pluginHosts.add(pluginPath, 0); // The package was already in the map, just return it. if (!result.second) @@ -85,7 +86,7 @@ NetscapePluginHostProxy* NetscapePluginHostManager::hostForPackage(WebNetscapePl mach_port_t pluginHostPort; ProcessSerialNumber pluginHostPSN; - if (!spawnPluginHost(package, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) { + if (!spawnPluginHost(pluginPath, pluginArchitecture, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) { mach_port_destroy(mach_task_self(), clientPort); m_pluginHosts.remove(result.first); return 0; @@ -93,17 +94,16 @@ NetscapePluginHostProxy* NetscapePluginHostManager::hostForPackage(WebNetscapePl // Since Flash NPObjects add methods dynamically, we don't want to cache when a property/method doesn't exist // on an object because it could be added later. - bool shouldCacheMissingPropertiesAndMethods = ![[[package bundle] bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"]; + bool shouldCacheMissingPropertiesAndMethods = bundleIdentifier != "com.macromedia.Flash Player.plugin"; NetscapePluginHostProxy* hostProxy = new NetscapePluginHostProxy(clientPort, pluginHostPort, pluginHostPSN, shouldCacheMissingPropertiesAndMethods); - CFRetain(package); result.first->second = hostProxy; return hostProxy; } -bool NetscapePluginHostManager::spawnPluginHost(WebNetscapePluginPackage *package, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel) +bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel) { if (m_pluginVendorPort == MACH_PORT_NULL) { if (!initializeVendorPort()) @@ -121,7 +121,7 @@ bool NetscapePluginHostManager::spawnPluginHost(WebNetscapePluginPackage *packag NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys: pluginHostAppExecutablePath, @"pluginHostPath", - [NSNumber numberWithInt:[package pluginHostArchitecture]], @"cpuType", + [NSNumber numberWithInt:pluginArchitecture], @"cpuType", localization.get(), @"localization", [NSNumber numberWithBool:useProxiedOpenPanel], @"useProxiedOpenPanel", nil]; @@ -152,11 +152,11 @@ bool NetscapePluginHostManager::spawnPluginHost(WebNetscapePluginPackage *packag NSString *visibleName = [NSString stringWithFormat:UI_STRING("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name " "and the second argument is the application name."), - [[package filename] stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]]; + [[(NSString*)pluginPath lastPathComponent] stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]]; NSDictionary *hostProperties = [[NSDictionary alloc] initWithObjectsAndKeys: visibleName, @"visibleName", - [package path], @"bundlePath", + (NSString *)pluginPath, @"bundlePath", nil]; data = [NSPropertyListSerialization dataFromPropertyList:hostProperties format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil]; @@ -215,10 +215,10 @@ void NetscapePluginHostManager::pluginHostDied(NetscapePluginHostProxy* pluginHo } } -PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) +PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) { WebPreferences *preferences = [[pluginView webView] preferences]; - NetscapePluginHostProxy* hostProxy = hostForPackage(pluginPackage, [preferences usesProxiedOpenPanel]); + NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]); if (!hostProxy) return 0; @@ -257,7 +257,7 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl pluginHostDied(hostProxy); // Try to spawn it again. - hostProxy = hostForPackage(pluginPackage, [preferences usesProxiedOpenPanel]); + hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]); // Create a new instance. instance = NetscapePluginInstanceProxy::create(hostProxy, pluginView, fullFrame); @@ -277,11 +277,11 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl return instance.release(); } -void NetscapePluginHostManager::createPropertyListFile(WebNetscapePluginPackage *package) +void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture) { NSString *pluginHostAppPath = [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] pathForAuxiliaryExecutable:pluginHostAppName]; NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath]; - NSString *bundlePath = [package path]; + NSString *bundlePath = pluginPath; pid_t pid; posix_spawnattr_t attr; @@ -289,7 +289,7 @@ void NetscapePluginHostManager::createPropertyListFile(WebNetscapePluginPackage // Set the architecture. size_t ocount = 0; - int cpuTypes[1] = { [package pluginHostArchitecture] }; + int cpuTypes[] = { pluginArchitecture }; posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &ocount); // Spawn the plug-in host and tell it to call the registration function. diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.h index d35503f..20db5d2 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.h +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.h @@ -84,11 +84,7 @@ private: mach_port_t m_clientPort; mach_port_t m_portSet; -#ifdef USE_LIBDISPATCH - dispatch_source_t m_clientPortSource; -#else RetainPtr<CFRunLoopSourceRef> m_clientPortSource; -#endif mach_port_t m_pluginHostPort; RetainPtr<CFMachPortRef> m_deadNameNotificationPort; diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm index 1d4cdad..8e1c2df 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm @@ -116,15 +116,9 @@ NetscapePluginHostProxy::NetscapePluginHostProxy(mach_port_t clientPort, mach_po CFRunLoopAddSource(CFRunLoopGetCurrent(), deathPortSource.get(), kCFRunLoopDefaultMode); -#ifdef USE_LIBDISPATCH - // FIXME: Unfortunately we can't use a dispatch source here until <rdar://problem/6393180> has been resolved. - m_clientPortSource = dispatch_source_mig_create(m_clientPort, WKWebKitPluginClient_subsystem.maxsize, 0, - dispatch_get_main_queue(), WebKitPluginClient_server); -#else m_clientPortSource.adoptCF(WKCreateMIGServerSource((mig_subsystem_t)&WKWebKitPluginClient_subsystem, m_clientPort)); CFRunLoopAddSource(CFRunLoopGetCurrent(), m_clientPortSource.get(), kCFRunLoopDefaultMode); CFRunLoopAddSource(CFRunLoopGetCurrent(), m_clientPortSource.get(), (CFStringRef)NSEventTrackingRunLoopMode); -#endif } NetscapePluginHostProxy::~NetscapePluginHostProxy() @@ -139,12 +133,8 @@ NetscapePluginHostProxy::~NetscapePluginHostProxy() } ASSERT(m_clientPortSource); -#ifdef USE_LIBDISPATCH - dispatch_release(m_clientPortSource); -#else CFRunLoopSourceInvalidate(m_clientPortSource.get()); m_clientPortSource = 0; -#endif } void NetscapePluginHostProxy::pluginHostDied() diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h index 7391c1e..5900b02 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h @@ -61,10 +61,7 @@ class ProxyInstance; class NetscapePluginInstanceProxy : public RefCounted<NetscapePluginInstanceProxy> { public: - static PassRefPtr<NetscapePluginInstanceProxy> create(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin) - { - return adoptRef(new NetscapePluginInstanceProxy(pluginHostProxy, pluginView, fullFramePlugin)); - } + static PassRefPtr<NetscapePluginInstanceProxy> create(NetscapePluginHostProxy*, WebHostedNetscapePluginView *, bool fullFramePlugin); ~NetscapePluginInstanceProxy(); uint32_t pluginID() const diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index 9c90dae..ca012ee 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -237,14 +237,19 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy do { m_pluginID = ++pluginIDCounter; } while (pluginHostProxy->pluginInstance(m_pluginID) || !m_pluginID); - - pluginHostProxy->addPluginInstance(this); #ifndef NDEBUG netscapePluginInstanceProxyCounter.increment(); #endif } +PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginInstanceProxy::create(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin) +{ + RefPtr<NetscapePluginInstanceProxy> proxy = adoptRef(new NetscapePluginInstanceProxy(pluginHostProxy, pluginView, fullFramePlugin)); + pluginHostProxy->addPluginInstance(proxy.get()); + return proxy.release(); +} + NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy() { ASSERT(!m_pluginHostProxy); diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 6917e5f..e743722 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -111,7 +111,7 @@ extern "C" { accleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled]; #endif - _proxy = NetscapePluginHostManager::shared().instantiatePlugin(_pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), + _proxy = NetscapePluginHostManager::shared().instantiatePlugin([_pluginPackage.get() path], [_pluginPackage.get() pluginHostArchitecture], [_pluginPackage.get() bundleIdentifier], self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), _mode == NP_FULL, _isPrivateBrowsingEnabled, accleratedCompositingEnabled); if (!_proxy) return NO; diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm index 7322d31..07d1d4f 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm @@ -104,7 +104,7 @@ NSError *WebNetscapePluginStream::pluginCancelledConnectionError() const return [[[NSError alloc] _initWithPluginErrorCode:WebKitErrorPlugInCancelledConnection contentURL:m_responseURL ? m_responseURL.get() : m_requestURL.get() pluginPageURL:nil - pluginName:[[m_pluginView.get() pluginPackage] name] + pluginName:[[m_pluginView.get() pluginPackage] pluginInfo].name MIMEType:m_mimeType.get()] autorelease]; } diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index a75251e..bcef2a1 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -108,7 +108,7 @@ bool WebHaltablePlugin::isWindowed() const String WebHaltablePlugin::pluginName() const { - return [[m_view pluginPackage] name]; + return [[m_view pluginPackage] pluginInfo].name; } @implementation WebBaseNetscapePluginView @@ -146,7 +146,7 @@ String WebHaltablePlugin::pluginName() const #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) // Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105> if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] && - [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.apple.QuickTime Plugin.plugin"]) { + [_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") { RetainPtr<NSMutableArray> mutableKeys(AdoptNS, [keys mutableCopy]); RetainPtr<NSMutableArray> mutableValues(AdoptNS, [values mutableCopy]); @@ -578,20 +578,7 @@ String WebHaltablePlugin::pluginName() const - (BOOL)supportsSnapshotting { - NSBundle *pluginBundle = [_pluginPackage.get() bundle]; - if (![[pluginBundle bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"]) - return YES; - - // Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString. - NSString *versionString = [pluginBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - - static const NSString *flash10dotOnePrefix = @"10.1"; - if (![versionString hasPrefix:flash10dotOnePrefix]) - return YES; - - // Some prerelease versions of Flash 10.1 crash when sent a drawRect event using the CA drawing model: <rdar://problem/7739922> - static const CFStringRef knownGoodFlash10dot1Release = CFSTR("10.1.53.60"); - return CFStringCompare((CFStringRef)versionString, knownGoodFlash10dot1Release, kCFCompareNumerically) != kCFCompareLessThan; + return [_pluginPackage.get() supportsSnapshotting]; } - (BOOL)hasBeenHalted @@ -930,7 +917,7 @@ String WebHaltablePlugin::pluginName() const } -- (CString)resolvedURLStringForURL:(const char*)url target:(const char*)target; +- (CString)resolvedURLStringForURL:(const char*)url target:(const char*)target { String relativeURLString = String::fromUTF8(url); if (relativeURLString.isNull()) diff --git a/WebKit/mac/Plugins/WebBasePluginPackage.h b/WebKit/mac/Plugins/WebBasePluginPackage.h index 1082551..ca2ddcd 100644 --- a/WebKit/mac/Plugins/WebBasePluginPackage.h +++ b/WebKit/mac/Plugins/WebBasePluginPackage.h @@ -26,7 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import <WebCore/WebCoreViewFactory.h> +#import <WebCore/PluginData.h> +#import <wtf/RetainPtr.h> #if ENABLE(NETSCAPE_PLUGIN_API) #import <WebKit/npfunctions.h> @@ -52,21 +53,15 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); #define WebPluginTypeDescriptionKey @"WebPluginTypeDescription" #define WebPluginTypeEnabledKey @"WebPluginTypeEnabled" -@interface WebBasePluginPackage : NSObject <WebCorePluginInfo> +@interface WebBasePluginPackage : NSObject { NSMutableSet *pluginDatabases; - NSString *name; - NSString *path; - NSString *pluginDescription; + WebCore::String path; + WebCore::PluginInfo pluginInfo; - NSBundle *bundle; - CFBundleRef cfBundle; + RetainPtr<CFBundleRef> cfBundle; - NSDictionary *MIMEToDescription; - NSDictionary *MIMEToExtensions; - NSMutableDictionary *extensionToMIME; - BP_CreatePluginMIMETypesPreferencesFuncPtr BP_CreatePluginMIMETypesPreferences; } @@ -78,23 +73,16 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); - (BOOL)load; - (void)unload; -- (NSString *)name; -- (NSString *)path; -- (NSString *)filename; -- (NSString *)pluginDescription; -- (NSBundle *)bundle; - -- (NSEnumerator *)extensionEnumerator; -- (NSEnumerator *)MIMETypeEnumerator; -- (NSString *)descriptionForMIMEType:(NSString *)MIMEType; -- (NSString *)MIMETypeForExtension:(NSString *)extension; -- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType; - -- (void)setName:(NSString *)theName; -- (void)setPath:(NSString *)thePath; -- (void)setPluginDescription:(NSString *)description; -- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary; -- (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary; +- (const WebCore::String&)path; + +- (const WebCore::PluginInfo&)pluginInfo; + +- (WebCore::String)bundleIdentifier; + +- (BOOL)supportsExtension:(const WebCore::String&)extension; +- (BOOL)supportsMIMEType:(const WebCore::String&)MIMEType; + +- (NSString *)MIMETypeForExtension:(const WebCore::String&)extension; - (BOOL)isQuickTimePlugIn; - (BOOL)isJavaPlugIn; diff --git a/WebKit/mac/Plugins/WebBasePluginPackage.mm b/WebKit/mac/Plugins/WebBasePluginPackage.mm index f186b81..70e5889 100644 --- a/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -28,6 +28,7 @@ #import <WebKit/WebBasePluginPackage.h> +#import <algorithm> #import <WebCore/WebCoreObjCExtras.h> #import <WebKit/WebKitNSStringExtras.h> #import <WebKit/WebNSObjectExtras.h> @@ -47,18 +48,20 @@ #import <mach-o/fat.h> #import <mach-o/loader.h> +#define JavaCocoaPluginIdentifier "com.apple.JavaPluginCocoa" +#define JavaCarbonPluginIdentifier "com.apple.JavaAppletPlugin" +#define JavaCFMPluginFilename "Java Applet Plugin Enabler" -#define JavaCocoaPluginIdentifier @"com.apple.JavaPluginCocoa" -#define JavaCarbonPluginIdentifier @"com.apple.JavaAppletPlugin" -#define JavaCFMPluginFilename @"Java Applet Plugin Enabler" - -#define QuickTimeCarbonPluginIdentifier @"com.apple.QuickTime Plugin.plugin" -#define QuickTimeCocoaPluginIdentifier @"com.apple.quicktime.webplugin" +#define QuickTimeCarbonPluginIdentifier "com.apple.QuickTime Plugin.plugin" +#define QuickTimeCocoaPluginIdentifier "com.apple.quicktime.webplugin" @interface NSArray (WebPluginExtensions) - (NSArray *)_web_lowercaseStrings; @end; +using namespace std; +using namespace WebCore; + @implementation WebBasePluginPackage + (void)initialize @@ -91,7 +94,7 @@ return WebCFAutorelease(WKCopyCFLocalizationPreferredName(NULL)); } -- (NSString *)pathByResolvingSymlinksAndAliasesInPath:(NSString *)thePath +static NSString *pathByResolvingSymlinksAndAliases(NSString *thePath) { NSString *newPath = [thePath stringByResolvingSymlinksInPath]; @@ -122,80 +125,20 @@ if (!(self = [super init])) return nil; - path = [[self pathByResolvingSymlinksAndAliasesInPath:pluginPath] retain]; - bundle = [[NSBundle alloc] initWithPath:path]; + path = pathByResolvingSymlinksAndAliases(pluginPath); + cfBundle.adoptCF(CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path])); + #ifndef __ppc__ // 32-bit PowerPC is the only platform where non-bundled CFM plugins are supported - if (!bundle) { + if (!cfBundle) { [self release]; return nil; } #endif - cfBundle = CFBundleCreate(NULL, (CFURLRef)[NSURL fileURLWithPath:path]); - extensionToMIME = [[NSMutableDictionary alloc] init]; return self; } -- (BOOL)getPluginInfoFromBundleAndMIMEDictionary:(NSDictionary *)MIMETypes -{ - if (!bundle) - return NO; - - if (!MIMETypes) { - MIMETypes = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesKey]; - if (!MIMETypes) - return NO; - } - - NSMutableDictionary *MIMEToExtensionsDictionary = [NSMutableDictionary dictionary]; - NSMutableDictionary *MIMEToDescriptionDictionary = [NSMutableDictionary dictionary]; - NSEnumerator *keyEnumerator = [MIMETypes keyEnumerator]; - NSDictionary *MIMEDictionary; - NSString *MIME, *description; - NSArray *extensions; - - while ((MIME = [keyEnumerator nextObject]) != nil) { - MIMEDictionary = [MIMETypes objectForKey:MIME]; - - // FIXME: Consider storing disabled MIME types. - NSNumber *isEnabled = [MIMEDictionary objectForKey:WebPluginTypeEnabledKey]; - if (isEnabled && [isEnabled boolValue] == NO) - continue; - - extensions = [[MIMEDictionary objectForKey:WebPluginExtensionsKey] _web_lowercaseStrings]; - if ([extensions count] == 0) - extensions = [NSArray arrayWithObject:@""]; - - MIME = [MIME lowercaseString]; - - [MIMEToExtensionsDictionary setObject:extensions forKey:MIME]; - - description = [MIMEDictionary objectForKey:WebPluginTypeDescriptionKey]; - if (!description) - description = @""; - - [MIMEToDescriptionDictionary setObject:description forKey:MIME]; - } - - [self setMIMEToExtensionsDictionary:MIMEToExtensionsDictionary]; - [self setMIMEToDescriptionDictionary:MIMEToDescriptionDictionary]; - - NSString *filename = [self filename]; - - NSString *theName = [bundle objectForInfoDictionaryKey:WebPluginNameKey]; - if (!theName) - theName = filename; - [self setName:theName]; - - description = [bundle objectForInfoDictionaryKey:WebPluginDescriptionKey]; - if (!description) - description = filename; - [self setPluginDescription:description]; - - return YES; -} - - (void)unload { } @@ -225,13 +168,22 @@ return pList; } +- (id)_objectForInfoDictionaryKey:(NSString *)key +{ + CFDictionaryRef bundleInfoDictionary = CFBundleGetInfoDictionary(cfBundle.get()); + if (!bundleInfoDictionary) + return nil; + + return (id)CFDictionaryGetValue(bundleInfoDictionary, key); +} + - (BOOL)getPluginInfoFromPLists { - if (!bundle) + if (!cfBundle) return NO; NSDictionary *MIMETypes = nil; - NSString *pListFilename = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey]; + NSString *pListFilename = [self _objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey]; // Check if the MIME types are claimed in a plist in the user's preferences directory. if (pListFilename) { @@ -247,15 +199,65 @@ // Plist doesn't exist, ask the plug-in to create it. MIMETypes = [[self pListForPath:pListPath createFile:YES] objectForKey:WebPluginMIMETypesKey]; } - - // Pass the MIME dictionary to the superclass to parse it. - return [self getPluginInfoFromBundleAndMIMEDictionary:MIMETypes]; + + if (!MIMETypes) { + MIMETypes = [self _objectForInfoDictionaryKey:WebPluginMIMETypesKey]; + if (!MIMETypes) + return NO; + } + + NSEnumerator *keyEnumerator = [MIMETypes keyEnumerator]; + NSDictionary *MIMEDictionary; + NSString *MIME, *description; + NSArray *extensions; + + while ((MIME = [keyEnumerator nextObject]) != nil) { + MIMEDictionary = [MIMETypes objectForKey:MIME]; + + // FIXME: Consider storing disabled MIME types. + NSNumber *isEnabled = [MIMEDictionary objectForKey:WebPluginTypeEnabledKey]; + if (isEnabled && [isEnabled boolValue] == NO) + continue; + + MimeClassInfo mimeClassInfo; + + extensions = [[MIMEDictionary objectForKey:WebPluginExtensionsKey] _web_lowercaseStrings]; + for (NSUInteger i = 0; i < [extensions count]; ++i) + mimeClassInfo.extensions.append((NSString *)[extensions objectAtIndex:i]); + + if ([extensions count] == 0) + extensions = [NSArray arrayWithObject:@""]; + + mimeClassInfo.type = String(MIME).lower(); + + description = [MIMEDictionary objectForKey:WebPluginTypeDescriptionKey]; + mimeClassInfo.desc = description; + + pluginInfo.mimes.append(mimeClassInfo); + if (!description) + description = @""; + } + + NSString *filename = [(NSString *)path lastPathComponent]; + pluginInfo.file = filename; + + NSString *theName = [self _objectForInfoDictionaryKey:WebPluginNameKey]; + if (!theName) + theName = filename; + pluginInfo.name = theName; + + description = [self _objectForInfoDictionaryKey:WebPluginDescriptionKey]; + if (!description) + description = filename; + pluginInfo.desc = description; + + return YES; } - (BOOL)load { - if (bundle && !BP_CreatePluginMIMETypesPreferences) - BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("BP_CreatePluginMIMETypesPreferences")); + if (cfBundle && !BP_CreatePluginMIMETypesPreferences) + BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("BP_CreatePluginMIMETypesPreferences")); return YES; } @@ -265,18 +267,6 @@ ASSERT(!pluginDatabases || [pluginDatabases count] == 0); [pluginDatabases release]; - [name release]; - [path release]; - [pluginDescription release]; - - [MIMEToDescription release]; - [MIMEToExtensions release]; - [extensionToMIME release]; - - [bundle release]; - if (cfBundle) - CFRelease(cfBundle); - [super dealloc]; } @@ -286,128 +276,71 @@ ASSERT(!pluginDatabases || [pluginDatabases count] == 0); [pluginDatabases release]; - if (cfBundle) - CFRelease(cfBundle); - [super finalize]; } -- (NSString *)name -{ - return name; -} - -- (NSString *)path +- (const String&)path { return path; } -- (NSString *)filename -{ - return [path lastPathComponent]; -} - -- (NSString *)pluginDescription +- (const PluginInfo&)pluginInfo { - return pluginDescription; + return pluginInfo; } -- (NSEnumerator *)extensionEnumerator +- (BOOL)supportsExtension:(const String&)extension { - return [extensionToMIME keyEnumerator]; -} - -- (NSEnumerator *)MIMETypeEnumerator -{ - return [MIMEToExtensions keyEnumerator]; -} - -- (NSString *)descriptionForMIMEType:(NSString *)MIMEType -{ - return [MIMEToDescription objectForKey:MIMEType]; -} - -- (NSString *)MIMETypeForExtension:(NSString *)extension -{ - return [extensionToMIME objectForKey:extension]; -} - -- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType -{ - return [MIMEToExtensions objectForKey:MIMEType]; -} - -- (NSBundle *)bundle -{ - return bundle; -} - -- (void)setName:(NSString *)theName -{ - [name release]; - name = [theName retain]; -} + ASSERT(extension.lower() == extension); + + for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { + const Vector<String>& extensions = pluginInfo.mimes[i].extensions; -- (void)setPath:(NSString *)thePath -{ - [path release]; - path = [thePath retain]; -} + if (find(extensions.begin(), extensions.end(), extension) != extensions.end()) + return YES; + } -- (void)setPluginDescription:(NSString *)description -{ - [pluginDescription release]; - pluginDescription = [description retain]; + return NO; } -- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary +- (BOOL)supportsMIMEType:(const WebCore::String&)mimeType { - [MIMEToDescription release]; - MIMEToDescription = [MIMEToDescriptionDictionary retain]; + ASSERT(mimeType.lower() == mimeType); + + for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { + if (pluginInfo.mimes[i].type == mimeType) + return YES; + } + + return NO; } -- (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary +- (NSString *)MIMETypeForExtension:(const String&)extension { - [MIMEToExtensions release]; - MIMEToExtensions = [MIMEToExtensionsDictionary retain]; - - // Reverse the mapping - [extensionToMIME removeAllObjects]; - - NSEnumerator *MIMEEnumerator = [MIMEToExtensions keyEnumerator], *extensionEnumerator; - NSString *MIME, *extension; - NSArray *extensions; + ASSERT(extension.lower() == extension); - while ((MIME = [MIMEEnumerator nextObject]) != nil) { - extensions = [MIMEToExtensions objectForKey:MIME]; - extensionEnumerator = [extensions objectEnumerator]; - - while ((extension = [extensionEnumerator nextObject]) != nil) { - if (![extension isEqualToString:@""]) - [extensionToMIME setObject:MIME forKey:extension]; - } + for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { + const MimeClassInfo& mimeClassInfo = pluginInfo.mimes[i]; + const Vector<String>& extensions = mimeClassInfo.extensions; + + if (find(extensions.begin(), extensions.end(), extension) != extensions.end()) + return mimeClassInfo.type; } -} -- (NSString *)description -{ - return [NSString stringWithFormat:@"name: %@\npath: %@\nmimeTypes:\n%@\npluginDescription:%@", - name, path, [MIMEToExtensions description], [MIMEToDescription description], pluginDescription]; + return nil; } - (BOOL)isQuickTimePlugIn { - NSString *bundleIdentifier = [[self bundle] bundleIdentifier]; - return [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:QuickTimeCarbonPluginIdentifier] || - [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:QuickTimeCocoaPluginIdentifier]; + const String& bundleIdentifier = [self bundleIdentifier]; + return bundleIdentifier == QuickTimeCocoaPluginIdentifier || bundleIdentifier == QuickTimeCocoaPluginIdentifier; } - (BOOL)isJavaPlugIn { - NSString *bundleIdentifier = [[self bundle] bundleIdentifier]; - return [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCocoaPluginIdentifier] || - [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCarbonPluginIdentifier] || - [[path lastPathComponent] _webkit_isCaseInsensitiveEqualToString:JavaCFMPluginFilename]; + const String& bundleIdentifier = [self bundleIdentifier]; + return bundleIdentifier == JavaCocoaPluginIdentifier || bundleIdentifier == JavaCarbonPluginIdentifier || + equalIgnoringCase(pluginInfo.file, JavaCFMPluginFilename); } static inline void swapIntsInHeader(uint8_t* bytes, unsigned length) @@ -492,7 +425,7 @@ static inline void swapIntsInHeader(uint8_t* bytes, unsigned length) - (UInt32)versionNumber { // CFBundleGetVersionNumber doesn't work with all possible versioning schemes, but we think for now it's good enough for us. - return CFBundleGetVersionNumber(cfBundle); + return CFBundleGetVersionNumber(cfBundle.get()); } - (void)wasAddedToPluginDatabase:(WebPluginDatabase *)database @@ -512,6 +445,11 @@ static inline void swapIntsInHeader(uint8_t* bytes, unsigned length) [pluginDatabases removeObject:database]; } +- (WebCore::String)bundleIdentifier +{ + return CFBundleGetIdentifier(cfBundle.get()); +} + @end @implementation NSArray (WebPluginExtensions) diff --git a/WebKit/mac/Plugins/WebNetscapePluginPackage.h b/WebKit/mac/Plugins/WebNetscapePluginPackage.h index 1d4c893..445c3bb 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginPackage.h +++ b/WebKit/mac/Plugins/WebNetscapePluginPackage.h @@ -77,6 +77,8 @@ typedef enum { - (WebExecutableType)executableType; - (NPPluginFuncs *)pluginFuncs; +- (BOOL)supportsSnapshotting; + #if USE(PLUGIN_HOST_PROCESS) - (cpu_type_t)pluginHostArchitecture; #endif diff --git a/WebKit/mac/Plugins/WebNetscapePluginPackage.mm b/WebKit/mac/Plugins/WebNetscapePluginPackage.mm index 5651e7e..7ca1121 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginPackage.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginPackage.mm @@ -29,12 +29,14 @@ #if ENABLE(NETSCAPE_PLUGIN_API) #import "WebNetscapePluginPackage.h" +#import "WebTypesInternal.h" #import "WebKitLogging.h" #import "WebKitNSStringExtras.h" #import "WebNSFileManagerExtras.h" #import "WebNSObjectExtras.h" #import "WebNetscapeDeprecatedFunctions.h" #import <WebCore/npruntime_impl.h> +#import <wtf/RetainPtr.h> #if USE(PLUGIN_HOST_PROCESS) #import "NetscapePluginHostManager.h" @@ -42,6 +44,8 @@ using namespace WebKit; #endif +using namespace WebCore; + #ifdef SUPPORT_CFM typedef void (* FunctionPointer)(void); typedef void (* TransitionVector)(void); @@ -54,7 +58,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); #define MIMEListStringStringNumber 128 #define RealPlayerAppIndentifier @"com.RealNetworks.RealOne Player" -#define RealPlayerPluginFilename @"RealPlayer Plugin" +#define RealPlayerPluginFilename "RealPlayer Plugin" @interface WebNetscapePluginPackage (Internal) - (void)_unloadWithShutdown:(BOOL)shutdown; @@ -95,7 +99,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); #ifdef SUPPORT_CFM if (!isBundle) { FSRef fref; - OSErr err = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &fref, NULL); + OSErr err = FSPathMakeRef((const UInt8 *)[(NSString *)path fileSystemRepresentation], &fref, NULL); if (err != noErr) return -1; @@ -103,7 +107,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); } #endif - return CFBundleOpenBundleResourceMap(cfBundle); + return CFBundleOpenBundleResourceMap(cfBundle.get()); } - (void)closeResourceFile:(ResFileRefNum)resRef @@ -115,7 +119,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); } #endif - CFBundleCloseBundleResourceMap(cfBundle, resRef); + CFBundleCloseBundleResourceMap(cfBundle.get(), resRef); } - (NSString *)stringForStringListID:(SInt16)stringListID andIndex:(SInt16)index @@ -156,46 +160,42 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); NSArray *extensions; unsigned i; - NSMutableDictionary *MIMEToExtensionsDictionary = [NSMutableDictionary dictionary]; - NSMutableDictionary *MIMEToDescriptionDictionary = [NSMutableDictionary dictionary]; - for (i=1; 1; i+=2) { MIME = [[self stringForStringListID:MIMEListStringStringNumber andIndex:i] lowercaseString]; if (!MIME) break; + MimeClassInfo mimeClassInfo; + mimeClassInfo.type = String(MIME).lower(); + extensionsList = [[self stringForStringListID:MIMEListStringStringNumber andIndex:i+1] lowercaseString]; if (extensionsList) { extensions = [extensionsList componentsSeparatedByString:@","]; - [MIMEToExtensionsDictionary setObject:extensions forKey:MIME]; - } else - // DRM and WMP claim MIMEs without extensions. Use a @"" extension in this case. - [MIMEToExtensionsDictionary setObject:[NSArray arrayWithObject:@""] forKey:MIME]; + for (NSUInteger j = 0; j < [extensions count]; ++j) + mimeClassInfo.extensions.append((NSString *)[extensions objectAtIndex:j]); + } description = [self stringForStringListID:MIMEDescriptionStringNumber - andIndex:[MIMEToExtensionsDictionary count]]; - if (description) - [MIMEToDescriptionDictionary setObject:description forKey:MIME]; - else - [MIMEToDescriptionDictionary setObject:@"" forKey:MIME]; - } + andIndex:pluginInfo.mimes.size() + 1]; + mimeClassInfo.desc = description; - [self setMIMEToDescriptionDictionary:MIMEToDescriptionDictionary]; - [self setMIMEToExtensionsDictionary:MIMEToExtensionsDictionary]; + pluginInfo.mimes.append(mimeClassInfo); + } - NSString *filename = [self filename]; + NSString *filename = [(NSString *)path lastPathComponent]; + pluginInfo.file = filename; description = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:1]; if (!description) description = filename; - [self setPluginDescription:description]; + pluginInfo.desc = description; NSString *theName = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:2]; if (!theName) theName = filename; - [self setName:theName]; + pluginInfo.name = theName; [self closeResourceFile:resRef]; @@ -208,9 +208,9 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); OSType type = 0; - if (bundle) { + if (cfBundle) { // Bundle - CFBundleGetPackageInfo(cfBundle, &type, NULL); + CFBundleGetPackageInfo(cfBundle.get(), &type, NULL); #ifdef SUPPORT_CFM isBundle = YES; #endif @@ -230,8 +230,11 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); return NO; // Check if the executable is Mach-O or CFM. - if (bundle) { - NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[bundle executablePath]]; + if (cfBundle) { + RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(cfBundle.get())); + if (!executableURL) + return NO; + NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[(NSURL *)executableURL.get() path]]; NSData *data = [executableFile readDataOfLength:512]; [executableFile closeFile]; // Check the length of the data before calling memcmp. We think this fixes 3782543. @@ -246,11 +249,11 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); #endif #if USE(PLUGIN_HOST_PROCESS) - NSArray *archs = [bundle executableArchitectures]; + RetainPtr<CFArrayRef> archs(AdoptCF, CFBundleCopyExecutableArchitectures(cfBundle.get())); - if ([archs containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]]) + if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]]) pluginHostArchitecture = CPU_TYPE_X86_64; - else if ([archs containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureI386]]) + else if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureI386]]) pluginHostArchitecture = CPU_TYPE_X86; else return NO; @@ -299,7 +302,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); - (void)createPropertyListFile { - NetscapePluginHostManager::createPropertyListFile(self); + NetscapePluginHostManager::createPropertyListFile(path, pluginHostArchitecture); } #endif @@ -323,7 +326,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); if (!cfBundle) return; - if ([(NSString *)CFBundleGetIdentifier(cfBundle) isEqualToString:@"com.lizardtech.NPDjVu"]) { + if ([self bundleIdentifier] == "com.lizardtech.NPDjVu") { // The DjVu plug-in will crash copying the vtable if it's too big so we cap it to // what the plug-in expects here. // size + version + 40 function pointers. @@ -352,7 +355,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); CFAbsoluteTime currentTime; CFAbsoluteTime duration; #endif - LOG(Plugins, "%f Load timing started for: %@", start, [self name]); + LOG(Plugins, "%f Load timing started for: %@", start, (NSString *)[self pluginInfo].name); if (isLoaded) return YES; @@ -360,7 +363,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); #ifdef SUPPORT_CFM if (isBundle) { #endif - if (!CFBundleLoadExecutable(cfBundle)) + if (!CFBundleLoadExecutable(cfBundle.get())) return NO; #if !LOG_DISABLED currentTime = CFAbsoluteTimeGetCurrent(); @@ -371,14 +374,14 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); #ifdef SUPPORT_CFM if (isCFM) { - pluginMainFunc = (MainFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("main") ); + pluginMainFunc = (MainFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("main") ); if (!pluginMainFunc) return NO; } else { #endif - NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Initialize")); - NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_GetEntryPoints")); - NP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Shutdown")); + NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_Initialize")); + NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_GetEntryPoints")); + NP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_Shutdown")); if (!NP_Initialize || !NP_GetEntryPoints || !NP_Shutdown) return NO; #ifdef SUPPORT_CFM @@ -389,7 +392,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); FSRef fref; OSErr err; - err = FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &fref, NULL); + err = FSPathMakeRef((UInt8 *)[(NSString *)path fileSystemRepresentation], &fref, NULL); if (err != noErr) { LOG_ERROR("FSPathMakeRef failed. Error=%d", err); return NO; @@ -503,7 +506,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); // Workaround for 3270576. The RealPlayer plug-in fails to load if its preference file is out of date. // Launch the RealPlayer application to refresh the file. if (npErr != NPERR_NO_ERROR) { - if (npErr == NPERR_MODULE_LOAD_FAILED_ERROR && [[self filename] isEqualToString:RealPlayerPluginFilename]) + if (npErr == NPERR_MODULE_LOAD_FAILED_ERROR && equalIgnoringCase(pluginInfo.file, RealPlayerPluginFilename)) [self launchRealPlayer]; return NO; } @@ -534,9 +537,9 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); // LiveConnect support pluginFuncs.javaClass = (JRIGlobalRef)functionPointerForTVector((TransitionVector)pluginFuncs.javaClass); if (pluginFuncs.javaClass) { - LOG(LiveConnect, "%@: CFM entry point for NPP_GetJavaClass = %p", [self name], pluginFuncs.javaClass); + LOG(LiveConnect, "%@: CFM entry point for NPP_GetJavaClass = %p", (NSString *)[self pluginInfo].name, pluginFuncs.javaClass); } else { - LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", [self name]); + LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", (NSString *)[self pluginInfo].name); } } else { @@ -625,9 +628,9 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); pluginVersion = pluginFuncs.version; if (pluginFuncs.javaClass) - LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", [self name], pluginFuncs.javaClass); + LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", (NSString *)[self pluginInfo].name, pluginFuncs.javaClass); else - LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", [self name]); + LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", (NSString *)[self pluginInfo].name); #ifdef SUPPORT_CFM } @@ -689,6 +692,22 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); [self _unloadWithShutdown:YES]; } + +- (BOOL)supportsSnapshotting +{ + if ([self bundleIdentifier] != "com.macromedia.Flash Player.plugin") + return YES; + + // Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString. + NSString *versionString = (NSString *)CFDictionaryGetValue(CFBundleGetInfoDictionary(cfBundle.get()), CFSTR("CFBundleShortVersionString")); + + if (![versionString hasPrefix:@"10.1"]) + return YES; + + // Some prerelease versions of Flash 10.1 crash when sent a drawRect event using the CA drawing model: <rdar://problem/7739922> + return CFStringCompare((CFStringRef)versionString, CFSTR("10.1.53.60"), kCFCompareNumerically) != kCFCompareLessThan; +} + @end #ifdef SUPPORT_CFM @@ -736,7 +755,7 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer fp) if (!isLoaded) return; - LOG(Plugins, "Unloading %@...", name); + LOG(Plugins, "Unloading %@...", (NSString *)pluginInfo.name); // Cannot unload a plug-in package while an instance is still using it if (instanceCount > 0) { diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 8b4d998..f062f7c 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -1234,7 +1234,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) cValues = (char **)malloc([values count] * sizeof(char *)); } - BOOL isWMP = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.WMP.defaultplugin"]; + BOOL isWMP = [_pluginPackage.get() bundleIdentifier] == "com.microsoft.WMP.defaultplugin"; unsigned i; unsigned count = [keys count]; @@ -2370,9 +2370,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) ASSERT(pluginFunctionCallDepth == 0); PluginMainThreadScheduler::scheduler().registerPlugin(plugin); - - _isFlash = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"]; - _isSilverlight = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.SilverlightPlugin"]; + + _isFlash = [_pluginPackage.get() bundleIdentifier] == "com.macromedia.Flash Player.plugin"; + _isSilverlight = [_pluginPackage.get() bundleIdentifier] == "com.microsoft.SilverlightPlugin"; [[self class] setCurrentPluginView:self]; NPError npErr = [_pluginPackage.get() pluginFuncs]->newp((char *)[_MIMEType.get() cString], plugin, _mode, argsCount, cAttributes, cValues, NULL); diff --git a/WebKit/mac/Plugins/WebPluginDatabase.mm b/WebKit/mac/Plugins/WebPluginDatabase.mm index 34f5e0f..e7fae1b 100644 --- a/WebKit/mac/Plugins/WebPluginDatabase.mm +++ b/WebKit/mac/Plugins/WebPluginDatabase.mm @@ -45,6 +45,8 @@ #import <WebKitSystemInterface.h> #import <wtf/Assertions.h> +using namespace WebCore; + static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPackage **candidatePlugin); @interface WebPluginDatabase (Internal) @@ -82,78 +84,107 @@ static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPa return; } - if ([[[*currentPlugin bundle] bundleIdentifier] isEqualToString:[[*candidatePlugin bundle] bundleIdentifier]] && [*candidatePlugin versionNumber] > [*currentPlugin versionNumber]) + if ([*currentPlugin bundleIdentifier] == [*candidatePlugin bundleIdentifier] && [*candidatePlugin versionNumber] > [*currentPlugin versionNumber]) *currentPlugin = *candidatePlugin; } -- (WebBasePluginPackage *)pluginForKey:(NSString *)key withEnumeratorSelector:(SEL)enumeratorSelector -{ - WebBasePluginPackage *plugin = nil; - WebBasePluginPackage *webPlugin = nil; +struct PluginPackageCandidates { + PluginPackageCandidates() + : webPlugin(nil) + , machoPlugin(nil) #ifdef SUPPORT_CFM - WebBasePluginPackage *CFMPlugin = nil; + , CFMPlugin(nil) #endif - WebBasePluginPackage *machoPlugin = nil; - - NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; - key = [key lowercaseString]; - - while ((plugin = [pluginEnumerator nextObject]) != nil) { - if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]) { - if ([plugin isKindOfClass:[WebPluginPackage class]]) - checkCandidate(&webPlugin, &plugin); + { + } + + void update(WebBasePluginPackage *plugin) + { + if ([plugin isKindOfClass:[WebPluginPackage class]]) { + checkCandidate(&webPlugin, &plugin); + return; + } + #if ENABLE(NETSCAPE_PLUGIN_API) - else if([plugin isKindOfClass:[WebNetscapePluginPackage class]]) { - WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType]; + if([plugin isKindOfClass:[WebNetscapePluginPackage class]]) { + WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType]; #ifdef SUPPORT_CFM - if (executableType == WebCFMExecutableType) { - checkCandidate(&CFMPlugin, &plugin); - } else + if (executableType == WebCFMExecutableType) { + checkCandidate(&CFMPlugin, &plugin); + return; + } #endif // SUPPORT_CFM - if (executableType == WebMachOExecutableType) { - checkCandidate(&machoPlugin, &plugin); - } else { - ASSERT_NOT_REACHED(); - } - } else { - ASSERT_NOT_REACHED(); + if (executableType == WebMachOExecutableType) { + checkCandidate(&machoPlugin, &plugin); + return; } -#endif } +#endif + ASSERT_NOT_REACHED(); } - - // Allow other plug-ins to win over QT because if the user has installed a plug-in that can handle a type - // that the QT plug-in can handle, they probably intended to override QT. - if (webPlugin && ![webPlugin isQuickTimePlugIn]) - return webPlugin; - else if (machoPlugin && ![machoPlugin isQuickTimePlugIn]) - return machoPlugin; + WebBasePluginPackage *bestCandidate() + { + // Allow other plug-ins to win over QT because if the user has installed a plug-in that can handle a type + // that the QT plug-in can handle, they probably intended to override QT. + if (webPlugin && ![webPlugin isQuickTimePlugIn]) + return webPlugin; + + if (machoPlugin && ![machoPlugin isQuickTimePlugIn]) + return machoPlugin; + #ifdef SUPPORT_CFM - else if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn]) - return CFMPlugin; + if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn]) + return CFMPlugin; #endif // SUPPORT_CFM - else if (webPlugin) - return webPlugin; - else if (machoPlugin) - return machoPlugin; + + if (webPlugin) + return webPlugin; + if (machoPlugin) + return machoPlugin; #ifdef SUPPORT_CFM - else if (CFMPlugin) - return CFMPlugin; + if (CFMPlugin) + return CFMPlugin; #endif - return nil; -} + return nil; + } + + WebBasePluginPackage *webPlugin; + WebBasePluginPackage *machoPlugin; +#ifdef SUPPORT_CFM + WebBasePluginPackage *CFMPlugin; +#endif +}; - (WebBasePluginPackage *)pluginForMIMEType:(NSString *)MIMEType { - return [self pluginForKey:[MIMEType lowercaseString] - withEnumeratorSelector:@selector(MIMETypeEnumerator)]; + PluginPackageCandidates candidates; + + MIMEType = [MIMEType lowercaseString]; + NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; + + while (WebBasePluginPackage *plugin = [pluginEnumerator nextObject]) { + if ([plugin supportsMIMEType:MIMEType]) + candidates.update(plugin); + } + + return candidates.bestCandidate(); } - (WebBasePluginPackage *)pluginForExtension:(NSString *)extension { - WebBasePluginPackage *plugin = [self pluginForKey:[extension lowercaseString] - withEnumeratorSelector:@selector(extensionEnumerator)]; + PluginPackageCandidates candidates; + + extension = [extension lowercaseString]; + NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; + + while (WebBasePluginPackage *plugin = [pluginEnumerator nextObject]) { + if ([plugin supportsExtension:extension]) + candidates.update(plugin); + } + + WebBasePluginPackage *plugin = candidates.bestCandidate(); + if (!plugin) { // If no plug-in was found from the extension, attempt to map from the extension to a MIME type // and find the a plug-in from the MIME type. This is done in case the plug-in has not fully specified @@ -275,8 +306,11 @@ static NSArray *additionalWebPlugInPaths; // Build a list of MIME types. NSMutableSet *MIMETypes = [[NSMutableSet alloc] init]; pluginEnumerator = [plugins objectEnumerator]; - while ((plugin = [pluginEnumerator nextObject]) != nil) - [MIMETypes addObjectsFromArray:[[plugin MIMETypeEnumerator] allObjects]]; + while ((plugin = [pluginEnumerator nextObject])) { + const PluginInfo& pluginInfo = [plugin pluginInfo]; + for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) + [MIMETypes addObject:pluginInfo.mimes[i].type]; + } // Register plug-in views and representations. NSEnumerator *MIMEEnumerator = [MIMETypes objectEnumerator]; @@ -410,9 +444,10 @@ static NSArray *additionalWebPlugInPaths; ASSERT(plugin); // Unregister plug-in's MIME type registrations - NSEnumerator *MIMETypeEnumerator = [plugin MIMETypeEnumerator]; - NSString *MIMEType; - while ((MIMEType = [MIMETypeEnumerator nextObject])) { + const PluginInfo& pluginInfo = [plugin pluginInfo]; + for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { + NSString *MIMEType = pluginInfo.mimes[i].type; + if ([registeredMIMETypes containsObject:MIMEType]) { if (self == sharedDatabase) [WebView _unregisterPluginMIMEType:MIMEType]; diff --git a/WebKit/mac/Plugins/WebPluginPackage.h b/WebKit/mac/Plugins/WebPluginPackage.h index 290bb1b..f8c8146 100644 --- a/WebKit/mac/Plugins/WebPluginPackage.h +++ b/WebKit/mac/Plugins/WebPluginPackage.h @@ -32,7 +32,9 @@ @protocol WebPluginViewFactory; -@interface WebPluginPackage : WebBasePluginPackage +@interface WebPluginPackage : WebBasePluginPackage { + NSBundle *nsBundle; +} - (Class)viewFactory; diff --git a/WebKit/mac/Plugins/WebPluginPackage.m b/WebKit/mac/Plugins/WebPluginPackage.mm index d7f144e..a608068 100644 --- a/WebKit/mac/Plugins/WebPluginPackage.m +++ b/WebKit/mac/Plugins/WebPluginPackage.mm @@ -40,26 +40,28 @@ NSString *WebPlugInContainingElementKey = @"WebPlugInContainingElementKey" @implementation WebPluginPackage -- initWithPath:(NSString *)pluginPath +- (id)initWithPath:(NSString *)pluginPath { if (!(self = [super initWithPath:pluginPath])) return nil; - if (bundle == nil) { + nsBundle = [[NSBundle alloc] initWithPath:path]; + + if (!nsBundle) { [self release]; return nil; } if (![[pluginPath pathExtension] _webkit_isCaseInsensitiveEqualToString:@"webplugin"]) { UInt32 type = 0; - CFBundleGetPackageInfo(cfBundle, &type, NULL); + CFBundleGetPackageInfo(cfBundle.get(), &type, NULL); if (type != FOUR_CHAR_CODE('WBPL')) { [self release]; return nil; } } - NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[bundle executablePath]]; + NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[nsBundle executablePath]]; NSData *data = [executableFile readDataOfLength:512]; [executableFile closeFile]; if (![self isNativeLibraryData:data]) { @@ -75,9 +77,16 @@ NSString *WebPlugInContainingElementKey = @"WebPlugInContainingElementKey" return self; } +- (void)dealloc +{ + [nsBundle release]; + + [super dealloc]; +} + - (Class)viewFactory { - return [bundle principalClass]; + return [nsBundle principalClass]; } - (BOOL)load @@ -87,14 +96,14 @@ NSString *WebPlugInContainingElementKey = @"WebPlugInContainingElementKey" #endif // Load the bundle - if (![bundle isLoaded]) { - if (![bundle load]) + if (![nsBundle isLoaded]) { + if (![nsBundle load]) return NO; } #if !LOG_DISABLED CFAbsoluteTime duration = CFAbsoluteTimeGetCurrent() - start; - LOG(Plugins, "principalClass took %f seconds for: %@", duration, [self name]); + LOG(Plugins, "principalClass took %f seconds for: %@", duration, (NSString *)[self pluginInfo].name); #endif return [super load]; } diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index cf4b03c..d72f4ed 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -84,6 +84,7 @@ #import <WebCore/FormState.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> +#import <WebCore/FrameLoaderStateMachine.h> #import <WebCore/FrameLoaderTypes.h> #import <WebCore/FrameTree.h> #import <WebCore/FrameView.h> @@ -1177,7 +1178,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() if (usesDocumentViews) { // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too. bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class]; - bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView; + bool canSkipCreation = core(m_webFrame.get())->loader()->stateMachine()->committingFirstRealLoad() && willProduceHTMLView; if (canSkipCreation) { [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource]; return; @@ -1631,8 +1632,10 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP KURL pluginPageURL = document->completeURL(deprecatedParseURL(parameterValue(paramNames, paramValues, "pluginspage"))); if (!pluginPageURL.protocolInHTTPFamily()) pluginPageURL = KURL(); + NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; + NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode - contentURL:pluginURL pluginPageURL:pluginPageURL pluginName:[pluginPackage name] MIMEType:MIMEType]; + contentURL:pluginURL pluginPageURL:pluginPageURL pluginName:pluginName MIMEType:MIMEType]; CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView], @selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]); [error release]; @@ -1721,7 +1724,8 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s if (!view) { WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get())); if (implementations->plugInFailedWithErrorFunc) { - NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:[pluginPackage name] MIMEType:MIMEType]; + NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; + NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView], @selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]); [error release]; diff --git a/WebKit/mac/WebCoreSupport/WebPasteboardHelper.h b/WebKit/mac/WebCoreSupport/WebPasteboardHelper.h index 94ff676..7092157 100644 --- a/WebKit/mac/WebCoreSupport/WebPasteboardHelper.h +++ b/WebKit/mac/WebCoreSupport/WebPasteboardHelper.h @@ -34,9 +34,9 @@ class WebPasteboardHelper : public WebCore::PasteboardHelper { public: WebPasteboardHelper(WebHTMLView* view) : m_view(view) {} - virtual WebCore::String urlFromPasteboard(const NSPasteboard*, WebCore::String* title) const; - virtual WebCore::String plainTextFromPasteboard(const NSPasteboard*) const; - virtual DOMDocumentFragment* fragmentFromPasteboard(const NSPasteboard*) const; + virtual WebCore::String urlFromPasteboard(NSPasteboard*, WebCore::String* title) const; + virtual WebCore::String plainTextFromPasteboard(NSPasteboard*) const; + virtual DOMDocumentFragment* fragmentFromPasteboard(NSPasteboard*) const; virtual NSArray* insertablePasteboardTypes() const; private: WebHTMLView* m_view; diff --git a/WebKit/mac/WebCoreSupport/WebPasteboardHelper.mm b/WebKit/mac/WebCoreSupport/WebPasteboardHelper.mm index eb6a58d..fb93f8e 100644 --- a/WebKit/mac/WebCoreSupport/WebPasteboardHelper.mm +++ b/WebKit/mac/WebCoreSupport/WebPasteboardHelper.mm @@ -37,7 +37,7 @@ using namespace WebCore; -String WebPasteboardHelper::urlFromPasteboard(const NSPasteboard* pasteboard, String* title) const +String WebPasteboardHelper::urlFromPasteboard(NSPasteboard* pasteboard, String* title) const { NSURL *URL = [pasteboard _web_bestURL]; if (title) { @@ -48,7 +48,7 @@ String WebPasteboardHelper::urlFromPasteboard(const NSPasteboard* pasteboard, St return [URL _web_originalDataAsString]; } -String WebPasteboardHelper::plainTextFromPasteboard(const NSPasteboard *pasteboard) const +String WebPasteboardHelper::plainTextFromPasteboard(NSPasteboard *pasteboard) const { NSArray *types = [pasteboard types]; @@ -85,7 +85,7 @@ String WebPasteboardHelper::plainTextFromPasteboard(const NSPasteboard *pasteboa return String(); } -DOMDocumentFragment *WebPasteboardHelper::fragmentFromPasteboard(const NSPasteboard *pasteboard) const +DOMDocumentFragment *WebPasteboardHelper::fragmentFromPasteboard(NSPasteboard *pasteboard) const { return [m_view _documentFragmentFromPasteboard:pasteboard]; } diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h new file mode 100644 index 0000000..ce8bf9d --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPlatformStrategies_h +#define WebPlatformStrategies_h + +#include <WebCore/PlatformStrategies.h> +#include <WebCore/PluginStrategy.h> + +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy { +public: + static void initialize(); + +private: + WebPlatformStrategies(); + + // WebCore::PlatformStrategies + virtual WebCore::PluginStrategy* createPluginStrategy(); + + // WebCore::PluginStrategy + virtual void refreshPlugins(); + virtual void getPluginInfo(Vector<WebCore::PluginInfo>&); +}; + +#endif // WebPlatformStrategies_h diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm new file mode 100644 index 0000000..d4bb684 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebPlatformStrategies.h" + +#import "WebPluginDatabase.h" +#import "WebPluginPackage.h" +#import <WebCore/BlockExceptions.h> +#import <wtf/StdLibExtras.h> + +#ifdef BUILDING_ON_TIGER +typedef unsigned NSUInteger; +#endif + +using namespace WebCore; + +void WebPlatformStrategies::initialize() +{ + DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ()); + setPlatformStrategies(&platformStrategies); +} + +WebPlatformStrategies::WebPlatformStrategies() +{ +} + +// PluginStrategy + +PluginStrategy* WebPlatformStrategies::createPluginStrategy() +{ + return this; +} + +void WebPlatformStrategies::refreshPlugins() +{ + [[WebPluginDatabase sharedDatabase] refresh]; +} + +void WebPlatformStrategies::getPluginInfo(Vector<WebCore::PluginInfo>& plugins) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSArray* pluginsArray = [[WebPluginDatabase sharedDatabase] plugins]; + for (unsigned int i = 0; i < [pluginsArray count]; ++i) { + WebPluginPackage *plugin = [pluginsArray objectAtIndex:i]; + + plugins.append([plugin pluginInfo]); + } + + END_BLOCK_OBJC_EXCEPTIONS; +} + + diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.h b/WebKit/mac/WebCoreSupport/WebSystemInterface.h index 6e20279..d460217 100644 --- a/WebKit/mac/WebCoreSupport/WebSystemInterface.h +++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.h @@ -26,12 +26,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef __cplusplus -extern "C" { -#endif - -void InitWebCoreSystemInterface(void); - -#ifdef __cplusplus -} -#endif +void InitWebCoreSystemInterface(); diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.m b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index b792707..0b74dee 100644 --- a/WebKit/mac/WebCoreSupport/WebSystemInterface.m +++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,12 +28,12 @@ #import "WebSystemInterface.h" -#import <WebCore/WebCoreSystemInterface.h> -#import <WebKitSystemInterface.h> - // Needed for builds not using PCH to expose BUILDING_ macros, see bug 32753. #include <wtf/Platform.h> +#import <WebCore/WebCoreSystemInterface.h> +#import <WebKitSystemInterface.h> + #define INIT(function) wk##function = WK##function void InitWebCoreSystemInterface(void) @@ -115,5 +115,9 @@ void InitWebCoreSystemInterface(void) INIT(NoteOpenPanelFiles); #endif +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) + INIT(GetHyphenationLocationBeforeIndex); +#endif + didInit = true; } diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm index fd6d5b0..a97d5a5 100644 --- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm +++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm @@ -35,7 +35,6 @@ #import <WebKit/WebNSUserDefaultsExtras.h> #import <WebKit/WebNSObjectExtras.h> #import <WebKit/WebNSViewExtras.h> -#import <WebKit/WebPluginDatabase.h> #import <WebKitSystemInterface.h> #import <wtf/Assertions.h> @@ -65,16 +64,6 @@ ASSERT([[self sharedFactory] isKindOfClass:self]); } -- (NSArray *)pluginsInfo -{ - return [[WebPluginDatabase sharedDatabase] plugins]; -} - -- (void)refreshPlugins -{ - [[WebPluginDatabase sharedDatabase] refresh]; -} - - (NSString *)inputElementAltText { return UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value"); diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 86090be..74439dd 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -174,7 +174,7 @@ struct WebDynamicScrollBarsViewPrivate { [[self contentView] setFrame:[self contentViewFrame]]; } -- (void)setSuppressLayout:(BOOL)flag; +- (void)setSuppressLayout:(BOOL)flag { _private->suppressLayout = flag; } diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 7c59615..b71d501 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -66,6 +66,7 @@ #import <WebCore/EventNames.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> +#import <WebCore/FrameLoaderStateMachine.h> #import <WebCore/FrameTree.h> #import <WebCore/GraphicsContext.h> #import <WebCore/HTMLFrameOwnerElement.h> @@ -1051,7 +1052,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (BOOL)_firstLayoutDone { - return _private->coreFrame->loader()->firstLayoutDone(); + return _private->coreFrame->loader()->stateMachine()->firstLayoutDone(); } - (WebFrameLoadType)_loadType @@ -1222,7 +1223,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) if (documentLoader && !documentLoader->mainDocumentError().isNull()) [result setObject:(NSError *)documentLoader->mainDocumentError() forKey:WebFrameMainDocumentError]; - if (frameLoader->containsPlugins()) + if (frameLoader->subframeLoader()->containsPlugins()) [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasPlugins]; if (DOMWindow* domWindow = _private->coreFrame->domWindow()) { diff --git a/WebKit/mac/WebView/WebGeolocationPosition.mm b/WebKit/mac/WebView/WebGeolocationPosition.mm index 46f62c1..c92b7f1 100644 --- a/WebKit/mac/WebView/WebGeolocationPosition.mm +++ b/WebKit/mac/WebView/WebGeolocationPosition.mm @@ -83,4 +83,10 @@ GeolocationPosition* core(WebGeolocationPosition *position) return self; } +- (void)dealloc +{ + [_internal release]; + [super dealloc]; +} + @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index 51fd5ba..c009f4a 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -29,6 +29,7 @@ #import "WebHTMLRepresentation.h" #import "DOMElementInternal.h" +#import "DOMNodeInternal.h" #import "DOMRangeInternal.h" #import "WebArchive.h" #import "WebBasePluginPackage.h" diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index a60ae12..e40500c 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -353,7 +353,6 @@ static CachedResourceClient* promisedDataClient() - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard inContext:(DOMRange *)context allowPlainText:(BOOL)allowPlainText; - (NSString *)_plainTextFromPasteboard:(NSPasteboard *)pasteboard; - (void)_pasteWithPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText; -- (void)_pasteAsPlainTextWithPasteboard:(NSPasteboard *)pasteboard; - (void)_removeMouseMovedObserverUnconditionally; - (void)_removeSuperviewObservers; - (void)_removeWindowObservers; @@ -874,19 +873,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) [webView release]; } -- (void)_pasteAsPlainTextWithPasteboard:(NSPasteboard *)pasteboard -{ - WebView *webView = [[self _webView] retain]; - [webView _setInsertionPasteboard:pasteboard]; - - NSString *text = [self _plainTextFromPasteboard:pasteboard]; - if ([self _shouldReplaceSelectionWithText:text givenAction:WebViewInsertActionPasted]) - [[self _frame] _replaceSelectionWithText:text selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard]]; - - [webView _setInsertionPasteboard:nil]; - [webView release]; -} - - (void)_removeMouseMovedObserverUnconditionally { if (!_private || !_private->observingMouseMovedNotifications) @@ -2576,6 +2562,7 @@ WEBCORE_COMMAND(pageDown) WEBCORE_COMMAND(pageDownAndModifySelection) WEBCORE_COMMAND(pageUp) WEBCORE_COMMAND(pageUpAndModifySelection) +WEBCORE_COMMAND(pasteAsPlainText) WEBCORE_COMMAND(selectAll) WEBCORE_COMMAND(selectLine) WEBCORE_COMMAND(selectParagraph) @@ -2615,18 +2602,6 @@ WEBCORE_COMMAND(yankAndSelect) return YES; } -- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pasteboard -{ - Frame* coreFrame = core([self _frame]); - if (!coreFrame) - return NO; - if (coreFrame->selection()->isContentRichlyEditable()) - [self _pasteWithPasteboard:pasteboard allowPlainText:YES]; - else - [self _pasteAsPlainTextWithPasteboard:pasteboard]; - return YES; -} - - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType { BOOL isSendTypeOK = !sendType || ([[self pasteboardTypesForSelection] containsObject:sendType] && [self _hasSelection]); @@ -5162,15 +5137,6 @@ static BOOL writingDirectionKeyBindingsEnabled() coreFrame->editor()->pasteAsPlainText(); } -- (void)pasteAsPlainText:(id)sender -{ - COMMAND_PROLOGUE - - if (![self _canEdit]) - return; - [self _pasteAsPlainTextWithPasteboard:[NSPasteboard generalPasteboard]]; -} - - (void)closeIfNotCurrentView { if ([[[self _frame] frameView] documentView] != self) diff --git a/WebKit/mac/WebView/WebNavigationData.mm b/WebKit/mac/WebView/WebNavigationData.mm index 290d8b1..753a441 100644 --- a/WebKit/mac/WebView/WebNavigationData.mm +++ b/WebKit/mac/WebView/WebNavigationData.mm @@ -55,7 +55,7 @@ @implementation WebNavigationData -- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource; +- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource { _private = [[WebNavigationDataPrivate alloc] init]; diff --git a/WebKit/mac/WebView/WebPDFRepresentation.mm b/WebKit/mac/WebView/WebPDFRepresentation.mm index 36449f3..44a1362 100644 --- a/WebKit/mac/WebView/WebPDFRepresentation.mm +++ b/WebKit/mac/WebView/WebPDFRepresentation.mm @@ -70,15 +70,15 @@ return PDFDocumentClass; } -- (void)setDataSource:(WebDataSource *)dataSource; +- (void)setDataSource:(WebDataSource *)dataSource { } -- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource; +- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource { } -- (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource; +- (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource { } diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 36aef1f..0a192f9 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -360,6 +360,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitUsesProxiedOpenPanelPreferenceKey, [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey, [NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey, + [NSNumber numberWithBool:YES], WebKitHTML5ParserEnabledPreferenceKey, nil]; // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above diff --git a/WebKit/mac/WebView/WebResource.mm b/WebKit/mac/WebView/WebResource.mm index 73c0118..fd02212 100644 --- a/WebKit/mac/WebView/WebResource.mm +++ b/WebKit/mac/WebView/WebResource.mm @@ -277,7 +277,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse" return frameName; } -- (id)description +- (NSString *)description { return [NSString stringWithFormat:@"<%@ %@>", [self className], [self URL]]; } diff --git a/WebKit/mac/WebView/WebSerializedJSValue.mm b/WebKit/mac/WebView/WebSerializedJSValue.mm index af96aa4..05a316b 100644 --- a/WebKit/mac/WebView/WebSerializedJSValue.mm +++ b/WebKit/mac/WebView/WebSerializedJSValue.mm @@ -40,7 +40,7 @@ using namespace WebCore; @implementation WebSerializedJSValue -- (id)initWithValue:(JSValueRef)value context:(JSContextRef)sourceContext exception:(JSValueRef*)exception; +- (id)initWithValue:(JSValueRef)value context:(JSContextRef)sourceContext exception:(JSValueRef*)exception { ASSERT_ARG(value, value); ASSERT_ARG(sourceContext, sourceContext); diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.h b/WebKit/mac/WebView/WebVideoFullscreenController.h index 2e0c4c3..3e7b6cf 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenController.h +++ b/WebKit/mac/WebView/WebVideoFullscreenController.h @@ -48,6 +48,8 @@ namespace WebCore { BOOL _isEndingFullscreen; BOOL _isWindowLoaded; BOOL _forceDisableAnimation; + uint32_t _idleDisplaySleepAssertion; + uint32_t _idleSystemSleepAssertion; SystemUIMode _savedUIMode; SystemUIOptions _savedUIOptions; } diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm index 8cbe0a0..69ded78 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenController.mm +++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm @@ -30,6 +30,7 @@ #import "WebTypesInternal.h" #import "WebVideoFullscreenHUDWindowController.h" #import "WebWindowAnimation.h" +#import <IOKit/pwr_mgt/IOPMLib.h> #import <QTKit/QTKit.h> #import <WebCore/HTMLMediaElement.h> #import <WebCore/SoftLinking.h> @@ -55,6 +56,13 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) @end @interface WebVideoFullscreenController(HUDWindowControllerDelegate) <WebVideoFullscreenHUDWindowControllerDelegate> +- (void)requestExitFullscreenWithAnimation:(BOOL)animation; +- (void)updateMenuAndDockForFullscreen; +- (void)updatePowerAssertions; +@end + +@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard) +- (BOOL)isOnActiveSpace; @end @implementation WebVideoFullscreenController @@ -98,15 +106,18 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) [window setHasShadow:YES]; // This is nicer with a shadow. [window setLevel:NSPopUpMenuWindowLevel-1]; [layer release]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp]; #endif } -- (WebCore::HTMLMediaElement*)mediaElement; +- (WebCore::HTMLMediaElement*)mediaElement { return _mediaElement.get(); } -- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement; +- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement { #ifdef BUILDING_ON_TIGER // WebVideoFullscreenController is not supported on Tiger: @@ -133,7 +144,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) return _delegate; } -- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate; +- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate { _delegate = delegate; } @@ -153,7 +164,8 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) [self clearFadeAnimation]; [[self window] close]; [self setWindow:nil]; - SetSystemUIMode(_savedUIMode, _savedUIOptions); + [self updateMenuAndDockForFullscreen]; + [self updatePowerAssertions]; [_hudController setDelegate:nil]; [_hudController release]; _hudController = nil; @@ -173,8 +185,8 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) _hudController = [[WebVideoFullscreenHUDWindowController alloc] init]; [_hudController setDelegate:self]; - GetSystemUIMode(&_savedUIMode, &_savedUIOptions); - SetSystemUIMode(kUIModeAllSuppressed , 0); + [self updateMenuAndDockForFullscreen]; + [self updatePowerAssertions]; [NSCursor setHiddenUntilMouseMoves:YES]; // Give the HUD keyboard focus initially @@ -186,6 +198,22 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) return _mediaElement->screenRect(); } +- (void)applicationDidResignActive:(NSNotification*)notification +{ + // Check to see if the fullscreenWindow is on the active space; this function is available + // on 10.6 and later, so default to YES if the function is not available: + NSWindow* fullscreenWindow = [self fullscreenWindow]; + BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES); + + // Replicate the QuickTime Player (X) behavior when losing active application status: + // Is the fullscreen screen the main screen? (Note: this covers the case where only a + // single screen is available.) Is the fullscreen screen on the current space? IFF so, + // then exit fullscreen mode. + if ([fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace) + [self requestExitFullscreenWithAnimation:NO]; +} + + #pragma mark - #pragma mark Exposed Interface @@ -229,7 +257,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) _fadeAnimation = [[WebWindowFadeAnimation alloc] initWithDuration:0.2 window:_backgroundFullscreenWindow initialAlpha:initialAlpha finalAlpha:fadeIn ? 1 : 0]; } -- (void)enterFullscreen:(NSScreen *)screen; +- (void)enterFullscreen:(NSScreen *)screen { if (!screen) screen = [NSScreen mainScreen]; @@ -277,6 +305,98 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) [[self fullscreenWindow] animateFromRect:[[self window] frame] toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)]; } +- (void)applicationDidChangeScreenParameters:(NSNotification*)notification +{ + // The user may have changed the main screen by moving the menu bar, or they may have changed + // the Dock's size or location, or they may have changed the fullscreen screen's dimensions. + // Update our presentation parameters, and ensure that the full screen window occupies the + // entire screen: + [self updateMenuAndDockForFullscreen]; + [[self window] setFrame:[[[self window] screen] frame] display:YES]; +} + +- (void)updateMenuAndDockForFullscreen +{ + // NSApplicationPresentationOptions is available on > 10.6 only: +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + NSApplicationPresentationOptions options = NSApplicationPresentationDefault; + NSScreen* fullscreenScreen = [[self window] screen]; + + if (!_isEndingFullscreen) { + // Auto-hide the menu bar if the fullscreenScreen contains the menu bar: + // NOTE: if the fullscreenScreen contains the menu bar but not the dock, we must still + // auto-hide the dock, or an exception will be thrown. + if ([[NSScreen screens] objectAtIndex:0] == fullscreenScreen) + options |= (NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock); + // Check if the current screen contains the dock by comparing the screen's frame to its + // visibleFrame; if a dock is present, the visibleFrame will differ. If the current screen + // contains the dock, hide it. + else if (!NSEqualRects([fullscreenScreen frame], [fullscreenScreen visibleFrame])) + options |= NSApplicationPresentationAutoHideDock; + } + + if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) + [NSApp setPresentationOptions:options]; + else +#endif + SetSystemUIMode(_isEndingFullscreen ? kUIModeNormal : kUIModeAllHidden, 0); +} + +#if !defined(BUILDING_ON_TIGER) // IOPMAssertionCreateWithName not defined on < 10.5 +- (void)_disableIdleDisplaySleep +{ + if (_idleDisplaySleepAssertion == kIOPMNullAssertionID) +#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK + IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &_idleDisplaySleepAssertion); +#else // IOPMAssertionCreate is depreciated in > 10.5 + IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullscreen."), &_idleDisplaySleepAssertion); +#endif +} + +- (void)_enableIdleDisplaySleep +{ + if (_idleDisplaySleepAssertion != kIOPMNullAssertionID) { + IOPMAssertionRelease(_idleDisplaySleepAssertion); + _idleDisplaySleepAssertion = kIOPMNullAssertionID; + } +} + +- (void)_disableIdleSystemSleep +{ + if (_idleSystemSleepAssertion == kIOPMNullAssertionID) +#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK + IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_idleSystemSleepAssertion); +#else // IOPMAssertionCreate is depreciated in > 10.5 + IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullscreen."), &_idleSystemSleepAssertion); +#endif +} + +- (void)_enableIdleSystemSleep +{ + if (_idleSystemSleepAssertion != kIOPMNullAssertionID) { + IOPMAssertionRelease(_idleSystemSleepAssertion); + _idleSystemSleepAssertion = kIOPMNullAssertionID; + } +} +#endif + +- (void)updatePowerAssertions +{ +#if !defined(BUILDING_ON_TIGER) + float rate = 0; + if (_mediaElement && _mediaElement->platformMedia().type == WebCore::PlatformMedia::QTMovieType) + rate = [_mediaElement->platformMedia().media.qtMovie rate]; + + if (rate && !_isEndingFullscreen) { + [self _disableIdleSystemSleep]; + [self _disableIdleDisplaySleep]; + } else { + [self _enableIdleSystemSleep]; + [self _enableIdleDisplaySleep]; + } +#endif +} + #pragma mark - #pragma mark Window callback @@ -314,6 +434,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) { UNUSED_PARAM(unusedNotification); [_hudController updateRate]; + [self updatePowerAssertions]; } @end @@ -453,12 +574,6 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) [[self windowController] fadeHUDIn]; } -- (void)resignKeyWindow -{ - [super resignKeyWindow]; - [[self windowController] requestExitFullscreenWithAnimation:NO]; -} - @end #endif /* ENABLE(VIDEO) */ diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 0023509..631dd63 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -86,6 +86,7 @@ #import "WebPDFView.h" #import "WebPanelAuthenticationHandler.h" #import "WebPasteboardHelper.h" +#import "WebPlatformStrategies.h" #import "WebPluginDatabase.h" #import "WebPluginHalterClient.h" #import "WebPolicyDelegate.h" @@ -103,13 +104,13 @@ #import <Foundation/NSURLConnection.h> #import <JavaScriptCore/APICast.h> #import <JavaScriptCore/JSValueRef.h> +#import <WebCore/AbstractDatabase.h> #import <WebCore/ApplicationCacheStorage.h> #import <WebCore/BackForwardList.h> #import <WebCore/Cache.h> #import <WebCore/ColorMac.h> #import <WebCore/CSSComputedStyleDeclaration.h> #import <WebCore/Cursor.h> -#import <WebCore/Database.h> #import <WebCore/Document.h> #import <WebCore/DocumentLoader.h> #import <WebCore/DragController.h> @@ -190,6 +191,7 @@ @interface NSWindow (WebNSWindowDetails) - (id)_oldFirstResponderBeforeBecoming; - (void)_enableScreenUpdatesIfNeeded; +- (BOOL)_wrapsCarbonWindow; @end using namespace WebCore; @@ -654,6 +656,10 @@ static bool shouldEnableLoadDeferring() #endif WebKitInitializeApplicationCachePathIfNecessary(); patchMailRemoveAttributesMethod(); + + // Initialize our platform strategies. + WebPlatformStrategies::initialize(); + didOneTimeInitialization = true; } @@ -1356,7 +1362,7 @@ static bool fastDocumentTeardownEnabled() settings->setMinimumLogicalFontSize([preferences minimumLogicalFontSize]); settings->setPluginsEnabled([preferences arePlugInsEnabled]); #if ENABLE(DATABASE) - Database::setIsAvailable([preferences databasesEnabled]); + AbstractDatabase::setIsAvailable([preferences databasesEnabled]); #endif settings->setLocalStorageEnabled([preferences localStorageEnabled]); settings->setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]); @@ -4209,7 +4215,7 @@ static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag) Frame* coreFrame = [self _mainCoreFrame]; if (!coreFrame) return YES; - return coreFrame->shouldClose(); + return coreFrame->loader()->shouldClose(); } static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValue) @@ -5389,7 +5395,7 @@ static WebFrameView *containingFrameView(NSView *view) NSDictionary *element = [sender representedObject]; ASSERT([element isKindOfClass:[NSDictionary class]]); - WebDataSource *dataSource = [[element objectForKey:WebElementFrameKey] dataSource]; + WebDataSource *dataSource = [(WebFrame *)[element objectForKey:WebElementFrameKey] dataSource]; NSURLRequest *request = [[dataSource request] copy]; ASSERT(request); @@ -5669,7 +5675,15 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi // An NSWindow may not display in the next runloop cycle after dirtying due to delayed window display logic, // in which case this observer can fire first. So if the window is due for a display, don't commit // layer changes, otherwise they'll show on screen before the view drawing. - if ([window viewsNeedDisplay]) + bool viewsNeedDisplay; +#ifndef __LP64__ + if (window && [window _wrapsCarbonWindow]) + viewsNeedDisplay = HIViewGetNeedsDisplay(HIViewGetRoot(static_cast<WindowRef>([window windowRef]))); + else +#endif + viewsNeedDisplay = [window viewsNeedDisplay]; + + if (viewsNeedDisplay) return; if ([webView _syncCompositingChanges]) { @@ -5766,7 +5780,7 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi return nil; } -- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position; +- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position { #if ENABLE(CLIENT_BASED_GEOLOCATION) if (_private && _private->page) |