summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebCoreSupport
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-05 14:36:32 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:30 +0100
commitf05b935882198ccf7d81675736e3aeb089c5113a (patch)
tree4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKit/mac/WebCoreSupport
parent60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff)
downloadexternal_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKit/mac/WebCoreSupport')
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h4
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm53
-rw-r--r--WebKit/mac/WebCoreSupport/WebContextMenuClient.mm6
-rw-r--r--WebKit/mac/WebCoreSupport/WebEditorClient.h9
-rw-r--r--WebKit/mac/WebCoreSupport/WebEditorClient.mm161
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm20
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationClient.h6
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationClient.mm59
-rw-r--r--WebKit/mac/WebCoreSupport/WebSystemInterface.mm2
9 files changed, 242 insertions, 78 deletions
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index a5f49e3..8649662 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -172,7 +172,9 @@ public:
virtual void exitFullScreenForElement(WebCore::Element*);
#endif
- virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
+ // FIXME: Remove once all ports are using client-based geolocation. https://bugs.webkit.org/show_bug.cgi?id=40373
+ // For client-based geolocation, these two methods have moved to WebGeolocationClient. https://bugs.webkit.org/show_bug.cgi?id=50061
+ virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
virtual bool selectItemWritingDirectionIsNatural();
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index fe95989..965e607 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -55,7 +55,6 @@
#import <WebCore/FloatRect.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoadRequest.h>
-#import <WebCore/Geolocation.h>
#import <WebCore/HTMLNames.h>
#import <WebCore/HitTestResult.h>
#import <WebCore/Icon.h>
@@ -102,13 +101,6 @@ using namespace WebCore;
- (id)initWithChooser:(PassRefPtr<FileChooser>)chooser;
@end
-@interface WebGeolocationPolicyListener : NSObject <WebGeolocationPolicyListener>
-{
- RefPtr<Geolocation> _geolocation;
-}
-- (id)initWithGeolocation:(Geolocation*)geolocation;
-@end
-
#if ENABLE(FULLSCREEN_API)
@interface WebKitFullScreenListener : NSObject <WebKitFullScreenListener>
@@ -781,7 +773,7 @@ void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graph
WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
if (graphicsLayer)
- [webHTMLView attachRootLayer:graphicsLayer->nativeLayer()];
+ [webHTMLView attachRootLayer:graphicsLayer->platformLayer()];
else
[webHTMLView detachRootLayer];
END_BLOCK_OBJC_EXCEPTIONS;
@@ -849,27 +841,6 @@ void WebChromeClient::exitFullScreenForElement(Element* element)
#endif
-void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
- if (![[m_webView UIDelegate] respondsToSelector:selector]) {
- geolocation->setIsAllowed(false);
- return;
- }
-
- WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
- WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation];
-
- CallUIDelegate(m_webView, selector, webOrigin, kit(frame), listener);
-
- [webOrigin release];
- [listener release];
-
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
@implementation WebOpenPanelResultListener
- (id)initWithChooser:(PassRefPtr<FileChooser>)chooser
@@ -932,28 +903,6 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca
@end
-@implementation WebGeolocationPolicyListener
-
-- (id)initWithGeolocation:(Geolocation*)geolocation
-{
- if (!(self = [super init]))
- return nil;
- _geolocation = geolocation;
- return self;
-}
-
-- (void)allow
-{
- _geolocation->setIsAllowed(true);
-}
-
-- (void)deny
-{
- _geolocation->setIsAllowed(false);
-}
-
-@end
-
#if ENABLE(FULLSCREEN_API)
@implementation WebKitFullScreenListener
diff --git a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
index f3a85f0..c5a1035 100644
--- a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
@@ -42,8 +42,10 @@
#import "WebViewFactory.h"
#import "WebViewInternal.h"
#import <WebCore/ContextMenu.h>
+#import <WebCore/ContextMenuController.h>
#import <WebCore/KURL.h>
#import <WebCore/LocalizedStrings.h>
+#import <WebCore/Page.h>
#import <WebCore/RuntimeApplicationChecks.h>
#import <WebKit/DOMPrivate.h>
@@ -278,7 +280,7 @@ NSMutableArray* WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu*
if (![delegate respondsToSelector:selector])
return defaultMenu->platformDescription();
- NSDictionary *element = [[[WebElementDictionary alloc] initWithHitTestResult:defaultMenu->hitTestResult()] autorelease];
+ NSDictionary *element = [[[WebElementDictionary alloc] initWithHitTestResult:[m_webView page]->contextMenuController()->hitTestResult()] autorelease];
BOOL preVersion3Client = isPreVersion3Client();
if (preVersion3Client) {
@@ -308,7 +310,7 @@ void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem* item, const
id delegate = [m_webView UIDelegate];
SEL selector = @selector(webView:contextMenuItemSelected:forElement:);
if ([delegate respondsToSelector:selector]) {
- NSDictionary *element = [[WebElementDictionary alloc] initWithHitTestResult:parentMenu->hitTestResult()];
+ NSDictionary *element = [[WebElementDictionary alloc] initWithHitTestResult:[m_webView page]->contextMenuController()->hitTestResult()];
NSMenuItem *platformItem = item->releasePlatformDescription();
CallUIDelegate(m_webView, selector, platformItem, element);
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h
index 23cf312..8a54ca9 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -129,12 +129,13 @@ public:
virtual void updateSpellingUIWithMisspelledWord(const WTF::String&);
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
- virtual void getGuessesForWord(const WTF::String&, WTF::Vector<WTF::String>& guesses);
+ virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses);
virtual void willSetInputMethodState();
virtual void setInputMethodState(bool enabled);
+ virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&);
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
- virtual void dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot);
+ virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, const WTF::Vector<WTF::String>& alternativeReplacementStrings, WebCore::Editor*);
+ virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel);
virtual bool isShowingCorrectionPanel();
#endif
private:
@@ -147,5 +148,7 @@ private:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
BOOL m_correctionPanelIsShown;
+ BOOL m_correctionPanelIsDismissedExternally;
+ WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissingCorrectionPanel;
#endif
};
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 9efa766..d3b38de 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -63,6 +63,7 @@
#import <WebCore/LegacyWebArchive.h>
#import <WebCore/PlatformKeyboardEvent.h>
#import <WebCore/PlatformString.h>
+#import <WebCore/SpellChecker.h>
#import <WebCore/UserTypingGestureIndicator.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <runtime/InitializeThreading.h>
@@ -77,6 +78,22 @@ using namespace WTF;
using namespace HTMLNames;
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+static inline NSCorrectionBubbleType correctionBubbleType(CorrectionPanelInfo::PanelType panelType)
+{
+ switch (panelType) {
+ case CorrectionPanelInfo::PanelTypeCorrection:
+ return NSCorrectionBubbleTypeCorrection;
+ case CorrectionPanelInfo::PanelTypeReversion:
+ return NSCorrectionBubbleTypeReversion;
+ case CorrectionPanelInfo::PanelTypeSpellingSuggestions:
+ return NSCorrectionBubbleTypeGuesses;
+ }
+ ASSERT_NOT_REACHED();
+ return NSCorrectionBubbleTypeCorrection;
+}
+#endif
+
@interface NSAttributedString (WebNSAttributedStringDetails)
- (id)_initWithDOMRange:(DOMRange*)range;
- (DOMDocumentFragment*)_documentFromRange:(NSRange)range document:(DOMDocument*)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources;
@@ -194,7 +211,7 @@ WebEditorClient::WebEditorClient(WebView *webView)
WebEditorClient::~WebEditorClient()
{
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- dismissCorrectionPanel(WebCore::CorrectionWasNotRejected);
+ dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
#endif
}
@@ -856,8 +873,8 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar
}
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, Editor* editor) {
- dismissCorrectionPanel(WebCore::CorrectionWasNotRejected);
+void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings, Editor* editor) {
+ dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
NSRect boundingBoxAsNSRect = boundingBoxOfReplacedString;
NSRect webViewFrame = m_webView.frame;
@@ -868,25 +885,52 @@ void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelTyp
NSString *replacementStringAsNSString = replacementString;
m_correctionPanelIsShown = YES;
- NSCorrectionBubbleType bubbleType = panelType == WebCore::CorrectionPanelInfo::PanelTypeCorrection ? NSCorrectionBubbleTypeCorrection : NSCorrectionBubbleTypeReversion;
- [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:nil forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(NSString *acceptedString) {
- if (!acceptedString && bubbleType == NSCorrectionBubbleTypeCorrection) {
- [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
- editor->handleRejectedCorrection();
- } else if (acceptedString && bubbleType == NSCorrectionBubbleTypeReversion) {
- [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseReverted toCorrection:replacedStringAsNSString forWord:replacementStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
- editor->handleRejectedCorrection();
+ m_correctionPanelIsDismissedExternally = NO;
+ m_reasonForDismissingCorrectionPanel = ReasonForDismissingCorrectionPanelIgnored;
+
+ NSCorrectionBubbleType bubbleType = correctionBubbleType(panelType);
+ NSMutableArray *alternativeStrings = nil;
+ if (!alternativeReplacementStrings.isEmpty()) {
+ size_t size = alternativeReplacementStrings.size();
+ alternativeStrings = [NSMutableArray arrayWithCapacity:size];
+ for (size_t i = 0; i < size; ++i)
+ [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]];
+ }
+ NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker];
+ [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(NSString *acceptedString) {
+ switch (bubbleType) {
+ case NSCorrectionBubbleTypeCorrection:
+ if (acceptedString)
+ [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
+ else {
+ if (!m_correctionPanelIsDismissedExternally || m_reasonForDismissingCorrectionPanel == ReasonForDismissingCorrectionPanelCancelled)
+ [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
+ else
+ [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
+ }
+ break;
+ case NSCorrectionBubbleTypeReversion:
+ if (acceptedString)
+ [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replacedStringAsNSString forWord:acceptedString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
+ break;
+ case NSCorrectionBubbleTypeGuesses:
+ if (acceptedString)
+ [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
+ break;
}
+ editor->handleCorrectionPanelResult(String(acceptedString));
}];
}
-void WebEditorClient::dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot correctionWasRejectedOrNot)
+void WebEditorClient::dismissCorrectionPanel(ReasonForDismissingCorrectionPanel reasonForDismissing)
{
if (isShowingCorrectionPanel()) {
- if (correctionWasRejectedOrNot == CorrectionWasRejected)
- [[NSSpellChecker sharedSpellChecker] cancelCorrectionBubbleForView:m_webView];
- else
+ m_correctionPanelIsDismissedExternally = YES;
+ m_reasonForDismissingCorrectionPanel = reasonForDismissing;
+ if (reasonForDismissing == ReasonForDismissingCorrectionPanelAccepted)
[[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_webView];
+ else
+ [[NSSpellChecker sharedSpellChecker] cancelCorrectionBubbleForView:m_webView];
m_correctionPanelIsShown = NO;
}
}
@@ -916,11 +960,22 @@ bool WebEditorClient::spellingUIIsShowing()
return [[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible];
}
-void WebEditorClient::getGuessesForWord(const String& word, WTF::Vector<String>& guesses)
-{
+void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) {
+ guesses.clear();
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ NSString* language = nil;
+ NSOrthography* orthography = nil;
+ NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
+ if (context.length()) {
+ [checker checkString:context range:NSMakeRange(0, context.length()) types:NSTextCheckingTypeOrthography options:0 inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:&orthography wordCount:0];
+ language = [checker languageForWordRange:NSMakeRange(0, context.length()) inString:context orthography:orthography];
+ }
+ NSArray* stringsArray = [checker guessesForWordRange:NSMakeRange(0, word.length()) inString:word language:language inSpellDocumentWithTag:spellCheckerDocumentTag()];
+#else
NSArray* stringsArray = [[NSSpellChecker sharedSpellChecker] guessesForWord:word];
+#endif
unsigned count = [stringsArray count];
- guesses.clear();
+
if (count > 0) {
NSEnumerator* enumerator = [stringsArray objectEnumerator];
NSString* string;
@@ -936,3 +991,73 @@ void WebEditorClient::willSetInputMethodState()
void WebEditorClient::setInputMethodState(bool)
{
}
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+@interface WebEditorSpellCheckResponder : NSObject
+{
+ WebCore::SpellChecker* _sender;
+ int _sequence;
+ RetainPtr<NSArray> _results;
+}
+- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence results:(NSArray*)results;
+- (void)perform;
+- (WTF::Vector<WebCore::SpellCheckingResult>) _coreResults;
+@end
+
+@implementation WebEditorSpellCheckResponder
+- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence results:(NSArray*)results
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ _sender = sender;
+ _sequence = sequence;
+ _results = results;
+ return self;
+}
+
+- (void)perform
+{
+ _sender->didCheck(_sequence, [self _coreResults]);
+}
+
+static SpellCheckingResult toCoreSpellingResult(NSTextCheckingResult* result)
+{
+ NSTextCheckingType type = [result resultType];
+ NSRange range = [result range];
+ DocumentMarker::MarkerType coreType;
+ if (type & NSTextCheckingTypeSpelling)
+ coreType = DocumentMarker::Spelling;
+ else if (type & NSTextCheckingTypeGrammar)
+ coreType = DocumentMarker::Grammar;
+ else
+ coreType = DocumentMarker::AllMarkers;
+
+ return SpellCheckingResult(coreType, range.location, range.length);
+}
+
+- (WTF::Vector<WebCore::SpellCheckingResult>)_coreResults
+{
+ WTF::Vector<WebCore::SpellCheckingResult> coreResults;
+ coreResults.reserveCapacity([_results.get() count]);
+ for (NSTextCheckingResult* result in _results.get())
+ coreResults.append(toCoreSpellingResult(result));
+ return coreResults;
+}
+
+@end
+#endif
+
+void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int sequence, const String& text)
+{
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ NSRange range = NSMakeRange(0, text.length());
+ NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
+ [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:text range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0
+ completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {
+ [currentLoop performSelector:@selector(perform)
+ target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence results:results] autorelease]
+ argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
+ }];
+#endif
+}
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 5968084..c8285dc 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1568,7 +1568,25 @@ public:
else if (event->type() == eventNames().mouseoutEvent)
[(WebBaseNetscapePluginView *)platformWidget() handleMouseExited:currentNSEvent];
}
-
+
+private:
+ virtual void notifyWidget(WidgetNotification notification)
+ {
+ switch (notification) {
+ case WillPaintFlattened: {
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [(WebBaseNetscapePluginView *)platformWidget() cacheSnapshot];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ break;
+ }
+ case DidPaintFlattened: {
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [(WebBaseNetscapePluginView *)platformWidget() clearCachedSnapshot];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ break;
+ }
+ }
+ }
};
#if USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationClient.h b/WebKit/mac/WebCoreSupport/WebGeolocationClient.h
index 5ea3369..b8e7b87 100644
--- a/WebKit/mac/WebCoreSupport/WebGeolocationClient.h
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationClient.h
@@ -26,7 +26,8 @@
#import <WebCore/GeolocationClient.h>
namespace WebCore {
- class GeolocationPosition;
+class Geolocation;
+class GeolocationPosition;
}
@class WebView;
@@ -43,6 +44,9 @@ public:
WebCore::GeolocationPosition* lastPosition();
+ void requestPermission(WebCore::Geolocation*);
+ void cancelPermissionRequest(WebCore::Geolocation*) { };
+
private:
WebView *m_webView;
};
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm b/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
index a635b44..b52b7bc 100644
--- a/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
@@ -25,11 +25,25 @@
#import "WebGeolocationClient.h"
+#import "WebDelegateImplementationCaching.h"
+#import "WebFrameInternal.h"
#import "WebGeolocationPositionInternal.h"
+#import "WebSecurityOriginInternal.h"
+#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
+#import <WebCore/BlockExceptions.h>
+#import <WebCore/Frame.h>
+#import <WebCore/Geolocation.h>
using namespace WebCore;
+@interface WebGeolocationPolicyListener : NSObject <WebGeolocationPolicyListener>
+{
+ RefPtr<Geolocation> _geolocation;
+}
+- (id)initWithGeolocation:(Geolocation*)geolocation;
+@end
+
WebGeolocationClient::WebGeolocationClient(WebView *webView)
: m_webView(webView)
{
@@ -50,6 +64,28 @@ void WebGeolocationClient::stopUpdating()
[[m_webView _geolocationProvider] unregisterWebView:m_webView];
}
+void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
+ if (![[m_webView UIDelegate] respondsToSelector:selector]) {
+ geolocation->setIsAllowed(false);
+ return;
+ }
+
+ Frame *frame = geolocation->frame();
+ WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
+ WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation];
+
+ CallUIDelegate(m_webView, selector, webOrigin, kit(frame), listener);
+
+ [webOrigin release];
+ [listener release];
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
GeolocationPosition* WebGeolocationClient::lastPosition()
{
#if ENABLE(CLIENT_BASED_GEOLOCATION)
@@ -58,3 +94,26 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
return 0;
#endif
}
+
+@implementation WebGeolocationPolicyListener
+
+- (id)initWithGeolocation:(Geolocation*)geolocation
+{
+ if (!(self = [super init]))
+ return nil;
+ _geolocation = geolocation;
+ return self;
+}
+
+- (void)allow
+{
+ _geolocation->setIsAllowed(true);
+}
+
+- (void)deny
+{
+ _geolocation->setIsAllowed(false);
+}
+
+@end
+
diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 2c57646..e1c1058 100644
--- a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -121,6 +121,8 @@ void InitWebCoreSystemInterface(void)
INIT(CreateCTLineWithUniCharProvider);
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+ INIT(IOSurfaceContextCreate);
+ INIT(IOSurfaceContextCreateImage);
#endif
didInit = true;