summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-05-26 10:11:43 +0100
committerSteve Block <steveblock@google.com>2010-05-27 11:14:42 +0100
commite78cbe89e6f337f2f1fe40315be88f742b547151 (patch)
treed778000b84a04f24bbad50c7fa66244365e960e9 /WebKit/mac/WebView
parent7b582e96e4e909ed7dba1e07153d20fbddaec3f7 (diff)
downloadexternal_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.zip
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.gz
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.bz2
Merge WebKit at r60074: Initial merge by git
Change-Id: I18a2dc5439e36c928351ea829d8fb4e39b062fc7
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.mm9
-rw-r--r--WebKit/mac/WebView/WebFrame.mm14
-rw-r--r--WebKit/mac/WebView/WebFrameInternal.h1
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm5
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h2
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm21
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h11
-rw-r--r--WebKit/mac/WebView/WebView.mm5
8 files changed, 62 insertions, 6 deletions
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
index 3aaea46..2041ac0 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
@@ -262,6 +262,15 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
NSSize documentSize = [documentView frame].size;
NSSize visibleSize = [self documentVisibleRect].size;
NSSize frameSize = [self frame].size;
+
+ // When in HiDPI with a scale factor > 1, the visibleSize and frameSize may be non-integral values,
+ // while the documentSize (set by WebCore) will be integral. Round up the non-integral sizes so that
+ // the mismatch won't cause unwanted scrollbars to appear. This can result in slightly cut off content,
+ // but it will always be less than one pixel, which should not be noticeable.
+ visibleSize.width = ceilf(visibleSize.width);
+ visibleSize.height = ceilf(visibleSize.height);
+ frameSize.width = ceilf(frameSize.width);
+ frameSize.height = ceilf(frameSize.height);
if (_private->hScroll == ScrollbarAuto) {
newHasHorizontalScroller = documentSize.width > visibleSize.width;
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 7545bd8..999f177 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -196,6 +196,18 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior)
return EditableLinkDefaultBehavior;
}
+WebCore::EditingBehavior core(WebKitEditingBehavior behavior)
+{
+ switch (behavior) {
+ case WebKitEditingMacBehavior:
+ return WebCore::EditingMacBehavior;
+ case WebKitEditingWinBehavior:
+ return WebCore::EditingWindowsBehavior;
+ }
+ ASSERT_NOT_REACHED();
+ return WebCore::EditingMacBehavior;
+}
+
TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior behavior)
{
switch (behavior) {
@@ -1025,7 +1037,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
RenderObject* bodyRenderer = body->renderer();
if (!bodyRenderer)
return nil;
- Color color = bodyRenderer->style()->backgroundColor();
+ Color color = bodyRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
if (!color.isValid())
return nil;
return nsColor(color);
diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h
index 4c1ee40..9b2248a 100644
--- a/WebKit/mac/WebView/WebFrameInternal.h
+++ b/WebKit/mac/WebView/WebFrameInternal.h
@@ -71,6 +71,7 @@ WebView *kit(WebCore::Page*);
WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior);
WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior);
+WebCore::EditingBehavior core(WebKitEditingBehavior);
WebView *getWebView(WebFrame *webFrame);
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 83d2e7b..5f9134f 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -4344,9 +4344,6 @@ static BOOL isInPasswordField(Frame* coreFrame)
// the current event prevents that from causing a problem inside WebKit or AppKit code.
[[event retain] autorelease];
- if ([self _handleStyleKeyEquivalent:event])
- return YES;
-
BOOL eventWasSentToWebCore = (_private->keyDownEvent == event);
BOOL ret = NO;
@@ -4364,7 +4361,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
ret = frame->eventHandler()->keyEvent(event);
if (!ret)
- ret = [super performKeyEquivalent:event];
+ ret = [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event];
[self release];
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index f4ae333..ba4df8f 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -93,6 +93,7 @@
#define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel"
#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
#define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled"
+#define WebKitHTML5ParserEnabledPreferenceKey @"WebKitHTML5ParserEnabled"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
@@ -104,6 +105,7 @@
#define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior"
#define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
#define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey"
+#define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior"
// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
// to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index 9de8495..ac98282 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -334,6 +334,7 @@ static WebCacheModel cacheModelForMainBundle(void)
@"0", WebKitPDFScaleFactorPreferenceKey,
@"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
[NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
+ [NSNumber numberWithInt:WebKitEditingMacBehavior], WebKitEditingBehaviorPreferenceKey,
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
[NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
#else
@@ -1237,6 +1238,26 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:flag forKey:WebKitFrameFlatteningEnabledPreferenceKey];
}
+- (BOOL)html5ParserEnabled
+{
+ return [self _boolValueForKey:WebKitHTML5ParserEnabledPreferenceKey];
+}
+
+- (void)setHTML5ParserEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitHTML5ParserEnabledPreferenceKey];
+}
+
+- (WebKitEditingBehavior)editingBehavior
+{
+ return static_cast<WebKitEditingBehavior>([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]);
+}
+
+- (void)setEditingBehavior:(WebKitEditingBehavior)behavior
+{
+ [self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey];
+}
+
- (void)didRemoveFromWebView
{
ASSERT(_private->numWebViews);
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index ee785e9..0031860 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -43,6 +43,11 @@ typedef enum {
WebTextDirectionSubmenuAlwaysIncluded
} WebTextDirectionSubmenuInclusionBehavior;
+typedef enum {
+ WebKitEditingMacBehavior,
+ WebKitEditingWinBehavior
+} WebKitEditingBehavior;
+
extern NSString *WebPreferencesChangedNotification;
extern NSString *WebPreferencesRemovedNotification;
@@ -129,6 +134,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (WebKitEditableLinkBehavior)editableLinkBehavior;
- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
+- (WebKitEditingBehavior)editingBehavior;
+- (void)setEditingBehavior:(WebKitEditingBehavior)behavior;
+
- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
@@ -167,6 +175,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)webGLEnabled;
- (void)setWebGLEnabled:(BOOL)enabled;
+- (BOOL)html5ParserEnabled;
+- (void)setHTML5ParserEnabled:(BOOL)flag;
+
- (BOOL)usesProxiedOpenPanel;
- (void)setUsesProxiedOpenPanel:(BOOL)enabled;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 36313b4..0df62ea 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -662,7 +662,8 @@ static bool shouldEnableLoadDeferring()
#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);
+ DeviceOrientationClient* deviceOrientationClient = 0;
+ _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, deviceOrientationClient);
_private->page->setCanStartMedia([self window]);
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
@@ -1368,6 +1369,7 @@ static bool fastDocumentTeardownEnabled()
settings->setTextAreasAreResizable([preferences textAreasAreResizable]);
settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]);
settings->setEditableLinkBehavior(core([preferences editableLinkBehavior]));
+ settings->setEditingBehavior(core([preferences editingBehavior]));
settings->setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior]));
settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]);
settings->setUsesPageCache([self usesPageCache]);
@@ -1405,6 +1407,7 @@ static bool fastDocumentTeardownEnabled()
settings->setWebGLEnabled([preferences webGLEnabled]);
settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]);
+ settings->setHTML5ParserEnabled([preferences html5ParserEnabled]);
}
static inline IMP getMethod(id o, SEL s)