summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-30 15:42:16 +0100
committerSteve Block <steveblock@google.com>2010-10-07 10:59:29 +0100
commitbec39347bb3bb5bf1187ccaf471d26247f28b585 (patch)
tree56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebKit/mac/WebView
parent90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff)
downloadexternal_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm11
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h3
-rw-r--r--WebKit/mac/WebView/WebView.mm62
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h4
5 files changed, 77 insertions, 4 deletions
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<WebKitEditingBehavior>([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 <WebCore/HistoryItem.h>
#import <WebCore/IconDatabase.h>
#import <WebCore/JSCSSStyleDeclaration.h>
+#import <WebCore/JSDocument.h>
#import <WebCore/JSElement.h>
+#import <WebCore/JSNodeList.h>
#import <WebCore/Logging.h>
#import <WebCore/MIMETypeRegistry.h>
+#import <WebCore/NodeList.h>
#import <WebCore/Page.h>
#import <WebCore/PageCache.h>
#import <WebCore/PageGroup.h>
@@ -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
+ // <https://bugs.webkit.org/show_bug.cgi?id=46134> and
+ // <https://bugs.webkit.org/show_bug.cgi?id=46334>.
+ 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 <rdar://problem/8175982>.
+ || (_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 <rdar://problem/8175982>.
+ if (_private->page)
+ _private->page->settings()->setUsePreHTML5ParserQuirks([self _needsPreHTML5ParserQuirks]);
}
- (BOOL)_dashboardBehavior:(WebDashboardBehavior)behavior
@@ -2649,7 +2679,7 @@ static PassOwnPtr<Vector<String> > 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<JSDocument*>(asObject(jsValue));
+ Document* document = jsDocument->impl();
+ RefPtr<NodeList> 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;