diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /WebCore/platform/mac | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/platform/mac')
-rw-r--r-- | WebCore/platform/mac/ClipboardMac.h | 2 | ||||
-rw-r--r-- | WebCore/platform/mac/ClipboardMac.mm | 25 | ||||
-rw-r--r-- | WebCore/platform/mac/LocalCurrentGraphicsContext.h | 2 | ||||
-rw-r--r-- | WebCore/platform/mac/LocalizedStringsMac.mm | 16 | ||||
-rw-r--r-- | WebCore/platform/mac/LoggingMac.mm | 2 | ||||
-rw-r--r-- | WebCore/platform/mac/PasteboardMac.mm | 2 | ||||
-rw-r--r-- | WebCore/platform/mac/PopupMenuMac.mm | 1 | ||||
-rw-r--r-- | WebCore/platform/mac/RuntimeApplicationChecks.h | 1 | ||||
-rw-r--r-- | WebCore/platform/mac/RuntimeApplicationChecks.mm | 6 | ||||
-rw-r--r-- | WebCore/platform/mac/ScrollbarThemeMac.mm | 2 | ||||
-rw-r--r-- | WebCore/platform/mac/ThemeMac.mm | 13 | ||||
-rw-r--r-- | WebCore/platform/mac/WebCoreSystemInterface.h | 7 | ||||
-rw-r--r-- | WebCore/platform/mac/WebCoreSystemInterface.mm | 7 | ||||
-rw-r--r-- | WebCore/platform/mac/WidgetMac.mm | 74 |
14 files changed, 103 insertions, 57 deletions
diff --git a/WebCore/platform/mac/ClipboardMac.h b/WebCore/platform/mac/ClipboardMac.h index db6ecb6..9bdd276 100644 --- a/WebCore/platform/mac/ClipboardMac.h +++ b/WebCore/platform/mac/ClipboardMac.h @@ -41,6 +41,7 @@ class NSPasteboard; namespace WebCore { class Frame; +class FileList; class ClipboardMac : public Clipboard, public CachedResourceClient { public: @@ -60,6 +61,7 @@ public: // extensions beyond IE's API virtual HashSet<String> types() const; + virtual PassRefPtr<FileList> files() const; void setDragImage(CachedImage*, const IntPoint&); void setDragImageElement(Node *, const IntPoint&); diff --git a/WebCore/platform/mac/ClipboardMac.mm b/WebCore/platform/mac/ClipboardMac.mm index d1b66a7..52bc952 100644 --- a/WebCore/platform/mac/ClipboardMac.mm +++ b/WebCore/platform/mac/ClipboardMac.mm @@ -31,6 +31,7 @@ #import "DragController.h" #import "Editor.h" #import "FoundationExtras.h" +#import "FileList.h" #import "Frame.h" #import "Image.h" #import "Page.h" @@ -139,7 +140,7 @@ void ClipboardMac::clearAllData() [m_pasteboard.get() declareTypes:[NSArray array] owner:nil]; } -static NSArray *absoluteURLsFromPasteboardFilenames(NSPasteboard* pasteboard, bool onlyFirstURL) +static NSArray *absoluteURLsFromPasteboardFilenames(NSPasteboard* pasteboard, bool onlyFirstURL = false) { NSArray *fileList = [pasteboard propertyListForType:NSFilenamesPboardType]; @@ -163,7 +164,7 @@ static NSArray *absoluteURLsFromPasteboardFilenames(NSPasteboard* pasteboard, bo return urls; } -static NSArray *absoluteURLsFromPasteboard(NSPasteboard* pasteboard, bool onlyFirstURL) +static NSArray *absoluteURLsFromPasteboard(NSPasteboard* pasteboard, bool onlyFirstURL = false) { // NOTE: We must always check [availableTypes containsObject:] before accessing pasteboard data // or CoreFoundation will printf when there is not data of the corresponding type. @@ -274,6 +275,26 @@ HashSet<String> ClipboardMac::types() const return result; } +// FIXME: We could cache the computed fileList if necessary +// Currently each access gets a new copy, setData() modifications to the +// clipboard are not reflected in any FileList objects the page has accessed and stored +PassRefPtr<FileList> ClipboardMac::files() const +{ + if (policy() != ClipboardReadable) + return FileList::create(); + + NSArray *absoluteURLs = absoluteURLsFromPasteboard(m_pasteboard.get()); + NSUInteger count = [absoluteURLs count]; + + RefPtr<FileList> fileList = FileList::create(); + for (NSUInteger x = 0; x < count; x++) { + NSURL *absoluteURL = [NSURL URLWithString:[absoluteURLs objectAtIndex:x]]; + ASSERT([absoluteURL isFileURL]); + fileList->append(File::create([absoluteURL path])); + } + return fileList.release(); // We will always return a FileList, sometimes empty +} + // The rest of these getters don't really have any impact on security, so for now make no checks void ClipboardMac::setDragImage(CachedImage* img, const IntPoint &loc) diff --git a/WebCore/platform/mac/LocalCurrentGraphicsContext.h b/WebCore/platform/mac/LocalCurrentGraphicsContext.h index 1c5cae7..90beb40 100644 --- a/WebCore/platform/mac/LocalCurrentGraphicsContext.h +++ b/WebCore/platform/mac/LocalCurrentGraphicsContext.h @@ -31,7 +31,7 @@ class GraphicsContext; // This class automatically saves and restores the current NSGraphicsContext for // functions which call out into AppKit and rely on the currentContext being set -class LocalCurrentGraphicsContext : Noncopyable { +class LocalCurrentGraphicsContext : public Noncopyable { public: LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); ~LocalCurrentGraphicsContext(); diff --git a/WebCore/platform/mac/LocalizedStringsMac.mm b/WebCore/platform/mac/LocalizedStringsMac.mm index ebb6d93..fdd7df5 100644 --- a/WebCore/platform/mac/LocalizedStringsMac.mm +++ b/WebCore/platform/mac/LocalizedStringsMac.mm @@ -697,4 +697,20 @@ String imageTitle(const String& filename, const IntSize& size) return String(); } +String mediaElementLoadingStateText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] mediaElementLoadingStateText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String mediaElementLiveBroadcastStateText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] mediaElementLiveBroadcastStateText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + } diff --git a/WebCore/platform/mac/LoggingMac.mm b/WebCore/platform/mac/LoggingMac.mm index 2ee983c..d3ba4d7 100644 --- a/WebCore/platform/mac/LoggingMac.mm +++ b/WebCore/platform/mac/LoggingMac.mm @@ -67,7 +67,7 @@ void InitializeLoggingChannelsIfNecessary() initializeWithUserDefault(LogThreading); initializeWithUserDefault(LogStorageAPI); initializeWithUserDefault(LogMedia); - initializeWithUserDefault(LogPlugin); + initializeWithUserDefault(LogPlugins); initializeWithUserDefault(LogArchives); } diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm index c0e43b3..e21f549 100644 --- a/WebCore/platform/mac/PasteboardMac.mm +++ b/WebCore/platform/mac/PasteboardMac.mm @@ -279,7 +279,7 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title) ASSERT(node->renderer() && node->renderer()->isImage()); RenderImage* renderer = toRenderImage(node->renderer()); - CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage()); + CachedImage* cachedImage = renderer->cachedImage(); ASSERT(cachedImage); if (cachedImage->errorOccurred()) diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm index 23324d3..b98235d 100644 --- a/WebCore/platform/mac/PopupMenuMac.mm +++ b/WebCore/platform/mac/PopupMenuMac.mm @@ -91,6 +91,7 @@ void PopupMenu::populate() NSMenuItem* menuItem = [m_popup.get() lastItem]; [menuItem setAttributedTitle:string]; [menuItem setEnabled:client()->itemIsEnabled(i)]; + [menuItem setToolTip:client()->itemToolTip(i)]; [string release]; } } diff --git a/WebCore/platform/mac/RuntimeApplicationChecks.h b/WebCore/platform/mac/RuntimeApplicationChecks.h index 44eedfa..f9c7079 100644 --- a/WebCore/platform/mac/RuntimeApplicationChecks.h +++ b/WebCore/platform/mac/RuntimeApplicationChecks.h @@ -30,6 +30,7 @@ namespace WebCore { bool applicationIsAppleMail(); bool applicationIsSafari(); +bool applicationIsMicrosoftMessenger(); } // namespace WebCore diff --git a/WebCore/platform/mac/RuntimeApplicationChecks.mm b/WebCore/platform/mac/RuntimeApplicationChecks.mm index 1670185..a3c4aa5 100644 --- a/WebCore/platform/mac/RuntimeApplicationChecks.mm +++ b/WebCore/platform/mac/RuntimeApplicationChecks.mm @@ -41,4 +41,10 @@ bool applicationIsSafari() return isSafari; } +bool applicationIsMicrosoftMessenger() +{ + static bool isMicrosoftMessenger = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.microsoft.Messenger"]; + return isMicrosoftMessenger; +} + } // namespace WebCore diff --git a/WebCore/platform/mac/ScrollbarThemeMac.mm b/WebCore/platform/mac/ScrollbarThemeMac.mm index 759a6e1..0a20e2f 100644 --- a/WebCore/platform/mac/ScrollbarThemeMac.mm +++ b/WebCore/platform/mac/ScrollbarThemeMac.mm @@ -391,7 +391,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co bufferRect.intersect(damageRect); bufferRect.move(-scrollbar->frameRect().x(), -scrollbar->frameRect().y()); - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(bufferRect.size(), false); + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(bufferRect.size()); if (!imageBuffer) return true; diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm index a3e743f..e7e12ac 100644 --- a/WebCore/platform/mac/ThemeMac.mm +++ b/WebCore/platform/mac/ThemeMac.mm @@ -26,6 +26,7 @@ #import "config.h" #import "ThemeMac.h" +#import "BlockExceptions.h" #import "GraphicsContext.h" #import "LocalCurrentGraphicsContext.h" #import "ScrollView.h" @@ -195,6 +196,8 @@ static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, f // FIXME: Share more code with radio buttons. static void paintCheckbox(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) { + BEGIN_BLOCK_OBJC_EXCEPTIONS + // Determine the width and height needed for the control and prepare the cell for painting. NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor); @@ -218,6 +221,8 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const [checkboxCell setControlView:nil]; context->restore(); + + END_BLOCK_OBJC_EXCEPTIONS } // Radio Buttons @@ -289,8 +294,10 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int context->translate(-inflatedRect.x(), -inflatedRect.y()); } + BEGIN_BLOCK_OBJC_EXCEPTIONS [radioCell drawWithFrame:NSRect(inflatedRect) inView:scrollView->documentView()]; [radioCell setControlView:nil]; + END_BLOCK_OBJC_EXCEPTIONS context->restore(); } @@ -348,6 +355,8 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) { + BEGIN_BLOCK_OBJC_EXCEPTIONS + // Determine the width and height needed for the control and prepare the cell for painting. NSButtonCell *buttonCell = button(part, states, zoomedRect, zoomFactor); LocalCurrentGraphicsContext localContext(context); @@ -391,6 +400,8 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext* if (![previousDefaultButtonCell isEqual:buttonCell]) [window setDefaultButtonCell:previousDefaultButtonCell]; + + END_BLOCK_OBJC_EXCEPTIONS } // Theme overrides @@ -479,6 +490,7 @@ LengthBox ThemeMac::controlPadding(ControlPart part, const Font& font, const Len void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, IntRect& zoomedRect, float zoomFactor) const { + BEGIN_BLOCK_OBJC_EXCEPTIONS switch (part) { case CheckboxPart: { // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox @@ -520,6 +532,7 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, I default: break; } + END_BLOCK_OBJC_EXCEPTIONS } void ThemeMac::paint(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) const diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h index cbe4aea..768899e 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/WebCore/platform/mac/WebCoreSystemInterface.h @@ -104,8 +104,9 @@ extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius); extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange); extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar); extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance); -extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration); -extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active); +extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, + float duration, unsigned state); +extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*); extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*); extern NSString* (*wkGetMIMETypeForExtension)(NSString*); @@ -122,6 +123,7 @@ extern int (*wkQTMovieDataRate)(QTMovie*); extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*); extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); +extern int (*wkQTMovieGetType)(QTMovie* movie); extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); extern void (*wkSetDragImage)(NSImage*, NSPoint offset); @@ -134,6 +136,7 @@ extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream); extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error); extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); +extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *); #ifndef BUILDING_ON_TIGER extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm index 05d1da6..d0e276f 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -39,9 +39,10 @@ void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius); NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange); NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar); BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance); -void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration); +void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, + float duration, unsigned state); BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); -void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active); +void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*); NSArray* (*wkGetExtensionsForMIMEType)(NSString*); @@ -56,6 +57,7 @@ int (*wkQTMovieDataRate)(QTMovie*); float (*wkQTMovieMaxTimeLoaded)(QTMovie*); NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); float (*wkQTMovieMaxTimeSeekable)(QTMovie*); +int (*wkQTMovieGetType)(QTMovie* movie); void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); void (*wkSetDragImage)(NSImage*, NSPoint offset); @@ -78,6 +80,7 @@ void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL); void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL); id (*wkCreateNSURLConnectionDelegateProxy)(void); unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); +BOOL (*wkIsLatchingWheelEvent)(NSEvent *); #ifndef BUILDING_ON_TIGER void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); diff --git a/WebCore/platform/mac/WidgetMac.mm b/WebCore/platform/mac/WidgetMac.mm index 1aaf4b2..8653a03 100644 --- a/WebCore/platform/mac/WidgetMac.mm +++ b/WebCore/platform/mac/WidgetMac.mm @@ -283,72 +283,52 @@ void Widget::afterMouseDown(NSView *view, Widget* widget) } } -IntPoint Widget::convertFromContainingWindow(const IntPoint& point) const +// These are here to deal with flipped coords on Mac. +IntRect Widget::convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect& rect) { - if (!platformWidget()) { - if (!parent()) - return point; - IntPoint result = parent()->convertFromContainingWindow(point); - result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); - return result; - } - + if (!rootWidget->platformWidget()) + return rect; + BEGIN_BLOCK_OBJC_EXCEPTIONS; - return IntPoint([platformWidget() convertPoint:point fromView:nil]); + return enclosingIntRect([rootWidget->platformWidget() convertRect:rect toView:nil]); END_BLOCK_OBJC_EXCEPTIONS; - - return point; + + return rect; } -IntRect Widget::convertFromContainingWindow(const IntRect& rect) const +IntRect Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, const IntRect& rect) { - if (!platformWidget()) { - if (!parent()) - return rect; - IntRect result = parent()->convertFromContainingWindow(rect); - result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); - return result; - } - + if (!rootWidget->platformWidget()) + return rect; + BEGIN_BLOCK_OBJC_EXCEPTIONS; - return enclosingIntRect([platformWidget() convertRect:rect fromView:nil]); + return enclosingIntRect([rootWidget->platformWidget() convertRect:rect fromView:nil]); END_BLOCK_OBJC_EXCEPTIONS; - + return rect; } -IntRect Widget::convertToContainingWindow(const IntRect& r) const +IntPoint Widget::convertFromRootToContainingWindow(const Widget* rootWidget, const IntPoint& point) { - if (!platformWidget()) { - if (!parent()) - return r; - IntRect result = r; - result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); - return parent()->convertToContainingWindow(result); - } - + if (!rootWidget->platformWidget()) + return point; + BEGIN_BLOCK_OBJC_EXCEPTIONS; - return IntRect([platformWidget() convertRect:r toView:nil]); + return IntPoint([rootWidget->platformWidget() convertPoint:point toView:nil]); END_BLOCK_OBJC_EXCEPTIONS; - - return r; + return point; } - -IntPoint Widget::convertToContainingWindow(const IntPoint& p) const + +IntPoint Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint& point) { - if (!platformWidget()) { - if (!parent()) - return p; - IntPoint result = p; - result.move(parent()->scrollX() - x(), parent()->scrollY() - y()); - return parent()->convertToContainingWindow(result); - } - + if (!rootWidget->platformWidget()) + return point; + BEGIN_BLOCK_OBJC_EXCEPTIONS; - return IntPoint([platformWidget() convertPoint:p toView:nil]); + return IntPoint([rootWidget->platformWidget() convertPoint:point fromView:nil]); END_BLOCK_OBJC_EXCEPTIONS; - return p; + return point; } void Widget::releasePlatformWidget() |