summaryrefslogtreecommitdiffstats
path: root/WebKit/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac')
-rw-r--r--WebKit/mac/ChangeLog251
-rw-r--r--WebKit/mac/History/WebHistory.mm18
-rw-r--r--WebKit/mac/Info.plist2
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm2
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm6
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h1
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm35
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h7
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm10
-rw-r--r--WebKit/mac/WebCoreSupport/WebInspectorClient.mm30
-rw-r--r--WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm8
-rw-r--r--WebKit/mac/WebView/WebDocumentInternal.h3
-rw-r--r--WebKit/mac/WebView/WebFrame.mm57
-rw-r--r--WebKit/mac/WebView/WebFrameInternal.h4
-rw-r--r--WebKit/mac/WebView/WebFramePrivate.h3
-rw-r--r--WebKit/mac/WebView/WebFullScreenController.h78
-rw-r--r--WebKit/mac/WebView/WebFullScreenController.mm923
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm13
-rw-r--r--WebKit/mac/WebView/WebPDFView.mm36
-rw-r--r--WebKit/mac/WebView/WebScriptDebugger.mm2
-rw-r--r--WebKit/mac/WebView/WebScriptWorld.mm2
-rw-r--r--WebKit/mac/WebView/WebTextCompletionController.mm2
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenController.mm12
-rw-r--r--WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm4
-rw-r--r--WebKit/mac/WebView/WebView.mm39
-rw-r--r--WebKit/mac/WebView/WebViewData.h7
-rw-r--r--WebKit/mac/WebView/WebViewInternal.h9
27 files changed, 1457 insertions, 107 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 1a66b1a..5bd9ff5 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,254 @@
+2011-01-07 Jer Noble <jer.noble@apple.com>
+
+ Yet another Leopard build fix: NSRect and CGRect are not inter-
+ changable in 32-bit.
+
+ * WebView/WebFullScreenController.mm:
+ (-[WebFullScreenController exitFullscreen]):
+
+2011-01-07 Jer Noble <jer.noble@apple.com>
+
+ Fix the Leopard build: Replace CoreAnimation SL-only functions
+ with Leopard equivalents.
+
+ * WebView/WebFullScreenController.mm:
+ (+[CATransaction setDisableActions:]):
+ (+[CATransaction setAnimationDuration:]):
+ (-[WebFullScreenController _animationDuration]):
+ (-[WebFullscreenWindow initWithContentRect:styleMask:backing:defer:]):
+
+2010-12-21 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Implement WebKit Full Screen support.
+ https://bugs.webkit.org/show_bug.cgi?id=49481
+ rdar://problem/8247444
+
+ Support the new fullscreen Chrome client requests. WebView will pass
+ through these requests to a WebFullscreenController.
+
+ * WebCoreSupport/WebChromeClient.h: Add fullScreenRendererChanged().
+ * WebView/WebView.mm:
+ (-[WebView _supportsFullScreenForElement:WebCore::]): Check to see if the fullscreen pref has been enabled.
+ (-[WebView _enterFullScreenForElement:WebCore::]): Create a WebFullScreenController.
+ (-[WebView _exitFullScreenForElement:WebCore::]): Request that the WebFullScreenController exit fullscreen.
+ (-[WebView _fullScreenRendererChanged:WebCore::]): Notify the WebFullScreenController that its renderer has changed.
+ * WebView/WebViewData.h: Add ivar newFullscreenController.
+
+2010-12-17 Jer Noble <jer@kokode.apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Implement WebKit Full Screen support.
+ https://bugs.webkit.org/show_bug.cgi?id=49481
+ rdar://problem/8247444
+
+ This patch implements the FullScreen APIs using the new RenderFullScreen renderer and the new
+ Document client APIs. The RenderFullScreen renderer's CALayer is hosted in a new, fullscreen
+ window, and a custom CAAnimation animates that layer between the initial screen rect of the
+ full screen element, to its final value. WebFullscreenController will swap the WebView out of
+ its original window, and into the fullscreen window. The controller will replace the WebView
+ with a placeholder view, so that if the placeholder moves or resized while the WebView is
+ absent, the WebView will move back to the correct location when exiting fullscreen.
+
+ * WebView/WebFullscreenController.h: Added.
+ * WebView/WebFullscreenController.mm: Added.
+ (-[WebFullscreenController windowDidExitFullscreen:]): Close the fullscreen window.
+ (-[WebFullscreenController windowDidEnterFullscreen:]): Swap the webView back into the fullscreen window.
+ (-[WebFullscreenController animationDidStop:finished:]): Call windowDid{Exit|Enter}FullScreen as appropriate.
+ (-[WebFullscreenController applicationDidResignActive:]):
+ (-[WebFullscreenController applicationDidChangeScreenParameters:]): Resize the fullscreen window to match
+ the new screen parameters.
+ (-[WebFullscreenController enterFullscreen:]): Set up the animation that will take the fullscreen element
+ from its original screen rect into fullscreen.
+ (-[WebFullscreenController exitFullscreen]): Swap the webView back into its original window.
+ Set up the animation that will take the fullscreen element back into its original screen
+ rect.
+ (-[WebFullscreenController _updatePowerAssertions]): Now checks _isAnyMoviePlaying to determine
+ whether to disable screensaver and sleep.
+ (-[WebFullscreenController _isAnyMoviePlaying]): Walks through the sub-tree starting at the fullscreen element
+ looking for HTMLVideoElements; returns whether any are found to be playing.
+ (-[WebFullscreenController _animationDuration]): Returns the current animation duration, affected by control
+ and shift keys.
+ (-[WebFullscreenWindow canBecomeKeyWindow]): Allow the window to become key.
+ (-[WebFullscreenWindow keyDown:]): Handle the 'Esc' key.
+ (-[WebFullscreenWindow cancelOperation:]): Request to exit fullscreen.
+ (-[WebFullscreenWindow rendererLayer]): Convenience accessor.
+ (-[WebFullscreenWindow setRendererLayer:]): Ditto.
+ (-[WebFullscreenWindow backgroundLayer]): Ditto.
+ (-[WebFullscreenWindow animationView]): Ditto.
+ (MediaEventListener::MediaEventListener): Implements the EventListener protocol.
+ (MediaEventListener::handleEvent): Tells its delegate to _updatePowerAssertions.
+
+2011-01-07 James Robinson <jamesr@chromium.org>
+
+ Revert "Implement mozilla's animationTime property"
+ https://bugs.webkit.org/show_bug.cgi?id=51952
+
+ This approach isn't quite right.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawRect:]):
+ * WebView/WebView.mm:
+ (layerSyncRunLoopObserverCallBack):
+
+2011-01-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 52035 - Unregistering DOMWrapperWorlds is unsafe
+
+ The method DOMWrapperWorld::unregisterWorld() effectively calls the DOMWrapperWorld's
+ destructor early, in order to release wrappers once we know we no longer intend to use them.
+ Whilst it is okay to have a method to throw away wrappers (assuming we know we're willing to
+ lose any state stored on them) it is not okay to deregister the world from the JSGlobalData.
+ A sequence of events that triggers the bug would look like this:
+
+ (1) Create a DOMWrapperWorld.
+ (2) Register a timer in the world.
+ (3) Call unregisterWorld() on the world.
+ (4) Timer goes off, code is executed in the world, creates a Node not attached to a Document.
+ (5) We attempt to lookup a wrapper map for the world on the JSGlobalData, but because we've
+ called forgetWorld() none exists.
+ (6) Attempt to add a wrapper to a NULL map.
+
+ Fix the problem by not removing the JSGlobalData's wrapper map until the world really goes away.
+
+ * WebView/WebScriptWorld.mm:
+ (-[WebScriptWorld unregisterWorld]):
+
+2011-01-04 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ WK2: Support Accessibility
+ https://bugs.webkit.org/show_bug.cgi?id=51859
+
+ Use rootObject() method to get top of AX tree.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ (WebFrameLoaderClient::accessibilityRemoteObject):
+ * WebView/WebFrame.mm:
+ (-[WebFrame setAccessibleName:]):
+ (-[WebFrame accessibilityRoot]):
+ * WebView/WebFrameInternal.h:
+ * WebView/WebFramePrivate.h:
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView accessibilityAttributeValue:]):
+ (-[WebHTMLView accessibilityFocusedUIElement]):
+ (-[WebHTMLView accessibilityHitTest:]):
+ (-[WebHTMLView _accessibilityParentForSubview:]):
+
+2011-01-04 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/51889> WebFrameLoaderClient::createMediaPlayerProxyPlugin() should use WebCore::PluginInfo.name
+
+ Reviewed by Eric Carlson.
+
+ This originally broke in r61581. It is inside an
+ ENABLE(PLUGIN_PROXY_FOR_VIDEO) macro, so it didn't break the Mac
+ build then.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm: Call
+ (WebFrameLoaderClient::createMediaPlayerProxyPlugin): Updated to
+ use WebCore::PluginInfo.name instead of
+ -[WebBasePluginPackage name].
+
+2011-01-02 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Simon Fraser.
+
+ <rdar://problem/8812159> Update copyright strings
+
+ * Info.plist:
+
+2010-12-29 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Ada Chan.
+
+ <rdar://problem/8758191> REGRESSION (r72887): Mail crashes when doing searches in a message due to method name conflict
+ https://bugs.webkit.org/show_bug.cgi?id=51717
+
+ Renamed -findString:options: to -_findString:options: in the WebDocumentOptionsSearching
+ protocol to avoid conflict with -[WebHTMLView(MailExtras) findString:options:] which Mail defines.
+
+ * WebView/WebDocumentInternal.h:
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView searchFor:direction:caseSensitive:wrap:startInSelection:]):
+ (-[WebHTMLView _findString:options:]):
+ * WebView/WebView.mm:
+ (findString):
+
+2010-12-28 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Sam Weinig.
+
+ Substitute // MARK: for compiler-specific #pragma mark
+ https://bugs.webkit.org/show_bug.cgi?id=51657
+
+ For consistency, we should substitute "// MARK:" for compiler-
+ specific "#pragma mark" in the source files for the Mac port.
+
+ * History/WebHistory.mm:
+ * Plugins/WebBaseNetscapePluginView.mm:
+ * Plugins/WebNetscapePluginView.mm:
+ * WebCoreSupport/WebInspectorClient.mm:
+ * WebCoreSupport/WebSecurityOrigin.mm:
+ * WebView/WebPDFView.mm:
+ * WebView/WebVideoFullscreenController.mm:
+ * WebView/WebVideoFullscreenHUDWindowController.mm:
+
+2010-12-23 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WebKit crashes at DebuggerCallFrame::functionName() if m_callFrame is the top global callframe.
+ https://bugs.webkit.org/show_bug.cgi?id=38535
+
+ WebScriptDebugger in WebKit has empty implementations for willExecuteProgram and didExecuteProgram. As a result,
+ if the top call frame is from a program, WebKitScriptDebugger doesn't record that callframe as the top frame, and
+ WebScriptDebugger's callframe stack is wrong from this point. That could cause crash if we trying to access the top
+ call frame from this stack when an exception throws because the saved top frame could be invalid.
+
+ To fix that, we need to maintain the call frame stack in willExecuteProgram and didExecuteProgram, as we did in
+ callEvent and returnEvent.
+
+ * WebView/WebScriptDebugger.mm:
+ (WebScriptDebugger::willExecuteProgram):
+ (WebScriptDebugger::didExecuteProgram):
+
+2010-12-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ WebKit2 needs to mirror the frame tree in the UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=51546
+
+ - Add client functions to notify that a frame has been added or
+ removed from the page cache.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didSaveToPageCache):
+ (WebFrameLoaderClient::didRestoreFromPageCache):
+
+2010-12-22 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Editor.h doesn't need to include SelectionController.h
+ https://bugs.webkit.org/show_bug.cgi?id=51441
+
+ Renamed SelectionController::EDirection to SelectionDirection.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _rangeByAlteringCurrentSelection:SelectionController::direction:granularity:]):
+ Takes SelectionDirection instead of SelectionController::EDirection.
+ * WebView/WebFrameInternal.h:
+ * WebView/WebTextCompletionController.mm:
+ (-[WebTextCompletionController doCompletion]): Calls _rangeByAlteringCurrentSelection:SelectionController.
+
2010-12-22 Simon Fraser <simon.fraser@apple.com>
Reviewed by Darin Adler.
diff --git a/WebKit/mac/History/WebHistory.mm b/WebKit/mac/History/WebHistory.mm
index af40a24..00cee78 100644
--- a/WebKit/mac/History/WebHistory.mm
+++ b/WebKit/mac/History/WebHistory.mm
@@ -110,7 +110,7 @@ private:
@implementation WebHistoryPrivate
-#pragma mark OBJECT FRAMEWORK
+// MARK: OBJECT FRAMEWORK
+ (void)initialize
{
@@ -146,7 +146,7 @@ private:
[super finalize];
}
-#pragma mark MODIFYING CONTENTS
+// MARK: MODIFYING CONTENTS
static void getDayBoundaries(NSTimeInterval interval, NSTimeInterval& beginningOfDay, NSTimeInterval& beginningOfNextDay)
{
@@ -399,7 +399,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
[self addItem:entry discardDuplicate:NO];
}
-#pragma mark DATE-BASED RETRIEVAL
+// MARK: DATE-BASED RETRIEVAL
- (NSArray *)orderedLastVisitedDays
{
@@ -431,7 +431,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
return _entriesByDate->get(dateKey).get();
}
-#pragma mark URL MATCHING
+// MARK: URL MATCHING
- (WebHistoryItem *)itemForURLString:(NSString *)URLString
{
@@ -453,7 +453,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
return [_entriesByURL allValues];
}
-#pragma mark ARCHIVING/UNARCHIVING
+// MARK: ARCHIVING/UNARCHIVING
- (void)setHistoryAgeInDaysLimit:(int)limit
{
@@ -676,7 +676,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
[super dealloc];
}
-#pragma mark MODIFYING CONTENTS
+// MARK: MODIFYING CONTENTS
- (void)_sendNotification:(NSString *)name entries:(NSArray *)entries
{
@@ -707,7 +707,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
entries:newEntries];
}
-#pragma mark DATE-BASED RETRIEVAL
+// MARK: DATE-BASED RETRIEVAL
- (NSArray *)orderedLastVisitedDays
{
@@ -719,7 +719,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
return [_historyPrivate orderedItemsLastVisitedOnDay:date];
}
-#pragma mark URL MATCHING
+// MARK: URL MATCHING
- (BOOL)containsURL:(NSURL *)URL
{
@@ -731,7 +731,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
return [_historyPrivate itemForURL:URL];
}
-#pragma mark SAVING TO DISK
+// MARK: SAVING TO DISK
- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error
{
diff --git a/WebKit/mac/Info.plist b/WebKit/mac/Info.plist
index 7232293..34ec7d4 100644
--- a/WebKit/mac/Info.plist
+++ b/WebKit/mac/Info.plist
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleGetInfoString</key>
- <string>${BUNDLE_VERSION}, Copyright 2003-2010 Apple Inc.</string>
+ <string>${BUNDLE_VERSION}, Copyright 2003-2011 Apple Inc.</string>
<key>CFBundleIdentifier</key>
<string>com.apple.${PRODUCT_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 7837608..7f73443 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -690,7 +690,7 @@ String WebHaltablePlugin::pluginName() const
}
}
-#pragma mark NOTIFICATIONS
+// MARK: NOTIFICATIONS
- (void)windowWillClose:(NSNotification *)notification
{
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index dbbe129..b215c8d 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -199,7 +199,7 @@ typedef struct {
WKSendUserChangeNotifications();
}
-#pragma mark EVENTS
+// MARK: EVENTS
// The WindowRef created by -[NSWindow windowRef] has a QuickDraw GrafPort that covers
// the entire window frame (or structure region to use the Carbon term) rather then just the window content.
@@ -859,7 +859,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
[self didCallPlugInFunction];
}
-#pragma mark WEB_NETSCAPE_PLUGIN
+// MARK: WEB_NETSCAPE_PLUGIN
- (BOOL)isNewWindowEqualToOldWindow
{
@@ -1342,7 +1342,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
}
#endif
-#pragma mark NSVIEW
+// MARK: NSVIEW
- (id)initWithFrame:(NSRect)frame
pluginPackage:(WebNetscapePluginPackage *)pluginPackage
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 8649662..05db524 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -164,6 +164,7 @@ public:
virtual bool supportsFullscreenForNode(const WebCore::Node*);
virtual void enterFullscreenForNode(WebCore::Node*);
virtual void exitFullscreenForNode(WebCore::Node*);
+ virtual void fullScreenRendererChanged(WebCore::RenderBox*);
#endif
#if ENABLE(FULLSCREEN_API)
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 965e607..a2c4ee5 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -29,6 +29,7 @@
#import "WebChromeClient.h"
+#import "DOMElementInternal.h"
#import "DOMNodeInternal.h"
#import "WebDefaultUIDelegate.h"
#import "WebDelegateImplementationCaching.h"
@@ -822,21 +823,41 @@ void WebChromeClient::exitFullscreenForNode(Node*)
bool WebChromeClient::supportsFullScreenForElement(const Element* element)
{
- return CallUIDelegateReturningBoolean(false, m_webView, @selector(webView:supportsFullScreenForElement:), kit(const_cast<WebCore::Element*>(element)));
+ SEL selector = @selector(webView:supportsFullScreenForElement:);
+ if ([[m_webView UIDelegate] respondsToSelector:selector])
+ return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)));
+ return [m_webView _supportsFullScreenForElement: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];
+ SEL selector = @selector(webView:enterFullScreenForElement:listener:);
+ if ([[m_webView UIDelegate] respondsToSelector:selector]) {
+ WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+ CallUIDelegate(m_webView, selector, kit(element), listener);
+ [listener release];
+ } else
+ [m_webView _enterFullScreenForElement:element];
}
void WebChromeClient::exitFullScreenForElement(Element* element)
{
- WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
- CallUIDelegate(m_webView, @selector(webView:exitFullScreenForElement:listener:), kit(element), listener);
- [listener release];
+ SEL selector = @selector(webView:exitFullScreenForElement:listener:);
+ if ([[m_webView UIDelegate] respondsToSelector:selector]) {
+ WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+ CallUIDelegate(m_webView, selector, kit(element), listener);
+ [listener release];
+ } else
+ [m_webView _exitFullScreenForElement:element];
+}
+
+void WebChromeClient::fullScreenRendererChanged(RenderBox* renderer)
+{
+ SEL selector = @selector(webView:fullScreenRendererChanged:);
+ if ([[m_webView UIDelegate] respondsToSelector:selector])
+ CallUIDelegate(m_webView, selector, (id)renderer);
+ else
+ [m_webView _fullScreenRendererChanged:renderer];
}
#endif
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 2b3b2cc..9de4246 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -175,6 +175,9 @@ private:
virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
virtual void transitionToCommittedForNewPage();
+ virtual void didSaveToPageCache();
+ virtual void didRestoreFromPageCache();
+
virtual void dispatchDidBecomeFrameset(bool);
virtual bool canHandleRequest(const WebCore::ResourceRequest&) const;
@@ -224,6 +227,10 @@ private:
virtual jobject javaApplet(NSView*);
#endif
+#if PLATFORM(MAC)
+ virtual RemoteAXObjectRef accessibilityRemoteObject() { return 0; }
+#endif
+
void setOriginalURLForDownload(WebDownload *, const WebCore::ResourceRequest&) const;
RetainPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction);
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index c8285dc..227d13a 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1253,6 +1253,14 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
}
}
+void WebFrameLoaderClient::didSaveToPageCache()
+{
+}
+
+void WebFrameLoaderClient::didRestoreFromPageCache()
+{
+}
+
void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool)
{
}
@@ -1858,7 +1866,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createMediaPlayerProxyPlugin(const IntS
if (errorCode) {
NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode
- contentURL:URL pluginPageURL:nil pluginName:[pluginPackage name] MIMEType:mimeType];
+ contentURL:URL pluginPageURL:nil pluginName:[pluginPackage pluginInfo].name MIMEType:mimeType];
WebNullPluginView *nullView = [[[WebNullPluginView alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height())
error:error DOMElement:kit(element)] autorelease];
view = nullView;
diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index b08c161..5beedcf 100644
--- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -69,7 +69,7 @@ using namespace WebCore;
- (void)destroyInspectorView:(bool)notifyInspectorController;
@end
-#pragma mark -
+// MARK: -
@interface WebNodeHighlighter : NSObject {
@private
@@ -81,7 +81,7 @@ using namespace WebCore;
- (void)hideHighlight;
@end
-#pragma mark -
+// MARK: -
WebInspectorClient::WebInspectorClient(WebView *webView)
@@ -208,7 +208,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
}
-#pragma mark -
+// MARK: -
@implementation WebInspectorWindowController
- (id)init
@@ -271,7 +271,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[super dealloc];
}
-#pragma mark -
+// MARK: -
- (WebView *)webView
{
@@ -307,7 +307,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
return window;
}
-#pragma mark -
+// MARK: -
- (BOOL)windowShouldClose:(id)sender
{
@@ -385,7 +385,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
}
}
-#pragma mark -
+// MARK: -
- (void)attach
{
@@ -465,8 +465,8 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[_webView close];
}
-#pragma mark -
-#pragma mark WebNodeHighlight delegate
+// MARK: -
+// MARK: WebNodeHighlight delegate
- (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight
{
@@ -478,15 +478,15 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[_inspectedWebView setCurrentNodeHighlight:nil];
}
-#pragma mark -
-#pragma mark UI delegate
+// MARK: -
+// MARK: UI delegate
- (NSUInteger)webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo
{
return WebDragDestinationActionNone;
}
-#pragma mark -
+// MARK: -
// These methods can be used by UI elements such as menu items and toolbar buttons when the inspector is the key window.
@@ -534,7 +534,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
@end
-#pragma mark -
+// MARK: -
@implementation WebNodeHighlighter
- (id)initWithInspectedWebView:(WebView *)webView
@@ -550,7 +550,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[super dealloc];
}
-#pragma mark -
+// MARK: -
- (void)highlightNode:(DOMNode *)node
{
@@ -575,8 +575,8 @@ void WebInspectorFrontendClient::updateWindowTitle() const
_currentHighlight = nil;
}
-#pragma mark -
-#pragma mark WebNodeHighlight delegate
+// MARK: -
+// MARK: WebNodeHighlight delegate
- (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight
{
diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
index f19dcb5..385d869 100644
--- a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
+++ b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -124,8 +124,8 @@ using namespace WebCore;
@end
-#pragma mark -
-#pragma mark WebQuotaManagers
+// MARK: -
+// MARK: WebQuotaManagers
@implementation WebSecurityOrigin (WebQuotaManagers)
@@ -146,8 +146,8 @@ using namespace WebCore;
@end
-#pragma mark -
-#pragma mark Deprecated
+// MARK: -
+// MARK: Deprecated
// FIXME: The following methods are deprecated and should removed later.
// Clients should instead get a WebQuotaManager, and query / set the quota via the Manager.
diff --git a/WebKit/mac/WebView/WebDocumentInternal.h b/WebKit/mac/WebView/WebDocumentInternal.h
index 4bf11d1..bcb6c07 100644
--- a/WebKit/mac/WebView/WebDocumentInternal.h
+++ b/WebKit/mac/WebView/WebDocumentInternal.h
@@ -68,7 +68,8 @@
@end
@protocol WebDocumentOptionsSearching <NSObject>
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
+// Prefixed with an underscore to avoid conflict with Mail's -[WebHTMLView(MailExtras) findString:options:].
+- (BOOL)_findString:(NSString *)string options:(WebFindOptions)options;
@end
/* Used to save and restore state in the view, typically when going back/forward */
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index b0f9bb9..5c2f256 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -56,11 +56,12 @@
#import <WebCore/AccessibilityObject.h>
#import <WebCore/AnimationController.h>
#import <WebCore/CSSMutableStyleDeclaration.h>
+#import <WebCore/CachedResourceLoader.h>
#import <WebCore/Chrome.h>
#import <WebCore/ColorMac.h>
#import <WebCore/DOMImplementation.h>
-#import <WebCore/CachedResourceLoader.h>
#import <WebCore/DocumentFragment.h>
+#import <WebCore/DocumentMarkerController.h>
#import <WebCore/EventHandler.h>
#import <WebCore/EventNames.h>
#import <WebCore/Frame.h>
@@ -688,27 +689,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return _private->coreFrame->view() ? _private->coreFrame->view()->needsLayout() : false;
}
-- (id)_accessibilityTree
-{
-#if HAVE(ACCESSIBILITY)
- if (!AXObjectCache::accessibilityEnabled()) {
- AXObjectCache::enableAccessibility();
- if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue])
- AXObjectCache::enableEnhancedUserInterfaceAccessibility();
- }
-
- if (!_private->coreFrame || !_private->coreFrame->document())
- return nil;
- RenderView* root = toRenderView(_private->coreFrame->document()->renderer());
- if (!root)
- return nil;
- return _private->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
-#else
- return nil;
-#endif
-}
-
-- (DOMRange *)_rangeByAlteringCurrentSelection:(SelectionController::EAlteration)alteration direction:(SelectionController::EDirection)direction granularity:(TextGranularity)granularity
+- (DOMRange *)_rangeByAlteringCurrentSelection:(SelectionController::EAlteration)alteration direction:(SelectionDirection)direction granularity:(TextGranularity)granularity
{
if (_private->coreFrame->selection()->isNone())
return nil;
@@ -1338,13 +1319,14 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
if (!AXObjectCache::accessibilityEnabled())
return;
- RenderView* root = toRenderView(_private->coreFrame->document()->renderer());
- if (!root)
+ if (!_private->coreFrame || !_private->coreFrame->document())
return;
- AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->getOrCreate(root);
- String strName(name);
- rootObject->setAccessibleName(strName);
+ AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->rootObject();
+ if (rootObject) {
+ String strName(name);
+ rootObject->setAccessibleName(strName);
+ }
#endif
}
@@ -1365,6 +1347,27 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length);
}
+- (id)accessibilityRoot
+{
+#if HAVE(ACCESSIBILITY)
+ if (!AXObjectCache::accessibilityEnabled()) {
+ AXObjectCache::enableAccessibility();
+ if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue])
+ AXObjectCache::enableEnhancedUserInterfaceAccessibility();
+ }
+
+ if (!_private->coreFrame || !_private->coreFrame->document())
+ return nil;
+
+ AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->rootObject();
+ if (rootObject)
+ return rootObject->wrapper();
+ return nil;
+#else
+ return nil;
+#endif
+}
+
@end
@implementation WebFrame
diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h
index 8cdc272..7ff5e75 100644
--- a/WebKit/mac/WebView/WebFrameInternal.h
+++ b/WebKit/mac/WebView/WebFrameInternal.h
@@ -138,9 +138,7 @@ WebView *getWebView(WebFrame *webFrame);
- (NSRect)_firstRectForDOMRange:(DOMRange *)range;
- (void)_scrollDOMRangeToVisible:(DOMRange *)range;
-- (id)_accessibilityTree;
-
-- (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionController::EDirection)direction granularity:(WebCore::TextGranularity)granularity;
+- (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity;
- (NSRange)_convertToNSRange:(WebCore::Range*)range;
- (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
- (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range;
diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h
index b0cb0f3..ddfa5cc 100644
--- a/WebKit/mac/WebView/WebFramePrivate.h
+++ b/WebKit/mac/WebView/WebFramePrivate.h
@@ -142,4 +142,7 @@ typedef enum {
// Returns whether there is a spelling marker in the specified range of the focused node.
- (BOOL)hasSpellingMarker:(int)location length:(int)length;
+// The top of the accessibility tree.
+- (id)accessibilityRoot;
+
@end
diff --git a/WebKit/mac/WebView/WebFullScreenController.h b/WebKit/mac/WebView/WebFullScreenController.h
new file mode 100644
index 0000000..f867dc2
--- /dev/null
+++ b/WebKit/mac/WebView/WebFullScreenController.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#if ENABLE(FULLSCREEN_API)
+
+#import <wtf/RefPtr.h>
+
+@class WebWindowFadeAnimation;
+@class WebView;
+namespace WebCore {
+ class Element;
+ class RenderBox;
+ class EventListener;
+}
+
+@interface WebFullScreenController : NSWindowController {
+@private
+ RefPtr<WebCore::Element> _element;
+ WebCore::RenderBox* _renderer; // (set)
+ RefPtr<WebCore::Element> _replacementElement;
+ NSWindow *_backgroundFullscreenWindow; // (retain)
+ WebWindowFadeAnimation *_fadeAnimation; // (retain)
+ WebView *_webView;
+ NSView* _placeholderView;
+ CALayer* _rendererLayer;
+ CALayer* _backgroundLayer;
+ RefPtr<WebCore::EventListener> _mediaEventListener;
+
+ BOOL _isAnimating;
+ BOOL _isFullscreen;
+ BOOL _isWindowLoaded;
+ BOOL _forceDisableAnimation;
+ BOOL _isPlaying;
+ uint32_t _idleDisplaySleepAssertion;
+ uint32_t _idleSystemSleepAssertion;
+ NSTimer *_tickleTimer;
+ SystemUIMode _savedUIMode;
+ SystemUIOptions _savedUIOptions;
+ CGRect _initialFrame;
+}
+
+- (WebView*)webView;
+- (void)setWebView:(WebView*)webView;
+
+- (void)setElement:(PassRefPtr<WebCore::Element>)element;
+- (WebCore::Element*)element;
+
+- (void)setRenderer:(WebCore::RenderBox*)renderer;
+- (WebCore::RenderBox*)renderer;
+
+- (void)enterFullscreen:(NSScreen *)screen;
+- (void)exitFullscreen;
+
+@end
+
+#endif // ENABLE(FULLSCREEN_API)
diff --git a/WebKit/mac/WebView/WebFullScreenController.mm b/WebKit/mac/WebView/WebFullScreenController.mm
new file mode 100644
index 0000000..a958e90
--- /dev/null
+++ b/WebKit/mac/WebView/WebFullScreenController.mm
@@ -0,0 +1,923 @@
+/*
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#if ENABLE(FULLSCREEN_API)
+
+#import "WebFullScreenController.h"
+
+#import "WebPreferencesPrivate.h"
+#import "WebWindowAnimation.h"
+#import "WebViewInternal.h"
+#import <IOKit/pwr_mgt/IOPMLib.h>
+#import <WebCore/AnimationList.h>
+#import <WebCore/CSSPropertyNames.h>
+#import <WebCore/Color.h>
+#import <WebCore/Document.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMDocumentInternal.h>
+#import <WebCore/DOMHTMLElement.h>
+#import <WebCore/DOMWindow.h>
+#import <WebCore/EventListener.h>
+#import <WebCore/EventNames.h>
+#import <WebCore/HTMLElement.h>
+#import <WebCore/HTMLNames.h>
+#import <WebCore/HTMLMediaElement.h>
+#import <WebCore/IntRect.h>
+#import <WebCore/NodeList.h>
+#import <WebCore/SoftLinking.h>
+#import <WebCore/RenderBlock.h>
+#import <WebCore/RenderLayer.h>
+#import <WebCore/RenderLayerBacking.h>
+#import <objc/objc-runtime.h>
+#import <wtf/UnusedParam.h>
+
+static const NSTimeInterval tickleTimerInterval = 1.0;
+static NSString* const isEnteringFullscreenKey = @"isEnteringFullscreen";
+
+using namespace WebCore;
+
+#if defined(BUILDING_ON_LEOPARD)
+@interface CATransaction(SnowLeopardConvenienceFunctions)
++ (void)setDisableActions:(BOOL)flag;
++ (void)setAnimationDuration:(CFTimeInterval)dur;
+@end
+
+@implementation CATransaction(SnowLeopardConvenienceFunctions)
++ (void)setDisableActions:(BOOL)flag
+{
+ [self setValue:[NSNumber numberWithBool:flag] forKey:kCATransactionDisableActions];
+}
+
++ (void)setAnimationDuration:(CFTimeInterval)dur
+{
+ [self setValue:[NSNumber numberWithDouble:dur] forKey:kCATransactionAnimationDuration];
+}
+@end
+
+#endif
+
+@interface WebFullscreenWindow : NSWindow
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER)
+<NSAnimationDelegate>
+#endif
+{
+ NSView* _animationView;
+
+ CALayer* _rendererLayer;
+ CALayer* _backgroundLayer;
+}
+- (CALayer*)rendererLayer;
+- (void)setRendererLayer:(CALayer*)rendererLayer;
+- (CALayer*)backgroundLayer;
+- (NSView*)animationView;
+@end
+
+class MediaEventListener : public EventListener {
+public:
+ static PassRefPtr<MediaEventListener> create(WebFullScreenController* delegate);
+ virtual bool operator==(const EventListener&);
+ virtual void handleEvent(ScriptExecutionContext*, Event*);
+
+private:
+ MediaEventListener(WebFullScreenController* delegate);
+ WebFullScreenController* delegate;
+};
+
+@interface WebFullScreenController(Private)
+- (void)_requestExitFullscreenWithAnimation:(BOOL)animation;
+- (void)_updateMenuAndDockForFullscreen;
+- (void)_updatePowerAssertions;
+- (WebFullscreenWindow *)_fullscreenWindow;
+- (Document*)_document;
+- (CFTimeInterval)_animationDuration;
+- (BOOL)_isAnyMoviePlaying;
+@end
+
+@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
+- (BOOL)isOnActiveSpace;
+@end
+
+@implementation WebFullScreenController
+
+#pragma mark -
+#pragma mark Initialization
+- (id)init
+{
+ // Do not defer window creation, to make sure -windowNumber is created (needed by WebWindowScaleAnimation).
+ NSWindow *window = [[WebFullscreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ self = [super initWithWindow:window];
+ [window release];
+ if (!self)
+ return nil;
+ [self windowDidLoad];
+ _mediaEventListener = MediaEventListener::create(self);
+ return self;
+
+}
+
+- (void)dealloc
+{
+ ASSERT(!_tickleTimer);
+
+ [self setWebView:nil];
+ [_placeholderView release];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [super dealloc];
+}
+
+- (void)windowDidLoad
+{
+#ifdef BUILDING_ON_TIGER
+ // WebFullScreenController is not supported on Tiger:
+ ASSERT_NOT_REACHED();
+#else
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp];
+#endif
+}
+
+#pragma mark -
+#pragma mark Accessors
+
+- (WebView*)webView
+{
+ return _webView;
+}
+
+- (void)setWebView:(WebView *)webView
+{
+ [webView retain];
+ [_webView release];
+ _webView = webView;
+}
+
+- (Element*)element
+{
+ return _element.get();
+}
+
+- (void)setElement:(PassRefPtr<Element>)element
+{
+#ifdef BUILDING_ON_TIGER
+ // WebFullScreenController is not supported on Tiger:
+ ASSERT_NOT_REACHED();
+#else
+ // When a new Element is set as the current full screen element, register event
+ // listeners on that Element's window, listening for changes in media play states.
+ // We will use these events to determine whether to disable the screensaver and
+ // display sleep timers when playing video in full screen. Make sure to unregister
+ // the events on the old element's window, if necessary, as well.
+
+ EventNames& eventNames = WebCore::eventNames();
+
+ if (_element) {
+ DOMWindow* window = _element->document()->domWindow();
+ if (window) {
+ window->removeEventListener(eventNames.playEvent, _mediaEventListener.get(), true);
+ window->removeEventListener(eventNames.pauseEvent, _mediaEventListener.get(), true);
+ window->removeEventListener(eventNames.endedEvent, _mediaEventListener.get(), true);
+ }
+ }
+
+ _element = element;
+
+ if (_element) {
+ DOMWindow* window = _element->document()->domWindow();
+ if (window) {
+ window->addEventListener(eventNames.playEvent, _mediaEventListener, true);
+ window->addEventListener(eventNames.pauseEvent, _mediaEventListener, true);
+ window->addEventListener(eventNames.endedEvent, _mediaEventListener, true);
+ }
+ }
+#endif
+}
+
+- (RenderBox*)renderer
+{
+ return _renderer;
+}
+
+- (void)setRenderer:(RenderBox*)renderer
+{
+#ifdef BUILDING_ON_TIGER
+ // WebFullScreenController is not supported on Tiger:
+ ASSERT_NOT_REACHED();
+#else
+ _renderer = renderer;
+#endif
+}
+
+#pragma mark -
+#pragma mark Notifications
+
+- (void)windowDidExitFullscreen:(BOOL)finished
+{
+ if (!_isAnimating)
+ return;
+
+ if (_isFullscreen)
+ return;
+
+ NSDisableScreenUpdates();
+ ASSERT(_element);
+ [self _document]->setFullScreenRendererBackgroundColor(Color::black);
+ [self _document]->webkitDidExitFullScreenForElement(_element.get());
+ [self setElement:nil];
+
+ if (finished) {
+ [self _updateMenuAndDockForFullscreen];
+ [self _updatePowerAssertions];
+
+ [[_webView window] display];
+ [[self _fullscreenWindow] setRendererLayer:nil];
+ [[self window] close];
+ }
+
+ NSEnableScreenUpdates();
+
+ _isAnimating = NO;
+ [self autorelease]; // Associated -retain is in -exitFullscreen.
+}
+
+- (void)windowDidEnterFullscreen:(BOOL)finished
+{
+ if (!_isAnimating)
+ return;
+
+ if (!_isFullscreen)
+ return;
+
+ NSDisableScreenUpdates();
+ [self _document]->webkitDidEnterFullScreenForElement(_element.get());
+ [self _document]->setFullScreenRendererBackgroundColor(Color::black);
+
+ if (finished) {
+ [self _updateMenuAndDockForFullscreen];
+ [self _updatePowerAssertions];
+ [NSCursor setHiddenUntilMouseMoves:YES];
+
+ // Move the webView into our fullscreen Window
+ if (!_placeholderView)
+ _placeholderView = [[NSView alloc] init];
+
+ // Do not swap the placeholder into place if already is in a window,
+ // assuming the placeholder's window will always be the webView's
+ // original window.
+ if (![_placeholderView window]) {
+ WebView* webView = [self webView];
+ [_placeholderView setFrame:[webView frame]];
+ [_placeholderView setAutoresizingMask:[webView autoresizingMask]];
+ [_placeholderView removeFromSuperview];
+ [[webView superview] replaceSubview:webView with:_placeholderView];
+
+ [[[self window] contentView] addSubview:webView];
+ [webView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
+ [webView setFrame:[[[self window] contentView] bounds]];
+ }
+
+ WebFullscreenWindow* window = [self _fullscreenWindow];
+ [window setBackgroundColor:[NSColor blackColor]];
+ [window setOpaque:YES];
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [[[window animationView] layer] setOpacity:0];
+ [CATransaction commit];
+ }
+ NSEnableScreenUpdates();
+
+ _isAnimating = NO;
+}
+
+- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished
+{
+ BOOL isEnteringFullscreenAnimation = [[anim valueForKey:isEnteringFullscreenKey] boolValue];
+
+ if (!isEnteringFullscreenAnimation)
+ [self windowDidExitFullscreen:finished];
+ else
+ [self windowDidEnterFullscreen:finished];
+}
+
+- (void)applicationDidResignActive:(NSNotification*)notification
+{
+ // Check to see if the fullscreenWindow is on the active space; this function is available
+ // on 10.6 and later, so default to YES if the function is not available:
+ NSWindow* fullscreenWindow = [self _fullscreenWindow];
+ BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);
+
+ // Replicate the QuickTime Player (X) behavior when losing active application status:
+ // Is the fullscreen screen the main screen? (Note: this covers the case where only a
+ // single screen is available.) Is the fullscreen screen on the current space? IFF so,
+ // then exit fullscreen mode.
+ if ([fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)
+ [self _requestExitFullscreenWithAnimation:NO];
+}
+
+- (void)applicationDidChangeScreenParameters:(NSNotification*)notification
+{
+ // The user may have changed the main screen by moving the menu bar, or they may have changed
+ // the Dock's size or location, or they may have changed the fullscreen screen's dimensions.
+ // Update our presentation parameters, and ensure that the full screen window occupies the
+ // entire screen:
+ [self _updateMenuAndDockForFullscreen];
+ NSWindow* window = [self window];
+ [window setFrame:[[window screen] frame] display:YES];
+}
+
+#pragma mark -
+#pragma mark Exposed Interface
+
+- (void)enterFullscreen:(NSScreen *)screen
+{
+ // Disable animation if we are already in full-screen mode.
+ BOOL shouldAnimate = !_isFullscreen;
+
+ if (_isAnimating) {
+ // The CAAnimation delegate functions will only be called the
+ // next trip through the run-loop, so manually call the delegate
+ // function here, letting it know the animation did not complete:
+ [self windowDidExitFullscreen:NO];
+ ASSERT(!_isAnimating);
+ }
+ _isFullscreen = YES;
+ _isAnimating = YES;
+
+ // setElement: must be called with a non-nil value before calling enterFullscreen:.
+ ASSERT(_element);
+
+ NSDisableScreenUpdates();
+
+ if (!screen)
+ screen = [NSScreen mainScreen];
+ NSRect screenFrame = [screen frame];
+
+ WebView* webView = [self webView];
+ NSRect webViewFrame = [webView convertRectToBase:[webView frame]];
+ webViewFrame.origin = [[webView window] convertBaseToScreen:webViewFrame.origin];
+
+ NSRect elementFrame = _element->screenRect();
+
+ // In the case of a multi-monitor setup where the webView straddles two
+ // monitors, we must create a window large enough to contain the destination
+ // frame and the initial frame.
+ NSRect windowFrame = NSUnionRect(screenFrame, elementFrame);
+ [[self window] setFrame:windowFrame display:YES];
+
+ // In a previous incarnation, the NSWindow attached to this controller may have
+ // been on a different screen. Temporarily change the collectionBehavior of the window:
+ NSWindowCollectionBehavior behavior = [[self window] collectionBehavior];
+ [[self window] setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
+ [[self window] makeKeyAndOrderFront:self];
+ [[self window] setCollectionBehavior:behavior];
+
+ NSView* animationView = [[self _fullscreenWindow] animationView];
+ NSRect viewBounds = [animationView bounds];
+
+ NSRect backgroundBounds = {[[self window] convertScreenToBase:screenFrame.origin], screenFrame.size};
+ backgroundBounds = [animationView convertRectFromBase:backgroundBounds];
+ // Flip the background layer's coordinate system.
+ backgroundBounds.origin.y = windowFrame.size.height - NSMaxY(backgroundBounds);
+
+ // Set our fullscreen element's initial frame, and flip the coordinate systems from
+ // screen coordinates (bottom/left) to layer coordinates (top/left):
+ _initialFrame = NSRectToCGRect(NSIntersectionRect(elementFrame, webViewFrame));
+ _initialFrame.origin.y = screenFrame.size.height - CGRectGetMaxY(_initialFrame);
+
+ // Inform the document that we will begin entering full screen. This will change
+ // pseudo-classes on the fullscreen element and the document element.
+ Document* document = [self _document];
+ document->webkitWillEnterFullScreenForElement(_element.get());
+
+ // Check to see if the fullscreen renderer is composited. If not, accelerated graphics
+ // may be disabled. In this case, do not attempt to animate the contents into place;
+ // merely snap to the final position:
+ if (!shouldAnimate || !_renderer || !_renderer->layer()->isComposited()) {
+ [self windowDidEnterFullscreen:YES];
+ NSEnableScreenUpdates();
+ return;
+ }
+
+ // Set up the final style of the FullScreen render block. Set an absolute
+ // width and height equal to the size of the screen, and anchor the layer
+ // at the top, left at (0,0). The RenderFullScreen style is already set
+ // to position:fixed.
+ [self _document]->setFullScreenRendererSize(IntSize(screenFrame.size));
+ [self _document]->setFullScreenRendererBackgroundColor(Color::transparent);
+
+ // Cause the document to layout, thus calculating a new fullscreen element size:
+ [self _document]->updateLayout();
+
+ // FIXME: try to use the fullscreen element's calculated x, y, width, and height instead of the
+ // renderBox functions:
+ RenderBox* childRenderer = _renderer->firstChildBox();
+ CGRect destinationFrame = CGRectMake(childRenderer->x(), childRenderer->y(), childRenderer->width(), childRenderer->height());
+
+ // Some properties haven't propogated from the GraphicsLayer to the CALayer yet. So
+ // tell the renderer's layer to sync it's compositing state:
+ GraphicsLayer* rendererGraphics = _renderer->layer()->backing()->graphicsLayer();
+ rendererGraphics->syncCompositingState();
+
+ CALayer* rendererLayer = rendererGraphics->platformLayer();
+ [[self _fullscreenWindow] setRendererLayer:rendererLayer];
+
+ CFTimeInterval duration = [self _animationDuration];
+
+ // Create a transformation matrix that will transform the renderer layer such that
+ // the fullscreen element appears to move from its starting position and size to its
+ // final one. Perform the transformation in two steps, using the CALayer's matrix
+ // math to calculate the effects of each step:
+ // 1. Apply a scale tranform to shrink the apparent size of the layer to the original
+ // element screen size.
+ // 2. Apply a translation transform to move the shrunk layer into the same screen position
+ // as the original element.
+ CATransform3D shrinkTransform = CATransform3DMakeScale(_initialFrame.size.width / destinationFrame.size.width, _initialFrame.size.height / destinationFrame.size.height, 1);
+ [rendererLayer setTransform:shrinkTransform];
+ CGRect shrunkDestinationFrame = [rendererLayer convertRect:destinationFrame toLayer:[animationView layer]];
+ CATransform3D moveTransform = CATransform3DMakeTranslation(_initialFrame.origin.x - shrunkDestinationFrame.origin.x, _initialFrame.origin.y - shrunkDestinationFrame.origin.y, 0);
+ CATransform3D finalTransform = CATransform3DConcat(shrinkTransform, moveTransform);
+ [rendererLayer setTransform:finalTransform];
+ CGRect translatedDestinationFrame = [rendererLayer convertRect:destinationFrame toLayer:[animationView layer]];
+
+ CALayer* backgroundLayer = [[self _fullscreenWindow] backgroundLayer];
+
+ // Start the opacity animation. We can use implicit animations here because we don't care when
+ // the animation finishes.
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:duration];
+ [backgroundLayer setOpacity:1];
+ [CATransaction commit];
+
+ // Use a CABasicAnimation here for the zoom effect. We want to be notified that the animation has
+ // completed by way of the CAAnimation delegate.
+ CABasicAnimation* zoomAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
+ [zoomAnimation setFromValue:[NSValue valueWithCATransform3D:finalTransform]];
+ [zoomAnimation setToValue:[NSValue valueWithCATransform3D:CATransform3DIdentity]];
+ [zoomAnimation setDelegate:self];
+ [zoomAnimation setDuration:duration];
+ [zoomAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
+ [zoomAnimation setFillMode:kCAFillModeForwards];
+ [zoomAnimation setValue:(id)kCFBooleanTrue forKey:isEnteringFullscreenKey];
+
+ // Disable implicit animations and set the layer's transformation matrix to its final state.
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [rendererLayer setTransform:CATransform3DIdentity];
+ [rendererLayer addAnimation:zoomAnimation forKey:@"zoom"];
+ [backgroundLayer setFrame:NSRectToCGRect(backgroundBounds)];
+ [CATransaction commit];
+
+ NSEnableScreenUpdates();
+}
+
+- (void)exitFullscreen
+{
+ if (!_isFullscreen)
+ return;
+
+ CATransform3D startTransform = CATransform3DIdentity;
+ if (_isAnimating) {
+ if (_renderer && _renderer->layer()->isComposited()) {
+ CALayer* rendererLayer = _renderer->layer()->backing()->graphicsLayer()->platformLayer();
+ startTransform = [[rendererLayer presentationLayer] transform];
+ }
+
+ // The CAAnimation delegate functions will only be called the
+ // next trip through the run-loop, so manually call the delegate
+ // function here, letting it know the animation did not complete:
+ [self windowDidEnterFullscreen:NO];
+ ASSERT(!_isAnimating);
+ }
+ _isFullscreen = NO;
+ _isAnimating = YES;
+
+ NSDisableScreenUpdates();
+
+ // The user may have moved the fullscreen window in Spaces, so temporarily change
+ // the collectionBehavior of the webView's window:
+ NSWindow* webWindow = [[self webView] window];
+ NSWindowCollectionBehavior behavior = [webWindow collectionBehavior];
+ [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
+ [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
+ [webWindow setCollectionBehavior:behavior];
+
+ // The fullscreen animation may have been cancelled before the
+ // webView was moved to the fullscreen window. Check to see
+ // if the _placeholderView exists and is in a window before
+ // attempting to swap the webView back to it's original tree:
+ if (_placeholderView && [_placeholderView window]) {
+ // Move the webView back to its own native window:
+ WebView* webView = [self webView];
+ [webView setFrame:[_placeholderView frame]];
+ [webView setAutoresizingMask:[_placeholderView autoresizingMask]];
+ [webView removeFromSuperview];
+ [[_placeholderView superview] replaceSubview:_placeholderView with:webView];
+
+ // Because the animation view is layer-hosted, make sure to
+ // disable animations when changing the layer's opacity. Other-
+ // wise, the content will appear to fade into view.
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ WebFullscreenWindow* window = [self _fullscreenWindow];
+ [[[window animationView] layer] setOpacity:1];
+ [window setBackgroundColor:[NSColor clearColor]];
+ [window setOpaque:NO];
+ [CATransaction commit];
+ }
+
+ NSView* animationView = [[self _fullscreenWindow] animationView];
+ CGRect layerEndFrame = NSRectToCGRect([animationView convertRect:NSRectFromCGRect(_initialFrame) fromView:nil]);
+
+ // The _renderer might be NULL due to its ancestor being removed:
+ CGRect layerStartFrame = CGRectZero;
+ if (_renderer) {
+ RenderBox* childRenderer = _renderer->firstChildBox();
+ layerStartFrame = CGRectMake(childRenderer->x(), childRenderer->y(), childRenderer->width(), childRenderer->height());
+ }
+
+ [self _document]->webkitWillExitFullScreenForElement(_element.get());
+ [self _document]->updateLayout();
+
+ // We have to retain ourselves because we want to be alive for the end of the animation.
+ // If our owner releases us we could crash if this is not the case.
+ // Balanced in windowDidExitFullscreen
+ [self retain];
+
+ // Check to see if the fullscreen renderer is composited. If not, accelerated graphics
+ // may be disabled. In this case, do not attempt to animate the contents into place;
+ // merely snap to the final position:
+ if (!_renderer || !_renderer->layer()->isComposited()) {
+ [self windowDidExitFullscreen:YES];
+ NSEnableScreenUpdates();
+ return;
+ }
+
+ GraphicsLayer* rendererGraphics = _renderer->layer()->backing()->graphicsLayer();
+
+ [self _document]->setFullScreenRendererBackgroundColor(Color::transparent);
+
+ rendererGraphics->syncCompositingState();
+
+ CALayer* rendererLayer = rendererGraphics->platformLayer();
+ [[self _fullscreenWindow] setRendererLayer:rendererLayer];
+
+ // Create a transformation matrix that will transform the renderer layer such that
+ // the fullscreen element appears to move from the full screen to its original position
+ // and size. Perform the transformation in two steps, using the CALayer's matrix
+ // math to calculate the effects of each step:
+ // 1. Apply a scale tranform to shrink the apparent size of the layer to the original
+ // element screen size.
+ // 2. Apply a translation transform to move the shrunk layer into the same screen position
+ // as the original element.
+ CATransform3D shrinkTransform = CATransform3DMakeScale(layerEndFrame.size.width / layerStartFrame.size.width, layerEndFrame.size.height / layerStartFrame.size.height, 1);
+ [rendererLayer setTransform:shrinkTransform];
+ CGRect shrunkDestinationFrame = [rendererLayer convertRect:layerStartFrame toLayer:[animationView layer]];
+ CATransform3D moveTransform = CATransform3DMakeTranslation(layerEndFrame.origin.x - shrunkDestinationFrame.origin.x, layerEndFrame.origin.y - shrunkDestinationFrame.origin.y, 0);
+ CATransform3D finalTransform = CATransform3DConcat(shrinkTransform, moveTransform);
+ [rendererLayer setTransform:finalTransform];
+ CGRect translatedDestinationFrame = [rendererLayer convertRect:layerStartFrame toLayer:[animationView layer]];
+
+ CFTimeInterval duration = [self _animationDuration];
+
+ CALayer* backgroundLayer = [[self _fullscreenWindow] backgroundLayer];
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:duration];
+ [backgroundLayer setOpacity:0];
+ [CATransaction commit];
+
+ CABasicAnimation* zoomAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
+ [zoomAnimation setFromValue:[NSValue valueWithCATransform3D:startTransform]];
+ [zoomAnimation setToValue:[NSValue valueWithCATransform3D:finalTransform]];
+ [zoomAnimation setDelegate:self];
+ [zoomAnimation setDuration:duration];
+ [zoomAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
+ [zoomAnimation setFillMode:kCAFillModeBoth];
+ [zoomAnimation setRemovedOnCompletion:NO];
+ [zoomAnimation setValue:(id)kCFBooleanFalse forKey:isEnteringFullscreenKey];
+
+ [rendererLayer addAnimation:zoomAnimation forKey:@"zoom"];
+
+ NSEnableScreenUpdates();
+}
+
+#pragma mark -
+#pragma mark Internal Interface
+
+- (void)_updateMenuAndDockForFullscreen
+{
+ // NSApplicationPresentationOptions is available on > 10.6 only:
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
+ NSScreen* fullscreenScreen = [[self window] screen];
+
+ if (_isFullscreen) {
+ // Auto-hide the menu bar if the fullscreenScreen contains the menu bar:
+ // NOTE: if the fullscreenScreen contains the menu bar but not the dock, we must still
+ // auto-hide the dock, or an exception will be thrown.
+ if ([[NSScreen screens] objectAtIndex:0] == fullscreenScreen)
+ options |= (NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock);
+ // Check if the current screen contains the dock by comparing the screen's frame to its
+ // visibleFrame; if a dock is present, the visibleFrame will differ. If the current screen
+ // contains the dock, hide it.
+ else if (!NSEqualRects([fullscreenScreen frame], [fullscreenScreen visibleFrame]))
+ options |= NSApplicationPresentationAutoHideDock;
+ }
+
+ if ([NSApp respondsToSelector:@selector(setPresentationOptions:)])
+ [NSApp setPresentationOptions:options];
+ else
+#endif
+ SetSystemUIMode(_isFullscreen ? kUIModeNormal : kUIModeAllHidden, 0);
+}
+
+#if !defined(BUILDING_ON_TIGER) // IOPMAssertionCreateWithName not defined on < 10.5
+- (void)_disableIdleDisplaySleep
+{
+ if (_idleDisplaySleepAssertion == kIOPMNullAssertionID)
+#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK
+ IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &_idleDisplaySleepAssertion);
+#else // IOPMAssertionCreate is depreciated in > 10.5
+ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullscreen."), &_idleDisplaySleepAssertion);
+#endif
+}
+
+- (void)_enableIdleDisplaySleep
+{
+ if (_idleDisplaySleepAssertion != kIOPMNullAssertionID) {
+ IOPMAssertionRelease(_idleDisplaySleepAssertion);
+ _idleDisplaySleepAssertion = kIOPMNullAssertionID;
+ }
+}
+
+- (void)_disableIdleSystemSleep
+{
+ if (_idleSystemSleepAssertion == kIOPMNullAssertionID)
+#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK
+ IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_idleSystemSleepAssertion);
+#else // IOPMAssertionCreate is depreciated in > 10.5
+ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullscreen."), &_idleSystemSleepAssertion);
+#endif
+}
+
+- (void)_enableIdleSystemSleep
+{
+ if (_idleSystemSleepAssertion != kIOPMNullAssertionID) {
+ IOPMAssertionRelease(_idleSystemSleepAssertion);
+ _idleSystemSleepAssertion = kIOPMNullAssertionID;
+ }
+}
+
+- (void)_enableTickleTimer
+{
+ [_tickleTimer invalidate];
+ [_tickleTimer release];
+ _tickleTimer = [[NSTimer scheduledTimerWithTimeInterval:tickleTimerInterval target:self selector:@selector(_tickleTimerFired) userInfo:nil repeats:YES] retain];
+}
+
+- (void)_disableTickleTimer
+{
+ [_tickleTimer invalidate];
+ [_tickleTimer release];
+ _tickleTimer = nil;
+}
+
+- (void)_tickleTimerFired
+{
+ UpdateSystemActivity(OverallAct);
+}
+#endif
+
+- (void)_updatePowerAssertions
+{
+#if !defined(BUILDING_ON_TIGER)
+ BOOL isPlaying = [self _isAnyMoviePlaying];
+
+ if (isPlaying && _isFullscreen) {
+ [self _disableIdleSystemSleep];
+ [self _disableIdleDisplaySleep];
+ [self _enableTickleTimer];
+ } else {
+ [self _enableIdleSystemSleep];
+ [self _enableIdleDisplaySleep];
+ [self _disableTickleTimer];
+ }
+#endif
+}
+
+- (void)_requestExit
+{
+ [self exitFullscreen];
+ _forceDisableAnimation = NO;
+}
+
+- (void)_requestExitFullscreenWithAnimation:(BOOL)animation
+{
+ _forceDisableAnimation = !animation;
+ [self performSelector:@selector(_requestExit) withObject:nil afterDelay:0];
+
+}
+
+- (BOOL)_isAnyMoviePlaying
+{
+ if (!_element)
+ return NO;
+
+ Node* nextNode = _element.get();
+ while (nextNode)
+ {
+ if (nextNode->hasTagName(HTMLNames::videoTag)) {
+ HTMLMediaElement* element = static_cast<HTMLMediaElement*>(nextNode);
+ if (!element->paused() && !element->ended())
+ return YES;
+ }
+
+ nextNode = nextNode->traverseNextNode(_element.get());
+ }
+
+ return NO;
+}
+
+#pragma mark -
+#pragma mark Utility Functions
+
+- (WebFullscreenWindow *)_fullscreenWindow
+{
+ return (WebFullscreenWindow *)[self window];
+}
+
+- (Document*)_document
+{
+ return core([[[self webView] mainFrame] DOMDocument]);
+}
+
+- (CFTimeInterval)_animationDuration
+{
+ static const CFTimeInterval defaultDuration = 0.5;
+ CFTimeInterval duration = defaultDuration;
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ NSUInteger modifierFlags = [NSEvent modifierFlags];
+#else
+ NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags];
+#endif
+ if ((modifierFlags & NSControlKeyMask) == NSControlKeyMask)
+ duration *= 2;
+ if ((modifierFlags & NSShiftKeyMask) == NSShiftKeyMask)
+ duration *= 10;
+ if (_forceDisableAnimation) {
+ // This will disable scale animation
+ duration = 0;
+ }
+ return duration;
+}
+
+@end
+
+#pragma mark -
+@implementation WebFullscreenWindow
+
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
+{
+ UNUSED_PARAM(aStyle);
+ self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
+ if (!self)
+ return nil;
+ [self setOpaque:NO];
+ [self setBackgroundColor:[NSColor clearColor]];
+ [self setIgnoresMouseEvents:NO];
+ [self setAcceptsMouseMovedEvents:YES];
+ [self setReleasedWhenClosed:NO];
+ [self setHasShadow:YES];
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ [self setMovable:NO];
+#else
+ [self setMovableByWindowBackground:NO];
+#endif
+
+ NSView* contentView = [self contentView];
+ _animationView = [[NSView alloc] initWithFrame:[contentView bounds]];
+
+ CALayer* contentLayer = [[CALayer alloc] init];
+ [_animationView setLayer:contentLayer];
+ [_animationView setWantsLayer:YES];
+ [_animationView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
+ [contentView addSubview:_animationView];
+
+ _backgroundLayer = [[CALayer alloc] init];
+ [contentLayer addSublayer:_backgroundLayer];
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ [contentLayer setGeometryFlipped:YES];
+#else
+ [contentLayer setSublayerTransform:CATransform3DMakeScale(1, -1, 1)];
+#endif
+ [contentLayer setOpacity:0];
+
+ [_backgroundLayer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
+ [_backgroundLayer setOpacity:0];
+ return self;
+}
+
+- (void)dealloc
+{
+ [_animationView release];
+ [_backgroundLayer release];
+ [_rendererLayer release];
+ [super dealloc];
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (void)keyDown:(NSEvent *)theEvent
+{
+ if ([[theEvent charactersIgnoringModifiers] isEqual:@"\e"]) // Esacpe key-code
+ [self cancelOperation:self];
+ else [super keyDown:theEvent];
+}
+
+- (void)cancelOperation:(id)sender
+{
+ UNUSED_PARAM(sender);
+ [[self windowController] _requestExitFullscreenWithAnimation:YES];
+}
+
+- (CALayer*)rendererLayer
+{
+ return _rendererLayer;
+}
+
+- (void)setRendererLayer:(CALayer *)rendererLayer
+{
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [rendererLayer retain];
+ [_rendererLayer removeFromSuperlayer];
+ [_rendererLayer release];
+ _rendererLayer = rendererLayer;
+
+ if (_rendererLayer)
+ [[[self animationView] layer] addSublayer:_rendererLayer];
+ [CATransaction commit];
+}
+
+- (CALayer*)backgroundLayer
+{
+ return _backgroundLayer;
+}
+
+- (NSView*)animationView
+{
+ return _animationView;
+}
+@end
+
+#pragma mark -
+#pragma mark MediaEventListener
+
+MediaEventListener::MediaEventListener(WebFullScreenController* delegate)
+ : EventListener(CPPEventListenerType)
+ , delegate(delegate)
+{
+}
+
+PassRefPtr<MediaEventListener> MediaEventListener::create(WebFullScreenController* delegate)
+{
+ return adoptRef(new MediaEventListener(delegate));
+}
+
+bool MediaEventListener::operator==(const EventListener& listener)
+{
+ return this == &listener;
+}
+
+void MediaEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
+{
+ [delegate _updatePowerAssertions];
+}
+
+#endif /* ENABLE(FULLSCREEN_API) */
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 3e8be9a..093f3db 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -83,6 +83,7 @@
#import <WebCore/ContextMenuController.h>
#import <WebCore/Document.h>
#import <WebCore/DocumentFragment.h>
+#import <WebCore/DocumentMarkerController.h>
#import <WebCore/DragController.h>
#import <WebCore/Editor.h>
#import <WebCore/EditorDeleteAction.h>
@@ -4273,7 +4274,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
- (id)accessibilityAttributeValue:(NSString*)attributeName
{
if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
- id accTree = [[self _frame] _accessibilityTree];
+ id accTree = [[self _frame] accessibilityRoot];
if (accTree)
return [NSArray arrayWithObject:accTree];
return nil;
@@ -4283,7 +4284,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
- (id)accessibilityFocusedUIElement
{
- id accTree = [[self _frame] _accessibilityTree];
+ id accTree = [[self _frame] accessibilityRoot];
if (accTree)
return [accTree accessibilityFocusedUIElement];
return self;
@@ -4291,7 +4292,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
- (id)accessibilityHitTest:(NSPoint)point
{
- id accTree = [[self _frame] _accessibilityTree];
+ id accTree = [[self _frame] accessibilityRoot];
if (accTree) {
NSPoint windowCoord = [[self window] convertScreenToBase:point];
return [accTree accessibilityHitTest:[self convertPoint:windowCoord fromView:nil]];
@@ -4301,7 +4302,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
- (id)_accessibilityParentForSubview:(NSView *)subview
{
- id accTree = [[self _frame] _accessibilityTree];
+ id accTree = [[self _frame] accessibilityRoot];
if (!accTree)
return self;
id parent = [accTree _accessibilityParentForSubview:subview];
@@ -6281,7 +6282,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection
{
- return [self findString:string options:(forward ? 0 : WebFindOptionsBackwards) | (caseFlag ? 0 : WebFindOptionsCaseInsensitive) | (startInSelection ? WebFindOptionsStartInSelection : 0)];
+ return [self _findString:string options:(forward ? 0 : WebFindOptionsBackwards) | (caseFlag ? 0 : WebFindOptionsCaseInsensitive) | (startInSelection ? WebFindOptionsStartInSelection : 0)];
}
@end
@@ -6352,7 +6353,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
return result;
}
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options
+- (BOOL)_findString:(NSString *)string options:(WebFindOptions)options
{
if (![string length])
return NO;
diff --git a/WebKit/mac/WebView/WebPDFView.mm b/WebKit/mac/WebView/WebPDFView.mm
index 0f54980..445b537 100644
--- a/WebKit/mac/WebView/WebPDFView.mm
+++ b/WebKit/mac/WebView/WebPDFView.mm
@@ -106,7 +106,7 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
- (id)initWithView:(WebPDFView *)view;
@end
-#pragma mark C UTILITY FUNCTIONS
+// MARK: C UTILITY FUNCTIONS
static void _applicationInfoForMIMEType(NSString *type, NSString **name, NSImage **image)
{
@@ -151,7 +151,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
@implementation WebPDFView
-#pragma mark WebPDFView API
+// MARK: WebPDFView API
+ (NSBundle *)PDFKitBundle
{
@@ -190,7 +190,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return [PDFSubview document];
}
-#pragma mark NSObject OVERRIDES
+// MARK: NSObject OVERRIDES
- (void)dealloc
{
@@ -204,7 +204,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
[super dealloc];
}
-#pragma mark NSResponder OVERRIDES
+// MARK: NSResponder OVERRIDES
- (void)centerSelectionInVisibleArea:(id)sender
{
@@ -257,7 +257,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
[self centerSelectionInVisibleArea:nil];
}
-#pragma mark NSView OVERRIDES
+// MARK: NSView OVERRIDES
- (BOOL)acceptsFirstResponder {
return YES;
@@ -483,7 +483,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
firstResponderIsPDFDocumentView = NO;
}
-#pragma mark NSUserInterfaceValidations PROTOCOL IMPLEMENTATION
+// MARK: NSUserInterfaceValidations PROTOCOL IMPLEMENTATION
- (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item
{
@@ -510,7 +510,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return CallUIDelegateReturningBoolean(result, [self _webView], @selector(webView:validateUserInterfaceItem:defaultValidation:), item, result);
}
-#pragma mark INTERFACE BUILDER ACTIONS FOR SAFARI
+// MARK: INTERFACE BUILDER ACTIONS FOR SAFARI
// Surprisingly enough, this isn't defined in any superclass, though it is defined in assorted AppKit classes since
// it's a standard menu item IBAction.
@@ -526,7 +526,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
[NSPasteboard _web_setFindPasteboardString:[[PDFSubview currentSelection] string] withOwner:self];
}
-#pragma mark WebFrameView UNDECLARED "DELEGATE METHODS"
+// MARK: WebFrameView UNDECLARED "DELEGATE METHODS"
// This is tested in -[WebFrameView canPrintHeadersAndFooters], but isn't declared anywhere (yuck)
- (BOOL)canPrintHeadersAndFooters
@@ -540,7 +540,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return [[PDFSubview document] getPrintOperationForPrintInfo:printInfo autoRotate:YES];
}
-#pragma mark WebDocumentView PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentView PROTOCOL IMPLEMENTATION
- (void)setDataSource:(WebDataSource *)ds
{
@@ -574,7 +574,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
{
}
-#pragma mark WebDocumentElement PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentElement PROTOCOL IMPLEMENTATION
- (NSDictionary *)elementAtPoint:(NSPoint)point
{
@@ -592,14 +592,14 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return [self elementAtPoint:point];
}
-#pragma mark WebDocumentSearching PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentSearching PROTOCOL IMPLEMENTATION
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag
{
return [self searchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag startInSelection:NO];
}
-#pragma mark WebDocumentIncrementalSearching PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentIncrementalSearching PROTOCOL IMPLEMENTATION
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection
{
@@ -612,7 +612,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return YES;
}
-#pragma mark WebMultipleTextMatches PROTOCOL IMPLEMENTATION
+// MARK: WebMultipleTextMatches PROTOCOL IMPLEMENTATION
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
{
@@ -696,7 +696,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
return result;
}
-#pragma mark WebDocumentText PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentText PROTOCOL IMPLEMENTATION
- (BOOL)supportsTextEncoding
{
@@ -750,7 +750,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
[PDFSubview clearSelection];
}
-#pragma mark WebDocumentViewState PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentViewState PROTOCOL IMPLEMENTATION
// Even though to WebKit we are the "docView", in reality a PDFView contains its own scrollview and docView.
// And it even turns out there is another PDFKit view between the docView and its enclosing ScrollView, so
@@ -809,7 +809,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
[PDFSubview setScaleFactor:[[state objectAtIndex:i++] floatValue]];
}
-#pragma mark _WebDocumentTextSizing PROTOCOL IMPLEMENTATION
+// MARK: _WebDocumentTextSizing PROTOCOL IMPLEMENTATION
- (IBAction)_zoomOut:(id)sender
{
@@ -841,7 +841,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
return [PDFSubview scaleFactor] != 1.0;
}
-#pragma mark WebDocumentSelection PROTOCOL IMPLEMENTATION
+// MARK: WebDocumentSelection PROTOCOL IMPLEMENTATION
- (NSRect)selectionRect
{
@@ -934,7 +934,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
[pasteboard setString:[self selectedString] forType:NSStringPboardType];
}
-#pragma mark PDFView DELEGATE METHODS
+// MARK: PDFView DELEGATE METHODS
- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL
{
diff --git a/WebKit/mac/WebView/WebScriptDebugger.mm b/WebKit/mac/WebView/WebScriptDebugger.mm
index f67b46f..25ef4b7 100644
--- a/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -220,10 +220,12 @@ void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, in
void WebScriptDebugger::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineno)
{
+ callEvent(debuggerCallFrame, sourceID, lineno);
}
void WebScriptDebugger::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineno)
{
+ returnEvent(debuggerCallFrame, sourceID, lineno);
}
void WebScriptDebugger::didReachBreakpoint(const DebuggerCallFrame&, intptr_t, int)
diff --git a/WebKit/mac/WebView/WebScriptWorld.mm b/WebKit/mac/WebView/WebScriptWorld.mm
index 8ca6f44..61daff1 100644
--- a/WebKit/mac/WebView/WebScriptWorld.mm
+++ b/WebKit/mac/WebView/WebScriptWorld.mm
@@ -77,7 +77,7 @@ static WorldMap& allWorlds()
- (void)unregisterWorld
{
- _private->world->unregisterWorld();
+ _private->world->clearWrappers();
}
- (void)dealloc
diff --git a/WebKit/mac/WebView/WebTextCompletionController.mm b/WebKit/mac/WebView/WebTextCompletionController.mm
index 82ad16c..48b5035 100644
--- a/WebKit/mac/WebView/WebTextCompletionController.mm
+++ b/WebKit/mac/WebView/WebTextCompletionController.mm
@@ -173,7 +173,7 @@ using namespace std;
WebFrame *frame = [_htmlView _frame];
DOMRange *selection = kit(core(frame)->selection()->toNormalizedRange().get());
DOMRange *wholeWord = [frame _rangeByAlteringCurrentSelection:SelectionController::AlterationExtend
- direction:SelectionController::DirectionBackward granularity:WordGranularity];
+ direction:DirectionBackward granularity:WordGranularity];
DOMRange *prefix = [wholeWord cloneRange];
[prefix setEnd:[selection startContainer] offset:[selection startOffset]];
diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm
index 2687b14..93e3d8c 100644
--- a/WebKit/mac/WebView/WebVideoFullscreenController.mm
+++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm
@@ -219,8 +219,8 @@ static const NSTimeInterval tickleTimerInterval = 1.0;
}
-#pragma mark -
-#pragma mark Exposed Interface
+// MARK: -
+// MARK: Exposed Interface
static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame)
{
@@ -422,8 +422,8 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
#endif
}
-#pragma mark -
-#pragma mark Window callback
+// MARK: -
+// MARK: Window callback
- (void)_requestExit
{
@@ -452,8 +452,8 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
[_hudController fadeWindowIn];
}
-#pragma mark -
-#pragma mark QTMovie callbacks
+// MARK: -
+// MARK: QTMovie callbacks
- (void)rateChanged:(NSNotification *)unusedNotification
{
diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm
index 6907311..0a5aca4 100644
--- a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm
+++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm
@@ -623,7 +623,7 @@ static NSString *timeToString(double time)
return timeToString([_delegate mediaElement]->currentTime());
}
-#pragma mark NSResponder
+// MARK: NSResponder
- (void)mouseEntered:(NSEvent *)theEvent
{
@@ -659,7 +659,7 @@ static NSString *timeToString(double time)
[_delegate requestExitFullscreen];
}
-#pragma mark NSWindowDelegate
+// MARK: NSWindowDelegate
- (void)windowDidExpose:(NSNotification *)notification
{
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index bd13ff0..9c7de2c 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -60,6 +60,7 @@
#import "WebFormDelegatePrivate.h"
#import "WebFrameInternal.h"
#import "WebFrameViewInternal.h"
+#import "WebFullScreenController.h"
#import "WebGeolocationClient.h"
#import "WebGeolocationPositionInternal.h"
#import "WebHTMLRepresentation.h"
@@ -4286,7 +4287,7 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0)
static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *string, WebFindOptions options)
{
if ([searchView conformsToProtocol:@protocol(WebDocumentOptionsSearching)])
- return [(NSView <WebDocumentOptionsSearching> *)searchView findString:string options:options];
+ return [(NSView <WebDocumentOptionsSearching> *)searchView _findString:string options:options];
if ([searchView conformsToProtocol:@protocol(WebDocumentIncrementalSearching)])
return [(NSView <WebDocumentIncrementalSearching> *)searchView searchFor:string direction:!(options & WebFindOptionsBackwards) caseSensitive:!(options & WebFindOptionsCaseInsensitive) wrap:!!(options & WebFindOptionsWrapAround) startInSelection:!!(options & WebFindOptionsStartInSelection)];
return [searchView searchFor:string direction:!(options & WebFindOptionsBackwards) caseSensitive:!(options & WebFindOptionsCaseInsensitive) wrap:!!(options & WebFindOptionsWrapAround)];
@@ -6027,6 +6028,42 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi
#endif
+#if ENABLE(FULLSCREEN_API)
+- (BOOL)_supportsFullScreenForElement:(const WebCore::Element*)element
+{
+ if (![[WebPreferences standardPreferences] fullScreenEnabled])
+ return NO;
+
+ // FIXME: If the element is in an IFrame, we should ensure it has
+ // an AllowsFullScreen=YES attribute before allowing fullscreen access.
+ return YES;
+}
+
+- (void)_enterFullScreenForElement:(WebCore::Element*)element
+{
+ if (!_private->newFullscreenController)
+ _private->newFullscreenController = [[WebFullScreenController alloc] init];
+
+ [_private->newFullscreenController setElement:element];
+ [_private->newFullscreenController setWebView:self];
+ [_private->newFullscreenController enterFullscreen:[[self window] screen]];
+}
+
+- (void)_exitFullScreenForElement:(WebCore::Element*)element
+{
+ if (!_private->newFullscreenController)
+ return;
+ [_private->newFullscreenController exitFullscreen];
+}
+
+- (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer
+{
+ if (!_private->newFullscreenController)
+ _private->newFullscreenController = [[WebFullScreenController alloc] init];
+ [_private->newFullscreenController setRenderer:renderer];
+}
+#endif
+
#if ENABLE(GLIB_SUPPORT)
static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*)
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 8b834ca..97d0fc3 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -49,6 +49,9 @@ namespace WebCore {
#if ENABLE(VIDEO)
@class WebVideoFullscreenController;
#endif
+#if ENABLE(FULLSCREEN_API)
+@class WebFullScreenController;
+#endif
extern BOOL applicationIsTerminating;
extern int pluginDatabaseClientCount;
@@ -171,6 +174,10 @@ extern int pluginDatabaseClientCount;
#if ENABLE(VIDEO)
WebVideoFullscreenController *fullscreenController;
#endif
+
+#if ENABLE(FULLSCREEN_API)
+ WebFullScreenController *newFullscreenController;
+#endif
#if ENABLE(GLIB_SUPPORT)
CFRunLoopObserverRef glibRunLoopObserver;
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index 0a6f462..555c4d1 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -39,10 +39,12 @@
#include <wtf/Forward.h>
namespace WebCore {
+ class Element;
class Frame;
class KURL;
class KeyboardEvent;
class Page;
+ class RenderBox;
class Node;
}
#endif
@@ -185,6 +187,13 @@ namespace WebCore {
- (void)_exitFullscreen;
#endif
+#if ENABLE(FULLSCREEN_API) && defined(__cplusplus)
+- (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element;
+- (void)_enterFullScreenForElement:(WebCore::Element*)element;
+- (void)_exitFullScreenForElement:(WebCore::Element*)element;
+- (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer;
+#endif
+
- (JSValueRef)_computedStyleIncludingVisitedInfo:(JSContextRef)context forElement:(JSValueRef)value;
@end