summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/WebCoreSupport')
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h6
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm71
-rw-r--r--WebKit/mac/WebCoreSupport/WebEditorClient.h14
-rw-r--r--WebKit/mac/WebCoreSupport/WebEditorClient.mm46
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm20
-rw-r--r--WebKit/mac/WebCoreSupport/WebSystemInterface.mm1
6 files changed, 150 insertions, 8 deletions
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index e5de14d..5f3b727 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -164,6 +164,12 @@ public:
virtual void enterFullscreenForNode(WebCore::Node*);
virtual void exitFullscreenForNode(WebCore::Node*);
#endif
+
+#if ENABLE(FULLSCREEN_API)
+ virtual bool supportsFullScreenForElement(const WebCore::Element*);
+ virtual void enterFullScreenForElement(WebCore::Element*);
+ virtual void exitFullScreenForElement(WebCore::Element*);
+#endif
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 2c2616d..d973e2b 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -110,6 +110,16 @@ using namespace WebCore;
- (id)initWithGeolocation:(Geolocation*)geolocation;
@end
+#if ENABLE(FULLSCREEN_API)
+@interface WebKitFullScreenListener : NSObject <WebKitFullScreenListener>
+{
+ RefPtr<Element> _element;
+}
+
+- (id)initWithElement:(Element*)element;
+@end
+#endif
+
WebChromeClient::WebChromeClient(WebView *webView)
: m_webView(webView)
{
@@ -815,6 +825,29 @@ void WebChromeClient::exitFullscreenForNode(Node*)
#endif
+#if ENABLE(FULLSCREEN_API)
+
+bool WebChromeClient::supportsFullScreenForElement(const Element* element)
+{
+ return CallUIDelegateReturningBoolean(false, m_webView, @selector(webView:supportsFullScreenForElement:), kit(const_cast<WebCore::Element*>(element)));
+}
+
+void WebChromeClient::enterFullScreenForElement(Element* element)
+{
+ WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+ CallUIDelegate(m_webView, @selector(webView:enterFullScreenForElement:listener:), kit(element), listener);
+ [listener release];
+}
+
+void WebChromeClient::exitFullScreenForElement(Element* element)
+{
+ WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+ CallUIDelegate(m_webView, @selector(webView:exitFullScreenForElement:listener:), kit(element), listener);
+ [listener release];
+}
+
+#endif
+
void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -919,3 +952,41 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca
}
@end
+
+#if ENABLE(FULLSCREEN_API)
+@implementation WebKitFullScreenListener
+- (id)initWithElement:(Element*)element
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _element = element;
+ return self;
+}
+
+- (void)webkitWillEnterFullScreen
+{
+ if (_element)
+ _element->document()->webkitWillEnterFullScreenForElement(_element.get());
+}
+
+- (void)webkitDidEnterFullScreen
+{
+ if (_element)
+ _element->document()->webkitDidEnterFullScreenForElement(_element.get());
+}
+
+- (void)webkitWillExitFullScreen
+{
+ if (_element)
+ _element->document()->webkitWillExitFullScreenForElement(_element.get());
+}
+
+- (void)webkitDidExitFullScreen
+{
+ if (_element)
+ _element->document()->webkitDidExitFullScreenForElement(_element.get());
+}
+
+@end
+#endif
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h
index e6426aa..fe33e05 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -27,6 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import <WebCore/Editor.h>
#import <WebCore/EditorClient.h>
#import <wtf/RetainPtr.h>
#import <wtf/Forward.h>
@@ -38,7 +39,7 @@
class WebEditorClient : public WebCore::EditorClient {
public:
WebEditorClient(WebView *);
-
+ virtual ~WebEditorClient();
virtual void pageDestroyed();
virtual bool isGrammarCheckingEnabled();
@@ -129,12 +130,19 @@ public:
virtual void getGuessesForWord(const WTF::String&, WTF::Vector<WTF::String>& guesses);
virtual void willSetInputMethodState();
virtual void setInputMethodState(bool enabled);
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
+ virtual void dismissCorrectionPanel(bool correctionAccepted);
+#endif
private:
void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo);
WebEditorClient();
-
+
WebView *m_webView;
RetainPtr<WebEditorUndoTarget> m_undoTarget;
-
bool m_haveUndoRedoOperations;
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ NSInteger m_correctionPanelTag;
+#endif
};
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 2c89919..41cff68 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -64,6 +64,9 @@
#import <runtime/InitializeThreading.h>
#import <wtf/PassRefPtr.h>
#import <wtf/Threading.h>
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#import <AppKit/NSTextChecker.h>
+#endif
using namespace WebCore;
using namespace WTF;
@@ -171,7 +174,17 @@ WebEditorClient::WebEditorClient(WebView *webView)
: m_webView(webView)
, m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease])
, m_haveUndoRedoOperations(false)
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ , m_correctionPanelTag(-1)
+#endif
+{
+}
+
+WebEditorClient::~WebEditorClient()
{
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ dismissCorrectionPanel(true);
+#endif
}
bool WebEditorClient::isContinuousSpellCheckingEnabled()
@@ -286,6 +299,10 @@ void WebEditorClient::respondToChangedSelection()
{
[m_webView _selectionChanged];
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ dismissCorrectionPanel(true);
+#endif
+
// FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"])
return;
@@ -790,6 +807,35 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar
#endif
}
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+void WebEditorClient::showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, Editor* editor) {
+ dismissCorrectionPanel(true);
+
+ NSRect boundingBoxAsNSRect = boundingBoxOfReplacedString;
+ NSRect webViewFrame = m_webView.frame;
+ boundingBoxAsNSRect.origin.y = webViewFrame.size.height-NSMaxY(boundingBoxAsNSRect);
+
+ // Need to explicitly use these local NSString objects, because the C++ references may be invalidated by the time the block below is executed.
+ NSString *replacedStringAsNSString = replacedString;
+ NSString *replacementStringAsNSString = replacementString;
+
+ m_correctionPanelTag = [[NSSpellChecker sharedSpellChecker] showCorrection:replacementStringAsNSString forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(BOOL accepted) {
+ if (!accepted) {
+ [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
+ editor->handleRejectedCorrection();
+ }
+ }];
+}
+
+void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
+{
+ if (m_correctionPanelTag >= 0) {
+ [[NSSpellChecker sharedSpellChecker] dismissCorrection:m_correctionPanelTag acceptCorrection:correctionAccepted];
+ m_correctionPanelTag = -1;
+ }
+}
+#endif
+
void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
{
[[NSSpellChecker sharedSpellChecker] updateSpellingPanelWithMisspelledWord:misspelledWord];
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 8bdeca0..3f7c471 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -241,8 +241,6 @@ bool WebFrameLoaderClient::hasHTMLView() const
void WebFrameLoaderClient::forceLayout()
{
NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
- if ([view isKindOfClass:[WebHTMLView class]])
- [(WebHTMLView *)view setNeedsToApplyStyles:YES];
[view setNeedsLayout:YES];
[view layout];
}
@@ -1576,8 +1574,20 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP
NSURL *baseURL = document->baseURL();
NSURL *pluginURL = url;
+ // <rdar://problem/8366089>: AppleConnect has a bug where it does not
+ // understand the parameter names specified in the <object> element that
+ // embeds its plug-in. This site-specific hack works around the issue by
+ // converting the parameter names to lowercase before passing them to the
+ // plug-in.
+ Frame* frame = core(m_webFrame.get());
+ NSMutableArray *attributeKeys = kit(paramNames);
+ if (frame && frame->settings()->needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) {
+ for (NSUInteger i = 0; i < [attributeKeys count]; ++i)
+ [attributeKeys replaceObjectAtIndex:i withObject:[[attributeKeys objectAtIndex:i] lowercaseString]];
+ }
+
if ([[webView UIDelegate] respondsToSelector:selector]) {
- NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:kit(paramNames)];
+ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:attributeKeys];
NSDictionary *arguments = [[NSDictionary alloc] initWithObjectsAndKeys:
attributes, WebPlugInAttributesKey,
[NSNumber numberWithInt:loadManually ? WebPlugInModeFull : WebPlugInModeEmbed], WebPlugInModeKey,
@@ -1620,7 +1630,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP
if (pluginPackage) {
if ([pluginPackage isKindOfClass:[WebPluginPackage class]])
- view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), loadManually);
+ view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, attributeKeys, kit(paramValues), baseURL, kit(element), loadManually);
#if ENABLE(NETSCAPE_PLUGIN_API)
else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) {
@@ -1630,7 +1640,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP
URL:pluginURL
baseURL:baseURL
MIMEType:MIMEType
- attributeKeys:kit(paramNames)
+ attributeKeys:attributeKeys
attributeValues:kit(paramValues)
loadManually:loadManually
element:element] autorelease];
diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 0b74dee..47b16b2 100644
--- a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -84,6 +84,7 @@ void InitWebCoreSystemInterface(void)
INIT(SignalCFReadStreamHasBytes);
INIT(QTIncludeOnlyModernMediaFileTypes);
INIT(QTMovieDataRate);
+ INIT(QTMovieDisableComponent);
INIT(QTMovieMaxTimeLoaded);
INIT(QTMovieMaxTimeLoadedChangeNotification);
INIT(QTMovieMaxTimeSeekable);