summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/mac/WebView
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebKit/mac/WebView
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebKit/mac/WebView')
-rw-r--r--Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h4
-rw-r--r--Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm23
-rw-r--r--Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm6
-rw-r--r--Source/WebKit/mac/WebView/WebFrame.mm4
-rw-r--r--Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--Source/WebKit/mac/WebView/WebPreferences.mm10
-rw-r--r--Source/WebKit/mac/WebView/WebPreferencesPrivate.h3
-rw-r--r--Source/WebKit/mac/WebView/WebScriptDebugDelegate.h8
-rw-r--r--Source/WebKit/mac/WebView/WebScriptDebugger.h2
-rw-r--r--Source/WebKit/mac/WebView/WebScriptDebugger.mm31
-rw-r--r--Source/WebKit/mac/WebView/WebView.mm16
11 files changed, 81 insertions, 27 deletions
diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
index 2aadc83..8bc776b 100644
--- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
+++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
@@ -80,6 +80,7 @@ struct WebFrameLoadDelegateImplementationCache {
struct WebScriptDebugDelegateImplementationCache {
BOOL didParseSourceExpectsBaseLineNumber;
+ BOOL exceptionWasRaisedExpectsHasHandlerFlag;
IMP didParseSourceFunc;
IMP failedToParseSourceFunc;
IMP didEnterCallFrameFunc;
@@ -138,7 +139,8 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id,
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
-id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
+id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, int, id);
+id CallScriptDebugDelegate(IMP, WebView *, SEL, id, BOOL, NSInteger, int, id);
id CallHistoryDelegate(IMP, WebView *, SEL);
id CallHistoryDelegate(IMP, WebView *, SEL, id, id);
diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
index d00d60b..c070b2b 100644
--- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
+++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
@@ -345,7 +345,7 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE
return nil;
}
-static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
+static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
{
if (!delegate)
return nil;
@@ -359,6 +359,20 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE
return nil;
}
+static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
+{
+ if (!delegate)
+ return nil;
+ if (!self->_private->catchesDelegateExceptions)
+ return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
+ @try {
+ return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
+ } @catch(id exception) {
+ ReportDiscardedDelegateException(selector, exception);
+ }
+ return nil;
+}
+
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
{
if (!delegate)
@@ -574,11 +588,16 @@ id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id o
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
}
-id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
+id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
{
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
}
+id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
+{
+ return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, boolean, integer1, integer2, object2);
+}
+
id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector)
{
return CallDelegate(implementation, self, self->_private->historyDelegate, selector);
diff --git a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
index 79c3067..b8edef8 100644
--- a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
+++ b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
@@ -565,11 +565,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
- (BOOL)accessibilityIsIgnored
{
- id docView = [self documentView];
- if ([docView isKindOfClass:[WebFrameView class]] && ![(WebFrameView *)docView allowsScrolling])
- return YES;
-
- return [super accessibilityIsIgnored];
+ return YES;
}
- (void)setScrollOrigin:(NSPoint)scrollOrigin updatePosition:(BOOL)updatePosition
diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm
index 3dde06f..154156a 100644
--- a/Source/WebKit/mac/WebView/WebFrame.mm
+++ b/Source/WebKit/mac/WebView/WebFrame.mm
@@ -802,8 +802,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
if (newEnd.isNull())
newEnd = end;
- newStart = rangeCompliantEquivalent(newStart);
- newEnd = rangeCompliantEquivalent(newEnd);
+ newStart = newStart.parentAnchoredEquivalent();
+ newEnd = newEnd.parentAnchoredEquivalent();
RefPtr<Range> range = _private->coreFrame->document()->createRange();
int exception = 0;
diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 93f83fc..e6ba629 100644
--- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -91,6 +91,7 @@
#define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled"
#define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders"
#define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter"
+#define WebKitWebAudioEnabledPreferenceKey @"WebKitWebAudioEnabled"
#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
#define WebKitAccelerated2dCanvasEnabledPreferenceKey @"WebKitAccelerated2dCanvasEnabled"
#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm
index 7ce3bc4..c97cc2a 100644
--- a/Source/WebKit/mac/WebView/WebPreferences.mm
+++ b/Source/WebKit/mac/WebView/WebPreferences.mm
@@ -1264,6 +1264,16 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey];
}
+- (BOOL)webAudioEnabled
+{
+ return [self _boolValueForKey:WebKitWebAudioEnabledPreferenceKey];
+}
+
+- (void)setWebAudioEnabled:(BOOL)enabled
+{
+ [self _setBoolValue:enabled forKey:WebKitWebAudioEnabledPreferenceKey];
+}
+
- (BOOL)webGLEnabled
{
return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
index 89b6288..25a1bbd 100644
--- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -185,6 +185,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)showRepaintCounter;
- (void)setShowRepaintCounter:(BOOL)show;
+- (BOOL)webAudioEnabled;
+- (void)setWebAudioEnabled:(BOOL)enabled;
+
- (BOOL)webGLEnabled;
- (void)setWebGLEnabled:(BOOL)enabled;
diff --git a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
index 823cc35..2444b98 100644
--- a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
+++ b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
@@ -99,9 +99,17 @@ enum {
// exception is being thrown
- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ hasHandler:(BOOL)hasHandler
sourceId:(WebSourceId)sid
line:(int)lineno
forWebFrame:(WebFrame *)webFrame;
+
+// exception is being thrown (deprecated old version; called only if new version is not implemented)
+- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ sourceId:(WebSourceId)sid
+ line:(int)lineno
+ forWebFrame:(WebFrame *)webFrame;
+
@end
diff --git a/Source/WebKit/mac/WebView/WebScriptDebugger.h b/Source/WebKit/mac/WebView/WebScriptDebugger.h
index c4147a2..73c9466 100644
--- a/Source/WebKit/mac/WebView/WebScriptDebugger.h
+++ b/Source/WebKit/mac/WebView/WebScriptDebugger.h
@@ -53,7 +53,7 @@ public:
void initGlobalCallFrame(const JSC::DebuggerCallFrame&);
- virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMsg);
+ virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const JSC::UString& errorMsg);
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);
diff --git a/Source/WebKit/mac/WebView/WebScriptDebugger.mm b/Source/WebKit/mac/WebView/WebScriptDebugger.mm
index 25ef4b7..9bc3bce 100644
--- a/Source/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/Source/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -34,7 +34,7 @@
#import "WebViewInternal.h"
#import <JavaScriptCore/DebuggerCallFrame.h>
#import <JavaScriptCore/JSGlobalObject.h>
-#import <JavaScriptCore/SourceCode.h>
+#import <JavaScriptCore/SourceProvider.h>
#import <WebCore/DOMWindow.h>
#import <WebCore/Frame.h>
#import <WebCore/JSDOMWindow.h>
@@ -57,11 +57,11 @@ NSString *toNSString(const UString& s)
return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.characters()) length:s.length()];
}
-static NSString *toNSString(const SourceCode& s)
+static NSString *toNSString(SourceProvider* s)
{
- if (!s.length())
+ if (!s->length())
return nil;
- return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.data()) length:s.length()];
+ return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s->data()) length:s->length()];
}
// convert UString to NSURL
@@ -104,15 +104,16 @@ void WebScriptDebugger::initGlobalCallFrame(const DebuggerCallFrame& debuggerCal
}
// callbacks - relay to delegate
-void WebScriptDebugger::sourceParsed(ExecState* exec, const SourceCode& source, int errorLine, const UString& errorMsg)
+void WebScriptDebugger::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const UString& errorMsg)
{
if (m_callingDelegate)
return;
m_callingDelegate = true;
- NSString *nsSource = toNSString(source);
- NSURL *nsURL = toNSURL(source.provider()->url());
+ NSString *nsSource = toNSString(sourceProvider);
+ NSURL *nsURL = toNSURL(sourceProvider->url());
+ int firstLine = sourceProvider->startPosition().m_line.oneBasedInt();
WebFrame *webFrame = toWebFrame(exec->dynamicGlobalObject());
WebView *webView = [webFrame webView];
@@ -121,9 +122,9 @@ void WebScriptDebugger::sourceParsed(ExecState* exec, const SourceCode& source,
if (errorLine == -1) {
if (implementations->didParseSourceFunc) {
if (implementations->didParseSourceExpectsBaseLineNumber)
- CallScriptDebugDelegate(implementations->didParseSourceFunc, webView, @selector(webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:), nsSource, source.firstLine(), nsURL, source.provider()->asID(), webFrame);
+ CallScriptDebugDelegate(implementations->didParseSourceFunc, webView, @selector(webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:), nsSource, firstLine, nsURL, sourceProvider->asID(), webFrame);
else
- CallScriptDebugDelegate(implementations->didParseSourceFunc, webView, @selector(webView:didParseSource:fromURL:sourceId:forWebFrame:), nsSource, [nsURL absoluteString], source.provider()->asID(), webFrame);
+ CallScriptDebugDelegate(implementations->didParseSourceFunc, webView, @selector(webView:didParseSource:fromURL:sourceId:forWebFrame:), nsSource, [nsURL absoluteString], sourceProvider->asID(), webFrame);
}
} else {
NSString* nsErrorMessage = toNSString(errorMsg);
@@ -131,7 +132,7 @@ void WebScriptDebugger::sourceParsed(ExecState* exec, const SourceCode& source,
NSError *error = [[NSError alloc] initWithDomain:WebScriptErrorDomain code:WebScriptGeneralErrorCode userInfo:info];
if (implementations->failedToParseSourceFunc)
- CallScriptDebugDelegate(implementations->failedToParseSourceFunc, webView, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:), nsSource, source.firstLine(), nsURL, error, webFrame);
+ CallScriptDebugDelegate(implementations->failedToParseSourceFunc, webView, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:), nsSource, firstLine, nsURL, error, webFrame);
[error release];
[info release];
@@ -211,9 +212,13 @@ void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, in
WebView *webView = [webFrame webView];
[m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
- WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
- if (implementations->exceptionWasRaisedFunc)
- CallScriptDebugDelegate(implementations->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
+ WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView);
+ if (cache->exceptionWasRaisedFunc) {
+ if (cache->exceptionWasRaisedExpectsHasHandlerFlag)
+ CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), m_topCallFrame.get(), hasHandler, sourceID, lineNumber, webFrame);
+ else
+ CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
+ }
m_callingDelegate = false;
}
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 809b286..82e4f2c 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -1496,6 +1496,7 @@ static bool fastDocumentTeardownEnabled()
settings->setShowDebugBorders([preferences showDebugBorders]);
settings->setShowRepaintCounter([preferences showRepaintCounter]);
settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]);
+ settings->setWebAudioEnabled([preferences webAudioEnabled]);
settings->setWebGLEnabled([preferences webGLEnabled]);
settings->setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]);
settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
@@ -1604,14 +1605,23 @@ static inline IMP getMethod(id o, SEL s)
cache->didParseSourceFunc = getMethod(delegate, @selector(webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:));
if (cache->didParseSourceFunc)
cache->didParseSourceExpectsBaseLineNumber = YES;
- else
+ else {
+ cache->didParseSourceExpectsBaseLineNumber = NO;
cache->didParseSourceFunc = getMethod(delegate, @selector(webView:didParseSource:fromURL:sourceId:forWebFrame:));
+ }
cache->failedToParseSourceFunc = getMethod(delegate, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:));
cache->didEnterCallFrameFunc = getMethod(delegate, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:));
cache->willExecuteStatementFunc = getMethod(delegate, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:));
cache->willLeaveCallFrameFunc = getMethod(delegate, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:));
- cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
+
+ cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:));
+ if (cache->exceptionWasRaisedFunc)
+ cache->exceptionWasRaisedExpectsHasHandlerFlag = YES;
+ else {
+ cache->exceptionWasRaisedExpectsHasHandlerFlag = NO;
+ cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
+ }
}
- (void)_cacheHistoryDelegateImplementations
@@ -5947,7 +5957,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num)
{
Frame* frame = [self _mainCoreFrame];
if (frame && frame->view())
- return frame->view()->syncCompositingStateRecursive();
+ return frame->view()->syncCompositingStateIncludingSubframes();
return YES;
}