diff options
author | Steve Block <steveblock@google.com> | 2009-12-15 10:12:09 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-17 17:41:10 +0000 |
commit | 643ca7872b450ea4efacab6188849e5aac2ba161 (patch) | |
tree | 6982576c228bcd1a7efe98afed544d840751094c /WebKit/mac | |
parent | d026980fde6eb3b01c1fe49441174e89cd1be298 (diff) | |
download | external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2 |
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebKit/mac')
56 files changed, 1990 insertions, 563 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 9104b89..b05f2a8 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,933 @@ +2009-12-10 Jon Honeycutt <jhoneycutt@apple.com> + + Mac build fix. Unreviewed. + + Re-adds code that was mistakenly removed from my last patch. + + * WebCoreSupport/WebPluginHalterClient.mm: + Add necessary #import. + + * WebView/WebDelegateImplementationCaching.h: + Declare a new overload of CallUIDelegateReturningBoolean. + + * WebView/WebDelegateImplementationCaching.mm: + (CallDelegateReturningBoolean): + Add a new overload with different arguments. + (CallUIDelegateReturningBoolean): + Ditto. + +2009-12-10 Jon Honeycutt <jhoneycutt@apple.com> + + Pass more information about a plug-in to the PluginHalterDelegate + + Reviewed by Adam Roben. + + * Plugins/WebBaseNetscapePluginView.mm: + (WebHaltablePlugin::isWindowed): + Return false - the Mac doesn't really have windowed plug-ins. + (WebHaltablePlugin::pluginName): + Return the name from the plug-in package. + + * WebCoreSupport/WebPluginHalterClient.h: + Update for new parameters. + + * WebCoreSupport/WebPluginHalterClient.mm: + (WebPluginHalterClient::shouldHaltPlugin): + Ditto; pass them when making the delegate call. + + * WebView/WebUIDelegatePrivate.h: + Update for new parameters. + +2009-12-08 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/7295070> WebKit video fullscreen keeps playing after closing the window + + Fix a leak of the QTMovieView when exiting fullscreen video, and remove the + old workaround. + + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController windowDidLoad]): Set the movie view as the contentView directly. + (-[WebVideoFullscreenController setMediaElement:WebCore::]): Cast the contentView to a movie view. + (-[WebVideoFullscreenController windowDidExitFullscreen]): Remove the old workaround. + +2009-12-08 Dmitry Titov <dimich@chromium.org> + + Rubber-stamped by David Levin. + + Revert and reopen "Add asserts to RefCounted to make sure ref/deref happens on the right thread." + It may have caused massive increase of reported leaks on the bots. + https://bugs.webkit.org/show_bug.cgi?id=31639 + + * ForwardingHeaders/wtf/ThreadVerifier.h: Removed. + +2009-12-08 Dmitry Titov <dimich@chromium.org> + + Reviewed by Darin Adler. + + Add asserts to RefCounted to make sure ref/deref happens on the right thread. + https://bugs.webkit.org/show_bug.cgi?id=31639 + + * ForwardingHeaders/wtf/ThreadVerifier.h: Added. + +2009-12-07 Dmitry Titov <dimich@chromium.org> + + Rubber-stamped by Darin Adler. + + Remove ENABLE_SHARED_SCRIPT flags + https://bugs.webkit.org/show_bug.cgi?id=32245 + This patch was obtained by "git revert" command and then un-reverting of ChangeLog files. + + * Configurations/FeatureDefines.xcconfig: + +2009-12-07 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7450481> One compositing test keeps DRT in "compositing mode", breaks repaint tests + + The counter that WebView used to keep track of the number of enclosed WebHTMLViews using + accelerated compositing was hard to manage, and maintained incorrectly in a number of cases. + This caused one compositing test make DumpRenderTree think that all subsequent tests + were compositing too. + + Replace this counter with notifications, which are only fired if a client (DRT) requests them. The + notification informs the client that a WebHTMLView entered compositing mode (or an already- + compositing WebHTML was added); it does not say when a view becomes uncomposited, or all + compositing subviews were removed, since this is tricky to get right. + + Change -[WebView _isUsingAcceleratedCompositing] to manually walk the frames, and + return YES if any document view is composited. + + * WebKit.exp: + * WebView/WebHTMLView.mm: + (-[WebHTMLView close]): + (-[WebHTMLView viewDidMoveToSuperview]): + (-[WebHTMLView attachRootLayer:]): + (-[WebHTMLView detachRootLayer]): + * WebView/WebView.mm: + (+[WebView automaticallyNotifiesObserversForKey:]): + (-[WebView _postsAcceleratedCompositingNotifications]): + (-[WebView _setPostsAcceleratedCompositingNotifications:]): + (-[WebView _isUsingAcceleratedCompositing]): + * WebView/WebViewData.h: + * WebView/WebViewInternal.h: + * WebView/WebViewPrivate.h: + +2009-12-07 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32184 + Handle out-of-memory conditions with JSC Ropes with a JS exception, rather than crashing. + Switch from using fastMalloc to tryFastMalloc, pass an ExecState to record the exception on. + + * WebView/WebView.mm: + (aeDescFromJSValue): + +2009-12-07 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Holger Hans Peter Freyther. + + Turn on (SVG) Filters support, by default. + https://bugs.webkit.org/show_bug.cgi?id=32224 + + * Configurations/FeatureDefines.xcconfig: Enable FILTERS build flag. + +2009-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7214236> and http://webkit.org/b/32052 - Implement HTML5 state object history API + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidPushStateWithinPage): + (WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): + (WebFrameLoaderClient::dispatchDidPopStateWithinPage): + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebFrameLoadDelegatePrivate.h: + * WebView/WebView.mm: + (-[WebView _cacheFrameLoadDelegateImplementations]): + +2009-12-03 Pavel Feldman <pfeldman@dhcp-172-28-174-220.spb.corp.google.com> + + Reviewed by Timothy Hatcher. + + Web Inspector: Simplify the settings support in inspector controller. + + https://bugs.webkit.org/show_bug.cgi?id=32076 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (-[WebInspectorWindowController showWindow:]): + (-[WebInspectorWindowController attach]): + (-[WebInspectorWindowController detach]): + +2009-12-03 Ben Murdoch <benm@google.com> + + Reviewed by Brady Eidson. + + [Android] notifyHistoryItemChanged() should pass a pointer to the HistoryItem that changed. + https://bugs.webkit.org/show_bug.cgi?id=31915 + + * History/WebHistoryItem.mm: + (WKNotifyHistoryItemChanged): Update WKNotifyHistoryItemChanged() to add the new HistoryItem parameter added in the WebCore portion of this patch. + * History/WebHistoryItemInternal.h: ditto. + +2009-12-03 Ben Murdoch <benm@google.com> + + Reviewed by Brady Eidson. + + [Android] The FrameLoaderClient is unaware of BackForwardList changes. + https://bugs.webkit.org/show_bug.cgi?id=31914 + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidAddBackForwardItem): Add an empty implementation. Method added to FrameLoaderClient by Android (see bug). + (WebFrameLoaderClient::dispatchDidRemoveBackForwardItem): ditto. + (WebFrameLoaderClient::dispatchDidChangeBackForwardIndex): ditto. + +2009-12-02 Dan Bernstein <mitz@apple.com> + + Reviewed by Mark Rowe. + + Fix a mistake in the previous change + + * WebView/WebView.mm: + (+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]): + Make sure to include the image types’ view and representation classes + even when plug-ins are not allowed. + +2009-12-02 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + Fixed <rdar://problem/7254127> WebKit can load plug-ins even when + plug-ins are disabled + + Ensure that the shared WebPluginDatabase is not instantiated if no + WebViews are used that have plug-ins enabled. + + * DefaultDelegates/WebDefaultPolicyDelegate.m: + (-[WebDefaultPolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]): + Call -[WebView _canShowMIMEType:] on the WebView instead of calling the + class method. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::canShowMIMEType): Ditto. + (WebFrameLoaderClient::transitionToCommittedForNewPage): Call + -[WebFrameView _viewClassForMIMEType:] on the WebView instead of calling + the class method. + (WebFrameLoaderClient::objectContentType): Ditto. + + * WebView/WebDataSource.mm: + (+[WebDataSource _representationClassForMIMEType:allowingPlugins:]): + Added the allowPlugins parameter, which is passed through to + +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]. + (-[WebDataSource _makeRepresentation]): Pass an allowPlugins value + based on the WebView’s preferences. + + * WebView/WebFrameView.mm: + (-[WebFrameView _makeDocumentViewForDataSource:]): Call + -[WebFrameView _viewClassForMIMEType:] instead of calling the class + method. + (+[WebFrameView _viewClassForMIMEType:allowingPlugins:]): Added the + allowPlugins parameter, which is passed through to + +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]. + (-[WebFrameView _viewClassForMIMEType:]): Added. Passes an allowPlugins + value based on the WebView’s preferences. + + * WebView/WebFrameViewInternal.h: + * WebView/WebView.mm: + (+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]): + Added the allowPlugins parameter. If false, skip the instantiation of + the shared WebPluginDatabase. + (-[WebView _viewClass:andRepresentationClass:forMIMEType:]): Pass an + allowPlugins value based on the WebView’s preferences. + (+[WebView _canShowMIMEType:allowingPlugins:]): Passes allowPlugins to + +_viewClass:andRepresentationClass:forMIMEType:allowingPlugins:. + (+[WebView canShowMIMEType:]): Changed to pass YES to + +_canShowMIMEType:allowingPlugins:. + (-[WebView _canShowMIMEType:]): Added. Passes an allowPlugins value + based on the WebView’s preferences. + (-[WebView _pluginForMIMEType:]): Return nil if plug-ins are disabled. + (-[WebView _pluginForExtension:]): Ditto. + (-[WebView _isMIMETypeRegisteredAsPlugin:]): Return NO if plug-ins are + disabled. + * WebView/WebViewInternal.h: + +2009-12-02 Timothy Hatcher <timothy@apple.com> + + Fixes a crash when scrolling a frame that goes away mid-scroll. + + <rdar://problem/7400263> + + Reviewed by John Sullivan. + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView scrollWheel:]): Retain self incase the last + reference is released when calling super. + +2009-11-13 Timothy Hatcher <timothy@apple.com> + + Migrate DOMHTMLInputElementPrivate.h as a private header. + + Reviewed by Darin Adler. + + * MigrateHeaders.make: + +2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Simon Fraser. + + Add SVG animation test framework with 'snapshot' functionality + https://bugs.webkit.org/show_bug.cgi?id=31897 + + Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method, + forwarding the call to SVGDocumentExtensions, if SVG is enabled. + + Implemented just like the existing pauseAnimation* methods for CSS animations. + + * WebView/WebFrame.mm: + (-[WebFrame _pauseSVGAnimation:onSMILNode:atTime:]): + * WebView/WebFramePrivate.h: + +2009-12-01 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Simplify [WebView userAgentForURL:]. No need to call into helper function. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::userAgent): + * WebView/WebView.mm: + (-[WebView userAgentForURL:]): + * WebView/WebViewInternal.h: + +2009-11-24 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + Bug 31859 - Make world selection for JSC IsolatedWorlds automagical. + + WebCore presently has to explicitly specify the world before entering into JSC, + which is a little fragile (particularly since property access via a + getter/setter might invoke execution). Instead derive the current world from + the lexical global object. + + Since WebCore no longer needs to explicitly specify the world on entry to JSC DebuggerCallFrame::evaluate can be called directly. + + * WebView/WebScriptDebugDelegate.mm: + (-[WebScriptCallFrame evaluateWebScript:]): + +2009-11-24 Dmitry Titov <dimich@chromium.org> + + Reviewed by Eric Seidel. + + Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit + https://bugs.webkit.org/show_bug.cgi?id=31444 + + * Configurations/FeatureDefines.xcconfig: + +2009-11-24 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Brady Eidson. + + https://bugs.webkit.org/show_bug.cgi?id=31844 + SocketStreamHandleCFNet should support CONNECT proxy credentials + + * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface): Add WKSI methods. + +2009-11-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + DocumentMarkers need to be educated about transforms + https://bugs.webkit.org/show_bug.cgi?id=31751 + + Find highlight is incorrect with transforms + <rdar://problem/6358394> + + Allow callers to specify that Frame::selectionTextRects() takes transforms into account + when computing the set of rects that encompass a selection. For transformed elemenets, the + selection rect will be the bounding box of the selected content. + + Fix DocumentMarkers to cache rects in absolute coordinates, rather than painting coordinates. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView selectionTextRects]): + Pass RespectTransforms to get a list of rects with transforms taken into account. + +2009-11-23 Kevin Decker <kdecker@apple.com> + + Reviewed by Adam Roben. + + <rdar://problem/7401503> + + Added a workaround for plug-ins not drawing immediately. + + * Plugins/WebBaseNetscapePluginView.mm: Added new constant. + (-[WebBaseNetscapePluginView _clearSubstituteImage]): Added. + (-[WebBaseNetscapePluginView resumeFromHalt]): Call above new method. + +2009-11-20 Dave Hyatt <hyatt@apple.com> + + Reviewed by Darin Adler. + + Make sure to export WebSerializedJSValue. + + * WebKit.exp: + +2009-11-20 Dave Hyatt <hyatt@apple.com> + + Reviewed by Oliver Hunt and Jon Honeycutt. + + Add support for WebSerializedJSValue to WebKit. This object wraps the SerializedScriptValue functionality in WebCore + and exposes the ability to do JS value serialization/deserialization to WebKit clients. + + * WebView/WebSerializedJSValue.h: Added. + * WebView/WebSerializedJSValue.mm: Added. + (-[WebSerializedJSValue initWithValue:context:]): + (-[WebSerializedJSValue deserialize:]): + (-[WebSerializedJSValue dealloc]): + +2009-11-20 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + WAI-ARIA: add support for 'math' role + https://bugs.webkit.org/show_bug.cgi?id=31706 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-11-19 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/7035231> + Support closed caption in <video> element + + * WebCoreSupport/WebSystemInterface.m: + (InitWebCoreSystemInterface): + Add QTMovieHasClosedCaptions and QTMovieSetShowClosedCaptions. + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory localizedMediaControlElementString:]): + (-[WebViewFactory localizedMediaControlElementHelpText:]): + Add accessibility help strings for media controller closed caption button. + +2009-11-18 Michelangelo De Simone <micdesim@gmail.com> + + Reviewed by Darin Adler. + + Fix for <https://bugs.webkit.org/show_bug.cgi?id=27959>. + Support for validationMessage attribute, as per HTML5 specs. + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory validationMessageValueMissingText]): + (-[WebViewFactory validationMessageTypeMismatchText]): + (-[WebViewFactory validationMessagePatternMismatchText]): + (-[WebViewFactory validationMessageTooLongText]): + (-[WebViewFactory validationMessageRangeUnderflowText]): + (-[WebViewFactory validationMessageRangeOverflowText]): + (-[WebViewFactory validationMessageStepMismatchText]): + +2009-11-18 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make the Mac Geolocation API async. + + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::requestGeolocationPermissionForFrame): + (-[WebGeolocationPolicyListener initWithGeolocation:]): + (-[WebGeolocationPolicyListener allow]): + (-[WebGeolocationPolicyListener deny]): + Add WebGeolocationPolicyListener implementation of the new WebGeolocationPolicyListener + protocol and use if to implement requestGeolocationPermissionForFrame using the new async + API. + + * WebCoreSupport/WebGeolocation.mm: Removed. + * WebCoreSupport/WebGeolocationInternal.h: Removed. + * WebCoreSupport/WebGeolocationMock.mm: Remove bogus include. + * WebCoreSupport/WebGeolocationPrivate.h: Removed. + * WebView/WebUIDelegatePrivate.h: Remove requestGeolocationPermission and add + WebGeolocationPolicyListener protocol and decidePolicyForGeolocationRequestFromOrigin delegate + method. + +2009-11-18 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Add Preferences for WebKitShowDebugBorders and WebKitShowRepaintCounter + https://bugs.webkit.org/show_bug.cgi?id=31601 + + These are used to debug accelerated compositing layers + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences showDebugBorders]): + (-[WebPreferences setShowDebugBorders:]): + (-[WebPreferences showRepaintCounter]): + (-[WebPreferences setShowRepaintCounter:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2009-11-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Make DRT show web inspector for tests in inspector/ folder. + - Updated DRT to show/close inspector for all tests under /inspector + - Introduced LayoutTestController::setTimelineProfilingEnabled and + WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled + - Removed reload on each inspector test + - Renamed fast/inspector to fast/inspector-support in order not to trigger + inspector for those. + - Reimplemented timeline tests in order to get rid of reload there. + - Moved tests that don't require harness into the fast group. + + https://bugs.webkit.org/show_bug.cgi?id=31472 + + * WebInspector/WebInspector.h: + * WebInspector/WebInspector.mm: + (-[WebInspector isTimelineProfilingEnabled]): + (-[WebInspector setTimelineProfilingEnabled:]): + +2009-11-14 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Need to implement ARIA role="directory" + https://bugs.webkit.org/show_bug.cgi?id=31516 + + Fix a spelling error in the comment of a localized (accessibility) string. + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-11-14 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Oliver Hunt. + + <rdar://problem/7287487> + Do not use QuickTime version to detect media controller theme + + * WebCoreSupport/WebSystemInterface.m: + (InitWebCoreSystemInterface): Initialize wkMediaControllerThemeAvailable. + +2009-11-13 Adam Roben <aroben@apple.com> + + Tell the WebFrameLoadDelegate when window objects in isolated worlds + are cleared + + Fixes <http://webkit.org/b/31124>. + + Reviewed by Dave Hyatt. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + Replaced windowObjectCleared with this function. If the delegate + implements it, call + -webView:didClearWindowObjectForFrame:inScriptWorld:. Otherwise, if + the passed-in world is the mainThreadNormalWorld(), call + -webView:didClearWindowObject:forFrame:. + + * WebView/WebDelegateImplementationCaching.h: Added a new entry in the + frame load delegate implementation cache for the new delegate method. + + * WebView/WebFrameLoadDelegatePrivate.h: + * WebView/WebScriptWorld.mm: + (allWorlds): Added. Returns a HashMap of all the WebScriptWorlds in + existence. + (-[WebScriptWorld initWithWorld:]): Add ourselves to allWorlds(). + (-[WebScriptWorld dealloc]): Remove ourselves from allWorlds(). + (+[WebScriptWorld findOrCreateWorld:]): Returns the existing + WebScriptWorld for this DOMWrapperWorld, or a new one if one doesn't + already exist. + + * WebView/WebScriptWorldInternal.h: Declared +findOrCreateWorld:. + + * WebView/WebView.mm: + (-[WebView _cacheFrameLoadDelegateImplementations]): Cache the + implementation of the new frame load delegate method. + +2009-11-13 Adam Roben <aroben@apple.com> + + Finish replacing worldIDs with world objects + + The only remaining use of worldIDs was in a method only used by DRT + for the isolated worlds tests. + + Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects + + Reviewed by Mark Rowe. + + * WebView/WebFrame.mm: + (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]): + * WebView/WebFramePrivate.h: + Renamed from + _stringByEvaluatingJavaScriptInIsolatedWorld:WithGobalObject:FromString:. + Now takes a WebScriptWorld instead of a worldID, so we don't need to + maintain a map of worldID -> world anymore. + +2009-11-12 Dan Bernstein <mitz@apple.com> + + Reviewed by Adele Peterson. + + When exiting full-screen video, rather than resetting the system UI + mode, restore it to what it was when full-screen mode was entered. + + * WebView/WebVideoFullscreenController.h: Cleaned up style, removed + unnecessary imports, and added _savedUIMode and _savedUIOptions ivars. + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenController delegate]): Cleaned up style. + (-[WebVideoFullscreenController setDelegate:]): Ditto. + (-[WebVideoFullscreenController windowDidExitFullscreen]): Restore the + system UI mode. + (-[WebVideoFullscreenController windowDidEnterFullscreen]): Save the + system UI mode. + * WebView/WebView.mm: Added now-necessary import. + +2009-11-12 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + externalRepresentation should take Frame as the argument + https://bugs.webkit.org/show_bug.cgi?id=31393 + + No new tests as this is just a refactoring. + + * Misc/WebCoreStatistics.mm: + (-[WebFrame renderTreeAsExternalRepresentation]): + +2009-11-12 Adam Roben <aroben@apple.com> + + Replace worldIDs with world objects + + WebScriptWorld is the new object that represents a world. The only + place worldID is still used is in -[WebFrame + _stringByEvaluatingJavaScriptInIsolatedWorld:WithGlobalObject:FromString:], + but that will change soon. + + Part of <http://webkit.org/b/31414> Implement new SPI for dealing with + user scripts/stylesheets and isolated worlds + + Reviewed by Sam Weinig. + + * WebKit.exp: Export WebScriptWorld. + + * WebView/WebFrame.mm: + (-[WebFrame _stringByEvaluatingJavaScriptInIsolatedWorld:WithGlobalObject:FromString:]): + Moved the bizarre world caching/creation logic that DRT depends on + here from the findWorld function in ScriptController.cpp. Updated to + use ScriptController::executeScriptInWorld instead of + ScriptController::executeScriptInIsolatedWorld. + (-[WebFrame _contextForWorld:]): Renamed from contextForWorldID:. Now + takes a WebScriptWorld. + + * WebView/WebFramePrivate.h: Replaced contextForWorldID: with + _contextForWorld:. + + * WebView/WebScriptWorld.h: Added. + * WebView/WebScriptWorld.mm: Added. + (-[WebScriptWorld initWithWorld:]): Store the passed-in world in our + _private member. + (-[WebScriptWorld init]): Create a new DOMWrapperWorld and pass it to + -initWithWorld:. + (-[WebScriptWorld dealloc]): Release _private. + (+[WebScriptWorld standardWorld]): Returns a shared instance that + represents WebCore's mainThreadNormalWorld(). + (+[WebScriptWorld world]): Returns a new instance. + (core): Returns the DOMWrapperWorld for this WebScriptWorld. + + * WebView/WebScriptWorldInternal.h: Added. + + * WebView/WebView.mm: + (+[WebView _addUserScriptToGroup:world:source:url:whitelist:blacklist:injectionTime:]): + (+[WebView _addUserStyleSheetToGroup:world:source:url:whitelist:blacklist:]): + (+[WebView _removeUserScriptFromGroup:world:url:]): + (+[WebView _removeUserStyleSheetFromGroup:world:url:]): + (+[WebView _removeUserScriptsFromGroup:world:]): + (+[WebView _removeUserStyleSheetsFromGroup:world:]): + * WebView/WebViewPrivate.h: + Changed these functions to take a WebScriptWorld instead of a worldID. + +2009-11-12 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + ARIA: add alert type roles + https://bugs.webkit.org/show_bug.cgi?id=31392 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-11-10 Daniel Bates <dbates@webkit.org> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=30754 + + Removed method draggedImage:movedTo: + + * WebView/WebFrame.mm: + * WebView/WebFrameInternal.h: + * WebView/WebHTMLView.mm: + +2009-11-10 Beth Dakin <bdakin@apple.com> + + Reviewed by Darin Adler. + + Small WebKit part of: + Fix for <rdar://problem/7059710> + -and corresponding- + https://bugs.webkit.org/show_bug.cgi?id=31196 Implement -webkit- + color-correction for CSS colors + + * Misc/WebKitNSStringExtras.mm: + (-[NSString _web_drawAtPoint:font:textColor:]): setFillColor now + requires callers to pass a ColorSpace. + +2009-11-10 Dan Bernstein <mitz@apple.com> + + Reviewed by Eric Carlson and Darin Adler. + + WebKit part of making full-screen video pause during scrubbing. + + * WebView/WebVideoFullscreenHUDWindowController.h: Added _isScrubbing + ivar. + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindowController dealloc]): Assert that + _isScrubbing is NO. + (-[WebVideoFullscreenHUDWindowController endScrubbing]): Call + HTMLMediaElement::endScrubbing(). + (-[WebVideoFullscreenHUDWindowController timelinePositionChanged:]): + If scrubbing has just begun, call HTMLMediaElement::beginScrubbing() + and schedule -endScrubbing to be called when mouse tracking ends. + +2009-11-09 Mark Mentovai <mark@chromium.org> + + Reviewed by Dan Bernstein. + + Track "can have scrollbar" state within FrameView independently of the + individual scrollbar states in ScrollView. + + rdar://problem/7215132, https://bugs.webkit.org/show_bug.cgi?id=29167 + REGRESSION (r48064): mint.com loses scrollbars after coming out of + edit mode. + + rdar://problem/7314421, https://bugs.webkit.org/show_bug.cgi?id=30517 + REGRESSION (r48064): Extra scroll bars in GarageBand Lesson Store. + + Test: fast/overflow/scrollbar-restored.html + + * WebView/WebFrameView.mm: + (-[WebFrameView _install]): + +2009-11-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Eric Carlson. + + Made the full-screen video HUD appear when playback stops, such as when + the end of the video is reached. + + * WebView/WebVideoFullscreenHUDWindowController.h: Cleaned up. + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Updated + for the renaming of -updateRate to -updatePlayButton. + (-[WebVideoFullscreenHUDWindowController updatePlayButton]): Renamed + -updateRate to this. + (-[WebVideoFullscreenHUDWindowController updateRate]): This method now + responds to changes to the playback rate by updating the play button + and showing or hiding the HUD as necessary. + (-[WebVideoFullscreenHUDWindowController togglePlaying:]): Now only + toggles playing. UI updates are driven by -updateRate being called. + (-[WebVideoFullscreenHUDWindowController playing]): Cleaned up. + +2009-11-02 Eric Carlson <eric.carlson@apple.com> + + Reviewed by John Sullivan and Mark Rowe. + + <rdar://problem/7356733> Voiceover does not read correct media controller time values + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory localizedMediaTimeDescription:]): + +2009-11-02 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + Made the remaining time display show negative zero at the end of the + video. + + Made other cleanup. + + * WebView/WebVideoFullscreenHUDWindowController.h: Reverted the types of + _timeline and _volumeSlider to the more generic NSControl. + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Cleaned + up style. + (-[WebVideoFullscreenHUDWindowController windowDidLoad]): Added an + assertion that the cast to NSButton * is legal. Removed casts. + (-[WebVideoFullscreenHUDWindowController updateTime]): Use + -setValue:forKey: instead of an NSSlider method. + (timeToString): Changed to support only non-negative values and + simplified. + (-[WebVideoFullscreenHUDWindowController remainingTimeText]): Always + prepend a “-” to the time. + +2009-11-02 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + WebKit part of making the appearance of the full-screen video HUD match + QuickTime Player X’s HUD. + + * WebView/WebVideoFullscreenHUDWindowController.h: Removed unnecessary + #import statements, cleaned up style, and changed _timeline, + _volumeSlider and _playButton to have more specific types. + * WebView/WebVideoFullscreenHUDWindowController.mm: Updated #import + statements. + (webkit_CGFloor): Added this helper function. + (-[WebVideoFullscreenHUDWindowController init]): Cleaned up style. + (createTimeTextField): Changed to use the bold system font. + (-[WebVideoFullscreenHUDWindowController windowDidLoad]): Changed the + subviews’ metrics and the text fields’ text alignment. + (-[WebVideoFullscreenHUDWindowController updateTime]): Avoid conversion + from double to float. + (stringToTimeTextAttributed): Removed this useless function that + returned an NSAttributedString masquerading as an NSString. + (-[WebVideoFullscreenHUDWindowController remainingTimeText]): Removed + call to stringToTimeTextAttributed(). + (-[WebVideoFullscreenHUDWindowController elapsedTimeText]): Ditto. + +2009-11-02 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + Support ARIA "tab" roles + https://bugs.webkit.org/show_bug.cgi?id=30842 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-11-01 Dan Bernstein <mitz@apple.com> + + Reviewed by Mark Rowe. + + Made the space bar toggle playing state in full-screen video when + modifier keys are down. Made it do so without highlighting the + Play/Pause button. + + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindowController keyDown:]): + +2009-11-01 Dan Bernstein <mitz@apple.com> + + Reviewed by Mark Rowe. + + Made the full-screen video HUD respond to the up and down arrow keys by + increasing and decreasing the volume by 1/10 of the range or, when + combined with the Option key, all the way up or down. + + Made the volume buttons in the full-screen video HUD match the behavior + of their equivalents in the QuickTime Player HUD by turning the volume + all the way up or down. + + Made the volume slider update immediately when the keyboard or volume + buttons are used to change the volume, rather than at the nearest 1/4 + second interval. + + Made the elapsed and remaining time displays update immediately when the + play head is dragged across the timeline, rather than at 1/4 second + intervals. + + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindowController keyDown:]): Handle the up and + down arrow keys. + (-[WebVideoFullscreenHUDWindowController windowDidLoad]): Changed the + actions of the volume up and volume down buttons. + (-[WebVideoFullscreenHUDWindowController setCurrentTime:]): Call + -updateTime. + (-[WebVideoFullscreenHUDWindowController setVolumeToZero:]): Added this + action for the volume down button. + (-[WebVideoFullscreenHUDWindowController setVolumeToMaximum:]): Added + this action for the volume up button. + (-[WebVideoFullscreenHUDWindowController decrementVolume]): No longer + and action method. + (-[WebVideoFullscreenHUDWindowController incrementVolume]): Ditto. + (-[WebVideoFullscreenHUDWindowController setVolume:]): Call + -updateVolume. + +2009-10-30 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + Notify the chrome when the focused node has changed. + https://bugs.webkit.org/show_bug.cgi?id=30832 + + Added stub implementation for new ChromeClient function. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::focusedNodeChanged): + +2009-10-30 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by Eric Seidel. + + Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. + + Bug 28420 - Implement HTML5 <ruby> rendering + (https://bugs.webkit.org/show_bug.cgi?id=28420) + + No new tests (no functional change). + + * Configurations/FeatureDefines.xcconfig: + +2009-10-29 Mark Rowe <mrowe@apple.com> + + Reviewed by Oliver Hunt. + + Validate the stopSpeaking: selector so that is not always enabled when a WebView is first responder. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]): + +2009-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=30932 + <rdar://problem/7350269> + + REGRESSION: Crash when turning on Private Browsing on site with flash. + + Null check setValue. + + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView privateBrowsingModeDidChange]): + +2009-10-29 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Kevin Decker. + + Refactor some duplicate plug-in clean up code into shared functions. + + * Plugins/WebPluginController.mm: + (-[WebPluginController stopOnePlugin:]): New, stop a plug-in. + (-[WebPluginController destroyOnePlugin:]): New, destroy plug-in. + (-[WebPluginController stopAllPlugins]): Call stopOnePlugin. + (-[WebPluginController destroyPlugin:]): Call stopOnePlugin and destroyOnePlugin. + (-[WebPluginController destroyAllPlugins]): Call destroyOnePlugin. + 2009-10-28 Eric Carlson <eric.carlson@apple.com> Reviewed by Simon Fraser. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 42aa3cf..cd462d6 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -44,14 +44,13 @@ ENABLE_DATAGRID = ENABLE_DATAGRID; ENABLE_DATALIST = ENABLE_DATALIST; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; -ENABLE_FILTERS = ; +ENABLE_FILTERS = ENABLE_FILTERS; ENABLE_GEOLOCATION = ; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; -ENABLE_RUBY = ENABLE_RUBY; ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; @@ -67,4 +66,4 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index fabc009..b3bf41d 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 532; -MINOR_VERSION = 4; +MINOR_VERSION = 6; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m index c832993..6de2792 100644 --- a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m +++ b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m @@ -66,11 +66,11 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil; BOOL isDirectory = NO; BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:[[request URL] path] isDirectory:&isDirectory]; - if (exists && !isDirectory && [WebView canShowMIMEType:type]) + if (exists && !isDirectory && [wv _canShowMIMEType:type]) [listener use]; else [listener ignore]; - } else if ([WebView canShowMIMEType:type]) + } else if ([wv _canShowMIMEType:type]) [listener use]; else [listener ignore]; diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make index 9e78367..072da65 100644 --- a/WebKit/mac/MigrateHeaders.make +++ b/WebKit/mac/MigrateHeaders.make @@ -106,6 +106,7 @@ all : \ $(PUBLIC_HEADERS_DIR)/DOMHTMLIFrameElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLImageElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLInputElement.h \ + $(PRIVATE_HEADERS_DIR)/DOMHTMLInputElementPrivate.h \ $(INTERNAL_HEADERS_DIR)/DOMHTMLInputElementInternal.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLIsIndexElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLLIElement.h \ diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index 6bac46e..f204ddb 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -242,7 +242,7 @@ using namespace WebCore; - (NSString *)renderTreeAsExternalRepresentation { - return externalRepresentation(_private->coreFrame->contentRenderer()); + return externalRepresentation(_private->coreFrame); } - (NSString *)counterValueForElement:(DOMElement*)element diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.mm b/WebKit/mac/Misc/WebKitNSStringExtras.mm index 5eb3e1f..da46630 100644 --- a/WebKit/mac/Misc/WebKitNSStringExtras.mm +++ b/WebKit/mac/Misc/WebKitNSStringExtras.mm @@ -93,7 +93,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length) CGFloat blue; CGFloat alpha; [[textColor colorUsingColorSpaceName:NSDeviceRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha]; - graphicsContext.setFillColor(makeRGBA(red * 255, green * 255, blue * 255, alpha * 255)); + graphicsContext.setFillColor(makeRGBA(red * 255, green * 255, blue * 255, alpha * 255), DeviceColorSpace); webCoreFont.drawText(&graphicsContext, run, FloatPoint(point.x, (flipped ? point.y : (-1 * point.y)))); diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 0b4d56a..bf8b80b 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -64,6 +64,8 @@ #define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification" #define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification" +static const NSTimeInterval ClearSubstituteImageDelay = 0.5; + using namespace WebCore; class WebHaltablePlugin : public HaltablePlugin { @@ -77,6 +79,8 @@ private: virtual void halt(); virtual void restart(); virtual Node* node() const; + virtual bool isWindowed() const; + virtual String pluginName() const; WebBaseNetscapePluginView* m_view; }; @@ -96,6 +100,16 @@ Node* WebHaltablePlugin::node() const return [m_view element]; } +bool WebHaltablePlugin::isWindowed() const +{ + return false; +} + +String WebHaltablePlugin::pluginName() const +{ + return [[m_view pluginPackage] name]; +} + @implementation WebBaseNetscapePluginView + (void)initialize @@ -498,6 +512,19 @@ Node* WebHaltablePlugin::node() const _hasBeenHalted = YES; } +- (void)_clearSubstituteImage +{ + Element* element = [self element]; + if (!element) + return; + + RenderObject* renderer = element->renderer(); + if (!renderer) + return; + + toRenderWidget(renderer)->showSubstituteImage(0); +} + - (void)resumeFromHalt { ASSERT(_isHalted); @@ -508,7 +535,9 @@ Node* WebHaltablePlugin::node() const _isHalted = NO; ASSERT([self element]->renderer()); - toRenderWidget([self element]->renderer())->showSubstituteImage(0); + // FIXME 7417484: This is a workaround for plug-ins not drawing immediately. We'd like to detect when the + // plug-in actually draws instead of just assuming it will do so within 0.5 seconds of being restarted. + [self performSelector:@selector(_clearSubstituteImage) withObject:nil afterDelay:ClearSubstituteImageDelay]; } - (BOOL)isHalted diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 135d45a..3ce5e39 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -849,7 +849,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) [self willCallPlugInFunction]; { JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [_pluginPackage.get() pluginFuncs]->setvalue(plugin, NPNVprivateModeBool, &value); + if ([_pluginPackage.get() pluginFuncs]->setvalue) + [_pluginPackage.get() pluginFuncs]->setvalue(plugin, NPNVprivateModeBool, &value); } [self didCallPlugInFunction]; } diff --git a/WebKit/mac/Plugins/WebPluginController.mm b/WebKit/mac/Plugins/WebPluginController.mm index 357cf7b..4343119 100644 --- a/WebKit/mac/Plugins/WebPluginController.mm +++ b/WebKit/mac/Plugins/WebPluginController.mm @@ -135,6 +135,28 @@ static NSMutableSet *pluginViews = nil; [super dealloc]; } +- (void)stopOnePlugin:(NSView *)view +{ + if ([view respondsToSelector:@selector(webPlugInStop)]) { + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + [view webPlugInStop]; + } else if ([view respondsToSelector:@selector(pluginStop)]) { + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + [view pluginStop]; + } +} + +- (void)destroyOnePlugin:(NSView *)view +{ + if ([view respondsToSelector:@selector(webPlugInDestroy)]) { + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + [view webPlugInDestroy]; + } else if ([view respondsToSelector:@selector(pluginDestroy)]) { + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + [view pluginDestroy]; + } +} + - (void)startAllPlugins { if (_started) @@ -167,16 +189,9 @@ static NSMutableSet *pluginViews = nil; } int i, count = [_views count]; - for (i = 0; i < count; i++) { - id aView = [_views objectAtIndex:i]; - if ([aView respondsToSelector:@selector(webPlugInStop)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [aView webPlugInStop]; - } else if ([aView respondsToSelector:@selector(pluginStop)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [aView pluginStop]; - } - } + for (i = 0; i < count; i++) + [self stopOnePlugin:[_views objectAtIndex:i]]; + _started = NO; } @@ -228,23 +243,9 @@ static NSMutableSet *pluginViews = nil; - (void)destroyPlugin:(NSView *)view { if ([_views containsObject:view]) { - if (_started) { - if ([view respondsToSelector:@selector(webPlugInStop)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [view webPlugInStop]; - } else if ([view respondsToSelector:@selector(pluginStop)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [view pluginStop]; - } - } - - if ([view respondsToSelector:@selector(webPlugInDestroy)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [view webPlugInDestroy]; - } else if ([view respondsToSelector:@selector(pluginDestroy)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [view pluginDestroy]; - } + if (_started) + [self stopOnePlugin:view]; + [self destroyOnePlugin:view]; #if ENABLE(NETSCAPE_PLUGIN_API) if (Frame* frame = core([self webFrame])) @@ -290,13 +291,7 @@ static void cancelOutstandingCheck(const void *item, void *context) int i, count = [_views count]; for (i = 0; i < count; i++) { id aView = [_views objectAtIndex:i]; - if ([aView respondsToSelector:@selector(webPlugInDestroy)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [aView webPlugInDestroy]; - } else if ([aView respondsToSelector:@selector(pluginDestroy)]) { - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - [aView pluginDestroy]; - } + [self destroyOnePlugin:aView]; #if ENABLE(NETSCAPE_PLUGIN_API) if (Frame* frame = core([self webFrame])) diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index a8f22f6..ca2863e 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -53,6 +53,8 @@ public: virtual bool canTakeFocus(WebCore::FocusDirection); virtual void takeFocus(WebCore::FocusDirection); + virtual void focusedNodeChanged(WebCore::Node*); + virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); virtual void show(); diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index c107299..58323bb 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -35,7 +35,6 @@ #import "WebElementDictionary.h" #import "WebFrameInternal.h" #import "WebFrameView.h" -#import "WebGeolocationInternal.h" #import "WebHTMLViewInternal.h" #import "WebHistoryInternal.h" #import "WebKitPrefix.h" @@ -91,12 +90,20 @@ using namespace WebCore; -@interface WebOpenPanelResultListener : NSObject <WebOpenPanelResultListener> { +@interface WebOpenPanelResultListener : NSObject <WebOpenPanelResultListener> +{ FileChooser* _chooser; } - (id)initWithChooser:(PassRefPtr<FileChooser>)chooser; @end +@interface WebGeolocationPolicyListener : NSObject <WebGeolocationPolicyListener> +{ + RefPtr<Geolocation> _geolocation; +} +- (id)initWithGeolocation:(Geolocation*)geolocation; +@end + WebChromeClient::WebChromeClient(WebView *webView) : m_webView(webView) { @@ -172,6 +179,10 @@ void WebChromeClient::takeFocus(FocusDirection direction) } } +void WebChromeClient::focusedNodeChanged(Node*) +{ +} + Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features) { NSURLRequest *URLRequest = nil; @@ -753,11 +764,19 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca { BEGIN_BLOCK_OBJC_EXCEPTIONS; + SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:); + if (![[m_webView UIDelegate] respondsToSelector:selector]) { + geolocation->setIsAllowed(false); + return; + } + WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; - WebGeolocation *webGeolocation = [[WebGeolocation alloc] _initWithWebCoreGeolocation:geolocation]; - CallUIDelegate(m_webView, @selector(webView:frame:requestGeolocationPermission:securityOrigin:), kit(frame), webGeolocation, webOrigin); + WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation]; + + CallUIDelegate(m_webView, selector, webOrigin, kit(frame), listener); + [webOrigin release]; - [webGeolocation release]; + [listener release]; END_BLOCK_OBJC_EXCEPTIONS; } @@ -823,3 +842,25 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca } @end + +@implementation WebGeolocationPolicyListener + +- (id)initWithGeolocation:(Geolocation*)geolocation +{ + if (!(self = [super init])) + return nil; + _geolocation = geolocation; + return self; +} + +- (void)allow +{ + _geolocation->setIsAllowed(true); +} + +- (void)deny +{ + _geolocation->setIsAllowed(false); +} + +@end diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index cf6eb0b..2774783 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -91,6 +91,10 @@ private: virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate); virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); + virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); @@ -194,7 +198,7 @@ private: virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType); virtual WebCore::String overrideMediaType() const; - virtual void windowObjectCleared(); + virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index efd1f68..9816e01 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -69,6 +69,7 @@ #import "WebPolicyDelegatePrivate.h" #import "WebPreferences.h" #import "WebResourceLoadDelegate.h" +#import "WebScriptWorldInternal.h" #import "WebSecurityOriginInternal.h" #import "WebUIDelegate.h" #import "WebUIDelegatePrivate.h" @@ -128,6 +129,7 @@ using namespace WebCore; using namespace HTMLNames; +using namespace std; #if ENABLE(MAC_JAVA_BRIDGE) @interface NSView (WebJavaPluginDetails) @@ -536,6 +538,30 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() CallFrameLoadDelegate(implementations->didChangeLocationWithinPageForFrameFunc, webView, @selector(webView:didChangeLocationWithinPageForFrame:), m_webFrame.get()); } +void WebFrameLoaderClient::dispatchDidPushStateWithinPage() +{ + WebView *webView = getWebView(m_webFrame.get()); + WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + if (implementations->didPushStateWithinPageForFrameFunc) + CallFrameLoadDelegate(implementations->didPushStateWithinPageForFrameFunc, webView, @selector(webView:didPushStateWithinPageForFrame:), m_webFrame.get()); +} + +void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage() +{ + WebView *webView = getWebView(m_webFrame.get()); + WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + if (implementations->didReplaceStateWithinPageForFrameFunc) + CallFrameLoadDelegate(implementations->didReplaceStateWithinPageForFrameFunc, webView, @selector(webView:didReplaceStateWithinPageForFrame:), m_webFrame.get()); +} + +void WebFrameLoaderClient::dispatchDidPopStateWithinPage() +{ + WebView *webView = getWebView(m_webFrame.get()); + WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + if (implementations->didPopStateWithinPageForFrameFunc) + CallFrameLoadDelegate(implementations->didPopStateWithinPageForFrameFunc, webView, @selector(webView:didPopStateWithinPageForFrame:), m_webFrame.get()); +} + void WebFrameLoaderClient::dispatchWillClose() { WebView *webView = getWebView(m_webFrame.get()); @@ -963,7 +989,7 @@ bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest& request) cons bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const { - return [WebView canShowMIMEType:MIMEType]; + return [getWebView(m_webFrame.get()) _canShowMIMEType:MIMEType]; } bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const @@ -1127,7 +1153,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() if (usesDocumentViews) { // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too. - bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class]; + bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class]; bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView; if (canSkipCreation) { [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource]; @@ -1234,7 +1260,7 @@ String WebFrameLoaderClient::userAgent(const KURL& url) if (!webView) return String(""); - return [webView _userAgentForURL:url]; + return [webView userAgentForURL:url]; } static const MouseEvent* findMouseEvent(const Event* event) @@ -1375,7 +1401,7 @@ ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const return ObjectContentOtherPlugin; } - if ([WebFrameView _viewClassForMIMEType:type]) + if ([m_webFrame->_private->webFrameView _viewClassForMIMEType:type]) return ObjectContentFrame; return ObjectContentNone; @@ -1701,12 +1727,23 @@ String WebFrameLoaderClient::overrideMediaType() const void WebFrameLoaderClient::documentElementAvailable() { } -void WebFrameLoaderClient::windowObjectCleared() +void WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { - Frame *frame = core(m_webFrame.get()); - ScriptController *script = frame->script(); WebView *webView = getWebView(m_webFrame.get()); WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + + if (implementations->didClearWindowObjectForFrameInScriptWorldFunc) { + CallFrameLoadDelegate(implementations->didClearWindowObjectForFrameInScriptWorldFunc, + webView, @selector(webView:didClearWindowObjectForFrame:inScriptWorld:), m_webFrame.get(), [WebScriptWorld findOrCreateWorld:world]); + return; + } + + if (world != mainThreadNormalWorld()) + return; + + Frame *frame = core(m_webFrame.get()); + ScriptController *script = frame->script(); + if (implementations->didClearWindowObjectForFrameFunc) { CallFrameLoadDelegate(implementations->didClearWindowObjectForFrameFunc, webView, @selector(webView:didClearWindowObject:forFrame:), script->windowScriptObject(), m_webFrame.get()); diff --git a/WebKit/mac/WebCoreSupport/WebGeolocation.mm b/WebKit/mac/WebCoreSupport/WebGeolocation.mm deleted file mode 100644 index 89d6ad9..0000000 --- a/WebKit/mac/WebCoreSupport/WebGeolocation.mm +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "WebGeolocationInternal.h" -#import <WebCore/Geolocation.h> - -using namespace WebCore; - -@implementation WebGeolocation (WebInternal) - -- (id)_initWithWebCoreGeolocation:(WebCoreGeolocation *)geolocation -{ - ASSERT(geolocation); - - self = [super init]; - if (self) { - geolocation->ref(); - _private = reinterpret_cast<WebGeolocationPrivate*>(geolocation); - } - return self; -} - -@end - -@implementation WebGeolocation - -- (BOOL)shouldClearCache -{ - return reinterpret_cast<Geolocation*>(_private)->shouldClearCache(); -} - -- (void)setIsAllowed:(BOOL)allowed -{ - reinterpret_cast<Geolocation*>(_private)->setIsAllowed(allowed); -} - -- (void)dealloc -{ - if (_private) - reinterpret_cast<Geolocation*>(_private)->deref(); - [super dealloc]; -} - -@end diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationInternal.h b/WebKit/mac/WebCoreSupport/WebGeolocationInternal.h deleted file mode 100644 index 8145d4d..0000000 --- a/WebKit/mac/WebCoreSupport/WebGeolocationInternal.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "WebGeolocationPrivate.h" - -namespace WebCore { - class Geolocation; -} - -typedef WebCore::Geolocation WebCoreGeolocation; - -@interface WebGeolocation (WebInternal) - -- (id)_initWithWebCoreGeolocation:(WebCoreGeolocation *)geolocation; - -@end diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm index 95b4301..32e8d0d 100644 --- a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm +++ b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm @@ -25,7 +25,6 @@ #import "WebGeolocationMockPrivate.h" -#import "WebGeolocationInternal.h" #import <WebCore/GeolocationServiceMock.h> #import <WebCore/Geoposition.h> #import <WebCore/PositionError.h> diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationPrivate.h b/WebKit/mac/WebCoreSupport/WebGeolocationPrivate.h deleted file mode 100644 index 5807f7c..0000000 --- a/WebKit/mac/WebCoreSupport/WebGeolocationPrivate.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <Foundation/Foundation.h> - -@class WebGeolocationPrivate; - -@interface WebGeolocation : NSObject { -@private - WebGeolocationPrivate *_private; -} - -- (BOOL)shouldClearCache; -- (void)setIsAllowed:(BOOL)allowed; -@end diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/WebKit/mac/WebCoreSupport/WebInspectorClient.h index 7487728..64621f8 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.h @@ -62,9 +62,8 @@ public: virtual void hideHighlight(); virtual void inspectedURLChanged(const WebCore::String& newURL); - virtual void populateSetting(const WebCore::String& key, WebCore::InspectorController::Setting&); - virtual void storeSetting(const WebCore::String& key, const WebCore::InspectorController::Setting&); - virtual void removeSetting(const WebCore::String& key); + virtual void populateSetting(const WebCore::String& key, WebCore::String* value); + virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); virtual void inspectorWindowObjectCleared(); diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 6a4f67d..01515b1 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -327,8 +327,8 @@ void WebInspectorClient::inspectorWindowObjectCleared() _visible = YES; // If no preference is set - default to an attached window. This is important for inspector LayoutTests. - InspectorController::Setting shouldAttach = [_inspectedWebView page]->inspectorController()->setting(inspectorStartsAttachedName); - _shouldAttach = (shouldAttach.type() == InspectorController::Setting::BooleanType) ? shouldAttach.booleanValue() : true; + String shouldAttach = [_inspectedWebView page]->inspectorController()->setting(inspectorStartsAttachedName); + _shouldAttach = shouldAttach != "false"; if (_shouldAttach) { WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView]; @@ -362,7 +362,7 @@ void WebInspectorClient::inspectorWindowObjectCleared() if (_attachedToInspectedWebView) return; - [_inspectedWebView page]->inspectorController()->setSetting(inspectorStartsAttachedName, InspectorController::Setting(true)); + [_inspectedWebView page]->inspectorController()->setSetting(inspectorStartsAttachedName, "true"); _movingWindows = YES; [self close]; @@ -376,7 +376,7 @@ void WebInspectorClient::inspectorWindowObjectCleared() if (!_attachedToInspectedWebView) return; - [_inspectedWebView page]->inspectorController()->setSetting(inspectorStartsAttachedName, InspectorController::Setting(false)); + [_inspectedWebView page]->inspectorController()->setSetting(inspectorStartsAttachedName, "false"); _movingWindows = YES; [self close]; diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h index 0bab4e3..a0d398d 100644 --- a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h +++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h @@ -27,6 +27,7 @@ namespace WebCore { class Node; + class String; } @class WebView; @@ -35,7 +36,7 @@ class WebPluginHalterClient : public WebCore::PluginHalterClient { public: WebPluginHalterClient(WebView *); - virtual bool shouldHaltPlugin(WebCore::Node*) const; + virtual bool shouldHaltPlugin(WebCore::Node*, bool, const WebCore::String&) const; virtual bool enabled() const; private: diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm index b83e4c8..0c87d19 100644 --- a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm +++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm @@ -28,6 +28,7 @@ #import "DOMNodeInternal.h" #import "WebDelegateImplementationCaching.h" #import "WebView.h" +#import <WebCore/PlatformString.h> using namespace WebCore; @@ -37,10 +38,10 @@ WebPluginHalterClient::WebPluginHalterClient(WebView *webView) ASSERT_ARG(webView, webView); } -bool WebPluginHalterClient::shouldHaltPlugin(Node* pluginNode) const +bool WebPluginHalterClient::shouldHaltPlugin(Node* pluginNode, bool isWindowed, const String& pluginName) const { - ASSERT_ARG(pluginNode, pluginNode); - return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webView:shouldHaltPlugin:), kit(pluginNode)); + ASSERT_ARG(pluginNode, pluginNode); + return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webView:shouldHaltPlugin:isWindowed:pluginName:), kit(pluginNode), isWindowed, (NSString *)pluginName); } bool WebPluginHalterClient::enabled() const diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.m b/WebKit/mac/WebCoreSupport/WebSystemInterface.m index f957814..f2a215d 100644 --- a/WebKit/mac/WebCoreSupport/WebSystemInterface.m +++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.m @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,6 +41,7 @@ void InitWebCoreSystemInterface(void) INIT(AdvanceDefaultButtonPulseAnimation); INIT(CGContextGetShouldSmoothFonts); + INIT(CopyCONNECTProxyResponse); INIT(CreateCustomCFReadStream); INIT(CreateNSURLConnectionDelegateProxy); INIT(DrawCapsLockIndicator); @@ -62,8 +63,11 @@ void InitWebCoreSystemInterface(void) INIT(InitializeMaximumHTTPConnectionCountPerHost); INIT(IsLatchingWheelEvent); INIT(MeasureMediaUIPart); + INIT(MediaControllerThemeAvailable); INIT(PopupMenu); INIT(SetCGFontRenderingMode); + INIT(SetCONNECTProxyAuthorizationForStream); + INIT(SetCONNECTProxyForStream); INIT(SetDragImage); INIT(SetNSURLConnectionDefersCallbacks); INIT(SetNSURLRequestShouldContentSniff); @@ -79,6 +83,8 @@ void InitWebCoreSystemInterface(void) INIT(QTMovieMaxTimeLoadedChangeNotification); INIT(QTMovieMaxTimeSeekable); INIT(QTMovieGetType); + INIT(QTMovieHasClosedCaptions); + INIT(QTMovieSetShowClosedCaptions); INIT(QTMovieViewSetDrawSynchronously); #ifndef BUILDING_ON_TIGER diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm index 79b2959..99729dc 100644 --- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm +++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm @@ -555,6 +555,12 @@ - (NSString *)AXARIAContentGroupText:(NSString *)ariaType { + if ([ariaType isEqualToString:@"ARIAApplicationAlert"]) + return UI_STRING("alert", "An ARIA accessibility group that acts as an alert."); + if ([ariaType isEqualToString:@"ARIAApplicationAlertDialog"]) + return UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog."); + if ([ariaType isEqualToString:@"ARIAApplicationDialog"]) + return UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog."); if ([ariaType isEqualToString:@"ARIAApplicationLog"]) return UI_STRING("log", "An ARIA accessibility group that acts as a console log."); if ([ariaType isEqualToString:@"ARIAApplicationMarquee"]) @@ -587,6 +593,10 @@ return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website."); if ([ariaType isEqualToString:@"ARIAUserInterfaceTooltip"]) return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip."); + if ([ariaType isEqualToString:@"ARIATabPanel"]) + return UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab."); + if ([ariaType isEqualToString:@"ARIADocumentMath"]) + return UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols."); return nil; } @@ -684,6 +694,11 @@ return UI_STRING("fast forward", "accessibility role description for fast forward button"); if ([name isEqualToString:@"SeekBackButton"]) return UI_STRING("fast reverse", "accessibility role description for fast reverse button"); + if ([name isEqualToString:@"ShowClosedCaptionsButton"]) + return UI_STRING("show closed captions", "accessibility role description for show closed captions button"); + if ([name isEqualToString:@"HideClosedCaptionsButton"]) + return UI_STRING("hide closed captions", "accessibility role description for hide closed captions button"); + ASSERT_NOT_REACHED(); return @""; } @@ -723,6 +738,10 @@ return UI_STRING("seek quickly forward", "accessibility help text for fast forward button"); if ([name isEqualToString:@"FullscreenButton"]) return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); + if ([name isEqualToString:@"ShowClosedCaptionsButton"]) + return UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button"); + if ([name isEqualToString:@"HideClosedCaptionsButton"]) + return UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button"); ASSERT_NOT_REACHED(); return @""; } @@ -730,7 +749,7 @@ - (NSString*)localizedMediaTimeDescription:(float)time { if (!isfinite(time)) - return UI_STRING("indefinite time", "string for an indefinite movie time"); + return UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value"); int seconds = (int)fabsf(time); int days = seconds / (60 * 60 * 24); @@ -739,13 +758,48 @@ seconds %= 60; if (days) - return [NSString stringWithFormat:UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"), days, hours, minutes, seconds]; + return [NSString stringWithFormat:UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds]; else if (hours) - return [NSString stringWithFormat:UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"), hours, minutes, seconds]; + return [NSString stringWithFormat:UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds]; else if (minutes) - return [NSString stringWithFormat:UI_STRING("date.format.for.minutes", "string for minutes & seconds"), minutes, seconds]; + return [NSString stringWithFormat:UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds]; + + return [NSString stringWithFormat:UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds]; +} + +- (NSString *)validationMessageValueMissingText +{ + return UI_STRING("value missing", "Validation message for required form control elements that have no value"); +} + +- (NSString *)validationMessageTypeMismatchText +{ + return UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type"); +} + +- (NSString *)validationMessagePatternMismatchText +{ + return UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); +} + +- (NSString *)validationMessageTooLongText +{ + return UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length"); +} - return [NSString stringWithFormat:UI_STRING("date.format.for.seconds", "string for seconds"), seconds]; +- (NSString *)validationMessageRangeUnderflowText +{ + return UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum"); +} + +- (NSString *)validationMessageRangeOverflowText +{ + return UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum"); +} + +- (NSString *)validationMessageStepMismatchText +{ + return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); } @end diff --git a/WebKit/mac/WebInspector/WebInspector.h b/WebKit/mac/WebInspector/WebInspector.h index c16726d..fa13c8d 100644 --- a/WebKit/mac/WebInspector/WebInspector.h +++ b/WebKit/mac/WebInspector/WebInspector.h @@ -49,6 +49,8 @@ - (BOOL)isJavaScriptProfilingEnabled; - (void)setJavaScriptProfilingEnabled:(BOOL)enabled; +- (BOOL)isTimelineProfilingEnabled; +- (void)setTimelineProfilingEnabled:(BOOL)enabled; - (BOOL)isProfilingJavaScript; - (void)toggleProfilingJavaScript:(id)sender; diff --git a/WebKit/mac/WebInspector/WebInspector.mm b/WebKit/mac/WebInspector/WebInspector.mm index ccb09c5..258dd01 100644 --- a/WebKit/mac/WebInspector/WebInspector.mm +++ b/WebKit/mac/WebInspector/WebInspector.mm @@ -148,6 +148,25 @@ using namespace WebCore; page->inspectorController()->disableProfiler(); } +- (BOOL)isTimelineProfilingEnabled +{ + if (Page* page = core(_webView)) + return page->inspectorController()->timelineAgent() ? YES : NO; + return NO; +} + +- (void)setTimelineProfilingEnabled:(BOOL)enabled +{ + Page* page = core(_webView); + if (!page) + return; + + if (enabled) + page->inspectorController()->startTimelineProfiler(); + else + page->inspectorController()->stopTimelineProfiler(); +} + - (void)close:(id)sender { if (Page* page = core(_webView)) diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index 12507d0..3aa270f 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -28,7 +28,9 @@ .objc_class_name_WebRenderNode .objc_class_name_WebResource .objc_class_name_WebScriptCallFrame +.objc_class_name_WebScriptWorld .objc_class_name_WebSecurityOrigin +.objc_class_name_WebSerializedJSValue .objc_class_name_WebStringTruncator .objc_class_name_WebTextIterator .objc_class_name_WebURLsWithTitles @@ -117,3 +119,4 @@ _WebViewDidEndEditingNotification _WebViewProgressEstimateChangedNotification _WebViewProgressFinishedNotification _WebViewProgressStartedNotification +__WebViewDidStartAcceleratedCompositingNotification diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm index b83139d..ecd89f7 100644 --- a/WebKit/mac/WebView/WebDataSource.mm +++ b/WebKit/mac/WebView/WebDataSource.mm @@ -140,10 +140,10 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl } } -+ (Class)_representationClassForMIMEType:(NSString *)MIMEType ++ (Class)_representationClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins { Class repClass; - return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType] ? repClass : nil; + return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType allowingPlugins:allowPlugins] ? repClass : nil; } @end @@ -340,7 +340,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (void)_makeRepresentation { - Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType]]; + Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; // Check if the data source was already bound? if (![[self representation] isKindOfClass:repClass]) { diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/WebKit/mac/WebView/WebDelegateImplementationCaching.h index edf3cad..3ad064c 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.h +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.h @@ -49,6 +49,7 @@ struct WebResourceDelegateImplementationCache { struct WebFrameLoadDelegateImplementationCache { IMP didClearWindowObjectForFrameFunc; + IMP didClearWindowObjectForFrameInScriptWorldFunc; IMP didClearInspectorWindowObjectForFrameFunc; IMP windowScriptObjectAvailableFunc; IMP didHandleOnloadEventsForFrameFunc; @@ -56,6 +57,9 @@ struct WebFrameLoadDelegateImplementationCache { IMP didCancelClientRedirectForFrameFunc; IMP willPerformClientRedirectToURLDelayFireDateForFrameFunc; IMP didChangeLocationWithinPageForFrameFunc; + IMP didPushStateWithinPageForFrameFunc; + IMP didReplaceStateWithinPageForFrameFunc; + IMP didPopStateWithinPageForFrameFunc; IMP willCloseFrameFunc; IMP didStartProvisionalLoadForFrameFunc; IMP didReceiveTitleForFrameFunc; @@ -110,6 +114,7 @@ BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL); BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id); BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id); BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL); +BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL, id); id CallFrameLoadDelegate(IMP, WebView *, SEL); id CallFrameLoadDelegate(IMP, WebView *, SEL, id); diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 486d094..54c4c33 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -233,6 +233,20 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d return result; } +static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean, id object2) +{ + if (!delegate || ![delegate respondsToSelector:selector]) + return result; + if (!self->_private->catchesDelegateExceptions) + return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); + @try { + return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); + } @catch(id exception) { + ReportDiscardedDelegateException(selector, exception); + } + return result; +} + static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2) { if (!delegate || ![delegate respondsToSelector:selector]) @@ -456,6 +470,11 @@ BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean); } +BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean, id object2) +{ + return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean, object2); +} + BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2) { return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object1, object2); diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 3c28e3c..b4424e1 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -354,6 +354,10 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; } } + // Calling super can release the last reference. <rdar://problem/7400263> + // Hold a reference so the code following the super call will not crash. + [self retain]; + [super scrollWheel:event]; if (!isLatchingEvent) { @@ -363,6 +367,8 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; verticallyPinnedByPreviousWheelEvent = (verticalPosition == 0.0 || verticalPosition == 1.0); horizontallyPinnedByPreviousWheelEvent = (horizontalPosition == 0.0 || horizontalPosition == 1.0); } + + [self release]; } - (BOOL)accessibilityIsIgnored diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 94fe997..58400d6 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -49,6 +49,7 @@ #import "WebNSObjectExtras.h" #import "WebNSURLExtras.h" #import "WebScriptDebugger.h" +#import "WebScriptWorldInternal.h" #import "WebViewInternal.h" #import <JavaScriptCore/APICast.h> #import <WebCore/AXObjectCache.h> @@ -78,6 +79,7 @@ #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/ScriptValue.h> #import <WebCore/SmartReplace.h> +#import <WebCore/SVGSMILElement.h> #import <WebCore/TextIterator.h> #import <WebCore/ThreadCheck.h> #import <WebCore/TypingCommand.h> @@ -923,20 +925,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction); } -- (void)_dragSourceMovedTo:(NSPoint)windowLoc -{ - if (!_private->coreFrame) - return; - FrameView* view = _private->coreFrame->view(); - if (!view) - return; - ASSERT([getWebView(self) _usesDocumentViews]); - // FIXME: These are fake modifier keys here, but they should be real ones instead. - PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]), - LeftButton, MouseEventMoved, 0, false, false, false, false, currentTime()); - _private->coreFrame->eventHandler()->dragSourceMovedTo(event); -} - - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation { if (!_private->coreFrame) @@ -1129,6 +1117,29 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return controller->pauseTransitionAtTime(coreNode->renderer(), name, time); } +// Pause a given SVG animation on the target node at a specific time. +// This method is only intended to be used for testing the SVG animation system. +- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time +{ + Frame* frame = core(self); + if (!frame) + return false; + + Document* document = frame->document(); + if (!document || !document->svgExtensions()) + return false; + + Node* coreNode = core(node); + if (!coreNode || !SVGSMILElement::isSMILElement(coreNode)) + return false; + +#if ENABLE(SVG) + return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time); +#else + return false; +#endif +} + - (unsigned) _numberOfActiveAnimations { Frame* frame = core(self); @@ -1204,7 +1215,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); } -- (NSString *)_stringByEvaluatingJavaScriptInIsolatedWorld:(unsigned)worldID WithGlobalObject:(JSObjectRef)globalObjectRef FromString:(NSString *)string +- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world { // Start off with some guess at a frame and a global object, we'll try to do better...! JSDOMWindow* anyWorldGlobalObject = _private->coreFrame->script()->globalObject(mainThreadNormalWorld()); @@ -1217,7 +1228,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) // Get the frame frome the global object we've settled on. Frame* frame = anyWorldGlobalObject->impl()->frame(); ASSERT(frame->document()); - JSValue result = frame->script()->executeScriptInIsolatedWorld(worldID, string, true).jsValue(); + JSValue result = frame->script()->executeScriptInWorld(core(world), string, true).jsValue(); if (!frame) // In case the script removed our frame from the page. return @""; @@ -1232,12 +1243,15 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return String(result.toString(anyWorldGlobalObject->globalExec())); } -- (JSGlobalContextRef)contextForWorldID:(unsigned)worldID; +- (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world { Frame* coreFrame = _private->coreFrame; if (!coreFrame) return 0; - return toGlobalRef(coreFrame->script()->globalObject(worldID)->globalExec()); + DOMWrapperWorld* coreWorld = core(world); + if (!coreWorld) + return 0; + return toGlobalRef(coreFrame->script()->globalObject(coreWorld)->globalExec()); } @end diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h index 10a3015..0dcf19b 100644 --- a/WebKit/mac/WebView/WebFrameInternal.h +++ b/WebKit/mac/WebView/WebFrameInternal.h @@ -155,7 +155,6 @@ WebView *getWebView(WebFrame *webFrame); - (DOMCSSStyleDeclaration *)_typingStyle; - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebCore::EditAction)undoAction; -- (void)_dragSourceMovedTo:(NSPoint)windowLoc; - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation; - (BOOL)_canProvideDocumentSource; diff --git a/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h index 80fa08a..2359cc6 100644 --- a/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h +++ b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h @@ -28,6 +28,7 @@ #import <WebKit/WebFrameLoadDelegate.h> +@class WebScriptWorld; @class WebSecurityOrigin; @interface NSObject (WebFrameLoadDelegatePrivate) @@ -36,4 +37,10 @@ - (void)webView:(WebView *)webView didRunInsecureContent:(WebSecurityOrigin *)origin; +- (void)webView:(WebView *)webView didClearWindowObjectForFrame:(WebFrame *)frame inScriptWorld:(WebScriptWorld *)world; + +- (void)webView:(WebView *)webView didPushStateWithinPageForFrame:(WebFrame *)frame; +- (void)webView:(WebView *)webView didReplaceStateWithinPageForFrame:(WebFrame *)frame; +- (void)webView:(WebView *)webView didPopStateWithinPageForFrame:(WebFrame *)frame; + @end diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index be13430..462686f 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -39,6 +39,7 @@ @class DOMNode; @class WebIconFetcher; @class WebScriptObject; +@class WebScriptWorld; // Keys for accessing the values in the page cache dictionary. extern NSString *WebPageCacheEntryDateKey; @@ -96,8 +97,8 @@ typedef enum { - (void)_recursive_pauseNullEventsForAllNetscapePlugins; #endif -- (NSString *)_stringByEvaluatingJavaScriptInIsolatedWorld:(unsigned)worldID WithGlobalObject:(JSObjectRef)globalObject FromString:(NSString *)string; -- (JSGlobalContextRef)contextForWorldID:(unsigned)worldID; +- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObject inScriptWorld:(WebScriptWorld *)world; +- (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world; // Pause a given CSS animation or transition on the target node at a specific time. // If the animation or transition is already paused, it will update its pause time. @@ -105,6 +106,10 @@ typedef enum { - (BOOL)_pauseAnimation:(NSString*)name onNode:(DOMNode *)node atTime:(NSTimeInterval)time; - (BOOL)_pauseTransitionOfProperty:(NSString*)name onNode:(DOMNode*)node atTime:(NSTimeInterval)time; +// Pause a given SVG animation on the target node at a specific time. +// This method is only intended to be used for testing the SVG animation system. +- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time; + // Returns the total number of currently running animations (includes both CSS transitions and CSS animations). - (unsigned) _numberOfActiveAnimations; diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm index c300586..4638418 100644 --- a/WebKit/mac/WebView/WebFrameView.mm +++ b/WebKit/mac/WebView/WebFrameView.mm @@ -156,7 +156,7 @@ enum { NSString* MIMEType = [dataSource _responseMIMEType]; if (!MIMEType) MIMEType = @"text/html"; - Class viewClass = [[self class] _viewClassForMIMEType:MIMEType]; + Class viewClass = [self _viewClassForMIMEType:MIMEType]; NSView <WebDocumentView> *documentView; if (viewClass) { // If the dataSource's representation has already been created, and it is also the @@ -244,10 +244,15 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl return [[[self _viewTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType] isSubclassOfClass:[WebHTMLView class]]; } -+ (Class)_viewClassForMIMEType:(NSString *)MIMEType ++ (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins { Class viewClass; - return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType] ? viewClass : nil; + return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins] ? viewClass : nil; +} + +- (Class)_viewClassForMIMEType:(NSString *)MIMEType +{ + return [[self class] _viewClassForMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; } - (void)_install @@ -273,6 +278,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl owner->setWidget(view); // Now the render part owns the view, so we don't any more. } + + view->updateCanHaveScrollbars(); } @end diff --git a/WebKit/mac/WebView/WebFrameViewInternal.h b/WebKit/mac/WebView/WebFrameViewInternal.h index 726b62e..9d7fd80 100644 --- a/WebKit/mac/WebView/WebFrameViewInternal.h +++ b/WebKit/mac/WebView/WebFrameViewInternal.h @@ -39,7 +39,8 @@ - (void)_setWebFrame:(WebFrame *)webFrame; - (float)_verticalPageScrollDistance; + (NSMutableDictionary *)_viewTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission; -+ (Class)_viewClassForMIMEType:(NSString *)MIMEType; +- (Class)_viewClassForMIMEType:(NSString *)MIMEType; ++ (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; + (BOOL)_canShowMIMETypeAsHTML:(NSString *)MIMEType; - (WebDynamicScrollBarsView *)_scrollView; - (void)_install; diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 936b6d7..5dc66ee 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -1976,11 +1976,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) // remove tooltips before clearing _private so removeTrackingRect: will work correctly [self removeAllToolTips]; -#if USE(ACCELERATED_COMPOSITING) - if (_private->layerHostingView) - [[self _webView] _stoppedAcceleratedCompositingForFrame:[self _frame]]; -#endif - [_private clear]; Page* page = core([self _webView]); @@ -2666,7 +2661,10 @@ WEBCORE_COMMAND(yankAndSelect) if (action == @selector(_lookUpInDictionaryFromMenu:)) return [self _hasSelection]; - + + if (action == @selector(stopSpeaking:)) + return [NSApp isSpeaking]; + #ifndef BUILDING_ON_TIGER if (action == @selector(toggleGrammarChecking:)) { // FIXME 4799134: WebView is the bottleneck for this grammar-checking logic, but we must validate @@ -2885,6 +2883,14 @@ WEBCORE_COMMAND(yankAndSelect) { if ([self superview] != nil) [self addSuperviewObservers]; + +#if USE(ACCELERATED_COMPOSITING) + if ([self superview] && [self _isUsingAcceleratedCompositing]) { + WebView *webView = [self _webView]; + if ([webView _postsAcceleratedCompositingNotifications]) + [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:webView userInfo:nil]; + } +#endif } - (void)viewWillMoveToWindow:(NSWindow *)window @@ -3441,21 +3447,6 @@ done: return (NSDragOperation)page->dragController()->sourceDragOperation(); } -- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc -{ - ASSERT(![self _webView] || [self _isTopHTMLView]); - - NSPoint windowImageLoc = [[self window] convertScreenToBase:screenLoc]; - NSPoint windowMouseLoc = windowImageLoc; - - if (Page* page = core([self _webView])) { - DragController* dragController = page->dragController(); - NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y()); - } - - [[self _frame] _dragSourceMovedTo:windowMouseLoc]; -} - - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { ASSERT(![self _webView] || [self _isTopHTMLView]); @@ -5425,7 +5416,6 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [hostingView release]; // hostingView is owned by being a subview of self _private->layerHostingView = hostingView; - [[self _webView] _startedAcceleratedCompositingForFrame:[self _frame]]; } // Make a container layer, which will get sized/positioned by AppKit and CA. @@ -5454,6 +5444,9 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) // Parent our root layer in the container layer [viewLayer addSublayer:layer]; + if ([[self _webView] _postsAcceleratedCompositingNotifications]) + [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:[self _webView] userInfo:nil]; + #if defined(BUILDING_ON_LEOPARD) [self _updateLayerHostingViewPosition]; #endif @@ -5466,7 +5459,6 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [_private->layerHostingView setWantsLayer:NO]; [_private->layerHostingView removeFromSuperview]; _private->layerHostingView = nil; - [[self _webView] _stoppedAcceleratedCompositingForFrame:[self _frame]]; } } @@ -5923,7 +5915,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Vector<FloatRect> list; if (Frame* coreFrame = core([self _frame])) - coreFrame->selectionTextRects(list); + coreFrame->selectionTextRects(list, Frame::RespectTransforms); unsigned size = list.size(); NSMutableArray *result = [[[NSMutableArray alloc] initWithCapacity:size] autorelease]; diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 4a87337..d295323 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -85,6 +85,8 @@ #define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly" #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" +#define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" +#define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter" #define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled" #define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime" diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 4914340..6b55ea3 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -351,6 +351,8 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey, [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, + [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey, [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey, [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey, nil]; @@ -1151,6 +1153,26 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey]; } +- (BOOL)showDebugBorders +{ + return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey]; +} + +- (void)setShowDebugBorders:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey]; +} + +- (BOOL)showRepaintCounter +{ + return [self _boolValueForKey:WebKitShowRepaintCounterPreferenceKey]; +} + +- (void)setShowRepaintCounter:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey]; +} + - (BOOL)webGLEnabled { return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey]; diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index c558cbb..3cea78b 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -149,6 +149,12 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)acceleratedCompositingEnabled; - (void)setAcceleratedCompositingEnabled:(BOOL)enabled; +- (BOOL)showDebugBorders; +- (void)setShowDebugBorders:(BOOL)show; + +- (BOOL)showRepaintCounter; +- (void)setShowRepaintCounter:(BOOL)show; + - (BOOL)webGLEnabled; - (void)setWebGLEnabled:(BOOL)enabled; diff --git a/WebKit/mac/WebView/WebScriptDebugDelegate.mm b/WebKit/mac/WebView/WebScriptDebugDelegate.mm index ef2cb67..8489c9b 100644 --- a/WebKit/mac/WebView/WebScriptDebugDelegate.mm +++ b/WebKit/mac/WebView/WebScriptDebugDelegate.mm @@ -249,7 +249,7 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber"; } JSValue exception; - JSValue result = DebuggerCallFrame_evaluateInWorld(*_private->debuggerCallFrame, String(script), exception); + JSValue result = _private->debuggerCallFrame->evaluate(String(script), exception); if (exception) return [self _convertValueToObjcValue:exception]; return result ? [self _convertValueToObjcValue:result] : nil; diff --git a/WebKit/mac/WebView/WebScriptWorld.h b/WebKit/mac/WebView/WebScriptWorld.h new file mode 100644 index 0000000..9204975 --- /dev/null +++ b/WebKit/mac/WebView/WebScriptWorld.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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. + */ + +@class WebScriptWorldPrivate; + +@interface WebScriptWorld : NSObject { +@private + WebScriptWorldPrivate *_private; +} + ++ (WebScriptWorld *)standardWorld; ++ (WebScriptWorld *)world; +@end diff --git a/WebKit/mac/WebView/WebScriptWorld.mm b/WebKit/mac/WebView/WebScriptWorld.mm new file mode 100644 index 0000000..0310701 --- /dev/null +++ b/WebKit/mac/WebView/WebScriptWorld.mm @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "WebScriptWorld.h" + +#import "WebScriptWorldInternal.h" +#import <WebCore/JSDOMBinding.h> +#import <WebCore/ScriptController.h> +#import <wtf/RefPtr.h> + +using namespace WebCore; + +@interface WebScriptWorldPrivate : NSObject { +@public + RefPtr<DOMWrapperWorld> world; +} +@end + +@implementation WebScriptWorldPrivate +@end + +typedef HashMap<DOMWrapperWorld*, WebScriptWorld*> WorldMap; +static WorldMap& allWorlds() +{ + static WorldMap& map = *new WorldMap; + return map; +} + +@implementation WebScriptWorld + +- (id)initWithWorld:(PassRefPtr<DOMWrapperWorld>)world +{ + ASSERT_ARG(world, world); + if (!world) + return nil; + + self = [super init]; + if (!self) + return nil; + + _private = [[WebScriptWorldPrivate alloc] init]; + _private->world = world; + + ASSERT_ARG(world, !allWorlds().contains(_private->world.get())); + allWorlds().add(_private->world.get(), self); + + return self; +} + +- (id)init +{ + return [self initWithWorld:ScriptController::createWorld()]; +} + +- (void)dealloc +{ + ASSERT(allWorlds().contains(_private->world.get())); + allWorlds().remove(_private->world.get()); + + [_private release]; + _private = nil; + [super dealloc]; +} + ++ (WebScriptWorld *)standardWorld +{ + static WebScriptWorld *world = [[WebScriptWorld alloc] initWithWorld:mainThreadNormalWorld()]; + return world; +} + ++ (WebScriptWorld *)world +{ + return [[[self alloc] init] autorelease]; +} + +@end + +@implementation WebScriptWorld (WebInternal) + +DOMWrapperWorld* core(WebScriptWorld *world) +{ + return world ? world->_private->world.get() : 0; +} + ++ (WebScriptWorld *)findOrCreateWorld:(DOMWrapperWorld*) world +{ + ASSERT_ARG(world, world); + + if (world == mainThreadNormalWorld()) + return [self standardWorld]; + + if (WebScriptWorld *existingWorld = allWorlds().get(world)) + return existingWorld; + + return [[[self alloc] initWithWorld:world] autorelease]; +} + +@end diff --git a/WebKit/mac/WebView/WebScriptWorldInternal.h b/WebKit/mac/WebView/WebScriptWorldInternal.h new file mode 100644 index 0000000..785d9c0 --- /dev/null +++ b/WebKit/mac/WebView/WebScriptWorldInternal.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "WebScriptWorld.h" + +namespace WebCore { + class DOMWrapperWorld; +} + +WebCore::DOMWrapperWorld* core(WebScriptWorld *); + +@interface WebScriptWorld (WebInternal) ++ (WebScriptWorld *)findOrCreateWorld:(WebCore::DOMWrapperWorld*)world; +@end diff --git a/WebKit/mac/WebView/WebSerializedJSValue.h b/WebKit/mac/WebView/WebSerializedJSValue.h new file mode 100644 index 0000000..5094776 --- /dev/null +++ b/WebKit/mac/WebView/WebSerializedJSValue.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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. + */ + +@class WebSerializedJSValuePrivate; + +typedef const struct OpaqueJSContext* JSContextRef; +typedef const struct OpaqueJSValue* JSValueRef; + +@interface WebSerializedJSValue : NSObject { +@private + WebSerializedJSValuePrivate *_private; +} + +- (id)initWithValue:(JSValueRef)object context:(JSContextRef)sourceContext exception:(JSValueRef*)exception; +- (JSValueRef)deserialize:(JSContextRef)destinationContext; + +@end diff --git a/WebKit/mac/WebView/WebSerializedJSValue.mm b/WebKit/mac/WebView/WebSerializedJSValue.mm new file mode 100644 index 0000000..af96aa4 --- /dev/null +++ b/WebKit/mac/WebView/WebSerializedJSValue.mm @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "WebSerializedJSValue.h" + +#import <WebCore/SerializedScriptValue.h> +#import <wtf/RefPtr.h> + +using namespace WebCore; + +@interface WebSerializedJSValuePrivate : NSObject { +@public + RefPtr<SerializedScriptValue> value; +} +@end + +@implementation WebSerializedJSValuePrivate +@end + +@implementation WebSerializedJSValue + +- (id)initWithValue:(JSValueRef)value context:(JSContextRef)sourceContext exception:(JSValueRef*)exception; +{ + ASSERT_ARG(value, value); + ASSERT_ARG(sourceContext, sourceContext); + + if (!value || !sourceContext) { + [self release]; + return nil; + } + + self = [super init]; + if (!self) + return nil; + + _private = [[WebSerializedJSValuePrivate alloc] init]; + + _private->value = SerializedScriptValue::create(sourceContext, value, exception); + if (!_private->value) { + [self release]; + return nil; + } + + return self; +} + +- (JSValueRef)deserialize:(JSContextRef)destinationContext +{ + if (!_private || !_private->value) + return 0; + return _private->value->deserialize(destinationContext, 0); +} + +- (void)dealloc +{ + [_private release]; + _private = nil; + [super dealloc]; +} + +@end + diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 0715475..a130b18 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -87,9 +87,14 @@ enum { WebMenuItemTagChangeBack, WebMenuItemTagBaseApplication = 10000 }; -@class WebGeolocation; + @class WebSecurityOrigin; +@protocol WebGeolocationPolicyListener <NSObject> +- (void)allow; +- (void)deny; +@end + @interface NSObject (WebUIDelegatePrivate) - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message; @@ -109,7 +114,7 @@ enum { - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu; - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element; - (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel; -- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode; +- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode isWindowed:(BOOL)isWindowed pluginName:(NSString *)pluginName; /*! @method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: @param sender The WebView sending the delegate method. @@ -124,7 +129,17 @@ enum { - (BOOL)webView:(WebView *)sender shouldReplaceUploadFile:(NSString *)path usingGeneratedFilename:(NSString **)filename; - (NSString *)webView:(WebView *)sender generateReplacementFile:(NSString *)path; -- (BOOL)webView:(WebView *)sender frame:(WebFrame *)frame requestGeolocationPermission:(WebGeolocation *)geolocation securityOrigin:(WebSecurityOrigin *)origin; +/*! + @method webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener: + @abstract + @param webView The WebView sending the delegate method. + @param origin The security origin that would like to use Geolocation. + @param frame The WebFrame whose JavaScript initiated this call. + @param listener The object to call when the decision is made +*/ +- (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin + frame:(WebFrame *)frame + listener:(id<WebGeolocationPolicyListener>)listener; - (void)webView:(WebView *)sender formStateDidChangeForNode:(DOMNode *)node; - (void)webView:(WebView *)sender formDidFocusNode:(DOMNode *)node; diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.h b/WebKit/mac/WebView/WebVideoFullscreenController.h index bb6a083..2e0c4c3 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenController.h +++ b/WebKit/mac/WebView/WebVideoFullscreenController.h @@ -10,47 +10,50 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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. */ #if ENABLE(VIDEO) -#import <Cocoa/Cocoa.h> #import <wtf/RefPtr.h> -#import <WebCore/HTMLMediaElement.h> + +namespace WebCore { + class HTMLMediaElement; +} @protocol WebVideoFullscreenControllerDelegate; @class WebVideoFullscreenHUDWindowController; @class WebWindowFadeAnimation; -@interface WebVideoFullscreenController : NSWindowController -{ +@interface WebVideoFullscreenController : NSWindowController { @private RefPtr<WebCore::HTMLMediaElement> _mediaElement; // (retain) - id<WebVideoFullscreenControllerDelegate> _delegate; // (assign) + id <WebVideoFullscreenControllerDelegate> _delegate; // (assign) NSWindow *_backgroundFullscreenWindow; // (retain) - WebVideoFullscreenHUDWindowController* _hudController; // (retain) + WebVideoFullscreenHUDWindowController *_hudController; // (retain) WebWindowFadeAnimation *_fadeAnimation; // (retain) BOOL _isEndingFullscreen; BOOL _isWindowLoaded; BOOL _forceDisableAnimation; + SystemUIMode _savedUIMode; + SystemUIOptions _savedUIOptions; } -- (id<WebVideoFullscreenControllerDelegate>)delegate; -- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate; +- (id <WebVideoFullscreenControllerDelegate>)delegate; +- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate; - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement; - (WebCore::HTMLMediaElement*)mediaElement; @@ -60,5 +63,4 @@ @end -#endif - +#endif // ENABLE(VIDEO) diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm index fe07f3e..946da90 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenController.mm +++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm @@ -10,34 +10,30 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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. */ #if ENABLE(VIDEO) -#import <QTKit/QTKit.h> -#import <objc/objc-runtime.h> -#import <HIToolbox/HIToolbox.h> - -#import <wtf/UnusedParam.h> -#import <WebCore/SoftLinking.h> -#import <WebCore/IntRect.h> - #import "WebVideoFullscreenController.h" -#import "WebVideoFullscreenHUDWindowController.h" -#import "WebKitSystemInterface.h" + #import "WebTypesInternal.h" +#import "WebVideoFullscreenHUDWindowController.h" #import "WebWindowAnimation.h" +#import <QTKit/QTKit.h> +#import <WebCore/HTMLMediaElement.h> +#import <WebCore/SoftLinking.h> +#import <objc/objc-runtime.h> SOFT_LINK_FRAMEWORK(QTKit) SOFT_LINK_CLASS(QTKit, QTMovieView) @@ -53,11 +49,8 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) { SEL _controllerActionOnAnimationEnd; WebWindowScaleAnimation *_fullscreenAnimation; // (retain) - QTMovieView *_movieView; // (retain) } - (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction; -- (QTMovieView *)movieView; -- (void)setMovieView:(QTMovieView *)movieView; @end @interface WebVideoFullscreenController(HUDWindowControllerDelegate) <WebVideoFullscreenHUDWindowControllerDelegate> @@ -94,7 +87,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) WebVideoFullscreenWindow *window = [self fullscreenWindow]; QTMovieView *view = [[getQTMovieViewClass() alloc] init]; [view setFillColor:[NSColor clearColor]]; - [window setMovieView:view]; + [window setContentView:view]; [view setControllerVisible:NO]; [view setPreservesAspectRatio:YES]; if (_mediaElement) @@ -113,10 +106,10 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) { _mediaElement = mediaElement; if ([self isWindowLoaded]) { - QTMovieView *movieView = [[self fullscreenWindow] movieView]; + QTMovieView *movieView = (QTMovieView *)[[self fullscreenWindow] contentView]; QTMovie *movie = _mediaElement->platformMedia().qtMovie; - ASSERT(movieView); + ASSERT(movieView && [movieView isKindOfClass:[getQTMovieViewClass() class]]); ASSERT(movie); [movieView setMovie:movie]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -126,12 +119,12 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) } } -- (id<WebVideoFullscreenControllerDelegate>)delegate +- (id <WebVideoFullscreenControllerDelegate>)delegate { return _delegate; } -- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate; +- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate; { _delegate = delegate; } @@ -148,13 +141,10 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) - (void)windowDidExitFullscreen { - // If we don't clear the movie, underlying movie data structures are leaked and the movie keeps playing <rdar://problem/7295070> - [[[self fullscreenWindow] movieView] setMovie:nil]; - [self clearFadeAnimation]; [[self window] close]; [self setWindow:nil]; - SetSystemUIMode(kUIModeNormal, 0); + SetSystemUIMode(_savedUIMode, _savedUIOptions); [_hudController setDelegate:nil]; [_hudController release]; _hudController = nil; @@ -174,6 +164,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) _hudController = [[WebVideoFullscreenHUDWindowController alloc] init]; [_hudController setDelegate:self]; + GetSystemUIMode(&_savedUIMode, &_savedUIOptions); SetSystemUIMode(kUIModeAllSuppressed , 0); [NSCursor setHiddenUntilMouseMoves:YES]; @@ -340,20 +331,6 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) [super dealloc]; } -- (QTMovieView *)movieView -{ - return _movieView; -} - -- (void)setMovieView:(QTMovieView *)movieView -{ - if (_movieView == movieView) - return; - [_movieView release]; - _movieView = [movieView retain]; - [self setContentView:_movieView]; -} - - (BOOL)resignFirstResponder { return NO; diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h index 1ffa596..a3d74d2 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h +++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h @@ -10,44 +10,47 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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. */ #if ENABLE(VIDEO) -#import <Cocoa/Cocoa.h> -#import <WebCore/HTMLMediaElement.h> +namespace WebCore { + class HTMLMediaElement; +} @protocol WebVideoFullscreenHUDWindowControllerDelegate; -@interface WebVideoFullscreenHUDWindowController : NSWindowController { -@private - id<WebVideoFullscreenHUDWindowControllerDelegate> _delegate; +@interface WebVideoFullscreenHUDWindowController : NSWindowController +{ + id <WebVideoFullscreenHUDWindowControllerDelegate> _delegate; NSTimer *_timelineUpdateTimer; #if !defined(BUILDING_ON_TIGER) NSTrackingArea *_area; #endif BOOL _mouseIsInHUD; BOOL _isEndingFullscreen; + BOOL _isScrubbing; NSControl *_timeline; NSTextField *_remainingTimeText; NSTextField *_elapsedTimeText; NSControl *_volumeSlider; - NSControl *_playButton; + NSButton *_playButton; } -- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate; -- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate; + +- (id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate; +- (void)setDelegate:(id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate; - (void)fadeWindowIn; - (void)fadeWindowOut; - (void)closeWindow; diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm index c61ae7c..82cb1bf 100644 --- a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm +++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm @@ -10,48 +10,56 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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. */ #if ENABLE(VIDEO) #import "WebVideoFullscreenHUDWindowController.h" -#import <QTKit/QTKit.h> #import "WebKitSystemInterface.h" #import "WebTypesInternal.h" -#import <wtf/RetainPtr.h> -#import <limits> +#import <JavaScriptCore/RetainPtr.h> +#import <JavaScriptCore/UnusedParam.h> +#import <WebCore/HTMLMediaElement.h> +using namespace WebCore; using namespace std; +static inline CGFloat webkit_CGFloor(CGFloat value) +{ + if (sizeof(value) == sizeof(float)) + return floorf(value); + return floor(value); +} + #define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) @interface WebVideoFullscreenHUDWindowController (Private) <NSWindowDelegate> -- (void)keyDown:(NSEvent *)event; - - (void)updateTime; - (void)timelinePositionChanged:(id)sender; - (float)currentTime; - (void)setCurrentTime:(float)currentTime; - (double)duration; -- (double)maxVolume; - (void)volumeChanged:(id)sender; +- (double)maxVolume; - (double)volume; - (void)setVolume:(double)volume; +- (void)decrementVolume; +- (void)incrementVolume; +- (void)updatePlayButton; - (void)togglePlaying:(id)sender; - (BOOL)playing; - (void)setPlaying:(BOOL)playing; @@ -65,11 +73,6 @@ using namespace std; - (void)exitFullscreen:(id)sender; @end - -// -// HUD Window -// - @interface WebVideoFullscreenHUDWindow : NSWindow @end @@ -136,10 +139,6 @@ using namespace std; @end -// -// HUD Window Controller -// - static const CGFloat windowHeight = 59; static const CGFloat windowWidth = 438; @@ -149,7 +148,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3; - (id)init { - NSWindow* window = [[WebVideoFullscreenHUDWindow alloc] initWithContentRect:NSMakeRect(0, 0, windowWidth, windowHeight) + NSWindow *window = [[WebVideoFullscreenHUDWindow alloc] initWithContentRect:NSMakeRect(0, 0, windowWidth, windowHeight) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; self = [super initWithWindow:window]; [window setDelegate:self]; @@ -166,6 +165,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3; #if !defined(BUILDING_ON_TIGER) ASSERT(!_area); #endif + ASSERT(!_isScrubbing); [_timeline release]; [_remainingTimeText release]; [_elapsedTimeText release]; @@ -186,18 +186,38 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3; - (void)keyDown:(NSEvent *)event { - if ([[event characters] isEqualToString:@" "]) - [_playButton performClick:self]; - else - [super keyDown:event]; + NSString *charactersIgnoringModifiers = [event charactersIgnoringModifiers]; + if ([charactersIgnoringModifiers length] == 1) { + switch ([charactersIgnoringModifiers characterAtIndex:0]) { + case ' ': + [self togglePlaying:nil]; + return; + case NSUpArrowFunctionKey: + if ([event modifierFlags] & NSAlternateKeyMask) + [self setVolume:[self maxVolume]]; + else + [self incrementVolume]; + return; + case NSDownArrowFunctionKey: + if ([event modifierFlags] & NSAlternateKeyMask) + [self setVolume:0]; + else + [self decrementVolume]; + return; + default: + break; + } + } + + [super keyDown:event]; } -- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate +- (id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate { return _delegate; } -- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate +- (void)setDelegate:(id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate { _delegate = delegate; } @@ -208,7 +228,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3; // First, update right away, then schedule future update [self updateTime]; - [self updateRate]; + [self updatePlayButton]; [_timelineUpdateTimer invalidate]; [_timelineUpdateTimer release]; @@ -216,7 +236,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3; // Note that this creates a retain cycle between the window and us. _timelineUpdateTimer = [[NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(updateTime) userInfo:nil repeats:YES] retain]; #if defined(BUILDING_ON_TIGER) - [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:(NSString*)kCFRunLoopCommonModes]; + [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:(NSString *)kCFRunLoopCommonModes]; #else [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:NSRunLoopCommonModes]; #endif @@ -306,7 +326,7 @@ static NSTextField *createTimeTextField(NSRect frame) NSTextField *textField = [[NSTextField alloc] initWithFrame:frame]; [textField setTextColor:[NSColor whiteColor]]; [textField setBordered:NO]; - [textField setFont:[NSFont systemFontOfSize:10]]; + [textField setFont:[NSFont boldSystemFontOfSize:10]]; [textField setDrawsBackground:NO]; [textField setBezeled:NO]; [textField setEditable:NO]; @@ -316,10 +336,25 @@ static NSTextField *createTimeTextField(NSRect frame) - (void)windowDidLoad { - static const CGFloat kMargin = 9; - static const CGFloat kMarginTop = 9; - static const CGFloat kButtonSize = 25; - static const CGFloat kButtonMiniSize = 16; + static const CGFloat horizontalMargin = 10; + static const CGFloat playButtonWidth = 41; + static const CGFloat playButtonHeight = 35; + static const CGFloat playButtonTopMargin = 4; + static const CGFloat volumeSliderWidth = 50; + static const CGFloat volumeSliderHeight = 13; + static const CGFloat volumeButtonWidth = 18; + static const CGFloat volumeButtonHeight = 16; + static const CGFloat volumeUpButtonLeftMargin = 4; + static const CGFloat volumeControlsTopMargin = 13; + static const CGFloat exitFullScreenButtonWidth = 25; + static const CGFloat exitFullScreenButtonHeight = 21; + static const CGFloat exitFullScreenButtonTopMargin = 11; + static const CGFloat timelineWidth = 315; + static const CGFloat timelineHeight = 14; + static const CGFloat timelineBottomMargin = 7; + static const CGFloat timeTextFieldWidth = 54; + static const CGFloat timeTextFieldHeight = 13; + static const CGFloat timeTextFieldHorizontalMargin = 7; NSWindow *window = [self window]; ASSERT(window); @@ -331,53 +366,48 @@ static NSTextField *createTimeTextField(NSRect frame) #endif [window setContentView:background]; #if !defined(BUILDING_ON_TIGER) - _area = [[NSTrackingArea alloc] initWithRect:[background bounds] options:NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways owner:self userInfo:nil]; + _area = [[NSTrackingArea alloc] initWithRect:[background bounds] options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways owner:self userInfo:nil]; [background addTrackingArea:_area]; #endif [background release]; - NSView *contentView = [[self window] contentView]; + NSView *contentView = [window contentView]; - CGFloat top = windowHeight - kMarginTop; - CGFloat center = (windowWidth - kButtonSize) / 2; - _playButton = createControlWithMediaUIControlType(WKMediaUIControlPlayPauseButton, NSMakeRect(center, top - kButtonSize, kButtonSize, kButtonSize)); + CGFloat center = webkit_CGFloor((windowWidth - playButtonWidth) / 2); + _playButton = (NSButton *)createControlWithMediaUIControlType(WKMediaUIControlPlayPauseButton, NSMakeRect(center, windowHeight - playButtonTopMargin - playButtonHeight, playButtonWidth, playButtonHeight)); + ASSERT([_playButton isKindOfClass:[NSButton class]]); [_playButton setTarget:self]; [_playButton setAction:@selector(togglePlaying:)]; [contentView addSubview:_playButton]; - CGFloat closeToRight = windowWidth - 2 * kMargin - kButtonMiniSize; - NSControl *exitFullscreenButton = createControlWithMediaUIControlType(WKMediaUIControlExitFullscreenButton, NSMakeRect(closeToRight, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + CGFloat closeToRight = windowWidth - horizontalMargin - exitFullScreenButtonWidth; + NSControl *exitFullscreenButton = createControlWithMediaUIControlType(WKMediaUIControlExitFullscreenButton, NSMakeRect(closeToRight, windowHeight - exitFullScreenButtonTopMargin - exitFullScreenButtonHeight, exitFullScreenButtonWidth, exitFullScreenButtonHeight)); [exitFullscreenButton setAction:@selector(exitFullscreen:)]; [exitFullscreenButton setTarget:self]; [contentView addSubview:exitFullscreenButton]; [exitFullscreenButton release]; - CGFloat left = kMargin; - NSControl *volumeDownButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeDownButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + CGFloat volumeControlsBottom = windowHeight - volumeControlsTopMargin - volumeButtonHeight; + CGFloat left = horizontalMargin; + NSControl *volumeDownButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeDownButton, NSMakeRect(left, volumeControlsBottom, volumeButtonWidth, volumeButtonHeight)); [contentView addSubview:volumeDownButton]; [volumeDownButton setTarget:self]; - [volumeDownButton setAction:@selector(decrementVolume:)]; + [volumeDownButton setAction:@selector(setVolumeToZero:)]; [volumeDownButton release]; - static const int volumeSliderWidth = 50; - - left = kMargin + kButtonMiniSize; - _volumeSlider = createControlWithMediaUIControlType(WKMediaUIControlSlider, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, volumeSliderWidth, kButtonMiniSize)); + left += volumeButtonWidth; + _volumeSlider = createControlWithMediaUIControlType(WKMediaUIControlSlider, NSMakeRect(left, volumeControlsBottom + webkit_CGFloor((volumeButtonHeight - volumeSliderHeight) / 2), volumeSliderWidth, volumeSliderHeight)); [_volumeSlider setValue:[NSNumber numberWithDouble:[self maxVolume]] forKey:@"maxValue"]; [_volumeSlider setTarget:self]; [_volumeSlider setAction:@selector(volumeChanged:)]; [contentView addSubview:_volumeSlider]; - left = kMargin + kButtonMiniSize + volumeSliderWidth + kButtonMiniSize / 2; - NSControl *volumeUpButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeUpButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + left += volumeSliderWidth + volumeUpButtonLeftMargin; + NSControl *volumeUpButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeUpButton, NSMakeRect(left, volumeControlsBottom, volumeButtonWidth, volumeButtonHeight)); [volumeUpButton setTarget:self]; - [volumeUpButton setAction:@selector(incrementVolume:)]; + [volumeUpButton setAction:@selector(setVolumeToMaximum:)]; [contentView addSubview:volumeUpButton]; [volumeUpButton release]; - - static const int timeTextWidth = 50; - static const int sliderHeight = 13; - static const int sliderMarginFixup = 4; #ifdef HAVE_MEDIA_CONTROL _timeline = WKCreateMediaUIControl(WKMediaUIControlTimeline); @@ -386,26 +416,21 @@ static NSTextField *createTimeTextField(NSRect frame) #endif [_timeline setTarget:self]; [_timeline setAction:@selector(timelinePositionChanged:)]; - [_timeline setFrame:NSMakeRect(kMargin + timeTextWidth + kMargin/2, kMargin - sliderMarginFixup, windowWidth - 2 * (kMargin - sliderMarginFixup) - kMargin * 2 - 2 * timeTextWidth, sliderHeight)]; + [_timeline setFrame:NSMakeRect(webkit_CGFloor((windowWidth - timelineWidth) / 2), timelineBottomMargin, timelineWidth, timelineHeight)]; [contentView addSubview:_timeline]; - static const int timeTextHeight = 11; - - _elapsedTimeText = createTimeTextField(NSMakeRect(kMargin, kMargin, timeTextWidth, timeTextHeight)); + _elapsedTimeText = createTimeTextField(NSMakeRect(timeTextFieldHorizontalMargin, timelineBottomMargin, timeTextFieldWidth, timeTextFieldHeight)); + [_elapsedTimeText setAlignment:NSLeftTextAlignment]; [contentView addSubview:_elapsedTimeText]; - _remainingTimeText = createTimeTextField(NSMakeRect(windowWidth - kMargin - timeTextWidth, kMargin, timeTextWidth, timeTextHeight)); + _remainingTimeText = createTimeTextField(NSMakeRect(windowWidth - timeTextFieldHorizontalMargin - timeTextFieldWidth, timelineBottomMargin, timeTextFieldWidth, timeTextFieldHeight)); + [_remainingTimeText setAlignment:NSRightTextAlignment]; [contentView addSubview:_remainingTimeText]; - + [window recalculateKeyViewLoop]; [window setInitialFirstResponder:_playButton]; [window center]; } - -/* - * Bindings - * - */ - (void)updateVolume { @@ -417,19 +442,31 @@ static NSTextField *createTimeTextField(NSRect frame) [self updateVolume]; [_timeline setFloatValue:[self currentTime]]; - [(NSSlider*)_timeline setMaxValue:[self duration]]; + [_timeline setValue:[NSNumber numberWithDouble:[self duration]] forKey:@"maxValue"]; [_remainingTimeText setStringValue:[self remainingTimeText]]; [_elapsedTimeText setStringValue:[self elapsedTimeText]]; } -- (void)fastForward +- (void)endScrubbing { + ASSERT(_isScrubbing); + _isScrubbing = NO; + if (HTMLMediaElement* mediaElement = [_delegate mediaElement]) + mediaElement->endScrubbing(); } - (void)timelinePositionChanged:(id)sender { [self setCurrentTime:[_timeline floatValue]]; + if (!_isScrubbing) { + _isScrubbing = YES; + if (HTMLMediaElement* mediaElement = [_delegate mediaElement]) + mediaElement->beginScrubbing(); + static NSArray *endScrubbingModes = [[NSArray alloc] initWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, nil]; + // Schedule -endScrubbing for when leaving mouse tracking mode. + [[NSRunLoop currentRunLoop] performSelector:@selector(endScrubbing) target:self argument:nil order:0 modes:endScrubbingModes]; + } } - (float)currentTime @@ -443,6 +480,7 @@ static NSTextField *createTimeTextField(NSRect frame) return; WebCore::ExceptionCode e; [_delegate mediaElement]->setCurrentTime(currentTime, e); + [self updateTime]; } - (double)duration @@ -461,7 +499,17 @@ static NSTextField *createTimeTextField(NSRect frame) [self setVolume:[_volumeSlider doubleValue]]; } -- (void)decrementVolume:(id)sender +- (void)setVolumeToZero:(id)sender +{ + [self setVolume:0]; +} + +- (void)setVolumeToMaximum:(id)sender +{ + [self setVolume:[self maxVolume]]; +} + +- (void)decrementVolume { if (![_delegate mediaElement]) return; @@ -470,7 +518,7 @@ static NSTextField *createTimeTextField(NSRect frame) [self setVolume:max(volume, 0.)]; } -- (void)incrementVolume:(id)sender +- (void)incrementVolume { if (![_delegate mediaElement]) return; @@ -492,32 +540,40 @@ static NSTextField *createTimeTextField(NSRect frame) if ([_delegate mediaElement]->muted()) [_delegate mediaElement]->setMuted(false); [_delegate mediaElement]->setVolume(volume / [self maxVolume], e); + [self updateVolume]; } -- (void)updateRate +- (void)updatePlayButton { [_playButton setIntValue:[self playing]]; } -- (void)togglePlaying:(id)sender +- (void)updateRate { - BOOL nowPlaying = [self playing]; - [self setPlaying:!nowPlaying]; + BOOL playing = [self playing]; - // Keep HUD visible when paused - if (!nowPlaying) + // Keep the HUD visible when paused. + if (!playing) [self fadeWindowIn]; else if (!_mouseIsInHUD) { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil]; [self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay]; } + [self updatePlayButton]; +} + +- (void)togglePlaying:(id)sender +{ + [self setPlaying:![self playing]]; } - (BOOL)playing { - if (![_delegate mediaElement]) - return false; - return ![_delegate mediaElement]->canPlay(); + HTMLMediaElement* mediaElement = [_delegate mediaElement]; + if (!mediaElement) + return NO; + + return !mediaElement->canPlay(); } - (void)setPlaying:(BOOL)playing @@ -533,46 +589,29 @@ static NSTextField *createTimeTextField(NSRect frame) static NSString *timeToString(double time) { + ASSERT_ARG(time, time >= 0); + if (!isfinite(time)) time = 0; - int seconds = (int)fabsf(time); + + int seconds = fabs(time); int hours = seconds / (60 * 60); int minutes = (seconds / 60) % 60; seconds %= 60; - if (hours) { - if (hours > 9) - return [NSString stringWithFormat:@"%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds]; - else - return [NSString stringWithFormat:@"%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds]; - } - else - return [NSString stringWithFormat:@"%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds]; - -} -static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment align) -{ - NSShadow *blackShadow = [[NSShadow alloc] init]; - [blackShadow setShadowColor:[NSColor blackColor]]; - [blackShadow setShadowBlurRadius:0]; - [blackShadow setShadowOffset:NSMakeSize(0, -1)]; - NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; - [style setAlignment:align]; - NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:blackShadow, NSShadowAttributeName, style, NSParagraphStyleAttributeName, nil]; - [style release]; - [blackShadow release]; + if (hours) + return [NSString stringWithFormat:@"%d:%02d:%02d", hours, minutes, seconds]; - NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:string attributes:dict]; - return [attrString autorelease]; + return [NSString stringWithFormat:@"%02d:%02d", minutes, seconds]; } - (NSString *)remainingTimeText { - if (![_delegate mediaElement]) + HTMLMediaElement* mediaElement = [_delegate mediaElement]; + if (!mediaElement) return @""; - // Negative number - return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime() - [_delegate mediaElement]->duration()), NSLeftTextAlignment); + return [@"-" stringByAppendingString:timeToString(mediaElement->duration() - mediaElement->currentTime())]; } - (NSString *)elapsedTimeText @@ -580,13 +619,10 @@ static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment al if (![_delegate mediaElement]) return @""; - return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime()), NSRightTextAlignment); + return timeToString([_delegate mediaElement]->currentTime()); } -/* - * Tracking area callbacks - * - */ +#pragma mark NSResponder - (void)mouseEntered:(NSEvent *)theEvent { @@ -601,11 +637,6 @@ static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment al [self fadeWindowIn]; } -/* - * Other Interface callbacks - * - */ - - (void)rewind:(id)sender { if (![_delegate mediaElement]) @@ -627,10 +658,7 @@ static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment al [_delegate requestExitFullscreen]; } -/* - * Window callback - * - */ +#pragma mark NSWindowDelegate - (void)windowDidExpose:(NSNotification *)notification { diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 25da631..33ea069 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -90,6 +90,7 @@ #import "WebPreferenceKeysPrivate.h" #import "WebPreferencesPrivate.h" #import "WebScriptDebugDelegate.h" +#import "WebScriptWorldInternal.h" #import "WebSystemInterface.h" #import "WebTextCompletionController.h" #import "WebTextIterator.h" @@ -115,6 +116,7 @@ #import <WebCore/FrameTree.h> #import <WebCore/FrameView.h> #import <WebCore/GCController.h> +#import <WebCore/HTMLMediaElement.h> #import <WebCore/HTMLNames.h> #import <WebCore/HistoryItem.h> #import <WebCore/IconDatabase.h> @@ -319,10 +321,6 @@ macro(yankAndSelect) \ #define AppleKeyboardUIMode CFSTR("AppleKeyboardUIMode") #define UniversalAccessDomain CFSTR("com.apple.universalaccess") -#if USE(ACCELERATED_COMPOSITING) -#define UsingAcceleratedCompositingProperty @"_isUsingAcceleratedCompositing" -#endif - static BOOL s_didSetCacheModel; static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer; @@ -398,6 +396,8 @@ NSString *_WebMainFrameTitleKey = @"mainFrameTitle"; NSString *_WebMainFrameURLKey = @"mainFrameURL"; NSString *_WebMainFrameDocumentKey = @"mainFrameDocument"; +NSString *_WebViewDidStartAcceleratedCompositingNotification = @"_WebViewDidStartAcceleratedCompositing"; + @interface WebProgressItem : NSObject { @public @@ -820,17 +820,20 @@ static bool runningTigerMail() return uniqueExtensions; } -+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType ++ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins { MIMEType = [MIMEType lowercaseString]; Class viewClass = [[WebFrameView _viewTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType]; Class repClass = [[WebDataSource _repTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType]; - + if (!viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType]) { // Our optimization to avoid loading the plug-in DB and image types for the HTML case failed. - // Load the plug-in DB allowing plug-ins to install types. - [WebPluginDatabase sharedDatabase]; - + + if (allowPlugins) { + // Load the plug-in DB allowing plug-ins to install types. + [WebPluginDatabase sharedDatabase]; + } + // Load the image types and get the view class and rep class. This should be the fullest picture of all handled types. viewClass = [[WebFrameView _viewTypesAllowImageTypeOmission:NO] _webkit_objectForMIMEType:MIMEType]; repClass = [[WebDataSource _repTypesAllowImageTypeOmission:NO] _webkit_objectForMIMEType:MIMEType]; @@ -855,7 +858,7 @@ static bool runningTigerMail() - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType { - if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType]) + if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]) return YES; if (_private->pluginDatabase) { @@ -1301,6 +1304,8 @@ static bool fastDocumentTeardownEnabled() settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]); settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); settings->setAcceleratedCompositingEnabled([preferences acceleratedCompositingEnabled]); + settings->setShowDebugBorders([preferences showDebugBorders]); + settings->setShowRepaintCounter([preferences showRepaintCounter]); settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]); settings->setWebGLEnabled([preferences webGLEnabled]); } @@ -1346,7 +1351,11 @@ static inline IMP getMethod(id o, SEL s) cache->didCancelClientRedirectForFrameFunc = getMethod(delegate, @selector(webView:didCancelClientRedirectForFrame:)); cache->didChangeLocationWithinPageForFrameFunc = getMethod(delegate, @selector(webView:didChangeLocationWithinPageForFrame:)); + cache->didPushStateWithinPageForFrameFunc = getMethod(delegate, @selector(webView:didPushStateWithinPageForFrame:)); + cache->didReplaceStateWithinPageForFrameFunc = getMethod(delegate, @selector(webView:didReplaceStateWithinPageForFrame:)); + cache->didPopStateWithinPageForFrameFunc = getMethod(delegate, @selector(webView:didPopStateWithinPageForFrame:)); cache->didClearWindowObjectForFrameFunc = getMethod(delegate, @selector(webView:didClearWindowObject:forFrame:)); + cache->didClearWindowObjectForFrameInScriptWorldFunc = getMethod(delegate, @selector(webView:didClearWindowObjectForFrame:inScriptWorld:)); cache->didClearInspectorWindowObjectForFrameFunc = getMethod(delegate, @selector(webView:didClearInspectorWindowObject:forFrame:)); cache->didCommitLoadForFrameFunc = getMethod(delegate, @selector(webView:didCommitLoadForFrame:)); cache->didFailLoadWithErrorForFrameFunc = getMethod(delegate, @selector(webView:didFailLoadWithError:forFrame:)); @@ -1542,9 +1551,6 @@ static inline IMP getMethod(id o, SEL s) if (!manualNotifyKeys) manualNotifyKeys = [[NSSet alloc] initWithObjects:_WebMainFrameURLKey, _WebIsLoadingKey, _WebEstimatedProgressKey, _WebCanGoBackKey, _WebCanGoForwardKey, _WebMainFrameTitleKey, _WebMainFrameIconKey, _WebMainFrameDocumentKey, -#if USE(ACCELERATED_COMPOSITING) - UsingAcceleratedCompositingProperty, // used by DRT -#endif nil]; if ([manualNotifyKeys containsObject:key]) return NO; @@ -2089,10 +2095,35 @@ static inline IMP getMethod(id o, SEL s) return handCursor().impl(); } +- (BOOL)_postsAcceleratedCompositingNotifications +{ +#if USE(ACCELERATED_COMPOSITING) + return _private->postsAcceleratedCompositingNotifications; +#else + return NO; +#endif + +} +- (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag +{ +#if USE(ACCELERATED_COMPOSITING) + _private->postsAcceleratedCompositingNotifications = flag; +#endif +} + - (BOOL)_isUsingAcceleratedCompositing { #if USE(ACCELERATED_COMPOSITING) - return _private->acceleratedFramesCount > 0; + Frame* coreFrame = [self _mainCoreFrame]; + if (_private->usesDocumentViews) { + for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { + NSView *documentView = [[kit(frame) frameView] documentView]; + if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing]) + return YES; + } + } + + return NO; #else return NO; #endif @@ -2175,36 +2206,36 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return patternsVector; } -+ (void)_addUserScriptToGroup:(NSString *)groupName worldID:(unsigned)worldID source:(NSString *)source url:(NSURL *)url ++ (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime { String group(groupName); - if (group.isEmpty() || worldID == UINT_MAX) + if (group.isEmpty()) return; PageGroup* pageGroup = PageGroup::pageGroup(group); if (!pageGroup) return; - pageGroup->addUserScriptToWorld(worldID, source, url, toStringVector(whitelist), toStringVector(blacklist), + pageGroup->addUserScriptToWorld(core(world), source, url, toStringVector(whitelist), toStringVector(blacklist), injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); } -+ (void)_addUserStyleSheetToGroup:(NSString *)groupName worldID:(unsigned)worldID source:(NSString *)source url:(NSURL *)url ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist { String group(groupName); - if (group.isEmpty() || worldID == UINT_MAX) + if (group.isEmpty()) return; PageGroup* pageGroup = PageGroup::pageGroup(group); if (!pageGroup) return; - pageGroup->addUserStyleSheetToWorld(worldID, source, url, toStringVector(whitelist), toStringVector(blacklist)); + pageGroup->addUserStyleSheetToWorld(core(world), source, url, toStringVector(whitelist), toStringVector(blacklist)); } -+ (void)_removeUserScriptFromGroup:(NSString *)groupName worldID:(unsigned)worldID url:(NSURL *)url ++ (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url { String group(groupName); if (group.isEmpty()) @@ -2214,10 +2245,10 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!pageGroup) return; - pageGroup->removeUserScriptFromWorld(worldID, url); + pageGroup->removeUserScriptFromWorld(core(world), url); } -+ (void)_removeUserStyleSheetFromGroup:(NSString *)groupName worldID:(unsigned)worldID url:(NSURL *)url ++ (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url { String group(groupName); if (group.isEmpty()) @@ -2227,10 +2258,10 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!pageGroup) return; - pageGroup->removeUserStyleSheetFromWorld(worldID, url); + pageGroup->removeUserStyleSheetFromWorld(core(world), url); } -+ (void)_removeUserScriptsFromGroup:(NSString *)groupName worldID:(unsigned)worldID ++ (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world { String group(groupName); if (group.isEmpty()) @@ -2240,10 +2271,10 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!pageGroup) return; - pageGroup->removeUserScriptsFromWorld(worldID); + pageGroup->removeUserScriptsFromWorld(core(world)); } -+ (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName worldID:(unsigned)worldID ++ (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world { String group(groupName); if (group.isEmpty()) @@ -2253,7 +2284,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!pageGroup) return; - pageGroup->removeUserStyleSheetsFromWorld(worldID); + pageGroup->removeUserStyleSheetsFromWorld(core(world)); } + (void)_removeAllUserContentFromGroup:(NSString *)groupName @@ -2374,13 +2405,26 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) PageGroup::closeLocalStorage(); } ++ (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins +{ + return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins]; +} + + (BOOL)canShowMIMEType:(NSString *)MIMEType { - return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType]; + return [self _canShowMIMEType:MIMEType allowingPlugins:YES]; +} + +- (BOOL)_canShowMIMEType:(NSString *)MIMEType +{ + return [[self class] _canShowMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; } - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType { + if (![_private->preferences arePlugInsEnabled]) + return nil; + WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForMIMEType:MIMEType]; if (pluginPackage) return pluginPackage; @@ -2393,6 +2437,9 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension { + if (![_private->preferences arePlugInsEnabled]) + return nil; + WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForExtension:extension]; if (pluginPackage) return pluginPackage; @@ -2424,6 +2471,9 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType { + if (![_private->preferences arePlugInsEnabled]) + return NO; + if ([[WebPluginDatabase sharedDatabase] isMIMETypeRegistered:MIMEType]) return YES; @@ -3192,7 +3242,14 @@ static bool needsWebViewInitThreadWorkaround() // Get the appropriate user-agent string for a particular URL. - (NSString *)userAgentForURL:(NSURL *)url { - return [self _userAgentForURL:KURL([url absoluteURL])]; + if (_private->useSiteSpecificSpoofing) { + // No current site-specific spoofs. + } + + if (_private->userAgent.isNull()) + _private->userAgent = [[self class] _standardUserAgentWithApplicationName:_private->applicationNameForUserAgent]; + + return _private->userAgent; } - (void)setHostWindow:(NSWindow *)hostWindow @@ -4009,7 +4066,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu if (jsValue.isBoolean()) return [NSAppleEventDescriptor descriptorWithBoolean:jsValue.getBoolean()]; if (jsValue.isString()) - return [NSAppleEventDescriptor descriptorWithString:String(jsValue.getString())]; + return [NSAppleEventDescriptor descriptorWithString:String(jsValue.getString(exec))]; if (jsValue.isNumber()) { double value = jsValue.uncheckedGetNumber(); int intValue = value; @@ -5294,19 +5351,6 @@ static WebFrameView *containingFrameView(NSView *view) } #endif // ENABLE(ICONDATABASE) -// Get the appropriate user-agent string for a particular URL. -- (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url -{ - if (_private->useSiteSpecificSpoofing) { - // No current site-specific spoofs. - } - - if (_private->userAgent.isNull()) - _private->userAgent = [[self class] _standardUserAgentWithApplicationName:_private->applicationNameForUserAgent]; - - return _private->userAgent; -} - - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier { ASSERT(!_private->identifierMap.contains(identifier)); @@ -5417,28 +5461,6 @@ static WebFrameView *containingFrameView(NSView *view) _private->needsOneShotDrawingSynchronization = needsSynchronization; } -- (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame -{ - BOOL entering = _private->acceleratedFramesCount == 0; - if (entering) - [self willChangeValueForKey:UsingAcceleratedCompositingProperty]; - ++_private->acceleratedFramesCount; - if (entering) - [self didChangeValueForKey:UsingAcceleratedCompositingProperty]; -} - -- (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame -{ - BOOL leaving = _private->acceleratedFramesCount == 1; - ASSERT(_private->acceleratedFramesCount > 0); - - if (leaving) - [self willChangeValueForKey:UsingAcceleratedCompositingProperty]; - --_private->acceleratedFramesCount; - if (leaving) - [self didChangeValueForKey:UsingAcceleratedCompositingProperty]; -} - - (BOOL)_syncCompositingChanges { Frame* frame = [self _mainCoreFrame]; diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 6ec94a7..37024c7 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -141,8 +141,7 @@ extern int pluginDatabaseClientCount; // When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates // so that the NSView drawing is visually synchronized with CALayer updates. BOOL needsOneShotDrawingSynchronization; - // Number of WebHTMLViews using accelerated compositing. Used to implement _isUsingAcceleratedCompositing. - int acceleratedFramesCount; + BOOL postsAcceleratedCompositingNotifications; // Run loop observer used to implement the compositing equivalent of -viewWillDraw CFRunLoopObserverRef layerSyncRunLoopObserver; #endif diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h index 15596db..6c2ae50 100644 --- a/WebKit/mac/WebView/WebViewInternal.h +++ b/WebKit/mac/WebView/WebViewInternal.h @@ -67,7 +67,6 @@ namespace WebCore { - (WebCore::Frame*)_mainCoreFrame; - (WebFrame *)_selectedOrMainFrame; -- (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url; - (WebCore::KeyboardUIMode)_keyboardUIMode; - (BOOL)_becomingFirstResponderFromOutside; @@ -82,8 +81,6 @@ namespace WebCore { #if USE(ACCELERATED_COMPOSITING) - (BOOL)_needsOneShotDrawingSynchronization; - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization; -- (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame; -- (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame; - (void)_scheduleCompositingLayerSync; #endif @@ -116,8 +113,10 @@ namespace WebCore { - (void)_pushPerformingProgrammaticFocus; - (void)_popPerformingProgrammaticFocus; - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame; -+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; ++ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; ++ (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; +- (BOOL)_canShowMIMEType:(NSString *)MIMEType; + (NSString *)_MIMETypeForFile:(NSString *)path; - (WebDownload *)_downloadURL:(NSURL *)URL; + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme; diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 99bd5fa..0622d4c 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -45,6 +45,7 @@ @class WebFrame; @class WebInspector; @class WebPreferences; +@class WebScriptWorld; @class WebTextIterator; @protocol WebFormDelegate; @@ -66,6 +67,9 @@ extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether // other WebElementDictionary keys extern NSString *WebElementLinkIsLiveKey; // NSNumber of BOOL indictating whether the link is live or not +// One of the subviews of the WebView entered compositing mode. +extern NSString *_WebViewDidStartAcceleratedCompositingNotification; + #if ENABLE_DASHBOARD_SUPPORT typedef enum { WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows, @@ -460,6 +464,8 @@ Could be worth adding to the API. + (NSCursor *)_pointingHandCursor; // SPI for DumpRenderTree +- (BOOL)_postsAcceleratedCompositingNotifications; +- (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag; - (BOOL)_isUsingAcceleratedCompositing; // SPI for PluginHalter @@ -479,12 +485,12 @@ Could be worth adding to the API. // Removes all white list entries created with _whiteListAccessFromOrigin. + (void)_resetOriginAccessWhiteLists; -+ (void)_addUserScriptToGroup:(NSString *)groupName worldID:(unsigned)worldID source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime; -+ (void)_addUserStyleSheetToGroup:(NSString *)groupName worldID:(unsigned)worldID source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist; -+ (void)_removeUserScriptFromGroup:(NSString *)groupName worldID:(unsigned)worldID url:(NSURL *)url; -+ (void)_removeUserStyleSheetFromGroup:(NSString *)groupName worldID:(unsigned)worldID url:(NSURL *)url; -+ (void)_removeUserScriptsFromGroup:(NSString *)groupName worldID:(unsigned)worldID; -+ (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName worldID:(unsigned)worldID; ++ (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime; ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist; ++ (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url; ++ (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url; ++ (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world; ++ (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world; + (void)_removeAllUserContentFromGroup:(NSString *)groupName; /*! |