From bec39347bb3bb5bf1187ccaf471d26247f28b585 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Thu, 30 Sep 2010 15:42:16 +0100 Subject: Merge WebKit at r68651 : Initial merge by git. Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12 --- WebKit/mac/WebView/WebPreferenceKeysPrivate.h | 1 + WebKit/mac/WebView/WebPreferences.mm | 11 +++++ WebKit/mac/WebView/WebPreferencesPrivate.h | 3 ++ WebKit/mac/WebView/WebView.mm | 62 +++++++++++++++++++++++++-- WebKit/mac/WebView/WebViewPrivate.h | 4 ++ 5 files changed, 77 insertions(+), 4 deletions(-) (limited to 'WebKit/mac/WebView') diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 17c8e4d..8119649 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -100,6 +100,7 @@ #define WebKitDNSPrefetchingEnabledPreferenceKey @"WebKitDNSPrefetchingEnabled" #define WebKitFullScreenEnabledPreferenceKey @"WebKitFullScreenEnabled" #define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled" +#define WebKitHyperlinkAuditingEnabledPreferenceKey @"WebKitHyperlinkAuditingEnabled" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 87284bb..2ddd8b3 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -368,6 +368,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitHyperlinkAuditingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -1332,6 +1333,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:flag forKey:WebKitMemoryInfoEnabledPreferenceKey]; } +- (BOOL)hyperlinkAuditingEnabled +{ + return [self _boolValueForKey:WebKitHyperlinkAuditingEnabledPreferenceKey]; +} + +- (void)setHyperlinkAuditingEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitHyperlinkAuditingEnabledPreferenceKey]; +} + - (WebKitEditingBehavior)editingBehavior { return static_cast([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]); diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 3bd5e24..bb525cd 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -196,6 +196,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)memoryInfoEnabled; - (void)setMemoryInfoEnabled:(BOOL)enabled; +- (BOOL)hyperlinkAuditingEnabled; +- (void)setHyperlinkAuditingEnabled:(BOOL)enabled; + // Other private methods - (void)_postPreferencesChangesNotification; + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 20f6e24..1fca8d1 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -133,9 +133,12 @@ #import #import #import +#import #import +#import #import #import +#import #import #import #import @@ -675,6 +678,7 @@ static bool shouldEnableLoadDeferring() // Initialize our platform strategies. WebPlatformStrategies::initialize(); + Settings::setMinDOMTimerInterval(0.004); didOneTimeInitialization = true; } @@ -696,7 +700,6 @@ static bool shouldEnableLoadDeferring() _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); - _private->page->settings()->setMinDOMTimerInterval(0.004); [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView]; @@ -1358,6 +1361,27 @@ static bool fastDocumentTeardownEnabled() return needsQuirk; } + +- (BOOL)_needsPreHTML5ParserQuirks +{ + // AOL Instant Messenger and Microsoft My Day contain markup incompatible + // with the new HTML5 parser. If these applications were linked against a + // version of WebKit prior to the introduction of the HTML5 parser, enable + // parser quirks to maintain compatibility. For details, see + // and + // . + static bool isApplicationNeedingParserQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER) + && (applicationIsAOLInstantMessenger() || applicationIsMicrosoftMyDay()); + + return isApplicationNeedingParserQuirks +#if ENABLE(DASHBOARD_SUPPORT) + // Pre-HTML5 parser quirks are required to remain compatible with many + // Dashboard widgets. See . + || (_private->page && _private->page->settings()->usesDashboardBackwardCompatibilityMode()) +#endif + || [[self preferences] usePreHTML5ParserQuirks]; +} + - (void)_preferencesChangedNotification:(NSNotification *)notification { WebPreferences *preferences = (WebPreferences *)[notification object]; @@ -1453,7 +1477,8 @@ static bool fastDocumentTeardownEnabled() settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); - settings->setUsePreHTML5ParserQuirks([preferences usePreHTML5ParserQuirks]); + settings->setHyperlinkAuditingEnabled([preferences hyperlinkAuditingEnabled]); + settings->setUsePreHTML5ParserQuirks([self _needsPreHTML5ParserQuirks]); // Application Cache Preferences are stored on the global cache storage manager, not in Settings. [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]]; @@ -1983,6 +2008,11 @@ static inline IMP getMethod(id o, SEL s) break; } } + + // Pre-HTML5 parser quirks should be enabled if Dashboard is in backward + // compatibility mode. See . + if (_private->page) + _private->page->settings()->setUsePreHTML5ParserQuirks([self _needsPreHTML5ParserQuirks]); } - (BOOL)_dashboardBehavior:(WebDashboardBehavior)behavior @@ -2649,7 +2679,7 @@ static PassOwnPtr > toStringVector(NSArray* patterns) if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticTextReplacementEnabled]) automaticTextReplacementEnabled = [NSSpellChecker isAutomaticTextReplacementEnabled]; if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) - automaticTextReplacementEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled]; + automaticSpellingCorrectionEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled]; #endif } @@ -5859,6 +5889,11 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi - (void)_scheduleCompositingLayerSync { + CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent(); + + // Make sure we wake up the loop or the observer could be delayed until some other source fires. + CFRunLoopWakeUp(currentRunLoop); + if (_private->layerSyncRunLoopObserver) return; @@ -5874,7 +5909,7 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi kCFRunLoopBeforeWaiting | kCFRunLoopExit, true /* repeats */, runLoopOrder, layerSyncRunLoopObserverCallBack, &context); - CFRunLoopAddObserver(CFRunLoopGetCurrent(), _private->layerSyncRunLoopObserver, kCFRunLoopCommonModes); + CFRunLoopAddObserver(currentRunLoop, _private->layerSyncRunLoopObserver, kCFRunLoopCommonModes); } #endif @@ -6020,6 +6055,25 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity @end +@implementation WebView (WebViewPrivateNodesFromRect) + +- (JSValueRef)_nodesFromRect:(JSContextRef)context forDocument:(JSValueRef)value x:(int)x y:(int)y top:(unsigned)top right:(unsigned)right bottom:(unsigned)bottom left:(unsigned)left ignoreClipping:(BOOL)ignoreClipping +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(context); + if (!value) + return JSValueMakeUndefined(context); + JSValue jsValue = toJS(exec, value); + if (!jsValue.inherits(&JSDocument::s_info)) + return JSValueMakeUndefined(context); + JSDocument* jsDocument = static_cast(asObject(jsValue)); + Document* document = jsDocument->impl(); + RefPtr nodes = document->nodesFromRect(x, y, top, right, bottom, left, ignoreClipping); + return toRef(exec, toJS(exec, jsDocument->globalObject(), nodes.get())); +} + +@end + #ifdef BUILDING_ON_LEOPARD static IMP originalRecursivelyRemoveMailAttributesImp; diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index aeb36c7..749eeb3 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -630,6 +630,10 @@ Could be worth adding to the API. - (JSValueRef)_computedStyleIncludingVisitedInfo:(JSContextRef)context forElement:(JSValueRef)value; @end +@interface WebView (WebViewPrivateNodesFromRect) +- (JSValueRef)_nodesFromRect:(JSContextRef)context forDocument:(JSValueRef)value x:(int)x y:(int)y top:(unsigned)top right:(unsigned)right bottom:(unsigned)bottom left:(unsigned)left ignoreClipping:(BOOL)ignoreClipping; +@end + @interface NSObject (WebFrameLoadDelegatePrivate) - (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame; -- cgit v1.1