summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-02 14:57:50 +0000
committerSteve Block <steveblock@google.com>2010-02-04 15:06:55 +0000
commitd0825bca7fe65beaee391d30da42e937db621564 (patch)
tree7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebKit/mac/WebView
parent3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff)
downloadexternal_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r--WebKit/mac/WebView/WebDataSource.mm4
-rw-r--r--WebKit/mac/WebView/WebFrame.mm12
-rw-r--r--WebKit/mac/WebView/WebFrameView.mm9
-rw-r--r--WebKit/mac/WebView/WebGeolocationPosition.h35
-rw-r--r--WebKit/mac/WebView/WebGeolocationPosition.mm86
-rw-r--r--WebKit/mac/WebView/WebGeolocationPositionInternal.h36
-rw-r--r--WebKit/mac/WebView/WebHTMLRepresentation.h13
-rw-r--r--WebKit/mac/WebView/WebHTMLRepresentation.mm23
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm29
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm15
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h3
-rw-r--r--WebKit/mac/WebView/WebScriptDebugger.h2
-rw-r--r--WebKit/mac/WebView/WebScriptDebugger.mm2
-rw-r--r--WebKit/mac/WebView/WebScriptWorld.h5
-rw-r--r--WebKit/mac/WebView/WebScriptWorld.mm7
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenController.mm1
-rw-r--r--WebKit/mac/WebView/WebView.mm70
-rw-r--r--WebKit/mac/WebView/WebViewData.h3
-rw-r--r--WebKit/mac/WebView/WebViewData.mm4
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h18
21 files changed, 363 insertions, 15 deletions
diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm
index ecd89f7..8a3842e 100644
--- a/WebKit/mac/WebView/WebDataSource.mm
+++ b/WebKit/mac/WebView/WebDataSource.mm
@@ -194,6 +194,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (BOOL)_transferApplicationCache:(NSString*)destinationBundleIdentifier
{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
DocumentLoader* loader = [self _documentLoader];
if (!loader)
@@ -202,6 +203,9 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
NSString *cacheDir = [NSString _webkit_localCacheDirectoryWithBundleIdentifier:destinationBundleIdentifier];
return ApplicationCacheStorage::storeCopyOfCache(cacheDir, loader->applicationCacheHost());
+#else
+ return NO;
+#endif
}
@end
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 58400d6..41d7e01 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -56,6 +56,7 @@
#import <WebCore/AccessibilityObject.h>
#import <WebCore/AnimationController.h>
#import <WebCore/CSSMutableStyleDeclaration.h>
+#import <WebCore/Chrome.h>
#import <WebCore/ColorMac.h>
#import <WebCore/DOMImplementation.h>
#import <WebCore/DocLoader.h>
@@ -847,7 +848,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
if (!_private->coreFrame || !_private->coreFrame->document())
return nil;
- return kit(createFragmentFromMarkup(_private->coreFrame->document(), markupString, baseURLString).get());
+ return kit(createFragmentFromMarkup(_private->coreFrame->document(), markupString, baseURLString, FragmentScriptingNotAllowed).get());
}
- (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes
@@ -1190,13 +1191,17 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
if (domWindow->hasEventListeners(eventNames().unloadEvent))
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasUnloadListener];
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (domWindow->optionalApplicationCache())
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesApplicationCache];
+#endif
}
if (Document* document = _private->coreFrame->document()) {
+#if ENABLE(DATABASE)
if (document->hasOpenDatabases())
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases];
+#endif
if (document->usingGeolocation())
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesGeolocation];
@@ -1355,7 +1360,10 @@ static bool needsMicrosoftMessengerDOMDocumentWorkaround()
- (void)loadRequest:(NSURLRequest *)request
{
- _private->coreFrame->loader()->load(request, false);
+ Frame* coreFrame = _private->coreFrame;
+ if (!coreFrame)
+ return;
+ coreFrame->loader()->load(request, false);
}
static NSURL *createUniqueWebDataURL()
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index 4638418..565e64d 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -55,6 +55,7 @@
#import "WebViewInternal.h"
#import "WebViewPrivate.h"
#import <Foundation/NSURLRequest.h>
+#import <WebCore/BackForwardList.h>
#import <WebCore/DragController.h>
#import <WebCore/EventHandler.h>
#import <WebCore/Frame.h>
@@ -199,9 +200,8 @@ enum {
- (float)_verticalPageScrollDistance
{
- float overlap = [self _verticalKeyboardScrollDistance];
float height = [[self _contentView] bounds].size.height;
- return (height < overlap) ? height / 2 : height - overlap;
+ return max(height * cFractionToStepWhenPaging, 1.f);
}
static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes)
@@ -342,7 +342,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
[scrollView setHasVerticalScroller:NO];
[scrollView setHasHorizontalScroller:NO];
[scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [scrollView setLineScroll:40.0f];
+ [scrollView setLineScroll:cScrollbarPixelsPerLineStep];
[self addSubview:scrollView];
// Don't call our overridden version of setNextKeyView here; we need to make the standard NSView
@@ -612,9 +612,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (float)_horizontalPageScrollDistance
{
- float overlap = [self _horizontalKeyboardScrollDistance];
float width = [[self _contentView] bounds].size.width;
- return (width < overlap) ? width / 2 : width - overlap;
+ return max(width * cFractionToStepWhenPaging, 1.f);
}
- (BOOL)_pageVertically:(BOOL)up
diff --git a/WebKit/mac/WebView/WebGeolocationPosition.h b/WebKit/mac/WebView/WebGeolocationPosition.h
new file mode 100644
index 0000000..99348b4
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPosition.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@class WebGeolocationPositionInternal;
+
+@interface WebGeolocationPosition : NSObject
+{
+ WebGeolocationPositionInternal *_internal;
+}
+
+- (id)initWithTimestamp:(double)timestamp latitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy;
+
+@end
diff --git a/WebKit/mac/WebView/WebGeolocationPosition.mm b/WebKit/mac/WebView/WebGeolocationPosition.mm
new file mode 100644
index 0000000..46f62c1
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPosition.mm
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebGeolocationPosition.h"
+
+#import "WebGeolocationPositionInternal.h"
+#import <wtf/PassRefPtr.h>
+#import <wtf/RefPtr.h>
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#import <WebCore/GeolocationPosition.h>
+
+using namespace WebCore;
+#endif
+
+@interface WebGeolocationPositionInternal : NSObject
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+{
+@public
+ RefPtr<GeolocationPosition> _position;
+}
+
+- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition;
+#endif
+@end
+
+@implementation WebGeolocationPositionInternal
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ _position = coreGeolocationPosition;
+ return self;
+}
+#endif
+
+@end
+
+@implementation WebGeolocationPosition
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+GeolocationPosition* core(WebGeolocationPosition *position)
+{
+ return position ? position->_internal->_position.get() : 0;
+}
+#endif
+
+- (id)initWithTimestamp:(double)timestamp latitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy
+{
+ self = [super init];
+ if (!self)
+ return nil;
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ _internal = [[WebGeolocationPositionInternal alloc] initWithCoreGeolocationPosition:GeolocationPosition::create(timestamp, latitude, longitude, accuracy)];
+#else
+ _internal = [[WebGeolocationPositionInternal alloc] init];
+#endif
+ return self;
+}
+
+@end
diff --git a/WebKit/mac/WebView/WebGeolocationPositionInternal.h b/WebKit/mac/WebView/WebGeolocationPositionInternal.h
new file mode 100644
index 0000000..27f8a39
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPositionInternal.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebGeolocationPosition.h"
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+namespace WebCore {
+ class GeolocationPosition;
+}
+
+WebCore::GeolocationPosition* core(WebGeolocationPosition *);
+
+#endif
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.h b/WebKit/mac/WebView/WebHTMLRepresentation.h
index 2098c47..68f9bde 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.h
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.h
@@ -30,6 +30,12 @@
#import <WebKit/WebDocumentPrivate.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
+#define WebNSUInteger unsigned int
+#else
+#define WebNSUInteger NSUInteger
+#endif
+
@class WebHTMLRepresentationPrivate;
@class NSView;
@@ -60,7 +66,12 @@
- (DOMElement *)formForElement:(DOMElement *)element;
- (DOMElement *)currentForm;
- (NSArray *)controlsInForm:(DOMElement *)form;
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element resultDistance:(WebNSUInteger*)outDistance resultIsInCellAbove:(BOOL*)outIsInCellAbove;
- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
+// Deprecated SPI
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element; // Use -searchForLabels:beforeElement:resultDistance:resultIsInCellAbove:
+
@end
+
+#undef WebNSUInteger
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm
index 39489e8..41ce9f9 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.mm
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm
@@ -39,6 +39,7 @@
#import "WebKitStatisticsPrivate.h"
#import "WebNSAttributedStringExtras.h"
#import "WebNSObjectExtras.h"
+#import "WebTypesInternal.h"
#import "WebView.h"
#import <Foundation/NSURLResponse.h>
#import <WebCore/Document.h>
@@ -337,7 +338,27 @@ static HTMLInputElement* inputElementFromDOMElement(DOMElement* element)
- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element
{
- return core([_private->dataSource webFrame])->searchForLabelsBeforeElement(labels, core(element));
+ return [self searchForLabels:labels beforeElement:element resultDistance:0 resultIsInCellAbove:0];
+}
+
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element resultDistance:(NSUInteger*)outDistance resultIsInCellAbove:(BOOL*)outIsInCellAbove
+{
+ size_t distance;
+ bool isInCellAbove;
+
+ NSString *result = core([_private->dataSource webFrame])->searchForLabelsBeforeElement(labels, core(element), &distance, &isInCellAbove);
+
+ if (outDistance) {
+ if (distance == notFound)
+ *outDistance = NSNotFound;
+ else
+ *outDistance = distance;
+ }
+
+ if (outIsInCellAbove)
+ *outIsInCellAbove = isInCellAbove;
+
+ return result;
}
- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 5dc66ee..54a177e 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* (C) 2006, 2007 Graham Dennis (graham.dennis@gmail.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -103,6 +103,7 @@
#import <WebCore/Page.h>
#import <WebCore/PlatformKeyboardEvent.h>
#import <WebCore/Range.h>
+#import <WebCore/RuntimeApplicationChecks.h>
#import <WebCore/SelectionController.h>
#import <WebCore/SharedBuffer.h>
#import <WebCore/SimpleFontData.h>
@@ -796,10 +797,26 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
[webView _setInsertionPasteboard:pasteboard];
DOMRange *range = [self _selectedRange];
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted])
[[self _frame] _replaceSelectionWithFragment:fragment selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:NO];
-
+#else
+ // Mail is ignoring the frament passed to the delegate and creates a new one.
+ // We want to avoid creating the fragment twice.
+ if (applicationIsAppleMail()) {
+ if ([self _shouldInsertFragment:nil replacingDOMRange:range givenAction:WebViewInsertActionPasted]) {
+ DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
+ if (fragment)
+ [[self _frame] _replaceSelectionWithFragment:fragment selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:NO];
+ }
+ } else {
+ DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText];
+ if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted])
+ [[self _frame] _replaceSelectionWithFragment:fragment selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:NO];
+ }
+#endif
[webView _setInsertionPasteboard:nil];
[webView release];
}
@@ -3309,6 +3326,12 @@ WEBCORE_COMMAND(yankAndSelect)
return [[[self elementAtPoint:point allowShadowContent:YES] objectForKey:WebElementIsSelectedKey] boolValue];
}
+- (BOOL)_isScrollBarEvent:(NSEvent *)event
+{
+ NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
+ return [[[self elementAtPoint:point allowShadowContent:YES] objectForKey:WebElementIsInScrollBarKey] boolValue];
+}
+
- (BOOL)acceptsFirstMouse:(NSEvent *)event
{
// There's a chance that responding to this event will run a nested event loop, and
@@ -3331,6 +3354,8 @@ WEBCORE_COMMAND(yankAndSelect)
[hitHTMLView _setMouseDownEvent:event];
if ([hitHTMLView _isSelectionEvent:event])
result = coreFrame->eventHandler()->eventMayStartDrag(event);
+ else if ([hitHTMLView _isScrollBarEvent:event])
+ result = true;
[hitHTMLView _setMouseDownEvent:nil];
}
return result;
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index d295323..7085cec 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -88,6 +88,7 @@
#define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders"
#define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter"
#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
+#define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel"
#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
// These are private both because callers should be using the cover methods and because the
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 6b55ea3..d06cc13 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -351,9 +351,10 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey,
[NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey,
- [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey,
- [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey,
[NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitUsesProxiedOpenPanelPreferenceKey,
[NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
nil];
@@ -1183,6 +1184,16 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
}
+- (BOOL)usesProxiedOpenPanel
+{
+ return [self _boolValueForKey:WebKitUsesProxiedOpenPanelPreferenceKey];
+}
+
+- (void)setUsesProxiedOpenPanel:(BOOL)enabled
+{
+ [self _setBoolValue:enabled forKey:WebKitUsesProxiedOpenPanelPreferenceKey];
+}
+
- (unsigned)pluginAllowedRunTime
{
return [self _integerValueForKey:WebKitPluginAllowedRunTimePreferenceKey];
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 3cea78b..20c98b2 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -158,6 +158,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)webGLEnabled;
- (void)setWebGLEnabled:(BOOL)enabled;
+- (BOOL)usesProxiedOpenPanel;
+- (void)setUsesProxiedOpenPanel:(BOOL)enabled;
+
// Other private methods
- (void)_postPreferencesChangesNotification;
+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier;
diff --git a/WebKit/mac/WebView/WebScriptDebugger.h b/WebKit/mac/WebView/WebScriptDebugger.h
index 1213ab2..c4147a2 100644
--- a/WebKit/mac/WebView/WebScriptDebugger.h
+++ b/WebKit/mac/WebView/WebScriptDebugger.h
@@ -57,7 +57,7 @@ public:
virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
- virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
+ virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler);
virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
diff --git a/WebKit/mac/WebView/WebScriptDebugger.mm b/WebKit/mac/WebView/WebScriptDebugger.mm
index 8deccff..a71d78b 100644
--- a/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -200,7 +200,7 @@ void WebScriptDebugger::returnEvent(const DebuggerCallFrame& debuggerCallFrame,
m_callingDelegate = false;
}
-void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
+void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler)
{
if (m_callingDelegate)
return;
diff --git a/WebKit/mac/WebView/WebScriptWorld.h b/WebKit/mac/WebView/WebScriptWorld.h
index 9204975..7059b76 100644
--- a/WebKit/mac/WebView/WebScriptWorld.h
+++ b/WebKit/mac/WebView/WebScriptWorld.h
@@ -22,6 +22,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+typedef struct OpaqueJSContext* JSGlobalContextRef;
+
@class WebScriptWorldPrivate;
@interface WebScriptWorld : NSObject {
@@ -31,4 +33,7 @@
+ (WebScriptWorld *)standardWorld;
+ (WebScriptWorld *)world;
+
++ (WebScriptWorld *)scriptWorldForGlobalContext:(JSGlobalContextRef)globalContext;
+
@end
diff --git a/WebKit/mac/WebView/WebScriptWorld.mm b/WebKit/mac/WebView/WebScriptWorld.mm
index 0310701..7dab1b3 100644
--- a/WebKit/mac/WebView/WebScriptWorld.mm
+++ b/WebKit/mac/WebView/WebScriptWorld.mm
@@ -27,6 +27,8 @@
#import "WebScriptWorldInternal.h"
#import <WebCore/JSDOMBinding.h>
#import <WebCore/ScriptController.h>
+#import <JavaScriptCore/APICast.h>
+
#import <wtf/RefPtr.h>
using namespace WebCore;
@@ -94,6 +96,11 @@ static WorldMap& allWorlds()
return [[[self alloc] init] autorelease];
}
++ (WebScriptWorld *)scriptWorldForGlobalContext:(JSGlobalContextRef)context
+{
+ return [self findOrCreateWorld:currentWorld(toJS(context))];
+}
+
@end
@implementation WebScriptWorld (WebInternal)
diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm
index 946da90..e5fde5e 100644
--- a/WebKit/mac/WebView/WebVideoFullscreenController.mm
+++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm
@@ -34,6 +34,7 @@
#import <WebCore/HTMLMediaElement.h>
#import <WebCore/SoftLinking.h>
#import <objc/objc-runtime.h>
+#import <wtf/UnusedParam.h>
SOFT_LINK_FRAMEWORK(QTKit)
SOFT_LINK_CLASS(QTKit, QTMovieView)
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index ad8f33a..6dcbfb4 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -56,6 +56,8 @@
#import "WebFormDelegatePrivate.h"
#import "WebFrameInternal.h"
#import "WebFrameViewInternal.h"
+#import "WebGeolocationControllerClient.h"
+#import "WebGeolocationPositionInternal.h"
#import "WebHTMLRepresentation.h"
#import "WebHTMLViewInternal.h"
#import "WebHistoryItemInternal.h"
@@ -100,6 +102,7 @@
#import <CoreFoundation/CFSet.h>
#import <Foundation/NSURLConnection.h>
#import <WebCore/ApplicationCacheStorage.h>
+#import <WebCore/BackForwardList.h>
#import <WebCore/Cache.h>
#import <WebCore/ColorMac.h>
#import <WebCore/Cursor.h>
@@ -162,6 +165,11 @@
#import <WebKit/WebDashboardRegion.h>
#endif
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#import <WebCore/GeolocationController.h>
+#import <WebCore/GeolocationError.h>
+#endif
+
@interface NSSpellChecker (WebNSSpellCheckerDetails)
- (void)_preflightChosenSpellServer;
@end
@@ -369,6 +377,7 @@ NSString *WebElementLinkURLKey = @"WebElementLinkURL";
NSString *WebElementSpellingToolTipKey = @"WebElementSpellingToolTip";
NSString *WebElementTitleKey = @"WebElementTitle";
NSString *WebElementLinkIsLiveKey = @"WebElementLinkIsLive";
+NSString *WebElementIsInScrollBarKey = @"WebElementIsInScrollBar";
NSString *WebElementIsContentEditableKey = @"WebElementIsContentEditableKey";
NSString *WebViewProgressStartedNotification = @"WebProgressStartedNotification";
@@ -515,6 +524,7 @@ static NSString *createUserVisibleWebKitVersionString()
static void WebKitInitializeApplicationCachePathIfNecessary()
{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
static BOOL initialized = NO;
if (initialized)
return;
@@ -529,6 +539,7 @@ static void WebKitInitializeApplicationCachePathIfNecessary()
cacheStorage().setCacheDirectory(cacheDir);
initialized = YES;
+#endif
}
static bool runningLeopardMail()
@@ -547,6 +558,11 @@ static bool runningTigerMail()
return NO;
}
+static bool shouldEnableLoadDeferring()
+{
+ return !applicationIsAdobeInstaller();
+}
+
- (void)_dispatchPendingLoadRequests
{
cache()->loader()->servePendingRequests();
@@ -607,7 +623,16 @@ static bool runningTigerMail()
didOneTimeInitialization = true;
}
+<<<<<<< HEAD
_private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), 0);
+=======
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ WebGeolocationControllerClient* geolocationControllerClient = new WebGeolocationControllerClient(self);
+#else
+ WebGeolocationControllerClient* geolocationControllerClient = 0;
+#endif
+ _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient);
+>>>>>>> webkit.org at r54127
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
@@ -987,7 +1012,9 @@ static bool fastDocumentTeardownEnabled()
return;
}
+#if ENABLE(VIDEO)
[self _exitFullscreen];
+#endif
if (Frame* mainFrame = [self _mainCoreFrame])
mainFrame->loader()->detachFromParent();
@@ -1288,6 +1315,8 @@ static bool fastDocumentTeardownEnabled()
settings->setApplicationChromeMode([preferences applicationChromeModeEnabled]);
if ([preferences userStyleSheetEnabled]) {
NSString* location = [[preferences userStyleSheetLocation] _web_originalDataAsString];
+ if ([location isEqualToString:@"apple-dashboard://stylesheet"])
+ location = @"file:///System/Library/PrivateFrameworks/DashboardClient.framework/Resources/widget.css";
settings->setUserStyleSheetLocation([NSURL URLWithString:(location ? location : @"")]);
} else
settings->setUserStyleSheetLocation([NSURL URLWithString:@""]);
@@ -1308,6 +1337,7 @@ static bool fastDocumentTeardownEnabled()
settings->setShowRepaintCounter([preferences showRepaintCounter]);
settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]);
settings->setWebGLEnabled([preferences webGLEnabled]);
+ settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
}
static inline IMP getMethod(id o, SEL s)
@@ -2319,6 +2349,11 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
frame->animation()->resumeAnimations(frame->document());
}
++ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme
+{
+ SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
+}
+
@end
@implementation _WebSafeForwarder
@@ -5577,6 +5612,41 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi
@end
+@implementation WebView (WebViewGeolocation)
+
+- (void)_setGeolocationProvider:(id<WebGeolocationProvider>)geolocationProvider
+{
+ if (_private)
+ _private->_geolocationProvider = geolocationProvider;
+}
+
+- (id<WebGeolocationProvider>)_geolocationProvider
+{
+ if (_private)
+ return _private->_geolocationProvider;
+ return nil;
+}
+
+- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ if (_private && _private->page)
+ _private->page->geolocationController()->positionChanged(core(position));
+#endif
+}
+
+- (void)_geolocationDidFailWithError:(NSError *)error
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ if (_private && _private->page) {
+ RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, [error localizedDescription]);
+ _private->page->geolocationController()->errorOccurred(geolocatioError.get());
+ }
+#endif
+}
+
+@end
+
#ifdef BUILDING_ON_LEOPARD
static IMP originalRecursivelyRemoveMailAttributesImp;
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 37024c7..b0569a2 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -43,6 +43,7 @@ namespace WebCore {
@class WebPreferences;
@class WebTextCompletionController;
@protocol WebFormDelegate;
+@protocol WebGeolocationProvider;
#if ENABLE(VIDEO)
@class WebVideoFullscreenController;
#endif
@@ -165,5 +166,7 @@ extern int pluginDatabaseClientCount;
#if ENABLE(VIDEO)
WebVideoFullscreenController *fullscreenController;
#endif
+
+ id<WebGeolocationProvider> _geolocationProvider;
}
@end
diff --git a/WebKit/mac/WebView/WebViewData.mm b/WebKit/mac/WebView/WebViewData.mm
index 835f46e..21ba4c8 100644
--- a/WebKit/mac/WebView/WebViewData.mm
+++ b/WebKit/mac/WebView/WebViewData.mm
@@ -81,7 +81,9 @@ int pluginDatabaseClientCount = 0;
ASSERT(applicationIsTerminating || !page);
ASSERT(applicationIsTerminating || !preferences);
ASSERT(!insertionPasteboard);
+#if ENABLE(VIDEO)
ASSERT(!fullscreenController);
+#endif
[applicationNameForUserAgent release];
[backgroundColor release];
@@ -101,7 +103,9 @@ int pluginDatabaseClientCount = 0;
{
ASSERT_MAIN_THREAD();
ASSERT(!insertionPasteboard);
+#if ENABLE(VIDEO)
ASSERT(!fullscreenController);
+#endif
[super finalize];
}
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 0622d4c..4d1145e 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -43,6 +43,7 @@
@class NSError;
@class WebFrame;
+@class WebGeolocationPosition;
@class WebInspector;
@class WebPreferences;
@class WebScriptWorld;
@@ -66,6 +67,7 @@ extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether
// other WebElementDictionary keys
extern NSString *WebElementLinkIsLiveKey; // NSNumber of BOOL indictating whether the link is live or not
+extern NSString *WebElementIsInScrollBarKey;
// One of the subviews of the WebView entered compositing mode.
extern NSString *_WebViewDidStartAcceleratedCompositingNotification;
@@ -507,6 +509,8 @@ Could be worth adding to the API.
*/
- (void)setCSSAnimationsSuspended:(BOOL)suspended;
++ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
+
@end
@interface WebView (WebViewPrintingPrivate)
@@ -573,6 +577,20 @@ Could be worth adding to the API.
- (BOOL)_selectionIsAll;
@end
+@protocol WebGeolocationProvider <NSObject>
+- (void)registerWebView:(WebView *)webView;
+- (void)unregisterWebView:(WebView *)webView;
+- (WebGeolocationPosition *)lastPosition;
+@end
+
+@interface WebView (WebViewGeolocation)
+- (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider;
+- (id<WebGeolocationProvider>)_geolocationProvider;
+
+- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
+- (void)_geolocationDidFailWithError:(NSError *)error;
+@end
+
@interface NSObject (WebFrameLoadDelegatePrivate)
- (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;