summaryrefslogtreecommitdiff
path: root/Source/WebKit/mac/WebView
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
commitad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch)
treeb34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebKit/mac/WebView
parent03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff)
downloadqtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebKit/mac/WebView')
-rw-r--r--Source/WebKit/mac/WebView/WebFrame.mm30
-rw-r--r--Source/WebKit/mac/WebView/WebFramePrivate.h4
-rw-r--r--Source/WebKit/mac/WebView/WebHTMLView.mm22
-rw-r--r--Source/WebKit/mac/WebView/WebNotification.h47
-rw-r--r--Source/WebKit/mac/WebView/WebNotification.mm157
-rw-r--r--Source/WebKit/mac/WebView/WebNotificationInternal.h43
-rw-r--r--Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h6
-rw-r--r--Source/WebKit/mac/WebView/WebPreferences.h15
-rw-r--r--Source/WebKit/mac/WebView/WebPreferences.mm43
-rw-r--r--Source/WebKit/mac/WebView/WebPreferencesPrivate.h7
-rw-r--r--Source/WebKit/mac/WebView/WebUIDelegatePrivate.h9
-rw-r--r--Source/WebKit/mac/WebView/WebView.mm62
-rw-r--r--Source/WebKit/mac/WebView/WebViewData.h4
-rw-r--r--Source/WebKit/mac/WebView/WebViewPrivate.h36
14 files changed, 423 insertions, 62 deletions
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