diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 13:36:51 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-24 15:38:28 +0100 |
commit | 2fc2651226baac27029e38c9d6ef883fa32084db (patch) | |
tree | e396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebKit2/UIProcess/mac | |
parent | b3725cedeb43722b3b175aaeff70552e562d2c94 (diff) | |
download | external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2 |
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebKit2/UIProcess/mac')
12 files changed, 121 insertions, 83 deletions
diff --git a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm index eacfefa..0a04eed 100644 --- a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm +++ b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "BackingStore.h" - -#include "CGUtilities.h" -#include "ShareableBitmap.h" -#include "UpdateInfo.h" -#include "WebPageProxy.h" -#include <WebCore/GraphicsContext.h> +#import "config.h" +#import "BackingStore.h" + +#import "CGUtilities.h" +#import "ShareableBitmap.h" +#import "UpdateInfo.h" +#import "WebPageProxy.h" +#import <WebCore/GraphicsContext.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm index 909745b..a580a57 100644 --- a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ChunkedUpdateDrawingAreaProxy.h" +#import "config.h" +#import "ChunkedUpdateDrawingAreaProxy.h" -#include "DrawingAreaMessageKinds.h" -#include "DrawingAreaProxyMessageKinds.h" -#include "UpdateChunk.h" -#include "WKAPICast.h" -#include "WKView.h" -#include "WebPageProxy.h" +#import "DrawingAreaMessageKinds.h" +#import "DrawingAreaProxyMessageKinds.h" +#import "UpdateChunk.h" +#import "WKAPICast.h" +#import "WKView.h" +#import "WebPageProxy.h" using namespace WebCore; @@ -96,7 +97,7 @@ void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* // Flip the destination. CGContextScaleCTM(m_bitmapContext.get(), 1, -1); - CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.bottom())); + CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.maxY())); CGContextDrawImage(m_bitmapContext.get(), updateChunkRect, image.get()); diff --git a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm index 846eb25..1c3aee3 100644 --- a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm @@ -23,16 +23,17 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "LayerBackedDrawingAreaProxy.h" +#import "config.h" +#import "LayerBackedDrawingAreaProxy.h" -#include "DrawingAreaMessageKinds.h" -#include "DrawingAreaProxyMessageKinds.h" -#include <QuartzCore/QuartzCore.h> -#include "WKAPICast.h" -#include "WKView.h" -#include "WKViewInternal.h" -#include "WebKitSystemInterface.h" -#include "WebPageProxy.h" +#import "DrawingAreaMessageKinds.h" +#import "DrawingAreaProxyMessageKinds.h" +#import <QuartzCore/QuartzCore.h> +#import "WKAPICast.h" +#import "WKView.h" +#import "WKViewInternal.h" +#import "WebKitSystemInterface.h" +#import "WebPageProxy.h" using namespace WebCore; @@ -89,4 +90,19 @@ void LayerBackedDrawingAreaProxy::detachCompositingContext() m_compositingRootLayer = 0; } +bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) +{ + WebPageProxy* webPageProxy = page(); + if (webPageProxy->drawsBackground() && webPageProxy->drawsTransparentBackground()) { + CGContextSaveGState(context); + CGContextSetBlendMode(context, kCGBlendModeCopy); + CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear)); + CGContextFillRect(context, rect); + + CGContextRestoreGState(context); + } + + return true; +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm index c89011e..ceb140a 100644 --- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm +++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm @@ -23,23 +23,24 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "TextChecker.h" +#import "config.h" +#import "TextChecker.h" -#include "TextCheckerState.h" -#include <wtf/RetainPtr.h> +#import "TextCheckerState.h" +#import <wtf/RetainPtr.h> #ifndef BUILDING_ON_SNOW_LEOPARD #import <AppKit/NSTextChecker.h> #endif -static const NSString * const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled"; -static const NSString * const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled"; -static const NSString * const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled"; -static const NSString * const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled"; -static const NSString * const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled"; -static const NSString * const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled"; -static const NSString * const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled"; -static const NSString * const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled"; +static NSString* const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled"; +static NSString* const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled"; +static NSString* const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled"; +static NSString* const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled"; +static NSString* const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled"; +static NSString* const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled"; +static NSString* const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled"; +static NSString* const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled"; using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index 4d1679f..9f635c1 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebContext.h" +#import "config.h" +#import "WebContext.h" -#include "WebKitSystemInterface.h" -#include "WebProcessCreationParameters.h" -#include <WebCore/FileSystem.h> -#include <sys/param.h> +#import "WebKitSystemInterface.h" +#import "WebProcessCreationParameters.h" +#import <WebCore/FileSystem.h> +#import <sys/param.h> using namespace WebCore; @@ -90,5 +91,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]); } +String WebContext::platformDefaultDatabaseDirectory() const +{ + return [@"~/Library/WebKit/Databases" stringByStandardizingPath]; +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h index ee4fa3d..20ffd0b 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h @@ -29,13 +29,8 @@ #include "WebContextMenuProxy.h" #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -@class WKView; -#else -class NSPopUpButtonCell; -class WKView; -#endif +OBJC_CLASS NSPopUpButtonCell; +OBJC_CLASS WKView; namespace WebKit { diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm index d76b997..67139b3 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebContextMenuProxyMac.h" +#import "config.h" +#import "WebContextMenuProxyMac.h" -#include "PageClientImpl.h" -#include "WebContextMenuItemData.h" -#include "WKView.h" +#import "PageClientImpl.h" +#import "WebContextMenuItemData.h" +#import "WKView.h" -#include <WebCore/IntRect.h> -#include <WebKitSystemInterface.h> +#import <WebCore/IntRect.h> +#import <WebKitSystemInterface.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index e129094..37a6f97 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebInspectorProxy.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index cd3e6f1..e641fe0 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -23,11 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPageProxy.h" +#import "config.h" +#import "WebPageProxy.h" -#include "PageClient.h" -#include <WebCore/Language.h> -#include <wtf/text/StringConcatenate.h> +#import "PageClient.h" +#import <WebCore/Language.h> +#import <wtf/text/StringConcatenate.h> @interface NSApplication (Details) - (void)speakString:(NSString *)string; diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h index 85339d6..788fd20 100644 --- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h @@ -29,13 +29,8 @@ #include "WebPopupMenuProxy.h" #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -@class WKView; -#else -class NSPopUpButtonCell; -class WKView; -#endif +OBJC_CLASS NSPopUpButtonCell; +OBJC_CLASS WKView; namespace WebKit { @@ -49,13 +44,13 @@ public: } ~WebPopupMenuProxyMac(); - virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); virtual void hidePopupMenu(); private: WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client); - void populate(const Vector<WebPopupItem>&); + void populate(const Vector<WebPopupItem>&, WebCore::TextDirection); RetainPtr<NSPopUpButtonCell> m_popup; WKView* m_webView; diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm index 481e8c5..61713fc 100644 --- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPopupMenuProxyMac.h" +#import "config.h" +#import "WebPopupMenuProxyMac.h" -#include "PageClientImpl.h" -#include "PlatformPopupMenuData.h" -#include "WKView.h" -#include "WebPopupItem.h" -#include <WebKitSystemInterface.h> +#import "PageClientImpl.h" +#import "PlatformPopupMenuData.h" +#import "WKView.h" +#import "WebPopupItem.h" +#import <WebKitSystemInterface.h> using namespace WebCore; @@ -47,7 +48,7 @@ WebPopupMenuProxyMac::~WebPopupMenuProxyMac() [m_popup.get() setControlView:nil]; } -void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items) +void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirection menuTextDirection) { if (m_popup) [m_popup.get() removeAllItems]; @@ -63,20 +64,38 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items) if (items[i].m_type == WebPopupItem::Seperator) [[m_popup.get() menu] addItem:[NSMenuItem separatorItem]]; else { - [m_popup.get() addItemWithTitle:nsStringFromWebCoreString(items[i].m_text)]; - NSMenuItem* menuItem = [m_popup.get() lastItem]; + [m_popup.get() addItemWithTitle:@""]; + NSMenuItem *menuItem = [m_popup.get() lastItem]; + + RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); + NSWritingDirection writingDirection = items[i].m_textDirection == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; + [paragraphStyle.get() setBaseWritingDirection:writingDirection]; + [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment]; + RetainPtr<NSMutableDictionary> attributes(AdoptNS, [[NSMutableDictionary alloc] initWithObjectsAndKeys: + paragraphStyle.get(), NSParagraphStyleAttributeName, + [m_popup.get() font], NSFontAttributeName, + nil]); + if (items[i].m_hasTextDirectionOverride) { + RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]); + RetainPtr<NSArray> writingDirectionArray(AdoptNS, [[NSArray alloc] initWithObjects:writingDirectionValue.get(), nil]); + [attributes.get() setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName]; + } + RetainPtr<NSAttributedString> string(AdoptNS, [[NSAttributedString alloc] initWithString:nsStringFromWebCoreString(items[i].m_text) attributes:attributes.get()]); + + [menuItem setAttributedTitle:string.get()]; [menuItem setEnabled:items[i].m_isEnabled]; [menuItem setToolTip:nsStringFromWebCoreString(items[i].m_toolTip)]; } } } -void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) { - populate(items); + populate(items, textDirection); [m_popup.get() attachPopUpWithFrame:rect inView:m_webView]; [m_popup.get() selectItemAtIndex:selectedIndex]; + [m_popup.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; NSMenu* menu = [m_popup.get() menu]; @@ -97,7 +116,8 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPo [m_popup.get() dismissPopUp]; [dummyView.get() removeFromSuperview]; - m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]); + if (m_client) + m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]); } void WebPopupMenuProxyMac::hidePopupMenu() @@ -105,5 +125,4 @@ void WebPopupMenuProxyMac::hidePopupMenu() [m_popup.get() dismissPopUp]; } - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm index b954bd2..f2f41d3 100644 --- a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPreferences.h" +#import "config.h" +#import "WebPreferences.h" -#include "PageClientImpl.h" -#include <wtf/text/StringConcatenate.h> +#import "PageClientImpl.h" +#import <wtf/text/StringConcatenate.h> namespace WebKit { |