diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebKit/mac | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebKit/mac')
35 files changed, 1195 insertions, 106 deletions
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index bf1173720..898482ec1 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,458 @@ +2012-02-24 Shinya Kawanaka <shinyak@chromium.org> + + SpellCheckRequest needs to know the context where the spellcheck happened. + https://bugs.webkit.org/show_bug.cgi?id=79320 + + Reviewed by Hajime Morita. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::requestCheckingOfString): + +2012-02-23 Andy Estes <aestes@apple.com> + + Rename [setS|s]uppressIncrementalRendering to [setS|s]uppressesIncrementalRendering and make it WebPreferences API. + https://bugs.webkit.org/show_bug.cgi?id=79433 + + Reviewed by Dan Bernstein. + + * WebCoreSupport/WebInspectorClient.mm: + (-[WebInspectorWindowController init]): + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences setSuppressesIncrementalRendering:]): + (-[WebPreferences suppressesIncrementalRendering]): + (-[WebPreferences setSuppressIncrementalRendering:]): + (-[WebPreferences suppressIncrementalRendering]): + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + +2012-02-22 Hajime Morrita <morrita@chromium.org> + + NOTIFICATIONS should be implemented as PageSupplement + https://bugs.webkit.org/show_bug.cgi?id=79052 + + Reviewed by Adam Barth. + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:]): + +2012-02-21 Ryosuke Niwa <rniwa@webkit.org> + + Remove the remaining uses of CSSStyleDeclaration in Editor + https://bugs.webkit.org/show_bug.cgi?id=78939 + + Reviewed by Enrica Casucci. + + * WebCoreSupport/WebEditorClient.h: + (WebEditorClient): + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::shouldApplyStyle): + * WebView/WebFrame.mm: + (-[WebFrame _setTypingStyle:withUndoAction:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _applyStyleToSelection:withUndoAction:]): + (-[WebHTMLView _changeCSSColorUsingSelector:inRange:]): + * WebView/WebView.mm: + (-[WebView applyStyle:]): + +2012-02-22 Ryosuke Niwa <rniwa@webkit.org> + + Remove the remaining uses of CSSStyleDeclaration in Editor + https://bugs.webkit.org/show_bug.cgi?id=78939 + + Reviewed by Enrica Casucci. + + * WebCoreSupport/WebEditorClient.h: + (WebEditorClient): + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::shouldApplyStyle): + * WebView/WebFrame.mm: + (-[WebFrame _setTypingStyle:withUndoAction:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _applyStyleToSelection:withUndoAction:]): + (-[WebHTMLView _changeCSSColorUsingSelector:inRange:]): + * WebView/WebView.mm: + (-[WebView applyStyle:]): + +2012-02-22 Jon Lee <jonlee@apple.com> + + Part of r108409 was incorrect, and incorporated an older version of a sub-patch. + This is the actual sub-patch that should have been submitted. + + * WebCoreSupport/WebNotificationClient.h: + * WebCoreSupport/WebNotificationClient.mm: + (WebNotificationClient::show): + (WebNotificationClient::cancel): + (WebNotificationClient::clearNotifications): + (WebNotificationClient::notificationObjectDestroyed): + (WebNotificationClient::notificationControllerDestroyed): + +2012-02-21 Jon Lee <jonlee@apple.com> + + Build fix. Push ENABLE_NOTIFICATIONS into .mm file. + + * WebCoreSupport/WebNotificationClient.h: + * WebView/WebNotification.h: + * WebView/WebNotification.mm: + (-[WebNotification title]): + (-[WebNotification body]): + (-[WebNotification origin]): + (-[WebNotification notificationID]): + (-[WebNotification dispatchShowEvent]): + (-[WebNotification dispatchCloseEvent]): + (-[WebNotification dispatchClickEvent]): + (-[WebNotification dispatchErrorEvent]): + +2012-02-21 John Sullivan <sullivan@apple.com> + + Build fix. + + * WebView/WebUIDelegatePrivate.h: + Added @class declarations for DOMNode and DOMElement. + +2012-02-21 Jon Lee <jonlee@apple.com> + + Build fix for r108409. + + * WebCoreSupport/WebNotificationClient.h: + (WebCore): + * WebCoreSupport/WebNotificationClient.mm: + * WebView/WebNotification.h: + (WebSecurityOrigin): + * WebView/WebNotification.mm: + (core): + (-[WebNotification initWithCoreNotification:notificationID:]): + +2012-02-21 Jon Lee <jonlee@apple.com> + + Bring notifications support to WK1 mac: permission requests + https://bugs.webkit.org/show_bug.cgi?id=78783 + <rdar://problem/10610578> + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebNotificationClient.h: + * WebCoreSupport/WebNotificationClient.mm: Create policy listener, which conforms to the + WebAllowDenyPolicyListener protocol, similar to geolocation. + (WebNotificationClient::requestPermission): + (WebNotificationClient::checkPermission): + (-[WebNotificationPolicyListener initWithCallback:]): + (-[WebNotificationPolicyListener allow]): Call the callback. + (-[WebNotificationPolicyListener deny]): Call the callback. + * WebView/WebUIDelegatePrivate.h: Define new UI delegate method to ask the user to decide a + policy for navigations. + + ==== + Bring notifications support to WK1 mac: showing, canceling, removing notifications + + Create a WebKit wrapper object for WebCore::Notification, which also keeps track of an assigned + ID. + * WebView/WebNotification.h: Added. + (WebSecurityOrigin): + * WebView/WebNotification.mm: Added. + (core): + (-[WebNotification initWithCoreNotification:notificationID:]): + (-[WebNotification init]): + (-[WebNotification dealloc]): + (-[WebNotification title]): + (-[WebNotification body]): + (-[WebNotification origin]): + (-[WebNotification notificationID]): + (-[WebNotification dispatchShowEvent]): + (-[WebNotification dispatchCloseEvent]): + (-[WebNotification dispatchClickEvent]): + (-[WebNotification dispatchErrorEvent]): + * WebView/WebNotificationInternal.h: Added. + (WebCore): Internal category to allow creating instances with WebCore objects. + + Extend WebView to include a WebNotificationProvider, which clients implement. + * WebView/WebViewData.h: Add a private member for the provider. + * WebView/WebViewPrivate.h: + * Define an enum WebNotificationPermission that mirrors WebCore::NotificationPresenter::Permission + that client which implement the provider can use to return policy decisions. + * Define WebNotificationProvider. + * Category WebViewNotification extends WebView with methods that set and manager the + notification provider, and handle events from the platform notifications. + * WebView/WebView.mm: + (-[WebView _setNotificationProvider:]): Sets the provider when initializing the WebView. + (-[WebView _notificationControllerDestroyed]): + (-[WebView _notificationProvider]): + (-[WebView _notificationDidShow:]): + (-[WebView _notificationDidClick:]): + (-[WebView _notificationsDidClose:]): + + * WebCoreSupport/WebNotificationClient.h: Add variables that map between WebCore::Notification + instances, their assigned IDs, their contexts, and corresponding WebKit wrapper objects. + * WebCoreSupport/WebNotificationClient.mm: + (generateNotificationID): Created unique IDs for each shown notification. + (WebNotificationClient::show): Create wrapper object for notification, assign ID, cache the + mappings between the objects, and forward it to the provider. + (WebNotificationClient::cancel): + (WebNotificationClient::clearNotifications): Clear all notifications associated with the + provided context. + (WebNotificationClient::notificationObjectDestroyed): Remove the notification from the maps. + (WebNotificationClient::notificationControllerDestroyed): If the controller is destroyed, tell + the provider to clear of the notifications related to this web view. + + ==== + (Prep work for) Bring notifications support to WK1 mac + + Rename WebGeolocationPolicyListener. The interface is generic enough to be reused for + notification requests. To avoid having to create a new listener type, instead rename it + to WebAllowDenyPolicyListener. + * WebView/WebUIDelegatePrivate.h: Rename the protocol. + * WebCoreSupport/WebGeolocationClient.mm: Refactor geolocation request listener to use + new name. + + Add preference to keep track of whether notifications are enabled in general. + * WebView/WebPreferenceKeysPrivate.h: Add WebNotificationsEnabledKey for storing the + preference. + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): By default have them enabled. + (-[WebPreferences setNotificationsEnabled:]): + (-[WebPreferences notificationsEnabled]): + * WebView/WebPreferencesPrivate.h: + + Add a stringValue method that exposes WebCore::SecurityOrigin::toString() for storing the + notification policy for a given origin. + * WebCoreSupport/WebSecurityOrigin.mm: + (-[WebSecurityOrigin stringValue]): + * WebCoreSupport/WebSecurityOriginPrivate.h: + +2012-02-21 Sam Weinig <sam@webkit.org> + + Attempt to fix the Snow Leopard build. + + * Configurations/Base.xcconfig: + +2012-02-21 Sam Weinig <sam@webkit.org> + + Use libc++ when building with Clang on Mac + https://bugs.webkit.org/show_bug.cgi?id=78981 + + Reviewed by Dan Bernstein. + + * Configurations/Base.xcconfig: + +2012-02-17 Mihnea Ovidenie <mihnea@adobe.com> + + CSS regions enabled by default + https://bugs.webkit.org/show_bug.cgi?id=78525 + + Reviewed by David Hyatt. + + Add a runtime preference to enable/disable regions functionality at runtime(WebKitCSSRegionsEnabled). + CSSRegions are still enabled by default. + In DRT, use layoutTestController.overridePreference("WebKitCSSRegionsEnabled", "0") to disable the css regions functionality. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences cssRegionsEnabled]): + (-[WebPreferences setCSSRegionsEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + +2012-02-17 Enrica Casucci <enrica@apple.com> + + Refactor DragData class to use PlatformStrategies in the Mac implementation. + https://bugs.webkit.org/show_bug.cgi?id=78768 + + Reviewed by Darin Adler. + + * WebCoreSupport/WebPlatformStrategies.h: Added color() method. + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::color): + +2012-02-16 Brady Eidson <beidson@apple.com> + + <rdar://problem/10616280> and https://bugs.webkit.org/show_bug.cgi?id=78767 + REGRESSION (r90471) - iAd Producer 2.0.1 produces blank pages + + Reviewed by Sam Weinig. + + * WebView/WebView.mm: + (-[WebView _needsIsLoadingInAPISenseQuirk]): + (-[WebView _preferencesChanged:]): + +2012-02-15 Enrica Casucci <enrica@apple.com> + + Refactor ClipboardMac class to use PlatformStrategies. + https://bugs.webkit.org/show_bug.cgi?id=78554 + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebDragClient.h: Changed methods signature to use name based pasteboard. + * WebCoreSupport/WebDragClient.mm: Ditto. + (WebDragClient::willPerformDragSourceAction): + (WebDragClient::startDrag): + (WebDragClient::declareAndWriteDragImage): + * WebCoreSupport/WebPlatformStrategies.h: Added new methods. + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::changeCount): + (WebPlatformStrategies::uniqueName): + +2012-02-15 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Notify ChromeClient when touch-event handlers are installed/removed. + https://bugs.webkit.org/show_bug.cgi?id=77440 + + Reviewed by Darin Fisher and Ryosuke Niwa. + + * WebCoreSupport/WebChromeClient.h: + +2012-02-14 Matt Lilek <mrl@apple.com> + + Don't ENABLE_DASHBOARD_SUPPORT unconditionally on all Mac platforms + https://bugs.webkit.org/show_bug.cgi?id=78629 + + Reviewed by David Kilzer. + + * Configurations/FeatureDefines.xcconfig: + +2012-02-14 Alexey Proskuryakov <ap@apple.com> + + [Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets + https://bugs.webkit.org/show_bug.cgi?id=78541 + <rdar://problem/10036695> + + Reviewed by Kent Tamura. + + * WebView/WebPreferences.mm: (+[WebPreferences initialize]): Changed default value of the + preference. + +2012-02-11 Nikolas Zimmermann <nzimmermann@rim.com> + + Convert svg/animations to use SMIL methods for driving the timeline + https://bugs.webkit.org/show_bug.cgi?id=78422 + + Reviewed by Dirk Schulze. + + Remove SVG animation sampling functionality provided for DRT, which no longer uses it. + Instead we switched the svg/animations tests to use SVGSVGElement.setCurrentTime. + + * WebKit.order: + * WebView/WebFrame.mm: + * WebView/WebFramePrivate.h: + +2012-02-13 Enrica Casucci <enrica@apple.com> + + Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. + https://bugs.webkit.org/show_bug.cgi?id=78282 + + This patch removes any accesss to the NSPasteboard object from the Pasteboard class which + now makes use of a new pasteboardStrategy object that is implemented both in WebKit and + WebKit2. The actual access to NSPasteboard is now performed inside the PlatformPasteboard + class. Currently both WebKit and WebKit2 use the same implementation of the PasteboardStrategy + interface but this one more step in the direction of removing access to NSPasteboard from + the WebProcess. + As part of the refactoring the I've reduced to a minimum the use of OBJ-C classes. + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebPlatformStrategies.h: Added PasteboardStrategy. + * WebCoreSupport/WebPlatformStrategies.mm: Added implementation of PasteboardStrategy interface. + (WebPlatformStrategies::createPasteboardStrategy): + (WebPlatformStrategies::getTypes): + (WebPlatformStrategies::bufferForType): + (WebPlatformStrategies::getPathnamesForType): + (WebPlatformStrategies::stringForType): + (WebPlatformStrategies::copy): + (WebPlatformStrategies::setTypes): + (WebPlatformStrategies::setBufferForType): + (WebPlatformStrategies::setPathnamesForType): + (WebPlatformStrategies::setStringForType): + +2012-02-12 Hajime Morrita <morrita@chromium.org> + + Page should have less intrusive way to associate API implementation objects. + https://bugs.webkit.org/show_bug.cgi?id=78085 + + Reviewed by Adam Barth. + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:]): + +2012-02-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r107435. + http://trac.webkit.org/changeset/107435 + https://bugs.webkit.org/show_bug.cgi?id=78410 + + It broke the Qt build (Requested by Ossy on #webkit). + + * WebCoreSupport/WebPlatformStrategies.h: + (WebPlatformStrategies): + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::addVisitedLink): + +2012-02-10 Adam Klein <adamk@chromium.org> + + Enable MUTATION_OBSERVERS by default on all platforms + https://bugs.webkit.org/show_bug.cgi?id=78196 + + Reviewed by Ojan Vafai. + + * Configurations/FeatureDefines.xcconfig: + +2012-02-10 Enrica Casucci <enrica@apple.com> + + Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. + https://bugs.webkit.org/show_bug.cgi?id=78282 + + This patch removes any accesss to the NSPasteboard object from the Pasteboard class which + now makes use of a new pasteboardStrategy object that is implemented both in WebKit and + WebKit2. The actual access to NSPasteboard is now performed inside the PlatformPasteboard + class. Currently both WebKit and WebKit2 use the same implementation of the PasteboardStrategy + interface but this one more step in the direction of removing access to NSPasteboard from + the WebProcess. + As part of the refactoring the I've reduced to a minimum the use of OBJ-C classes. + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebPlatformStrategies.h: Added PasteboardStrategy. + * WebCoreSupport/WebPlatformStrategies.mm: Added implementation of PasteboardStrategy interface. + (WebPlatformStrategies::createPasteboardStrategy): + (WebPlatformStrategies::getTypes): + (WebPlatformStrategies::bufferForType): + (WebPlatformStrategies::getPathnamesForType): + (WebPlatformStrategies::stringForType): + (WebPlatformStrategies::copy): + (WebPlatformStrategies::setTypes): + (WebPlatformStrategies::setBufferForType): + (WebPlatformStrategies::setPathnamesForType): + (WebPlatformStrategies::setStringForType): + +2012-02-10 Benjamin Poulain <bpoulain@apple.com> + + [Mac] DYLIB_INSTALL_NAME_BASE should not be prefixed by the SDKROOT + https://bugs.webkit.org/show_bug.cgi?id=78320 + + Reviewed by Joseph Pecoraro. + + <rdar://problem/10839750> + + * Configurations/WebKit.xcconfig: + +2012-02-09 Alexey Proskuryakov <ap@apple.com> + + REGRESSION (r104885): Articles not displayed in Vienna RSS reader + https://bugs.webkit.org/show_bug.cgi?id=78280 + <rdar://problem/10762545> + + Reviewed by Oliver Hunt. + + * Misc/WebNSURLExtras.h: + * Misc/WebNSURLExtras.mm: (-[NSURL _webkit_URLFromURLOrPath]): + Added a method to create a URL from a path, similarly to what KURL used to do. + + * WebView/WebFrame.mm: (-[WebFrame loadData:MIMEType:textEncodingName:baseURL:]): + Use it in an API where a known regression occurred. + 2012-02-07 Antti Koivisto <antti@apple.com> REGRESSION (r106681): Null check missing in [WebFrame(WebInternal) _typingStyle] diff --git a/Source/WebKit/mac/Configurations/Base.xcconfig b/Source/WebKit/mac/Configurations/Base.xcconfig index 648332252..b62984744 100644 --- a/Source/WebKit/mac/Configurations/Base.xcconfig +++ b/Source/WebKit/mac/Configurations/Base.xcconfig @@ -65,6 +65,11 @@ WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE); WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE); WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE); +CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +CLANG_CXX_LIBRARY_1060 = libstdc++; +CLANG_CXX_LIBRARY_1070 = libc++; +CLANG_CXX_LIBRARY_1080 = libc++; +CLANG_CXX_LIBRARY_1090 = libc++; REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index f5bc9cf39..3e2090355 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -37,7 +37,8 @@ ENABLE_BLOB_macosx = ENABLE_BLOB; ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; -ENABLE_DASHBOARD_SUPPORT = ENABLE_DASHBOARD_SUPPORT; +ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); +ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); ENABLE_DATALIST_macosx = ENABLE_DATALIST; @@ -95,7 +96,7 @@ ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_MHTML = ; -ENABLE_MUTATION_OBSERVERS = ; +ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(REAL_PLATFORM_NAME)); ENABLE_NOTIFICATIONS_macosx = $(ENABLE_NOTIFICATIONS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index 20bc364c1..5344a720d 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 20; +MINOR_VERSION = 23; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/Configurations/WebKit.xcconfig b/Source/WebKit/mac/Configurations/WebKit.xcconfig index 7e0ac2979..0a0cf9f41 100644 --- a/Source/WebKit/mac/Configurations/WebKit.xcconfig +++ b/Source/WebKit/mac/Configurations/WebKit.xcconfig @@ -83,8 +83,8 @@ WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_WEBKIT_FRAME WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; NORMAL_PRODUCTION_FRAMEWORKS_DIR = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); -NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; -NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); +NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos); NORMAL_PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; PRODUCTION_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); diff --git a/Source/WebKit/mac/Misc/WebNSURLExtras.h b/Source/WebKit/mac/Misc/WebNSURLExtras.h index c7b266e93..6b170a7bb 100644 --- a/Source/WebKit/mac/Misc/WebNSURLExtras.h +++ b/Source/WebKit/mac/Misc/WebNSURLExtras.h @@ -69,6 +69,8 @@ - (NSString *)_webkit_suggestedFilenameWithMIMEType:(NSString *)MIMEType; +- (NSURL *)_webkit_URLFromURLOrPath; + @end @interface NSString (WebNSURLExtras) diff --git a/Source/WebKit/mac/Misc/WebNSURLExtras.mm b/Source/WebKit/mac/Misc/WebNSURLExtras.mm index b408bd4a3..c2351dd3d 100644 --- a/Source/WebKit/mac/Misc/WebNSURLExtras.mm +++ b/Source/WebKit/mac/Misc/WebNSURLExtras.mm @@ -883,6 +883,14 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string) return suggestedFilenameWithMIMEType(self, MIMEType); } +- (NSURL *)_webkit_URLFromURLOrPath +{ + if ([self scheme]) + return self; + + return [NSURL fileURLWithPath:[self absoluteString]]; +} + @end @implementation NSString (WebNSURLExtras) diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h index 48ff09bba..66fa060b5 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -189,6 +189,7 @@ public: #endif virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { } + virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { } virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE { return false; } private: WebView *m_webView; diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.h b/Source/WebKit/mac/WebCoreSupport/WebDragClient.h index e472fb7ce..9d96b82c5 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.h @@ -36,7 +36,7 @@ public: virtual void dragControllerDestroyed() OVERRIDE; virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) OVERRIDE; virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag) OVERRIDE; - virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE; + virtual void declareAndWriteDragImage(const String& pasteboardName, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE; private: WebView* m_webView; }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm index 9ba4b05dc..aff7ec2cf 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm @@ -83,7 +83,7 @@ WebCore::DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntP void WebDragClient::willPerformDragSourceAction(WebCore::DragSourceAction action, const WebCore::IntPoint& mouseDownPoint, WebCore::Clipboard* clipboard) { ASSERT(clipboard); - [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:static_cast<WebCore::ClipboardMac*>(clipboard)->pasteboard()]; + [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:[NSPasteboard pasteboardWithName:static_cast<WebCore::ClipboardMac*>(clipboard)->pasteboardName()]]; } void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag) @@ -100,7 +100,7 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const RetainPtr<WebHTMLView> topViewProtector = topHTMLView; [topHTMLView _stopAutoscrollTimer]; - NSPasteboard *pasteboard = static_cast<ClipboardMac*>(clipboard)->pasteboard(); + NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:static_cast<ClipboardMac*>(clipboard)->pasteboardName()]; NSImage *dragNSImage = dragImage.get(); WebHTMLView *sourceHTMLView = htmlView.get(); @@ -120,14 +120,14 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const [topHTMLView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES]; } -void WebDragClient::declareAndWriteDragImage(NSPasteboard* pasteboard, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame* frame) +void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame* frame) { - ASSERT(pasteboard); + ASSERT(pasteboardName); ASSERT(element); WebHTMLView *source = getTopHTMLView(frame); WebArchive *archive = [element webArchive]; - [pasteboard _web_declareAndWriteDragImageForElement:element URL:URL title:title archive:archive source:source]; + [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:element URL:URL title:title archive:archive source:source]; } void WebDragClient::dragControllerDestroyed() diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h index c70d6089d..c75fee09f 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -61,7 +61,7 @@ public: virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction) OVERRIDE; virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) OVERRIDE; - virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*) OVERRIDE; + virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*) OVERRIDE; virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range* rangeToBeReplaced) OVERRIDE; @@ -135,7 +135,7 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE; virtual void willSetInputMethodState() OVERRIDE; virtual void setInputMethodState(bool enabled) OVERRIDE; - virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) OVERRIDE; + virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE; #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) OVERRIDE; virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) OVERRIDE; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index fabdf6c6f..478553034 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -241,10 +241,10 @@ bool WebEditorClient::isSelectTrailingWhitespaceEnabled() return [m_webView isSelectTrailingWhitespaceEnabled]; } -bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range) +bool WebEditorClient::shouldApplyStyle(StylePropertySet* style, Range* range) { return [[m_webView _editingDelegateForwarder] webView:m_webView - shouldApplyStyle:kit(style) toElementsInDOMRange:kit(range)]; + shouldApplyStyle:kit(style->ensureCSSStyleDeclaration()) toElementsInDOMRange:kit(range)]; } bool WebEditorClient::shouldMoveRangeAfterDelete(Range* range, Range* rangeToBeReplaced) @@ -972,15 +972,15 @@ void WebEditorClient::setInputMethodState(bool) @end #endif -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int sequence, WebCore::TextCheckingTypeMask checkingTypes, const String& text) +void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, const WebCore::TextCheckingRequest& request) { #ifndef BUILDING_ON_LEOPARD - NSRange range = NSMakeRange(0, text.length()); + NSRange range = NSMakeRange(0, request.text().length()); NSRunLoop* currentLoop = [NSRunLoop currentRunLoop]; - [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:text range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 + [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:request.text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) { [currentLoop performSelector:@selector(perform) - target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence types:checkingTypes results:results] autorelease] + target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:request.sequence() types:request.mask() results:results] autorelease] argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; }]; #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm index b52b7bc64..541f40ccd 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,7 +37,7 @@ using namespace WebCore; -@interface WebGeolocationPolicyListener : NSObject <WebGeolocationPolicyListener> +@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener> { RefPtr<Geolocation> _geolocation; } diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 14ebd1d65..2ae865951 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -240,7 +240,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const [preferences setMinimumFontSize:0]; [preferences setMinimumLogicalFontSize:9]; [preferences setPlugInsEnabled:NO]; - [preferences setSuppressIncrementalRendering:YES]; + [preferences setSuppressesIncrementalRendering:YES]; [preferences setTabsToLinks:NO]; [preferences setUserStyleSheetEnabled:NO]; diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h index 82903ca59..a40ce81e5 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,11 +25,20 @@ #import <WebCore/NotificationPresenter.h> +#if ENABLE(NOTIFICATIONS) +#import <WebCore/Notification.h> +#import <wtf/HashMap.h> +#import <wtf/RefPtr.h> +#import <wtf/RetainPtr.h> +#endif + namespace WebCore { +class Notification; class ScriptExecutionContext; class VoidCallback; } +@class WebNotification; @class WebView; class WebNotificationClient : public WebCore::NotificationPresenter { @@ -40,11 +49,18 @@ public: private: virtual bool show(WebCore::Notification*) OVERRIDE; virtual void cancel(WebCore::Notification*) OVERRIDE; + virtual void clearNotifications(WebCore::ScriptExecutionContext*) OVERRIDE; virtual void notificationObjectDestroyed(WebCore::Notification*) OVERRIDE; virtual void notificationControllerDestroyed() OVERRIDE; virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) OVERRIDE; - virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) OVERRIDE; + virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) OVERRIDE { } virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::ScriptExecutionContext*) OVERRIDE; WebView *m_webView; +#if ENABLE(NOTIFICATIONS) + HashMap<RefPtr<WebCore::Notification>, RetainPtr<WebNotification> > m_notificationMap; + + typedef HashMap<RefPtr<WebCore::ScriptExecutionContext>, Vector<RetainPtr<WebNotification> > > NotificationContextMap; + NotificationContextMap m_notificationContextMap; +#endif }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm index 80138e313..2f7cd5411 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,49 +25,199 @@ #import "WebNotificationClient.h" -#import <WebCore/NotImplemented.h> -#import <WebCore/Notification.h> +#if ENABLE(NOTIFICATIONS) +#import "WebDelegateImplementationCaching.h" +#import "WebNotificationInternal.h" +#import "WebPreferencesPrivate.h" +#import "WebSecurityOriginInternal.h" +#import "WebUIDelegatePrivate.h" +#import "WebViewInternal.h" +#import <WebCore/BlockExceptions.h> +#import <WebCore/Page.h> +#import <WebCore/ScriptExecutionContext.h> +#endif using namespace WebCore; +#if ENABLE(NOTIFICATIONS) +@interface WebNotificationPolicyListener : NSObject <WebAllowDenyPolicyListener> +{ + RefPtr<VoidCallback> _callback; +} +- (id)initWithCallback:(PassRefPtr<VoidCallback>)callback; +@end +#endif + +#if ENABLE(NOTIFICATIONS) +static uint64_t generateNotificationID() +{ + static uint64_t uniqueNotificationID = 1; + return uniqueNotificationID++; +} +#endif + WebNotificationClient::WebNotificationClient(WebView *webView) : m_webView(webView) { } -bool WebNotificationClient::show(Notification*) +bool WebNotificationClient::show(Notification* notification) { - notImplemented(); +#if ENABLE(NOTIFICATIONS) + if (![m_webView _notificationProvider]) + return false; + + uint64_t notificationID = generateNotificationID(); + RetainPtr<WebNotification> webNotification = adoptNS([[WebNotification alloc] initWithCoreNotification:notification notificationID:notificationID]); + m_notificationMap.set(notification, webNotification); + + NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<RetainPtr<WebNotification> >()).first; + it->second.append(webNotification); + + [[m_webView _notificationProvider] showNotification:webNotification.get() fromWebView:m_webView]; + return true; +#else + UNUSED_PARAM(notification); return false; +#endif +} + +void WebNotificationClient::cancel(Notification* notification) +{ +#if ENABLE(NOTIFICATIONS) + WebNotification *webNotification = m_notificationMap.get(notification).get(); + if (!webNotification) + return; + + [[m_webView _notificationProvider] cancelNotification:webNotification]; +#else + UNUSED_PARAM(notification); +#endif } -void WebNotificationClient::cancel(Notification*) +void WebNotificationClient::clearNotifications(ScriptExecutionContext* context) { - notImplemented(); +#if ENABLE(NOTIFICATIONS) + NotificationContextMap::iterator it = m_notificationContextMap.find(context); + if (it == m_notificationContextMap.end()) + return; + + Vector<RetainPtr<WebNotification> >& webNotifications = it->second; + NSMutableArray *nsIDs = [NSMutableArray array]; + size_t count = webNotifications.size(); + for (size_t i = 0; i < count; ++i) { + WebNotification *webNotification = webNotifications[i].get(); + [nsIDs addObject:[NSNumber numberWithUnsignedLongLong:[webNotification notificationID]]]; + m_notificationMap.remove(core(webNotification)); + } + + [[m_webView _notificationProvider] clearNotifications:nsIDs]; + m_notificationContextMap.remove(it); +#else + UNUSED_PARAM(context); +#endif } -void WebNotificationClient::notificationObjectDestroyed(WebCore::Notification*) +void WebNotificationClient::notificationObjectDestroyed(Notification* notification) { - notImplemented(); +#if ENABLE(NOTIFICATIONS) + RetainPtr<WebNotification> webNotification = m_notificationMap.take(notification); + if (!webNotification) + return; + + NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext()); + ASSERT(it != m_notificationContextMap.end()); + size_t index = it->second.find(webNotification); + ASSERT(index != notFound); + it->second.remove(index); + if (it->second.isEmpty()) + m_notificationContextMap.remove(it); + + [[m_webView _notificationProvider] notificationDestroyed:webNotification.get()]; +#else + UNUSED_PARAM(notification); +#endif } void WebNotificationClient::notificationControllerDestroyed() { +#if ENABLE(NOTIFICATIONS) + [m_webView _notificationControllerDestroyed]; +#endif delete this; } -void WebNotificationClient::requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) +void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) { - notImplemented(); +#if ENABLE(NOTIFICATIONS) + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + SEL selector = @selector(webView:decidePolicyForNotificationRequestFromOrigin:listener:); + if (![[m_webView UIDelegate] respondsToSelector:selector]) + return; + + WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:context->securityOrigin()]; + WebNotificationPolicyListener* listener = [[WebNotificationPolicyListener alloc] initWithCallback:callback]; + + CallUIDelegate(m_webView, selector, webOrigin, listener); + + [webOrigin release]; + [listener release]; + + END_BLOCK_OBJC_EXCEPTIONS; +#else + UNUSED_PARAM(context); + UNUSED_PARAM(callback); +#endif } -void WebNotificationClient::cancelRequestsForPermission(WebCore::ScriptExecutionContext*) +NotificationPresenter::Permission WebNotificationClient::checkPermission(ScriptExecutionContext* context) { - notImplemented(); +#if ENABLE(NOTIFICATIONS) + if (!context || !context->isDocument()) + return NotificationPresenter::PermissionDenied; + if (![[m_webView preferences] notificationsEnabled]) + return NotificationPresenter::PermissionDenied; + WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:context->securityOrigin()]; + WebNotificationPermission permission = [[m_webView _notificationProvider] policyForOrigin:webOrigin]; + [webOrigin release]; + switch (permission) { + case WebNotificationPermissionAllowed: + return NotificationPresenter::PermissionAllowed; + case WebNotificationPermissionDenied: + return NotificationPresenter::PermissionDenied; + case WebNotificationPermissionNotAllowed: + return NotificationPresenter::PermissionNotAllowed; + default: + return NotificationPresenter::PermissionNotAllowed; + } +#else + UNUSED_PARAM(context); + return NotificationPresenter::PermissionDenied; +#endif } -NotificationPresenter::Permission WebNotificationClient::checkPermission(WebCore::ScriptExecutionContext*) +#if ENABLE(NOTIFICATIONS) +@implementation WebNotificationPolicyListener +- (id)initWithCallback:(PassRefPtr<VoidCallback>)callback { - notImplemented(); - return NotificationPresenter::PermissionDenied; + if (!(self = [super init])) + return nil; + + ASSERT(callback); + _callback = callback; + return self; } + +- (void)allow +{ + _callback->handleEvent(); +} + +- (void)deny +{ + _callback->handleEvent(); +} + +@end +#endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index f1bd1a32c..4fde2b3b0 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -27,11 +27,12 @@ #define WebPlatformStrategies_h #include <WebCore/CookiesStrategy.h> +#include <WebCore/PasteboardStrategy.h> #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> #include <WebCore/VisitedLinkStrategy.h> -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy, private WebCore::PasteboardStrategy { public: static void initialize(); @@ -42,6 +43,7 @@ private: virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE; virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE; virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE; + virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE; // WebCore::CookiesStrategy virtual void notifyCookiesChanged() OVERRIDE; @@ -53,6 +55,22 @@ private: // WebCore::VisitedLinkStrategy virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE; virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash) OVERRIDE; + + // WebCore::PasteboardStrategy + virtual void getTypes(Vector<String>& types, const String& pasteboardName) OVERRIDE; + virtual PassRefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE; + virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) OVERRIDE; + virtual String stringForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE; + virtual int changeCount(const String& pasteboardName) OVERRIDE; + virtual String uniqueName() OVERRIDE; + virtual WebCore::Color color(const String& pasteboardName) OVERRIDE; + + virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE; + virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE; + virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) OVERRIDE; + virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE; + virtual void setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) OVERRIDE; + }; #endif // WebPlatformStrategies_h diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index d1a4d9560..fc3035048 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -28,8 +28,10 @@ #import "WebPluginDatabase.h" #import "WebPluginPackage.h" #import <WebCore/BlockExceptions.h> +#import <WebCore/Color.h> #import <WebCore/Page.h> #import <WebCore/PageGroup.h> +#import <WebCore/PlatformPasteboard.h> using namespace WebCore; @@ -58,6 +60,11 @@ VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() return this; } +PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy() +{ + return this; +} + void WebPlatformStrategies::notifyCookiesChanged() { } @@ -90,3 +97,63 @@ void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash) { return page->group().addVisitedLinkHash(hash); } + +void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).getTypes(types); +} + +PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName) +{ + return PlatformPasteboard(pasteboardName).bufferForType(pasteboardType); +} + +void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).getPathnamesForType(pathnames, pasteboardType); +} + +String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName) +{ + return PlatformPasteboard(pasteboardName).stringForType(pasteboardType); +} + +void WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard) +{ + PlatformPasteboard(toPasteboard).copy(fromPasteboard); +} + +int WebPlatformStrategies::changeCount(const String &pasteboardName) +{ + return PlatformPasteboard(pasteboardName).changeCount(); +} + +String WebPlatformStrategies::uniqueName() +{ + return PlatformPasteboard::uniqueName(); +} + +Color WebPlatformStrategies::color(const String& pasteboardName) +{ + return PlatformPasteboard(pasteboardName).color(); +} + +void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes); +} + +void WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType); +} + +void WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType); +} + +void WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName) +{ + PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType); +} diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm index 2373f8464..8f38fed43 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -66,6 +66,11 @@ using namespace WebCore; return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier(); } +- (NSString *)stringValue +{ + return reinterpret_cast<SecurityOrigin*>(_private)->toString(); +} + // Deprecated. Use host instead. This needs to stay here until we ship a new Safari. - (NSString *)domain { diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h index a784aba67..fae4c3382 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h +++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010, 2012 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 @@ - (NSString *)host; - (NSString *)databaseIdentifier; +- (NSString *)stringValue; // Returns zero if the port is the default port for the protocol, non-zero otherwise. - (unsigned short)port; diff --git a/Source/WebKit/mac/WebKit.order b/Source/WebKit/mac/WebKit.order index 51b31e4a9..acd1a3755 100644 --- a/Source/WebKit/mac/WebKit.order +++ b/Source/WebKit/mac/WebKit.order @@ -2308,7 +2308,6 @@ __ZN3WTF6VectorINS_6RefPtrIN7WebCore14SecurityOriginEEELm0EED1Ev -[WebStorageManager syncLocalStorage] -[WebStorageManager deleteOrigin:] -[WebStorageManager diskUsageForOrigin:] --[WebFrame(WebPrivate) _pauseSVGAnimation:onSMILNode:atTime:] __ZN3WTF6RefPtrIN7WebCore7ArchiveEED1Ev __ZN3WTF10RefCountedIN7WebCore7ArchiveEE5derefEv -[WebDataSource webArchive] diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index 9c15fafef..24bb8f39c 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -87,8 +87,6 @@ #import <WebCore/ScriptValue.h> #import <WebCore/SecurityOrigin.h> #import <WebCore/SmartReplace.h> -#import <WebCore/SVGDocumentExtensions.h> -#import <WebCore/SVGSMILElement.h> #import <WebCore/TextIterator.h> #import <WebCore/ThreadCheck.h> #import <WebCore/TypingCommand.h> @@ -801,7 +799,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return; - _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction); + // FIXME: We shouldn't have to create a copy here. + _private->coreFrame->editor()->computeAndSetTypingStyle(core(style)->copy().get(), undoAction); } - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation @@ -992,29 +991,6 @@ 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 -{ -#if ENABLE(SVG) - 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; - - return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time); -#else - return false; -#endif -} - - (unsigned) _numberOfActiveAnimations { Frame* frame = core(self); @@ -1484,7 +1460,7 @@ static NSURL *createUniqueWebDataURL() if (!MIMEType) MIMEType = @"text/html"; - [self _loadData:data MIMEType:MIMEType textEncodingName:encodingName baseURL:baseURL unreachableURL:nil]; + [self _loadData:data MIMEType:MIMEType textEncodingName:encodingName baseURL:[baseURL _webkit_URLFromURLOrPath] unreachableURL:nil]; } - (void)_loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL unreachableURL:(NSURL *)unreachableURL diff --git a/Source/WebKit/mac/WebView/WebFramePrivate.h b/Source/WebKit/mac/WebView/WebFramePrivate.h index 98dbb706e..899ceeddf 100644 --- a/Source/WebKit/mac/WebView/WebFramePrivate.h +++ b/Source/WebKit/mac/WebView/WebFramePrivate.h @@ -104,10 +104,6 @@ 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/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index 66f7b3aaf..7052fca0b 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -4352,14 +4352,10 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame) - (void)_applyStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction { - if (Frame* coreFrame = core([self _frame])) - coreFrame->editor()->applyStyleToSelection(core(style), undoAction); -} - -- (void)_applyParagraphStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction -{ - if (Frame* coreFrame = core([self _frame])) - coreFrame->editor()->applyParagraphStyleToSelection(core(style), undoAction); + if (Frame* coreFrame = core([self _frame])) { + // FIXME: We shouldn't have to make a copy here. We want callers of this function to work directly with StylePropertySet eventually. + coreFrame->editor()->applyStyleToSelection(core(style)->copy().get(), undoAction); + } } - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event @@ -4657,9 +4653,13 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame) { DOMCSSStyleDeclaration *style = [self _styleFromColorPanelWithSelector:selector]; WebView *webView = [self _webView]; - if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:range]) - if (Frame* coreFrame = core([self _frame])) - coreFrame->editor()->applyStyle(core(style), [self _undoActionFromColorPanelWithSelector:selector]); + if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:range]) { + if (Frame* coreFrame = core([self _frame])) { + // FIXME: We shouldn't have to make a copy here. + coreFrame->editor()->applyStyle(core(style)->copy().get(), [self _undoActionFromColorPanelWithSelector:selector]); + } + } + } - (void)changeDocumentBackgroundColor:(id)sender diff --git a/Source/WebKit/mac/WebView/WebNotification.h b/Source/WebKit/mac/WebView/WebNotification.h new file mode 100644 index 000000000..c04b2ad07 --- /dev/null +++ b/Source/WebKit/mac/WebView/WebNotification.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +@class WebNotificationPrivate; +@class WebSecurityOrigin; + +@interface WebNotification : NSObject +{ + WebNotificationPrivate *_private; +} + +- (NSString *)title; +- (NSString *)body; +- (WebSecurityOrigin *)origin; +- (uint64_t)notificationID; + +- (void)dispatchShowEvent; +- (void)dispatchCloseEvent; +- (void)dispatchClickEvent; +- (void)dispatchErrorEvent; + +@end diff --git a/Source/WebKit/mac/WebView/WebNotification.mm b/Source/WebKit/mac/WebView/WebNotification.mm new file mode 100644 index 000000000..bbd0248f6 --- /dev/null +++ b/Source/WebKit/mac/WebView/WebNotification.mm @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2012 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebNotification.h" + +#import "WebNotificationInternal.h" + +#if ENABLE(NOTIFICATIONS) +#import "WebSecurityOriginInternal.h" +#import <WebCore/Notification.h> +#import <WebCore/ScriptExecutionContext.h> +#import <wtf/RefPtr.h> + +using namespace WebCore; +#endif + +OBJC_CLASS WebNotificationInternal; + +@interface WebNotificationPrivate : NSObject +{ +@public +#if ENABLE(NOTIFICATIONS) + RefPtr<Notification> _internal; + uint64_t _notificationID; +#endif +} +@end + +@implementation WebNotificationPrivate +@end + +#if ENABLE(NOTIFICATIONS) +@implementation WebNotification (WebNotificationInternal) +Notification* core(WebNotification *notification) +{ + if (!notification->_private) + return 0; + return notification->_private->_internal.get(); +} + +- (id)initWithCoreNotification:(Notification*)coreNotification notificationID:(uint64_t)notificationID +{ + if (!(self = [super init])) + return nil; + _private = [[WebNotificationPrivate alloc] init]; + _private->_internal = coreNotification; + _private->_notificationID = notificationID; + return self; +} +@end +#endif + +@implementation WebNotification +- (id)init +{ + return nil; +} + +- (NSString *)title +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + return core(self)->contents().title; +#else + return nil; +#endif +} + +- (NSString *)body +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + return core(self)->contents().body; +#else + return nil; +#endif +} + +- (WebSecurityOrigin *)origin +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + return [[[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:core(self)->scriptExecutionContext()->securityOrigin()] autorelease]; +#else + return nil; +#endif +} + +- (uint64_t)notificationID +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + return _private->_notificationID; +#else + return 0; +#endif +} + +- (void)dispatchShowEvent +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + core(self)->dispatchShowEvent(); +#endif +} + +- (void)dispatchCloseEvent +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + core(self)->dispatchCloseEvent(); +#endif +} + +- (void)dispatchClickEvent +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + core(self)->dispatchClickEvent(); +#endif +} + +- (void)dispatchErrorEvent +{ +#if ENABLE(NOTIFICATIONS) + ASSERT(core(self)); + core(self)->dispatchErrorEvent(); +#endif +} + +@end + diff --git a/Source/WebKit/mac/WebView/WebNotificationInternal.h b/Source/WebKit/mac/WebView/WebNotificationInternal.h new file mode 100644 index 000000000..b624069d9 --- /dev/null +++ b/Source/WebKit/mac/WebView/WebNotificationInternal.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebNotification.h" + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { +class Notification; +} + +WebCore::Notification* core(WebNotification *); + +@interface WebNotification (WebNotificationInternal) +- (id)initWithCoreNotification:(WebCore::Notification*)coreNotification notificationID:(uint64_t)notificationID; +@end + +#endif diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 20e42ab3d..261a30e56 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2012 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -95,6 +95,7 @@ #define WebKitCanvasUsesAcceleratedDrawingPreferenceKey @"WebKitCanvasUsesAcceleratedDrawing" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" #define WebKitCSSCustomFilterEnabledPreferenceKey @"WebKitCSSCustomFilterEnabled" +#define WebKitCSSRegionsEnabledPreferenceKey @"WebKitCSSRegionsEnabled" #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" #define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter" #define WebKitWebAudioEnabledPreferenceKey @"WebKitWebAudioEnabled" @@ -116,6 +117,8 @@ #define WebKitShouldDisplaySubtitlesPreferenceKey @"WebKitShouldDisplaySubtitles" #define WebKitShouldDisplayCaptionsPreferenceKey @"WebKitShouldDisplayCaptions" #define WebKitShouldDisplayTextDescriptionsPreferenceKey @"WebKitShouldDisplayTextDescriptions" +#define WebKitNotificationsEnabledKey @"WebKitNotificationsEnabled" +#define WebKitSuppressesIncrementalRenderingKey @"WebKitSuppressesIncrementalRendering" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. @@ -130,7 +133,6 @@ #define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey" #define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior" #define WebKitUsePreHTML5ParserQuirksKey @"WebKitUsePreHTML5ParserQuirks" -#define WebKitSuppressIncrementalRenderingKey @"WebKitSuppressIncrementalRendering" #define WebKitBackspaceKeyNavigationEnabledKey @"WebKitBackspaceKeyNavigationEnabled" // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set diff --git a/Source/WebKit/mac/WebView/WebPreferences.h b/Source/WebKit/mac/WebView/WebPreferences.h index 80cc9355a..6e01709f0 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.h +++ b/Source/WebKit/mac/WebView/WebPreferences.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2012 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -431,4 +431,17 @@ caching behavior. */ - (WebCacheModel)cacheModel; +/*! + @method setSuppressesIncrementalRendering: + @param suppressesIncrementalRendering YES to suppress incremental rendering; + NO otherwise. +*/ +- (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering; + +/*! + @method suppressesIncrementalRendering + @result YES if the WebView suppresses incremental rendering; NO otherwise. +*/ +- (BOOL)suppressesIncrementalRendering; + @end diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index f49df5473..ed23910a9 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights reserved. * (C) 2006 Graham Dennis (graham.dennis@gmail.com) * * Redistribution and use in source and binary forms, with or without @@ -369,6 +369,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, // CSS Shaders also need WebGL enabled (which is disabled by default), so we can keep it enabled for now. [NSNumber numberWithBool:YES], WebKitCSSCustomFilterEnabledPreferenceKey, + [NSNumber numberWithBool:YES], WebKitCSSRegionsEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, @@ -384,15 +385,16 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitHyperlinkAuditingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey, [NSNumber numberWithBool:YES], WebKitAVFoundationEnabledKey, - [NSNumber numberWithBool:YES], WebKitHixie76WebSocketProtocolEnabledKey, + [NSNumber numberWithBool:NO], WebKitHixie76WebSocketProtocolEnabledKey, [NSNumber numberWithBool:NO], WebKitMediaPlaybackRequiresUserGesturePreferenceKey, [NSNumber numberWithBool:YES], WebKitMediaPlaybackAllowsInlinePreferenceKey, [NSNumber numberWithBool:NO], WebKitWebAudioEnabledPreferenceKey, - [NSNumber numberWithBool:NO], WebKitSuppressIncrementalRenderingKey, + [NSNumber numberWithBool:NO], WebKitSuppressesIncrementalRenderingKey, [NSNumber numberWithBool:YES], WebKitBackspaceKeyNavigationEnabledKey, [NSNumber numberWithBool:NO], WebKitShouldDisplaySubtitlesPreferenceKey, [NSNumber numberWithBool:NO], WebKitShouldDisplayCaptionsPreferenceKey, [NSNumber numberWithBool:NO], WebKitShouldDisplayTextDescriptionsPreferenceKey, + [NSNumber numberWithBool:YES], WebKitNotificationsEnabledKey, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -806,6 +808,17 @@ static WebCacheModel cacheModelForMainBundle(void) return [self _integerValueForKey:WebKitCacheModelPreferenceKey]; } + +- (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering +{ + [self _setBoolValue:suppressesIncrementalRendering forKey:WebKitSuppressesIncrementalRenderingKey]; +} + +- (BOOL)suppressesIncrementalRendering +{ + return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey]; +} + @end @implementation WebPreferences (WebPrivate) @@ -1335,6 +1348,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitCSSCustomFilterEnabledPreferenceKey]; } +- (BOOL)cssRegionsEnabled +{ + return [self _boolValueForKey:WebKitCSSRegionsEnabledPreferenceKey]; +} + +- (void)setCSSRegionsEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitCSSRegionsEnabledPreferenceKey]; +} + - (BOOL)showDebugBorders { return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey]; @@ -1583,12 +1606,12 @@ static NSString *classIBCreatorID = nil; - (void)setSuppressIncrementalRendering:(BOOL)flag { - [self _setBoolValue:flag forKey:WebKitSuppressIncrementalRenderingKey]; + [self _setBoolValue:flag forKey:WebKitSuppressesIncrementalRenderingKey]; } - (BOOL)suppressIncrementalRendering { - return [self _boolValueForKey:WebKitSuppressIncrementalRenderingKey]; + return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey]; } - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag @@ -1631,6 +1654,16 @@ static NSString *classIBCreatorID = nil; return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey]; } +- (void)setNotificationsEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitNotificationsEnabledKey]; +} + +- (BOOL)notificationsEnabled +{ + return [self _boolValueForKey:WebKitNotificationsEnabledKey]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 305434ffb..29a8be125 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -189,6 +189,9 @@ extern NSString *WebPreferencesChangedInternalNotification; - (BOOL)cssCustomFilterEnabled; - (void)setCSSCustomFilterEnabled:(BOOL)enabled; +- (BOOL)cssRegionsEnabled; +- (void)setCSSRegionsEnabled:(BOOL)enabled; + - (BOOL)showDebugBorders; - (void)setShowDebugBorders:(BOOL)show; @@ -271,6 +274,7 @@ extern NSString *WebPreferencesChangedInternalNotification; - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag; - (BOOL)isHixie76WebSocketProtocolEnabled; +// Deprecated. You should use [setS|s]uppressesIncrementalRendering in WebPreferences.h instead. - (void)setSuppressIncrementalRendering:(BOOL)flag; - (BOOL)suppressIncrementalRendering; @@ -286,4 +290,7 @@ extern NSString *WebPreferencesChangedInternalNotification; - (void)setShouldDisplayTextDescriptions:(BOOL)flag; - (BOOL)shouldDisplayTextDescriptions; +- (void)setNotificationsEnabled:(BOOL)flag; +- (BOOL)notificationsEnabled; + @end diff --git a/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h b/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h index 9c98fdfcc..9f1801961 100644 --- a/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -117,9 +117,11 @@ extern NSString *WebConsoleMessageWarningMessageLevel; extern NSString *WebConsoleMessageErrorMessageLevel; extern NSString *WebConsoleMessageDebugMessageLevel; +@class DOMElement; +@class DOMNode; @class WebSecurityOrigin; -@protocol WebGeolocationPolicyListener <NSObject> +@protocol WebAllowDenyPolicyListener <NSObject> - (void)allow; - (void)deny; @end @@ -223,7 +225,8 @@ extern NSString *WebConsoleMessageDebugMessageLevel; */ - (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame - listener:(id<WebGeolocationPolicyListener>)listener; + listener:(id<WebAllowDenyPolicyListener>)listener; +- (void)webView:(WebView *)webView decidePolicyForNotificationRequestFromOrigin:(WebSecurityOrigin *)origin listener:(id<WebAllowDenyPolicyListener>)listener; - (void)webView:(WebView *)sender elementDidFocusNode:(DOMNode *)node; - (void)webView:(WebView *)sender elementDidBlurNode:(DOMNode *)node; diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 4525cba9f..9b722026e 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2005-2012 Apple Inc. All rights reserved. * Copyright (C) 2006 David Smith (catfish.man@gmail.com) * Copyright (C) 2010 Igalia S.L * @@ -742,13 +742,13 @@ static NSString *leakOutlookQuirksUserScriptContents() #if ENABLE(CLIENT_BASED_GEOLOCATION) pageClients.geolocationClient = new WebGeolocationClient(self); #endif + _private->page = new Page(pageClients); #if ENABLE(NOTIFICATIONS) - pageClients.notificationClient = new WebNotificationClient(self); + WebCore::provideNotification(_private->page, new WebNotificationClient(self)); #endif #if ENABLE(DEVICE_ORIENTATION) - pageClients.deviceOrientationClient = new WebDeviceOrientationClient(self); + WebCore::provideDeviceOrientationTo(_private->page, new WebDeviceOrientationClient(self)); #endif - _private->page = new Page(pageClients); _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); @@ -1322,6 +1322,13 @@ static bool fastDocumentTeardownEnabled() return needsQuirk; } +- (BOOL)_needsIsLoadingInAPISenseQuirk +{ + static BOOL needsQuirk = WKAppVersionCheckLessThan(@"com.apple.iAdProducer", -1, 2.1); + + return needsQuirk; +} + - (BOOL)_needsKeyboardEventDisambiguationQuirks { static BOOL needsQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_IE_COMPATIBLE_KEYBOARD_EVENT_DISPATCH) && !applicationIsSafari(); @@ -1474,6 +1481,7 @@ static bool needsSelfRetainWhileLoadingQuirk() #if ENABLE(CSS_SHADERS) settings->setCSSCustomFilterEnabled([preferences cssCustomFilterEnabled]); #endif + settings->setCSSRegionsEnabled([preferences cssRegionsEnabled]); #if ENABLE(FULLSCREEN_API) settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif @@ -1499,7 +1507,7 @@ static bool needsSelfRetainWhileLoadingQuirk() #endif settings->setMediaPlaybackRequiresUserGesture([preferences mediaPlaybackRequiresUserGesture]); settings->setMediaPlaybackAllowsInline([preferences mediaPlaybackAllowsInline]); - settings->setSuppressIncrementalRendering([preferences suppressIncrementalRendering]); + settings->setSuppressesIncrementalRendering([preferences suppressesIncrementalRendering]); settings->setBackspaceKeyNavigationEnabled([preferences backspaceKeyNavigationEnabled]); settings->setMockScrollbarsEnabled([preferences mockScrollbarsEnabled]); @@ -1509,6 +1517,8 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setShouldDisplayTextDescriptions([preferences shouldDisplayTextDescriptions]); #endif + settings->setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]); + // Application Cache Preferences are stored on the global cache storage manager, not in Settings. [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]]; @@ -5516,8 +5526,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu // change the API to allow this. WebFrame *webFrame = [self _selectedOrMainFrame]; Frame* coreFrame = core(webFrame); + // FIXME: We shouldn't have to make a copy here. if (coreFrame) - coreFrame->editor()->applyStyle(core(style)); + coreFrame->editor()->applyStyle(core(style)->copy().get()); } @end @@ -6401,6 +6412,43 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity @end +@implementation WebView (WebViewNotification) +- (void)_setNotificationProvider:(id<WebNotificationProvider>)notificationProvider +{ + if (_private) { + _private->_notificationProvider = notificationProvider; + [_private->_notificationProvider registerWebView:self]; + } +} + +- (void)_notificationControllerDestroyed +{ + [[self _notificationProvider] unregisterWebView:self]; +} + +- (id<WebNotificationProvider>)_notificationProvider +{ + if (_private) + return _private->_notificationProvider; + return nil; +} + +- (void)_notificationDidShow:(uint64_t)notificationID +{ + [[self _notificationProvider] webView:self didShowNotification:notificationID]; +} + +- (void)_notificationDidClick:(uint64_t)notificationID +{ + [[self _notificationProvider] webView:self didClickNotification:notificationID]; +} + +- (void)_notificationsDidClose:(NSArray *)notificationIDs +{ + [[self _notificationProvider] webView:self didCloseNotifications:notificationIDs]; +} +@end + @implementation WebView (WebViewPrivateStyleInfo) - (JSValueRef)_computedStyleIncludingVisitedInfo:(JSContextRef)context forElement:(JSValueRef)value @@ -6414,7 +6462,7 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity return JSValueMakeUndefined(context); JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue)); Element* element = jsElement->impl(); - RefPtr<CSSComputedStyleDeclaration> style = computedStyle(element, true); + RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(element, true); return toRef(exec, toJS(exec, jsElement->globalObject(), style.get())); } diff --git a/Source/WebKit/mac/WebView/WebViewData.h b/Source/WebKit/mac/WebView/WebViewData.h index 665cb9175..ea2bfcf60 100644 --- a/Source/WebKit/mac/WebView/WebViewData.h +++ b/Source/WebKit/mac/WebView/WebViewData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without @@ -50,6 +50,7 @@ namespace WebCore { @protocol WebFormDelegate; @protocol WebDeviceOrientationProvider; @protocol WebGeolocationProvider; +@protocol WebNotificationProvider; #if ENABLE(VIDEO) @class WebVideoFullscreenController; #endif @@ -191,6 +192,7 @@ private: #endif id<WebGeolocationProvider> _geolocationProvider; id<WebDeviceOrientationProvider> m_deviceOrientationProvider; + id<WebNotificationProvider> _notificationProvider; RefPtr<WebCore::HistoryItem> _globalHistoryItem; diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index cd92f31e5..e0fee81d1 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2005-2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,8 +39,10 @@ @class WebDeviceOrientation; @class WebGeolocationPosition; @class WebInspector; +@class WebNotification; @class WebPreferences; @class WebScriptWorld; +@class WebSecurityOrigin; @class WebTextIterator; @protocol WebDeviceOrientationProvider; @@ -104,6 +106,13 @@ typedef enum { WebPaginationModeVertical, } WebPaginationMode; +// This needs to be in sync with WebCore::NotificationPresenter::Permission +typedef enum { + WebNotificationPermissionAllowed, + WebNotificationPermissionNotAllowed, + WebNotificationPermissionDenied +} WebNotificationPermission; + @interface WebController : NSTreeController { IBOutlet WebView *webView; } @@ -701,6 +710,21 @@ Could be worth adding to the API. - (WebGeolocationPosition *)lastPosition; @end +@protocol WebNotificationProvider +- (void)registerWebView:(WebView *)webView; +- (void)unregisterWebView:(WebView *)webView; + +- (void)showNotification:(WebNotification *)notification fromWebView:(WebView *)webView; +- (void)cancelNotification:(WebNotification *)notification; +- (void)notificationDestroyed:(WebNotification *)notification; +- (void)clearNotifications:(NSArray *)notificationIDs; +- (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin; + +- (void)webView:(WebView *)webView didShowNotification:(uint64_t)notificationID; +- (void)webView:(WebView *)webView didClickNotification:(uint64_t)notificationID; +- (void)webView:(WebView *)webView didCloseNotifications:(NSArray *)notificationIDs; +@end + @interface WebView (WebViewGeolocation) - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider; - (id<WebGeolocationProvider>)_geolocationProvider; @@ -709,6 +733,16 @@ Could be worth adding to the API. - (void)_geolocationDidFailWithError:(NSError *)error; @end +@interface WebView (WebViewNotification) +- (void)_setNotificationProvider:(id<WebNotificationProvider>)notificationProvider; +- (id<WebNotificationProvider>)_notificationProvider; +- (void)_notificationControllerDestroyed; + +- (void)_notificationDidShow:(uint64_t)notificationID; +- (void)_notificationDidClick:(uint64_t)notificationID; +- (void)_notificationsDidClose:(NSArray *)notificationIDs; +@end + @interface WebView (WebViewPrivateStyleInfo) - (JSValueRef)_computedStyleIncludingVisitedInfo:(JSContextRef)context forElement:(JSValueRef)value; @end |