summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/WebCoreSupport')
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h7
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm31
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h6
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm88
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationMock.mm60
-rw-r--r--WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h33
-rw-r--r--WebKit/mac/WebCoreSupport/WebInspectorClient.mm7
-rw-r--r--WebKit/mac/WebCoreSupport/WebPluginHalterClient.h42
-rw-r--r--WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm44
-rw-r--r--WebKit/mac/WebCoreSupport/WebViewFactory.mm142
10 files changed, 443 insertions, 17 deletions
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 7a1d7b3..a8f22f6 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -93,12 +93,13 @@ public:
virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
- virtual PlatformWidget platformWindow() const;
+ virtual PlatformPageClient platformPageClient() const;
virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const;
virtual void setStatusbarText(const WebCore::String&);
+ virtual void scrollbarsModeDidChange() const { }
virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
@@ -149,6 +150,10 @@ public:
virtual void scheduleCompositingLayerSync();
#endif
+ virtual bool supportsFullscreenForNode(const WebCore::Node*);
+ virtual void enterFullscreenForNode(WebCore::Node*);
+ virtual void exitFullscreenForNode(WebCore::Node*);
+
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
private:
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 145255e..a3f004e 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -49,12 +49,14 @@
#import <Foundation/Foundation.h>
#import <WebCore/BlockExceptions.h>
#import <WebCore/Console.h>
+#import <WebCore/Element.h>
#import <WebCore/FileChooser.h>
#import <WebCore/FloatRect.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoadRequest.h>
#import <WebCore/Geolocation.h>
#import <WebCore/HitTestResult.h>
+#import <WebCore/HTMLNames.h>
#import <WebCore/IntRect.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformScreen.h>
@@ -462,7 +464,7 @@ IntRect WebChromeClient::windowToScreen(const IntRect& r) const
return enclosingIntRect(tempRect);
}
-PlatformWidget WebChromeClient::platformWindow() const
+PlatformPageClient WebChromeClient::platformPageClient() const
{
if ([m_webView _usesDocumentViews])
return 0;
@@ -670,12 +672,12 @@ void WebChromeClient::formStateDidChange(const WebCore::Node* node)
void WebChromeClient::formDidFocus(const WebCore::Node* node)
{
- CallUIDelegate(m_webView, @selector(webView:formStateDidFocusNode:), kit(const_cast<WebCore::Node*>(node)));
+ CallUIDelegate(m_webView, @selector(webView:formDidFocusNode:), kit(const_cast<WebCore::Node*>(node)));
}
void WebChromeClient::formDidBlur(const WebCore::Node* node)
{
- CallUIDelegate(m_webView, @selector(webView:formStateDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
+ CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
}
#if USE(ACCELERATED_COMPOSITING)
@@ -715,6 +717,29 @@ void WebChromeClient::scheduleCompositingLayerSync()
#endif
+#if ENABLE(VIDEO)
+
+bool WebChromeClient::supportsFullscreenForNode(const Node* node)
+{
+ return node->hasTagName(WebCore::HTMLNames::videoTag);
+}
+
+void WebChromeClient::enterFullscreenForNode(Node* node)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [m_webView _enterFullscreenForNode:node];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+void WebChromeClient::exitFullscreenForNode(Node*)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [m_webView _exitFullscreen];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+#endif
+
void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 6f0f39f..6259c80 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -144,6 +144,9 @@ private:
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
@@ -205,7 +208,8 @@ private:
NSDictionary *actionDictionary(const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>) const;
virtual bool canCachePage() const;
-
+ virtual bool shouldLoadMediaElementURL(const WebCore::KURL&) const;
+
RetainPtr<WebFrame> m_webFrame;
RetainPtr<WebFramePolicyListener> m_policyListener;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 42b7ff8..ec05572 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -56,6 +56,7 @@
#import "WebKitErrorsPrivate.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
+#import "WebNavigationData.h"
#import "WebNSURLExtras.h"
#import "WebNetscapePluginView.h"
#import "WebNetscapePluginPackage.h"
@@ -68,6 +69,7 @@
#import "WebPolicyDelegatePrivate.h"
#import "WebPreferences.h"
#import "WebResourceLoadDelegate.h"
+#import "WebSecurityOriginInternal.h"
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
@@ -716,7 +718,7 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function,
{
id <WebFormDelegate> formDelegate = [getWebView(m_webFrame.get()) _formDelegate];
if (!formDelegate) {
- (core(m_webFrame.get())->loader()->*function)(PolicyUse);
+ (core(m_webFrame.get())->loader()->policyChecker()->*function)(PolicyUse);
return;
}
@@ -809,7 +811,26 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
void WebFrameLoaderClient::updateGlobalHistory()
{
+ WebView* view = getWebView(m_webFrame.get());
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
+
+ if ([view historyDelegate]) {
+ WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
+ if (implementations->navigatedFunc) {
+ WebNavigationData *data = [[WebNavigationData alloc] initWithURLString:loader->urlForHistory()
+ title:loader->title()
+ originalRequest:loader->originalRequestCopy().nsURLRequest()
+ response:loader->response().nsURLResponse()
+ hasSubstituteData:loader->substituteData().isValid()
+ clientRedirectSource:loader->clientRedirectSourceForHistory()];
+
+ CallHistoryDelegate(implementations->navigatedFunc, view, @selector(webView:didNavigateWithNavigationData:inFrame:), data, m_webFrame.get());
+ [data release];
+ }
+
+ return;
+ }
+
[[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory()
withTitle:loader->title()
method:loader->originalRequestCopy().httpMethod()
@@ -819,16 +840,29 @@ void WebFrameLoaderClient::updateGlobalHistory()
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
+ WebView* view = getWebView(m_webFrame.get());
+ WebHistoryDelegateImplementationCache* implementations = [view historyDelegate] ? WebViewGetHistoryDelegateImplementations(view) : 0;
+
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->clientRedirectFunc) {
+ CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:),
+ loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory());
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->serverRedirectFunc) {
+ CallHistoryDelegate(implementations->serverRedirectFunc, view, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:),
+ loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->serverRedirectDestinationForHistory());
}
}
@@ -841,6 +875,24 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:webItem];
}
+void WebFrameLoaderClient::didDisplayInsecureContent()
+{
+ WebView *webView = getWebView(m_webFrame.get());
+ WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
+ if (implementations->didDisplayInsecureContentFunc)
+ CallFrameLoadDelegate(implementations->didDisplayInsecureContentFunc, webView, @selector(webViewDidDisplayInsecureContent:));
+}
+
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin)
+{
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+
+ WebView *webView = getWebView(m_webFrame.get());
+ WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
+ if (implementations->didRunInsecureContentFunc)
+ CallFrameLoadDelegate(implementations->didRunInsecureContentFunc, webView, @selector(webView:didRunInsecureContent:), webSecurityOrigin.get());
+}
+
ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request)
{
return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()];
@@ -1012,15 +1064,25 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso
return loader.release();
}
-// FIXME: <rdar://problem/4880065> - Push Global History into WebCore
-// Once that task is complete, this will go away
-void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL)
+void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
- NSURL* nsURL = URL;
+ WebView* view = getWebView(m_webFrame.get());
+
+ if ([view historyDelegate]) {
+ WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
+ if (!implementations->setTitleFunc)
+ return;
+
+ CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title, (NSString *)url);
+ return;
+ }
+
+ NSURL* nsURL = url;
nsURL = [nsURL _webkit_canonicalize];
if(!nsURL)
return;
NSString *titleNSString = title;
+
[[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
}
@@ -1145,7 +1207,7 @@ void WebFrameLoaderClient::receivedPolicyDecison(PolicyAction action)
m_policyListener = nil;
m_policyFunction = 0;
- (core(m_webFrame.get())->loader()->*function)(action);
+ (core(m_webFrame.get())->loader()->policyChecker()->*function)(action);
}
String WebFrameLoaderClient::userAgent(const KURL& url)
@@ -1676,6 +1738,16 @@ jobject WebFrameLoaderClient::javaApplet(NSView* view)
}
#endif
+bool WebFrameLoaderClient::shouldLoadMediaElementURL(const KURL& url) const {
+ WebView *webView = getWebView(m_webFrame.get());
+
+ if (id policyDelegate = [webView policyDelegate]) {
+ if ([policyDelegate respondsToSelector:@selector(webView:shouldLoadMediaURL:inFrame:)])
+ return [policyDelegate webView:webView shouldLoadMediaURL:url inFrame:m_webFrame.get()];
+ }
+ return true;
+}
+
@implementation WebFramePolicyListener
+ (void)initialize
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm
new file mode 100644
index 0000000..95b4301
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebGeolocationMockPrivate.h"
+
+#import "WebGeolocationInternal.h"
+#import <WebCore/GeolocationServiceMock.h>
+#import <WebCore/Geoposition.h>
+#import <WebCore/PositionError.h>
+#import <wtf/CurrentTime.h>
+
+
+using namespace WebCore;
+using namespace WTF;
+
+@implementation WebGeolocationMock
+
++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy
+{
+ RefPtr<Coordinates> coordinates = Coordinates::create(latitude,
+ longitude,
+ false, 0.0, // altitude
+ accuracy,
+ false, 0.0, // altitudeAccuracy
+ false, 0.0, // heading
+ false, 0.0); // speed
+ RefPtr<Geoposition> position = Geoposition::create(coordinates.release(), currentTime() * 1000.0);
+ GeolocationServiceMock::setPosition(position.release());
+}
+
++ (void)setError:(int)code:(NSString *)message
+{
+ PositionError::ErrorCode codeEnum = static_cast<PositionError::ErrorCode>(code);
+ RefPtr<PositionError> error = PositionError::create(codeEnum, message);
+ GeolocationServiceMock::setError(error.release());
+}
+
+@end
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h
new file mode 100644
index 0000000..28895f2
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface WebGeolocationMock : NSObject {
+}
+
++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy;
++ (void)setError:(int)code:(NSString *)message;
+@end
diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index 3f0b43d..6a4f67d 100644
--- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -81,8 +81,9 @@ void WebInspectorClient::inspectorDestroyed()
Page* WebInspectorClient::createPage()
{
- if (!m_windowController)
- m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
+ if (m_windowController)
+ [[m_windowController.get() webView] close];
+ m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
return core([m_windowController.get() webView]);
}
@@ -325,7 +326,7 @@ void WebInspectorClient::inspectorWindowObjectCleared()
_visible = YES;
- // If no preference is set - default to an attached window
+ // If no preference is set - default to an attached window. This is important for inspector LayoutTests.
InspectorController::Setting shouldAttach = [_inspectedWebView page]->inspectorController()->setting(inspectorStartsAttachedName);
_shouldAttach = (shouldAttach.type() == InspectorController::Setting::BooleanType) ? shouldAttach.booleanValue() : true;
diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h
new file mode 100644
index 0000000..48c655d
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/PluginHalterClient.h>
+
+namespace WebCore {
+ class Node;
+}
+
+@class WebView;
+
+class WebPluginHalterClient : public WebCore::PluginHalterClient {
+public:
+ WebPluginHalterClient(WebView *);
+
+ virtual bool shouldHaltPlugin(WebCore::Node*) const;
+
+private:
+ WebView *m_webView;
+};
diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm
new file mode 100644
index 0000000..2384d0b
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebPluginHalterClient.h"
+
+#import "DOMNodeInternal.h"
+#import "WebDelegateImplementationCaching.h"
+#import "WebView.h"
+
+using namespace WebCore;
+
+WebPluginHalterClient::WebPluginHalterClient(WebView *webView)
+ : m_webView(webView)
+{
+ ASSERT_ARG(webView, webView);
+}
+
+bool WebPluginHalterClient::shouldHaltPlugin(Node* pluginNode) const
+{
+ ASSERT_ARG(pluginNode, pluginNode);
+ return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webView:shouldHaltPlugin:), kit(pluginNode));
+}
diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm
index 96ebaa4..79b2959 100644
--- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm
+++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2009 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -553,6 +553,43 @@
return UI_STRING("definition", "definition phrase");
}
+- (NSString *)AXARIAContentGroupText:(NSString *)ariaType
+{
+ if ([ariaType isEqualToString:@"ARIAApplicationLog"])
+ return UI_STRING("log", "An ARIA accessibility group that acts as a console log.");
+ if ([ariaType isEqualToString:@"ARIAApplicationMarquee"])
+ return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee.");
+ if ([ariaType isEqualToString:@"ARIAApplicationStatus"])
+ return UI_STRING("application status", "An ARIA accessibility group that acts as a status update.");
+ if ([ariaType isEqualToString:@"ARIAApplicationTimer"])
+ return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer.");
+ if ([ariaType isEqualToString:@"ARIADocument"])
+ return UI_STRING("document", "An ARIA accessibility group that acts as a document.");
+ if ([ariaType isEqualToString:@"ARIADocumentArticle"])
+ return UI_STRING("article", "An ARIA accessibility group that acts as an article.");
+ if ([ariaType isEqualToString:@"ARIADocumentNote"])
+ return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document.");
+ if ([ariaType isEqualToString:@"ARIADocumentRegion"])
+ return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document.");
+ if ([ariaType isEqualToString:@"ARIALandmarkApplication"])
+ return UI_STRING("application", "An ARIA accessibility group that acts as an application.");
+ if ([ariaType isEqualToString:@"ARIALandmarkBanner"])
+ return UI_STRING("banner", "An ARIA accessibility group that acts as a banner.");
+ if ([ariaType isEqualToString:@"ARIALandmarkComplementary"])
+ return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information.");
+ if ([ariaType isEqualToString:@"ARIALandmarkContentInfo"])
+ return UI_STRING("content", "An ARIA accessibility group that contains content.");
+ if ([ariaType isEqualToString:@"ARIALandmarkMain"])
+ return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website.");
+ if ([ariaType isEqualToString:@"ARIALandmarkNavigation"])
+ return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website.");
+ if ([ariaType isEqualToString:@"ARIALandmarkSearch"])
+ return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website.");
+ if ([ariaType isEqualToString:@"ARIAUserInterfaceTooltip"])
+ return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip.");
+ return nil;
+}
+
- (NSString *)AXButtonActionVerb
{
return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
@@ -608,4 +645,107 @@
return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast");
}
+- (NSString*)localizedMediaControlElementString:(NSString*)name
+{
+ if ([name isEqualToString:@"AudioElement"])
+ return UI_STRING("audio element controller", "accessibility role description for audio element controller");
+ if ([name isEqualToString:@"VideoElement"])
+ return UI_STRING("video element controller", "accessibility role description for video element controller");
+
+ // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
+ if ([name isEqualToString:@"ControlsPanel"])
+ return @"";
+
+ if ([name isEqualToString:@"MuteButton"])
+ return UI_STRING("mute", "accessibility role description for mute button");
+ if ([name isEqualToString:@"UnMuteButton"])
+ return UI_STRING("unmute", "accessibility role description for turn mute off button");
+ if ([name isEqualToString:@"PlayButton"])
+ return UI_STRING("play", "accessibility role description for play button");
+ if ([name isEqualToString:@"PauseButton"])
+ return UI_STRING("pause", "accessibility role description for pause button");
+ if ([name isEqualToString:@"Slider"])
+ return UI_STRING("movie time", "accessibility role description for timeline slider");
+ if ([name isEqualToString:@"SliderThumb"])
+ return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb");
+ if ([name isEqualToString:@"RewindButton"])
+ return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button");
+ if ([name isEqualToString:@"ReturnToRealtimeButton"])
+ return UI_STRING("return to realtime", "accessibility role description for return to real time button");
+ if ([name isEqualToString:@"CurrentTimeDisplay"])
+ return UI_STRING("elapsed time", "accessibility role description for elapsed time display");
+ if ([name isEqualToString:@"TimeRemainingDisplay"])
+ return UI_STRING("remaining time", "accessibility role description for time remaining display");
+ if ([name isEqualToString:@"StatusDisplay"])
+ return UI_STRING("status", "accessibility role description for movie status");
+ if ([name isEqualToString:@"FullscreenButton"])
+ return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button");
+ if ([name isEqualToString:@"SeekForwardButton"])
+ return UI_STRING("fast forward", "accessibility role description for fast forward button");
+ if ([name isEqualToString:@"SeekBackButton"])
+ return UI_STRING("fast reverse", "accessibility role description for fast reverse button");
+ ASSERT_NOT_REACHED();
+ return @"";
+}
+
+- (NSString*)localizedMediaControlElementHelpText:(NSString*)name
+{
+ if ([name isEqualToString:@"AudioElement"])
+ return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller");
+ if ([name isEqualToString:@"VideoElement"])
+ return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller");
+
+ if ([name isEqualToString:@"MuteButton"])
+ return UI_STRING("mute audio tracks", "accessibility help text for mute button");
+ if ([name isEqualToString:@"UnMuteButton"])
+ return UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
+ if ([name isEqualToString:@"PlayButton"])
+ return UI_STRING("begin playback", "accessibility help text for play button");
+ if ([name isEqualToString:@"PauseButton"])
+ return UI_STRING("pause playback", "accessibility help text for pause button");
+ if ([name isEqualToString:@"Slider"])
+ return UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
+ if ([name isEqualToString:@"SliderThumb"])
+ return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
+ if ([name isEqualToString:@"RewindButton"])
+ return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
+ if ([name isEqualToString:@"ReturnToRealtimeButton"])
+ return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
+ if ([name isEqualToString:@"CurrentTimeDisplay"])
+ return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
+ if ([name isEqualToString:@"TimeRemainingDisplay"])
+ return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
+ if ([name isEqualToString:@"StatusDisplay"])
+ return UI_STRING("current movie status", "accessibility help text for movie status display");
+ if ([name isEqualToString:@"SeekBackButton"])
+ return UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
+ if ([name isEqualToString:@"SeekForwardButton"])
+ return UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
+ if ([name isEqualToString:@"FullscreenButton"])
+ return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
+ ASSERT_NOT_REACHED();
+ return @"";
+}
+
+- (NSString*)localizedMediaTimeDescription:(float)time
+{
+ if (!isfinite(time))
+ return UI_STRING("indefinite time", "string for an indefinite movie time");
+
+ int seconds = (int)fabsf(time);
+ int days = seconds / (60 * 60 * 24);
+ int hours = seconds / (60 * 60);
+ int minutes = (seconds / 60) % 60;
+ seconds %= 60;
+
+ if (days)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"), days, hours, minutes, seconds];
+ else if (hours)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"), hours, minutes, seconds];
+ else if (minutes)
+ return [NSString stringWithFormat:UI_STRING("date.format.for.minutes", "string for minutes & seconds"), minutes, seconds];
+
+ return [NSString stringWithFormat:UI_STRING("date.format.for.seconds", "string for seconds"), seconds];
+}
+
@end