[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jer.noble at apple.com jer.noble at apple.com
Wed Dec 22 12:43:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c5584f35be27cf6710569871389c0f483abfe445
Author: jer.noble at apple.com <jer.noble at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 27 20:49:02 2010 +0000

    2010-07-27  Jer Noble  <jer.noble at apple.com>
    
            Reviewed by Eric Carlson.
    
            Add JavaScript API to allow a page to go fullscreen.
            rdar://problem/6867795
            https://bugs.webkit.org/show_bug.cgi?id=43099
    
            * wtf/Platform.h: Enable FULLSCREEN_API mode for the Mac (except iOS).
    2010-07-27  Jer Noble  <jer.noble at apple.com>
    
            Reviewed by Eric Carlson.
    
            Add JavaScript API to allow a page to go fullscreen.
            rdar://problem/6867795
    
            Added chrome client overrides which support entering and exiting full screen.  A new preference has
            been added (setFullScreenEnabled:) to control at runtime whether full screen support is enabled
            (defaults to disabled).  Added a new WebKitFullScreenListener callback object which notifies WebCore
            when the chrome has started/finished its full screen animation.
    
            * Configurations/FeatureDefines.xcconfig:
            * WebCoreSupport/WebChromeClient.h:
            * WebCoreSupport/WebChromeClient.mm:
            (WebChromeClient::supportsFullscreenForElement):
            (WebChromeClient::enterFullscreenForElement):
            (WebChromeClient::exitFullscreenForElement):
            (-[WebKitFullScreenListener initWithElement:]):
            (-[WebKitFullScreenListener webkitWillEnterFullScreen]):
            (-[WebKitFullScreenListener webkitDidEnterFullScreen]):
            (-[WebKitFullScreenListener webkitWillExitFullScreen]):
            (-[WebKitFullScreenListener webkitDidExitFullScreen]):
            * WebView/WebPreferenceKeysPrivate.h:
            * WebView/WebPreferences.h:
            * WebView/WebPreferences.mm:
            (+[WebPreferences initialize]):
            (-[WebPreferences setFullScreenEnabled:]):
            (-[WebPreferences fullScreenEnabled]):
            * WebView/WebUIDelegatePrivate.h:
            * WebView/WebView.mm:
            (-[WebView _preferencesChangedNotification:]):
    2010-07-27  Jer Noble  <jer.noble at apple.com>
    
            Reviewed by Eric Carlson.
    
            Add JavaScript API to allow a page to go fullscreen.
            rdar://problem/6867795
            https://bugs.webkit.org/show_bug.cgi?id=43099
    
            Mozilla has proposed a new set of JavaScript APIs which allow any element in
            a document to go full-screen.  The current revision of their proposal can be
            found here:
            <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI&oldid=243429>
    
            The proposed specification includes the following:
    
            Document:
            - Three new methods on Document:
                + void requestFullScreen()
                + void requestFullScreenWithKeys()
                + void cancelFullScreen()
            - Three new attributes of Document:
                + readonly attribute boolean fullScreen
                + readonly attribute boolean fullScreenWithKeys
                + (optional) readonly attribute Element currentFullScreenElement
    
            Element:
            - Two new methods on Element:
                + void requestFullScreen()
                + void requestFullScreenWithKeys()
    
            Events:
            - One new event:
                + fullScreenChange
    
            CSS Pseudo-classes:
            - Three new Pseudo-classes:
                + :full-screen
                + :full-screen-doc
                + :full-screen-root-with-target
    
            For WebKit's initial implementation, all the above new APIs will be prefixed with
            "webkit" or "-webkit" where appropriate.
    
            New tests:
            LayoutTests/fullscreen/full-screen-api.html
            LayoutTests/fullscreen/full-screen-css.html
            LayoutTests/fullscreen/full-screen-request.html
    
            Project file changes:
            * Configurations/FeatureDefines.xcconfig: Added an ENABLE_FULLSCREEN_API entry.
            * DerivedSources.make: Added rules for fullscreen.css and WebCore.FullScreen.exp.
            * WebCore.FullScreen.exp: Added export symbols for Document and Element functions.
            * WebCore.xcodeproj/project.pbxproj: New source files added to the project.
    
            IDL changes:
            * dom/Document.idl: Added the new full-screen API to the Document's javascript interface.
            * dom/Element.idl: Added the new full-screen API to the Element's javascript interface.
    
            Source changes:
            * bindings/objc/PublicDOMInterfaces.h: Exposed Document and Element fullscreen functions in the DOM classes.
            * css/CSSSelector.cpp: Added new FullScreen pseudo-classes.
            * css/CSSSelector.h: Added new full-screen pseudo classes to the PseudoType enum.
            * css/CSSStyleSelector.cpp:
            (WebCore::loadFullDefaultStyle): Pull the fullscreen.css sheet into the defaultStyle and the defaultQuirksStyle sheets.
            (WebCore::loadSimpleDefaultStyle): Pull the fullscreen.css sheet into the defaultStyle sheet.
            (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Check for the new FullScreen pseudo classes.
            * dom/Document.cpp:
            (WebCore::Document::createEvent): Support creating a "WebKitFullScreenChange" event.
            (WebCore::Document::addListenerTypeIfNeeded): Support listening for a "webKitFullScreenChangeEvent"
            (WebCore::Document::webkitRequestFullScreenForElement): Passes request to the chrome client to enter full screen mode.
            (WebCore::Document::webkitCancelFullScreen): Passes request to the chrome client to exit full screen mode.
            (WebCore::Document::webkitWillEnterFullScreenForElement): Sets the FullScreen pseudo-classes on the full-screen element and its document.
            (WebCore::Document::webkitDidEnterFullScreenForElement): Currently a no-op.
            (WebCore::Document::webkitWillExitFullScreenForElement): Currently a no-op.
            (WebCore::Document::webkitDidExitFullScreenForElement): Clears the FullScreen pseudo-classes on the full-screen element and its document.
            * dom/Document.h: Added const accessors for new full-screen instance variables.
            (WebCore::Document::):
            (WebCore::Document::webkitIsFullScreen): Accessor for m_isFullScreen.
            (WebCore::Document::webkitIsFullScreenWithKeysEnabled): Accessor for m_isFullScren and m_areKeysEnabled.
            (WebCore::Document::webkitCurrentFullScreenElement): Accessor for m_fullScreenElement.
            * dom/Element.cpp:
            (WebCore::Element::webkitRequestFullScreen): Calls Document::webkitRequestFullScreenForElement.
            * dom/Element.h:
            * dom/EventNames.h: Add a webkitfullscreenchange event name.
            * html/HTMLElement.cpp:
            (WebCore::HTMLElement::parseMappedAttribute): Parse the new "onwebkitfullscreenchange" attribute and register a listener.
            * page/ChromeClient.h:
            (WebCore::ChromeClient::supportsFullscreenForElement): Pass through to the current UI delegate.
            (WebCore::ChromeClient::enterFullscreenForElement): Create a WebKitFullScreenListener and pass through to the current UI delegate.
            (WebCore::ChromeClient::exitFullscreenForElement): Create a WebKitFullScreenListener and pass through to the current UI delegate.
            * page/Settings.cpp:
            (WebCore::Settings::Settings):
            * page/Settings.h: Add a new setting to control runtime support for full screen mode (defaults to off)
            * rendering/MediaControlElements.cpp:
            (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): The full screen button now toggles full screen mode (previously, it only entered).
            * rendering/style/RenderStyleConstants.h: Added new style constants.
    2010-08-09  Jer Noble  <jer.noble at apple.com>
    
            Add JavaScript API to allow a page to go fullscreen.
            rdar://problem/6867795
            https://bugs.webkit.org/show_bug.cgi?id=43099
    
            New tests for the new full screen API:
    
            full-screen-api.html: tests for the presence of the new full screen
                apis.
            full-screen-request.html: tests that clients can request the browser
                enter full screen mode successfully.
            full-screen-css.html: tests that the new full screen pseudo classes are
                applied once full screen mode is entered.
            full-screen-remove.html: tests that the document's current full screen
                element is changed when that element is removed from the DOM tree.
            full-screen-remove-ancestor.html: tests that the document's current full
                screen element is changed an ancestor of that element is removed
                from the DOM tree.
            full-screen-twice.html: tests that entering full screen mode on two
                different elements in a row does not fail.
    
            Tests that were changed:
    
            domListEnumeration.html: This test returns a specific count of
                properties on HTML elements; after consultation with Sam Weinig (the
                original test author), it was decided that this part of the test
                would be very difficult to make platform specific, and that nothing
                significant would be lost if the property count sections were
                removed.
    
            platform/*/Skipped: Added the fullscreen/ directory to the Skipped list
                for every platform save mac.
    
            * fast/dom/Window/window-properties-expected.txt: Added the new
                properties exposed on Document and Element.
            * fast/dom/domListEnumeration-expected.txt: Removed the iteration count
                part of this test.
            * fast/dom/script-tests/domListEnumeration.js: ""
            * fullscreen: Added.
            * platform/mac/fullscreen: Added.
            * platform/mac/fullscreen/full-screen-api-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-api.html: Added.
            * platform/mac/fullscreen/full-screen-css-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-css.html: Added.
            * platform/mac/fullscreen/full-screen-remove-ancestor-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-remove-ancestor.html: Added.
            * platform/mac/fullscreen/full-screen-remove-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-remove.html: Added.
            * platform/mac/fullscreen/full-screen-request-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-request.html: Added.
            * platform/mac/fullscreen/full-screen-twice-expected.txt: Added.
            * platform/mac/fullscreen/full-screen-twice.html: Added.
    2010-07-27  Jer Noble  <jer.noble at apple.com>
    
            Reviewed by Eric Carlson.
    
            Add JavaScript API to allow a page to go fullscreen.
            rdar://problem/6867795
    
            Added basic full screen support to DumpRenderTree: when a webView requests
            that DumpRenderTree go "full screen", just call the provided callback listener object's
            will/did Enter/Exit full screen methods.  Also, register a new user default which
            enables full screen support.
    
            * DumpRenderTree/mac/DumpRenderTree.mm:
            (resetDefaultsToConsistentValues):
            * DumpRenderTree/mac/UIDelegate.mm:
            (-[UIDelegate webView:supportsFullscreenForElement:]):
            (-[UIDelegate webView:enterFullscreenForElement:listener:]):
            (-[UIDelegate webView:exitFullscreenForElement:listener:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66251 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index dc436d5..196a2d0 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-27  Jer Noble  <jer.noble at apple.com>
+
+        Reviewed by Eric Carlson.
+
+        Add JavaScript API to allow a page to go fullscreen.
+        rdar://problem/6867795
+        https://bugs.webkit.org/show_bug.cgi?id=43099
+
+        * wtf/Platform.h: Enable FULLSCREEN_API mode for the Mac (except iOS).
+
 2010-08-27  Gavin Barraclough  <barraclough at apple.com>
 
         Windows build fix pt 2.
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 2f27485..d58af31 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -595,6 +595,7 @@
 #endif
 #define HAVE_READLINE 1
 #define HAVE_RUNLOOP_TIMER 1
+#define ENABLE_FULLSCREEN_API 1
 #endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
 
 #if PLATFORM(MAC)
@@ -904,6 +905,10 @@
 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
 #endif
 
+#if !defined(ENABLE_FULLSCREEN_API)
+#define ENABLE_FULLSCREEN_API 0
+#endif
+
 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
     || (CPU(IA64) && !CPU(IA64_32)) \
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8d08a0b..daee908 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,57 @@
+2010-08-09  Jer Noble  <jer.noble at apple.com>
+
+        Add JavaScript API to allow a page to go fullscreen.
+        rdar://problem/6867795
+        https://bugs.webkit.org/show_bug.cgi?id=43099
+
+        New tests for the new full screen API:
+
+        full-screen-api.html: tests for the presence of the new full screen 
+            apis.
+        full-screen-request.html: tests that clients can request the browser 
+            enter full screen mode successfully.
+        full-screen-css.html: tests that the new full screen pseudo classes are 
+            applied once full screen mode is entered.
+        full-screen-remove.html: tests that the document's current full screen 
+            element is changed when that element is removed from the DOM tree.
+        full-screen-remove-ancestor.html: tests that the document's current full 
+            screen element is changed an ancestor of that element is removed 
+            from the DOM tree.
+        full-screen-twice.html: tests that entering full screen mode on two     
+            different elements in a row does not fail.
+        
+        Tests that were changed:
+        
+        domListEnumeration.html: This test returns a specific count of 
+            properties on HTML elements; after consultation with Sam Weinig (the 
+            original test author), it was decided that this part of the test 
+            would be very difficult to make platform specific, and that nothing 
+            significant would be lost if the property count sections were 
+            removed.
+        
+        platform/*/Skipped: Added the fullscreen/ directory to the Skipped list 
+            for every platform save mac.
+
+        * fast/dom/Window/window-properties-expected.txt: Added the new 
+            properties exposed on Document and Element.
+        * fast/dom/domListEnumeration-expected.txt: Removed the iteration count 
+            part of this test.
+        * fast/dom/script-tests/domListEnumeration.js: ""
+        * fullscreen: Added.
+        * platform/mac/fullscreen: Added.
+        * platform/mac/fullscreen/full-screen-api-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-api.html: Added.
+        * platform/mac/fullscreen/full-screen-css-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-css.html: Added.
+        * platform/mac/fullscreen/full-screen-remove-ancestor-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-remove-ancestor.html: Added.
+        * platform/mac/fullscreen/full-screen-remove-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-remove.html: Added.
+        * platform/mac/fullscreen/full-screen-request-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-request.html: Added.
+        * platform/mac/fullscreen/full-screen-twice-expected.txt: Added.
+        * platform/mac/fullscreen/full-screen-twice.html: Added.
+
 2010-08-27  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/LayoutTests/fast/dom/Window/window-properties-expected.txt b/LayoutTests/fast/dom/Window/window-properties-expected.txt
index cca064f..e553bec 100644
--- a/LayoutTests/fast/dom/Window/window-properties-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-properties-expected.txt
@@ -43,6 +43,7 @@ window.Attr.prototype.replaceChild [function]
 window.Audio [object AudioConstructor]
 window.Audio.length [number]
 window.Audio.prototype [object HTMLAudioElementPrototype]
+window.Audio.prototype.ALLOW_KEYBOARD_INPUT [number]
 window.Audio.prototype.ATTRIBUTE_NODE [number]
 window.Audio.prototype.CDATA_SECTION_NODE [number]
 window.Audio.prototype.COMMENT_NODE [number]
@@ -123,6 +124,7 @@ window.Audio.prototype.setAttributeNS [function]
 window.Audio.prototype.setAttributeNode [function]
 window.Audio.prototype.setAttributeNodeNS [function]
 window.Audio.prototype.webkitMatchesSelector [function]
+window.Audio.prototype.webkitRequestFullScreen [function]
 window.BeforeLoadEvent [object BeforeLoadEventConstructor]
 window.BeforeLoadEvent.prototype [object BeforeLoadEventPrototype]
 window.BeforeLoadEvent.prototype.AT_TARGET [number]
@@ -636,6 +638,7 @@ window.Document.prototype.querySelectorAll [function]
 window.Document.prototype.removeChild [function]
 window.Document.prototype.removeEventListener [function]
 window.Document.prototype.replaceChild [function]
+window.Document.prototype.webkitCancelFullScreen [function]
 window.DocumentFragment [object DocumentFragmentConstructor]
 window.DocumentFragment.prototype [object DocumentFragmentPrototype]
 window.DocumentFragment.prototype.ATTRIBUTE_NODE [number]
@@ -715,7 +718,9 @@ window.DocumentType.prototype.removeChild [function]
 window.DocumentType.prototype.removeEventListener [function]
 window.DocumentType.prototype.replaceChild [function]
 window.Element [object ElementConstructor]
+window.Element.ALLOW_KEYBOARD_INPUT [number]
 window.Element.prototype [object ElementPrototype]
+window.Element.prototype.ALLOW_KEYBOARD_INPUT [number]
 window.Element.prototype.ATTRIBUTE_NODE [number]
 window.Element.prototype.CDATA_SECTION_NODE [number]
 window.Element.prototype.COMMENT_NODE [number]
@@ -780,6 +785,7 @@ window.Element.prototype.setAttributeNS [function]
 window.Element.prototype.setAttributeNode [function]
 window.Element.prototype.setAttributeNodeNS [function]
 window.Element.prototype.webkitMatchesSelector [function]
+window.Element.prototype.webkitRequestFullScreen [function]
 window.Entity [object EntityConstructor]
 window.Entity.prototype [object EntityPrototype]
 window.Entity.prototype.ATTRIBUTE_NODE [number]
diff --git a/LayoutTests/fast/dom/domListEnumeration-expected.txt b/LayoutTests/fast/dom/domListEnumeration-expected.txt
index ea4524f..9ffb653 100644
--- a/LayoutTests/fast/dom/domListEnumeration-expected.txt
+++ b/LayoutTests/fast/dom/domListEnumeration-expected.txt
@@ -32,7 +32,6 @@ PASS resultArray[2].i is '2'
 PASS resultArray[2].item is namedNodeMap.item(2)
 
 [object HTMLFormElement]
-PASS resultArray.length is 136
 PASS resultArray[0].i is '0'
 PASS resultArray[0].item is document.getElementsByTagName('select')[0]
 PASS resultArray[1].i is '1'
@@ -41,7 +40,6 @@ PASS resultArray[2].i is '2'
 PASS resultArray[2].item is document.getElementsByTagName('select')[2]
 
 [object HTMLSelectElement]
-PASS resultArray.length is 144
 PASS resultArray[0].i is '0'
 PASS resultArray[0].item is document.getElementsByTagName('option')[0]
 PASS resultArray[1].i is '1'
diff --git a/LayoutTests/fast/dom/script-tests/domListEnumeration.js b/LayoutTests/fast/dom/script-tests/domListEnumeration.js
index b8d31ed..c1339e1 100644
--- a/LayoutTests/fast/dom/script-tests/domListEnumeration.js
+++ b/LayoutTests/fast/dom/script-tests/domListEnumeration.js
@@ -130,7 +130,6 @@ shouldBe("resultArray[2].item", "namedNodeMap.item(2)");
 // HTMLFormElement
 var htmlFormElement = document.getElementsByTagName('form')[0];
 resultArray = iterateList(htmlFormElement);
-shouldBe("resultArray.length", "136");
 shouldBe("resultArray[0].i", "'0'");
 shouldBe("resultArray[0].item", "document.getElementsByTagName('select')[0]");
 shouldBe("resultArray[1].i", "'1'");
@@ -141,7 +140,6 @@ shouldBe("resultArray[2].item", "document.getElementsByTagName('select')[2]");
 // HTMLSelectElement
 var htmlSelectElement = document.getElementsByTagName('select')[0];
 resultArray = iterateList(htmlSelectElement);
-shouldBe("resultArray.length", "144");
 shouldBe("resultArray[0].i", "'0'");
 shouldBe("resultArray[0].item", "document.getElementsByTagName('option')[0]");
 shouldBe("resultArray[1].i", "'1'");
diff --git a/LayoutTests/fullscreen/full-screen-api-expected.txt b/LayoutTests/fullscreen/full-screen-api-expected.txt
new file mode 100644
index 0000000..9640804
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-api-expected.txt
@@ -0,0 +1,8 @@
+EXPECTED (document.webkitFullScreen == 'false') OK
+EXPECTED (document.webkitCancelFullScreen != 'undefined') OK
+EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
+EXPECTED (document.onwebkitfullscreenchange == 'null') OK
+EXPECTED (span.webkitRequestFullScreen != 'undefined') OK
+EXPECTED (span.onwebkitfullscreenchange == 'null') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-api.html b/LayoutTests/fullscreen/full-screen-api.html
new file mode 100644
index 0000000..859e627
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-api.html
@@ -0,0 +1,13 @@
+<body>
+    <script src="full-screen-test.js"></script>
+<span></span>
+<script>
+    span = document.getElementsByTagName('span')[0];
+    testExpected("document.webkitFullScreen", false);
+    testExpected("document.webkitCancelFullScreen", undefined, "!=");
+    testExpected("document.webkitCurrentFullScreenElement", null);
+    testExpected("document.onwebkitfullscreenchange", null)
+    testExpected("span.webkitRequestFullScreen", undefined, "!=");
+    testExpected("span.onwebkitfullscreenchange", null) 
+    endTest();
+</script>
diff --git a/LayoutTests/fullscreen/full-screen-css-expected.txt b/LayoutTests/fullscreen/full-screen-css-expected.txt
new file mode 100644
index 0000000..ab993f8
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-css-expected.txt
@@ -0,0 +1,15 @@
+EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') != 'rgb(0, 255, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') != 'rgb(255, 0, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') != 'rgb(0, 0, 255)') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
+EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgb(0, 255, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') == 'rgb(255, 0, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') == 'rgb(0, 0, 255)') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgb(0, 255, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') != 'rgb(255, 0, 0)') OK
+EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') == 'rgb(0, 0, 255)') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-css.html b/LayoutTests/fullscreen/full-screen-css.html
new file mode 100644
index 0000000..3115927
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-css.html
@@ -0,0 +1,50 @@
+<body>
+<script src="full-screen-test.js"></script>
+<style>
+    :-webkit-full-screen { background: lime; }
+    :-webkit-full-screen-document { color: blue; }
+    :root:-webkit-full-screen-document:not(:-webkit-full-screen) { background: red; }
+</style>
+<span></span>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+
+        var span = document.getElementsByTagName('span')[0];
+    
+        testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)", "!=");
+        testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)", "!=");
+        testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)", "!=");
+    
+        var spanEnteredFullScreen = function(event) {
+            testExpected("document.webkitCurrentFullScreenElement", span);
+            testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
+            testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)");
+            testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)");
+        
+            callback = documentEnteredFullScreen;
+            document.documentElement.webkitRequestFullScreen();
+        };
+    
+        var documentEnteredFullScreen = function(event) {
+            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
+            testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)", "!=");
+            testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)");
+            endTest();
+        };
+    
+        callback = spanEnteredFullScreen;
+        span.webkitRequestFullScreen();
+    }
+</script>
diff --git a/LayoutTests/fullscreen/full-screen-remove-ancestor-expected.txt b/LayoutTests/fullscreen/full-screen-remove-ancestor-expected.txt
new file mode 100644
index 0000000..d9a0ab3
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-remove-ancestor-expected.txt
@@ -0,0 +1,6 @@
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-remove-ancestor.html b/LayoutTests/fullscreen/full-screen-remove-ancestor.html
new file mode 100644
index 0000000..b072929
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-remove-ancestor.html
@@ -0,0 +1,36 @@
+<body>
+<script src="full-screen-test.js"></script>
+<div><span></span></div>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+
+        var span = document.getElementsByTagName('span')[0];
+        var div = span.parentNode;
+
+        var spanEnteredFullScreen = function(event) {
+            callback = documentEnteredFullScreen;
+            testExpected("document.webkitCurrentFullScreenElement", span);
+            document.body.removeChild(div);
+        };
+
+        var documentEnteredFullScreen = function(event) {
+            callback = null;
+            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            endTest();
+        };
+
+        callback = spanEnteredFullScreen;
+        span.webkitRequestFullScreen();
+    }
+</script>
diff --git a/LayoutTests/fullscreen/full-screen-remove-expected.txt b/LayoutTests/fullscreen/full-screen-remove-expected.txt
new file mode 100644
index 0000000..d9a0ab3
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-remove-expected.txt
@@ -0,0 +1,6 @@
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-remove.html b/LayoutTests/fullscreen/full-screen-remove.html
new file mode 100644
index 0000000..5a94bfd
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-remove.html
@@ -0,0 +1,35 @@
+<body>
+<script src="full-screen-test.js"></script>
+<div><span></span></div>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+    
+        var span = document.getElementsByTagName('span')[0];
+    
+        var spanEnteredFullScreen = function(event) {
+            callback = documentEnteredFullScreen;
+            testExpected("document.webkitCurrentFullScreenElement", span);
+            span.parentNode.removeChild(span);
+        };
+    
+        var documentEnteredFullScreen = function(event) {
+            callback = null;
+            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            endTest();
+        };
+    
+        callback = spanEnteredFullScreen;
+        span.webkitRequestFullScreen();
+    }
+</script>
diff --git a/LayoutTests/fullscreen/full-screen-request-expected.txt b/LayoutTests/fullscreen/full-screen-request-expected.txt
new file mode 100644
index 0000000..4bf81ef
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-request-expected.txt
@@ -0,0 +1,3 @@
+EVENT(webkitfullscreenchange) TEST(document.webkitFullScreen==true) OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-request.html b/LayoutTests/fullscreen/full-screen-request.html
new file mode 100644
index 0000000..2adb97f
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-request.html
@@ -0,0 +1,12 @@
+<body>
+<script src="full-screen-test.js"></script>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitFullScreen==true");
+        document.documentElement.webkitRequestFullScreen();
+    }
+</script>
diff --git a/LayoutTests/fullscreen/full-screen-test.js b/LayoutTests/fullscreen/full-screen-test.js
new file mode 100644
index 0000000..d37a80b
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-test.js
@@ -0,0 +1,119 @@
+var console = null;
+var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
+
+logConsole();
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function logConsole()
+{
+    if (!console && document.body) {
+        console = document.createElement('div');
+        document.body.appendChild(console);
+    }
+    return console;
+}
+
+function testAndEnd(testFuncString)
+{
+    test(testFuncString, true);
+}
+
+function test(testFuncString, endit)
+{
+    logResult(eval(testFuncString), "TEST(" + testFuncString + ")");
+    if (endit)
+        endTest();  
+}
+
+function testExpected(testFuncString, expected, comparison)
+{
+    try {
+        var observed = eval(testFuncString);
+    } catch (ex) {
+        consoleWrite(ex);
+        return;
+    }
+    
+    if (comparison === undefined)
+        comparison = '==';
+
+    var success = false;
+    switch (comparison)
+    {
+        case '<':  success = observed <  expected; break;
+        case '<=': success = observed <= expected; break;
+        case '>':  success = observed >  expected; break;
+        case '>=': success = observed >= expected; break;
+        case '!=': success = observed != expected; break;
+        case '==': success = observed == expected; break;
+    }
+    
+    reportExpected(success, testFuncString, comparison, expected, observed)
+}
+
+var testNumber = 0;
+
+function reportExpected(success, testFuncString, comparison, expected, observed)
+{
+    testNumber++;
+
+    var msg = "Test " + testNumber;
+
+    if (printFullTestDetails || !success)
+        msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em>" + expected + "</em>')";
+
+    if (!success)
+        msg +=  ", OBSERVED '<em>" + observed + "</em>'";
+
+    logResult(success, msg);
+}
+
+function waitForEventAndEnd(eventName, funcString)
+{
+    waitForEvent(eventName, funcString, true)
+}
+
+function waitForEvent(element, eventName, func, endit)
+{
+    function _eventCallback(event)
+    {
+        consoleWrite("EVENT(" + eventName + ")");
+
+        if (func)
+            func(event);
+        
+        if (endit)
+            endTest();    
+    }
+
+    element.addEventListener(eventName, _eventCallback);
+}
+
+var testEnded = false;
+
+function endTest()
+{
+    consoleWrite("END OF TEST");
+    testEnded = true;
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();     
+}
+
+function logResult(success, text)
+{
+    if (success)
+        consoleWrite(text + " <span style='color:green'>OK</span>");
+    else
+        consoleWrite(text + " <span style='color:red'>FAIL</span>");
+}
+
+function consoleWrite(text)
+{
+    if (testEnded)
+        return;
+    logConsole().innerHTML += text + "<br>";
+}
\ No newline at end of file
diff --git a/LayoutTests/fullscreen/full-screen-twice-expected.txt b/LayoutTests/fullscreen/full-screen-twice-expected.txt
new file mode 100644
index 0000000..d9a0ab3
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-twice-expected.txt
@@ -0,0 +1,6 @@
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-twice.html b/LayoutTests/fullscreen/full-screen-twice.html
new file mode 100644
index 0000000..06485b8
--- /dev/null
+++ b/LayoutTests/fullscreen/full-screen-twice.html
@@ -0,0 +1,35 @@
+<body>
+<script src="full-screen-test.js"></script>
+<span></span>
+<script>
+    // Bail out early if the full screen API is not enabled or is missing:
+    if (Element.prototype.webkitRequestFullScreen == undefined) {
+        logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+        endTest();
+    } else {
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+    
+        var span = document.getElementsByTagName('span')[0];
+
+        var spanEnteredFullScreen = function() {
+            testExpected("document.webkitCurrentFullScreenElement", span);
+            callback = documentEnteredFullScreen;
+            document.documentElement.webkitRequestFullScreen();
+        };
+    
+        var documentEnteredFullScreen = function() {
+            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            callback = null;
+            endTest();
+        };
+
+        callback = spanEnteredFullScreen;
+        span.webkitRequestFullScreen();
+    }
+</script>
diff --git a/LayoutTests/platform/android/Skipped b/LayoutTests/platform/android/Skipped
new file mode 100644
index 0000000..f4ab335
--- /dev/null
+++ b/LayoutTests/platform/android/Skipped
@@ -0,0 +1,2 @@
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/LayoutTests/platform/chromium/Skipped b/LayoutTests/platform/chromium/Skipped
new file mode 100644
index 0000000..f4ab335
--- /dev/null
+++ b/LayoutTests/platform/chromium/Skipped
@@ -0,0 +1,2 @@
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/LayoutTests/platform/google-chrome-linux64/Skipped b/LayoutTests/platform/google-chrome-linux64/Skipped
new file mode 100644
index 0000000..f4ab335
--- /dev/null
+++ b/LayoutTests/platform/google-chrome-linux64/Skipped
@@ -0,0 +1,2 @@
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 2d8b977..3a55904 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5945,3 +5945,6 @@ media/video-buffered.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=44784
 fast/history/history-subframe-with-name.html
+
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index ded8ce1..e75e24d 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5447,3 +5447,5 @@ perf/
 # BlodBuilder is not enabled
 http/tests/local/blob/send-data-blob.html
 
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 5485cb2..f803a34 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -972,3 +972,6 @@ inspector/dom-breakpoints.html
 
 # <https://bugs.webkit.org/show_bug.cgi?id=44484>
 svg/batik/paints/patternRegions-positioned-objects.svg
+
+# Full Screen support is not yet enabled.
+fullscreen/
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dae300e..9c0619d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,100 @@
+2010-07-27  Jer Noble  <jer.noble at apple.com>
+
+        Reviewed by Eric Carlson.
+
+        Add JavaScript API to allow a page to go fullscreen.
+        rdar://problem/6867795
+        https://bugs.webkit.org/show_bug.cgi?id=43099
+        
+        Mozilla has proposed a new set of JavaScript APIs which allow any element in
+        a document to go full-screen.  The current revision of their proposal can be 
+        found here:
+        <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI&oldid=243429>
+        
+        The proposed specification includes the following:
+        
+        Document:
+        - Three new methods on Document:
+            + void requestFullScreen()
+            + void requestFullScreenWithKeys()
+            + void cancelFullScreen()
+        - Three new attributes of Document:
+            + readonly attribute boolean fullScreen
+            + readonly attribute boolean fullScreenWithKeys
+            + (optional) readonly attribute Element currentFullScreenElement
+            
+        Element:
+        - Two new methods on Element:
+            + void requestFullScreen()
+            + void requestFullScreenWithKeys()
+        
+        Events:
+        - One new event:
+            + fullScreenChange
+        
+        CSS Pseudo-classes:
+        - Three new Pseudo-classes:
+            + :full-screen
+            + :full-screen-doc
+            + :full-screen-root-with-target
+        
+        For WebKit's initial implementation, all the above new APIs will be prefixed with 
+        "webkit" or "-webkit" where appropriate.
+        
+        New tests:
+        LayoutTests/fullscreen/full-screen-api.html
+        LayoutTests/fullscreen/full-screen-css.html
+        LayoutTests/fullscreen/full-screen-request.html
+
+        Project file changes:
+        * Configurations/FeatureDefines.xcconfig: Added an ENABLE_FULLSCREEN_API entry.
+        * DerivedSources.make: Added rules for fullscreen.css and WebCore.FullScreen.exp.
+        * WebCore.FullScreen.exp: Added export symbols for Document and Element functions.
+        * WebCore.xcodeproj/project.pbxproj: New source files added to the project.
+
+        IDL changes:
+        * dom/Document.idl: Added the new full-screen API to the Document's javascript interface.
+        * dom/Element.idl: Added the new full-screen API to the Element's javascript interface.
+
+        Source changes:
+        * bindings/objc/PublicDOMInterfaces.h: Exposed Document and Element fullscreen functions in the DOM classes.
+        * css/CSSSelector.cpp: Added new FullScreen pseudo-classes.
+        * css/CSSSelector.h: Added new full-screen pseudo classes to the PseudoType enum.
+        * css/CSSStyleSelector.cpp: 
+        (WebCore::loadFullDefaultStyle): Pull the fullscreen.css sheet into the defaultStyle and the defaultQuirksStyle sheets.
+        (WebCore::loadSimpleDefaultStyle): Pull the fullscreen.css sheet into the defaultStyle sheet.
+        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Check for the new FullScreen pseudo classes.
+        * dom/Document.cpp:
+        (WebCore::Document::createEvent): Support creating a "WebKitFullScreenChange" event.
+        (WebCore::Document::addListenerTypeIfNeeded): Support listening for a "webKitFullScreenChangeEvent"
+        (WebCore::Document::webkitRequestFullScreenForElement): Passes request to the chrome client to enter full screen mode.
+        (WebCore::Document::webkitCancelFullScreen): Passes request to the chrome client to exit full screen mode.
+        (WebCore::Document::webkitWillEnterFullScreenForElement): Sets the FullScreen pseudo-classes on the full-screen element and its document.
+        (WebCore::Document::webkitDidEnterFullScreenForElement): Currently a no-op.
+        (WebCore::Document::webkitWillExitFullScreenForElement): Currently a no-op.
+        (WebCore::Document::webkitDidExitFullScreenForElement): Clears the FullScreen pseudo-classes on the full-screen element and its document.
+        * dom/Document.h: Added const accessors for new full-screen instance variables.
+        (WebCore::Document::):
+        (WebCore::Document::webkitIsFullScreen): Accessor for m_isFullScreen.
+        (WebCore::Document::webkitIsFullScreenWithKeysEnabled): Accessor for m_isFullScren and m_areKeysEnabled.
+        (WebCore::Document::webkitCurrentFullScreenElement): Accessor for m_fullScreenElement.
+        * dom/Element.cpp:
+        (WebCore::Element::webkitRequestFullScreen): Calls Document::webkitRequestFullScreenForElement. 
+        * dom/Element.h:
+        * dom/EventNames.h: Add a webkitfullscreenchange event name.
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseMappedAttribute): Parse the new "onwebkitfullscreenchange" attribute and register a listener.
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::supportsFullscreenForElement): Pass through to the current UI delegate.
+        (WebCore::ChromeClient::enterFullscreenForElement): Create a WebKitFullScreenListener and pass through to the current UI delegate.
+        (WebCore::ChromeClient::exitFullscreenForElement): Create a WebKitFullScreenListener and pass through to the current UI delegate.
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        * page/Settings.h: Add a new setting to control runtime support for full screen mode (defaults to off)
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): The full screen button now toggles full screen mode (previously, it only entered).
+        * rendering/style/RenderStyleConstants.h: Added new style constants.
+
 2010-08-27  James Robinson  <jamesr at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig
index f2b4c09..8f8c213 100644
--- a/WebCore/Configurations/FeatureDefines.xcconfig
+++ b/WebCore/Configurations/FeatureDefines.xcconfig
@@ -71,6 +71,7 @@ ENABLE_FILTERS_macosx = ENABLE_FILTERS;
 
 ENABLE_FILE_WRITER = ;
 ENABLE_FILE_SYSTEM = ;
+ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API;
 ENABLE_GEOLOCATION = ENABLE_GEOLOCATION;
 
 ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME));
@@ -120,4 +121,4 @@ ENABLE_XHTMLMP = ;
 ENABLE_XPATH = ENABLE_XPATH;
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index b9f6589..e7f000c 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -676,6 +676,10 @@ ifeq ($(OS),MACOS)
 endif
 endif
 
+ifeq ($(findstring ENABLE_FULLSCREEN_API,$(FEATURE_DEFINES)), ENABLE_FULLSCREEN_API)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/fullscreen.css
+endif
+
 UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS)
 	perl $< $@ UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS)
 
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 02b217a..0a8a510 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -1475,6 +1475,13 @@ __ZN7WebCore9HTMLNames8audioTagE
 __ZN7WebCore9HTMLNames8videoTagE
 #endif
 
+#if ENABLE(FULLSCREEN_API)
+__ZN7WebCore8Document33webkitDidExitFullScreenForElementEPNS_7ElementE
+__ZN7WebCore8Document34webkitDidEnterFullScreenForElementEPNS_7ElementE
+__ZN7WebCore8Document34webkitWillExitFullScreenForElementEPNS_7ElementE
+__ZN7WebCore8Document35webkitWillEnterFullScreenForElementEPNS_7ElementE
+#endif
+
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 __ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 2ef816c..8c56f1c 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -10940,6 +10940,7 @@
 		C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; };
 		C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; };
 		C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; };
+		CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; };
 		CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptControllerBase.h; sourceTree = "<group>"; };
 		CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarkerController.cpp; sourceTree = "<group>"; };
 		CE057FA41220731100A476D5 /* DocumentMarkerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarkerController.h; sourceTree = "<group>"; };
@@ -17035,6 +17036,7 @@
 				BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */,
 				31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */,
 				4CDE54EC0E5579780089E26C /* wml.css */,
+				CD4E0AFA11F7BC27009D3811 /* fullscreen.css */,
 			);
 			path = css;
 			sourceTree = "<group>";
diff --git a/WebCore/bindings/objc/PublicDOMInterfaces.h b/WebCore/bindings/objc/PublicDOMInterfaces.h
index ea46436..428ac4a 100644
--- a/WebCore/bindings/objc/PublicDOMInterfaces.h
+++ b/WebCore/bindings/objc/PublicDOMInterfaces.h
@@ -156,6 +156,9 @@
 - (DOMNodeList *)getElementsByClassName:(NSString *)tagname AVAILABLE_IN_WEBKIT_VERSION_4_0;
 - (DOMElement *)querySelector:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0;
 - (DOMNodeList *)querySelectorAll:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0;
+#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
+- (void)webkitCancelFullScreen AVAILABLE_IN_WEBKIT_VERSION_4_0;
+#endif
 @end
 
 @interface DOMDocumentFragment : DOMNode WEBKIT_VERSION_1_3
@@ -224,6 +227,9 @@
 - (DOMNodeList *)getElementsByClassName:(NSString *)name AVAILABLE_IN_WEBKIT_VERSION_4_0;
 - (DOMElement *)querySelector:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0;
 - (DOMNodeList *)querySelectorAll:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0;
+#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
+- (void)webkitRequestFullScreen:(unsigned short)flags AVAILABLE_IN_WEBKIT_VERSION_4_0;
+#endif
 @end
 
 @interface DOMEntity : DOMNode WEBKIT_VERSION_1_3
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index b1d2d3d..8bfa93c 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -262,6 +262,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
         case MediaControlsBackgroundPart:
             m_value.ident = CSSValueMediaControlsBackground;
             break;
+        case MediaControlsFullscreenBackgroundPart:
+            m_value.ident = CSSValueMediaControlsFullscreenBackground;
+            break;
         case MediaCurrentTimePart:
             m_value.ident = CSSValueMediaCurrentTimeDisplay;
             break;
diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp
index 1f336a2..fb8f695 100644
--- a/WebCore/css/CSSSelector.cpp
+++ b/WebCore/css/CSSSelector.cpp
@@ -248,6 +248,13 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
         return NOPSEUDO;
 #endif
 
+#if ENABLE(FULLSCREEN_API)
+    case PseudoFullScreen:
+        return FULL_SCREEN;
+    case PseudoFullScreenDocument:
+        return FULL_SCREEN_DOCUMENT;
+#endif
+            
     case PseudoInputListButton:
 #if ENABLE(DATALIST)
         return INPUT_LIST_BUTTON;
@@ -426,6 +433,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
     DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first"));
     DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left"));
     DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right"));
+#if ENABLE(FULLSCREEN_API)
+    DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen"));
+    DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document"));
+#endif
 
     static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
     if (!nameToPseudoType) {
@@ -537,6 +548,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
         nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage);
         nameToPseudoType->set(leftPage.impl(), CSSSelector::PseudoLeftPage);
         nameToPseudoType->set(rightPage.impl(), CSSSelector::PseudoRightPage);
+#if ENABLE(FULLSCREEN_API)
+        nameToPseudoType->set(fullScreen.impl(), CSSSelector::PseudoFullScreen);
+        nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFullScreenDocument);
+#endif
     }
     return nameToPseudoType;
 }
@@ -666,6 +681,10 @@ void CSSSelector::extractPseudoType() const
     case PseudoSingleButton:
     case PseudoNoButton:
     case PseudoNotParsed:
+#if ENABLE(FULLSCREEN_API)
+    case PseudoFullScreen:
+    case PseudoFullScreenDocument:
+#endif
         break;
     case PseudoFirstPage:
     case PseudoLeftPage:
diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h
index e253949..00e23b9 100644
--- a/WebCore/css/CSSSelector.h
+++ b/WebCore/css/CSSSelector.h
@@ -217,6 +217,10 @@ namespace WebCore {
             PseudoLeftPage,
             PseudoRightPage,
             PseudoFirstPage,
+#if ENABLE(FULLSCREEN_API)
+            PseudoFullScreen,
+            PseudoFullScreenDocument,
+#endif
         };
 
         enum MarginBoxType {
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index a595888..0ba63e0 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -557,6 +557,14 @@ static void loadFullDefaultStyle()
     String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraQuirksStyleSheet();
     CSSStyleSheet* quirksSheet = parseUASheet(quirksRules);
     defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval());
+    
+#if ENABLE(FULLSCREEN_API)
+    // Full-screen rules.
+    String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
+    CSSStyleSheet* fullscreenSheet = parseUASheet(fullscreenRules);
+    defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval());
+    defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval());
+#endif
 }
 
 static void loadSimpleDefaultStyle()
@@ -2635,6 +2643,26 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
                     break;
                 return true;
             }
+#if ENABLE(FULLSCREEN_API)
+            case CSSSelector::PseudoFullScreen:
+                // While a Document is in the fullscreen state, and the document's current fullscreen 
+                // element is an element in the document, the 'full-screen' pseudoclass applies to 
+                // that element. Also, an <iframe>, <object> or <embed> element whose child browsing 
+                // context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
+                if (!e->document()->webkitFullScreen())
+                    return false;
+                if (e != e->document()->webkitCurrentFullScreenElement())
+                    return false;
+                return true;
+            case CSSSelector::PseudoFullScreenDocument:
+                // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies 
+                // to the root element of that Document.
+                if (!e->document()->webkitFullScreen())
+                    return false;
+                if (e != e->document()->documentElement())
+                    return false;
+                return true;
+#endif
             case CSSSelector::PseudoUnknown:
             case CSSSelector::PseudoNotParsed:
             default:
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index d302990..56c6cc2 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -585,6 +585,7 @@ media-volume-slider
 media-volume-sliderthumb
 media-volume-slider-mute-button
 media-controls-background
+media-controls-fullscreen-background
 media-current-time-display
 media-time-remaining-display
 menulist
diff --git a/WebCore/css/fullscreen.css b/WebCore/css/fullscreen.css
new file mode 100644
index 0000000..ebf3a02
--- /dev/null
+++ b/WebCore/css/fullscreen.css
@@ -0,0 +1,27 @@
+:-webkit-full-screen {
+    position:fixed;
+    top:0;
+    left:0;
+    right:0;
+    bottom:0;
+}
+
+:root:full-screen-document:not(:full-screen) {
+    overflow:hidden;
+}
+
+video:-webkit-full-screen {
+    width: 100%;
+    height: 100%
+    image-fit: fill;
+}
+
+img:-webkit-full-screen {
+    width: 100%;
+    height: 100%;
+    image-fit: fill;
+}
+
+video:-webkit-full-page-media:-webkit-full-screen::-webkit-media-controls-panel {
+    bottom: 0px;
+}
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 9e3c487..5d83474 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -400,6 +400,10 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
 #endif
     , m_weakReference(DocumentWeakReference::create(this))
     , m_idAttributeName(idAttr)
+#if ENABLE(FULLSCREEN_API)
+    , m_isFullScreen(0)
+    , m_areKeysEnabledInFullScreen(0)
+#endif
     , m_loadEventDelayCount(0)
 {
     m_document = this;
@@ -484,6 +488,9 @@ void Document::removedLastRef()
         m_activeNode = 0;
         m_titleElement = 0;
         m_documentElement = 0;
+#if ENABLE(FULLSCREEN_API)
+        m_fullScreenElement = 0;
+#endif
 
         // removeAllChildren() doesn't always unregister IDs, do it upfront to avoid having stale references in the map.
         m_elementsById.clear();
@@ -3235,6 +3242,19 @@ void Document::nodeWillBeRemoved(Node* n)
         frame->selection()->nodeWillBeRemoved(n);
         frame->dragCaretController()->nodeWillBeRemoved(n);
     }
+    
+#if ENABLE(FULLSCREEN_API)
+    // If the current full screen element or any of its ancestors is removed, set the current
+    // full screen element to the document root, and fire a fullscreenchange event to inform 
+    // clients of the DOM.
+    ASSERT(n);
+    if (n->contains(m_fullScreenElement.get())) {
+        ASSERT(n != documentElement());
+        m_fullScreenElement = documentElement();
+        m_fullScreenElement->setNeedsStyleRecalc();
+        m_fullScreenElement->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
+    }
+#endif
 }
 
 void Document::textInserted(Node* text, unsigned offset, unsigned length)
@@ -4648,6 +4668,70 @@ InspectorController* Document::inspectorController() const
     return page() ? page()->inspectorController() : 0;
 }
 #endif
+    
+#if ENABLE(FULLSCREEN_API)
+void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags)
+{
+    if (!page() || !page()->settings()->fullScreenEnabled())
+        return;
+
+    if (!element)
+        element = documentElement();
+    
+    if (!page()->chrome()->client()->supportsFullScreenForElement(element))
+        return;
+    
+    m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT;
+    page()->chrome()->client()->enterFullScreenForElement(element);
+}
+
+void Document::webkitCancelFullScreen()
+{
+    if (!page() || !m_fullScreenElement)
+        return;
+    
+    page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
+}
+    
+void Document::webkitWillEnterFullScreenForElement(Element* element)
+{
+    ASSERT(element);
+    ASSERT(page() && page()->settings()->fullScreenEnabled());
+
+    m_fullScreenElement = element;
+    m_isFullScreen = true;
+    documentElement()->setNeedsStyleRecalc(FullStyleChange);
+    m_fullScreenElement->setNeedsStyleRecalc(FullStyleChange);
+    updateStyleIfNeeded();
+    
+    m_fullScreenElement->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
+}
+    
+void Document::webkitDidEnterFullScreenForElement(Element*)
+{
+}
+
+void Document::webkitWillExitFullScreenForElement(Element*)
+{
+}
+
+void Document::webkitDidExitFullScreenForElement(Element* element)
+{
+    ASSERT(element);
+    m_isFullScreen = false;
+    m_areKeysEnabledInFullScreen = false;
+
+    // m_fullScreenElement has already been cleared; recalc the style of 
+    // the passed in element instead.
+    element->setNeedsStyleRecalc(FullStyleChange);
+    if (element != documentElement())
+        documentElement()->setNeedsStyleRecalc(FullStyleChange);
+    updateStyleIfNeeded();
+    
+    element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
+}
+    
+#endif
 
 void Document::decrementLoadEventDelayCount()
 {
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 3381bea..4cfb6bc 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -273,6 +273,9 @@ public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
 #endif
+#if ENABLE(FULLSCREEN_API)
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange);
+#endif
 
     DocumentType* doctype() const { return m_docType.get(); }
 
@@ -997,6 +1000,19 @@ public:
     MediaCanStartListener* takeAnyMediaCanStartListener();
 
     const QualifiedName& idAttributeName() const { return m_idAttributeName; }
+    
+#if ENABLE(FULLSCREEN_API)
+    bool webkitFullScreen() const { return m_isFullScreen; }
+    bool webkitFullScreenKeyboardInputAllowed() const { return m_isFullScreen && m_areKeysEnabledInFullScreen; }
+    Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement.get(); }
+    void webkitRequestFullScreenForElement(Element*, unsigned short flags);
+    void webkitCancelFullScreen();
+    
+    void webkitWillEnterFullScreenForElement(Element*);
+    void webkitDidEnterFullScreenForElement(Element*);
+    void webkitWillExitFullScreenForElement(Element*);
+    void webkitDidExitFullScreenForElement(Element*);
+#endif
 
     bool writeDisabled() const { return m_writeDisabled; }
     void setWriteDisabled(bool flag) { m_writeDisabled = flag; }
@@ -1284,6 +1300,12 @@ private:
     HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
 
     QualifiedName m_idAttributeName;
+    
+#if ENABLE(FULLSCREEN_API)
+    bool m_isFullScreen;
+    bool m_areKeysEnabledInFullScreen;
+    RefPtr<Element> m_fullScreenElement;
+#endif
 
     int m_loadEventDelayCount;
 };
diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl
index 3ae551e..0bd93b8 100644
--- a/WebCore/dom/Document.idl
+++ b/WebCore/dom/Document.idl
@@ -245,6 +245,13 @@ module core {
         [DontEnum] void initializeWMLPageState();
 #endif
 
+#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
+        readonly attribute boolean webkitFullScreen;
+        readonly attribute boolean webkitFullScreenKeyboardInputAllowed;
+        readonly attribute Element webkitCurrentFullScreenElement;
+        void webkitCancelFullScreen();
+#endif
+
 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
         // Event handler DOM attributes
         attribute [DontEnum] EventListener onabort;
@@ -317,6 +324,7 @@ module core {
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
+        attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
 #endif
 
 #if defined(LANGUAGE_CPP) && LANGUAGE_CPP
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index abe3da3..7502864 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1591,5 +1591,12 @@ bool Element::childShouldCreateRenderer(Node* child) const
     return Node::childShouldCreateRenderer(child);
 }
 #endif
+    
+#if ENABLE(FULLSCREEN_API)
+void Element::webkitRequestFullScreen(unsigned short flags)
+{
+    document()->webkitRequestFullScreenForElement(this, flags);
+}
+#endif    
 
 } // namespace WebCore
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 694db98..570ee0a 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -94,6 +94,9 @@ public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
 #endif
+#if ENABLE(FULLSCREEN_API)
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitfullscreenchange);
+#endif
 
     virtual PassRefPtr<DocumentFragment> deprecatedCreateContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed);
 
@@ -292,6 +295,14 @@ public:
 #if ENABLE(SVG)
     virtual bool childShouldCreateRenderer(Node*) const; 
 #endif
+    
+#if ENABLE(FULLSCREEN_API)
+    enum {
+        ALLOW_KEYBOARD_INPUT = 1
+    };
+    
+    void webkitRequestFullScreen(unsigned short flags);
+#endif
 
 protected:
     Element(const QualifiedName& tagName, Document* document, ConstructionType type)
diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl
index 0ad3184..0141313 100644
--- a/WebCore/dom/Element.idl
+++ b/WebCore/dom/Element.idl
@@ -133,6 +133,11 @@ module core {
         readonly attribute DOMString innerText;
 #endif
 
+#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
+        const unsigned short ALLOW_KEYBOARD_INPUT = 1;
+        void webkitRequestFullScreen(in unsigned short flags);
+#endif
+
 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
         // Event handler DOM attributes
         attribute [DontEnum] EventListener onabort;
@@ -205,6 +210,7 @@ module core {
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
+        attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
 #endif
     };
 
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index ebed2e1..e50ade0 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -166,6 +166,8 @@ namespace WebCore {
     \
     macro(loadend) \
     \
+    macro(webkitfullscreenchange)
+    \
 // end of DOM_EVENT_NAMES_FOR_EACH
 
     class EventNames : public Noncopyable {
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index b4cdb02..103d2c6 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -223,6 +223,7 @@ onwebkitanimationiteration
 onwebkitanimationend
 onwebkitbeginfullscreen
 onwebkitendfullscreen
+onwebkitfullscreenchange
 onwebkittransitionend
 optimum
 pattern
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index f40489b..0862130 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -249,6 +249,10 @@ void HTMLElement::parseMappedAttribute(Attribute* attr)
         setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
     } else if (attr->name() == ontouchcancelAttr) {
         setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attr));
+#if ENABLE(FULLSCREEN_API)
+    } else if (attr->name() == onwebkitfullscreenchangeAttr) {
+        setAttributeEventListener(eventNames().webkitfullscreenchangeEvent, createAttributeEventListener(this, attr));
+#endif
     }
 }
 
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h
index 60b73c3..d3e1662 100644
--- a/WebCore/page/ChromeClient.h
+++ b/WebCore/page/ChromeClient.h
@@ -234,6 +234,12 @@ namespace WebCore {
         virtual void enterFullscreenForNode(Node*) { }
         virtual void exitFullscreenForNode(Node*) { }
 
+#if ENABLE(FULLSCREEN_API)
+        virtual bool supportsFullScreenForElement(const Element*) { return false; }
+        virtual void enterFullScreenForElement(Element*) { }
+        virtual void exitFullScreenForElement(Element*) { }
+#endif
+        
 #if ENABLE(TILED_BACKING_STORE)
         virtual IntRect visibleRectForTiledBackingStore() const { return IntRect(); }
 #endif
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 866b45a..10e6f3e 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -134,6 +134,9 @@ Settings::Settings(Page* page)
     , m_tiledBackingStoreEnabled(false)
     , m_paginateDuringLayoutEnabled(false)
     , m_dnsPrefetchingEnabled(true)
+#if ENABLE(FULLSCREEN_API)
+    , m_fullScreenAPIEnabled(false)
+#endif
     , m_memoryInfoEnabled(false)
     , m_interactiveFormValidation(false)
 {
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 7c6b8c9..693cc54 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -311,6 +311,11 @@ namespace WebCore {
         void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; }
         bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; }
 
+#if ENABLE(FULLSCREEN_API)
+        void setFullScreenEnabled(bool flag) { m_fullScreenAPIEnabled = flag; }
+        bool fullScreenEnabled() const  { return m_fullScreenAPIEnabled; }
+#endif
+
         void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; }
         bool memoryInfoEnabled() const { return m_memoryInfoEnabled; }
 
@@ -402,6 +407,9 @@ namespace WebCore {
         bool m_tiledBackingStoreEnabled : 1;
         bool m_paginateDuringLayoutEnabled : 1;
         bool m_dnsPrefetchingEnabled : 1;
+#if ENABLE(FULLSCREEN_API)
+        bool m_fullScreenAPIEnabled : 1;
+#endif
         bool m_memoryInfoEnabled: 1;
         bool m_interactiveFormValidation: 1;
     
diff --git a/WebCore/platform/ThemeTypes.h b/WebCore/platform/ThemeTypes.h
index d82aa73..3567004 100644
--- a/WebCore/platform/ThemeTypes.h
+++ b/WebCore/platform/ThemeTypes.h
@@ -51,7 +51,7 @@ enum ControlPart {
     MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart, 
     MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart,
     MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart,
-    MediaVolumeSliderMuteButtonPart, MediaControlsBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart,
+    MediaVolumeSliderMuteButtonPart, MediaControlsBackgroundPart, MediaControlsFullscreenBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart,
     MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, MeterPart, OuterSpinButtonPart, ProgressBarPart, ProgressBarValuePart,
     SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
     SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp
index 3fb712f..aaeb3e2 100644
--- a/WebCore/rendering/MediaControlElements.cpp
+++ b/WebCore/rendering/MediaControlElements.cpp
@@ -42,6 +42,7 @@
 #include "RenderMedia.h"
 #include "RenderSlider.h"
 #include "RenderTheme.h"
+#include "Settings.h"
 
 namespace WebCore {
 
@@ -780,7 +781,20 @@ PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElem
 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
 {
     if (event->type() == eventNames().clickEvent) {
-        mediaElement()->enterFullscreen();
+#if ENABLE(FULLSCREEN_API)
+        // Only use the new full screen API if the fullScreenEnabled setting has 
+        // been explicitly enabled.  Otherwise, use the old fullscreen API.  This
+        // allows apps which embed a WebView to retain the existing full screen
+        // video implementation without requiring them to implement their own full 
+        // screen behavior.
+        if (document()->settings() && document()->settings()->fullScreenEnabled()) {
+            if (document()->webkitFullScreen() && document()->webkitCurrentFullScreenElement() == mediaElement())
+                document()->webkitCancelFullScreen();
+            else
+                mediaElement()->webkitRequestFullScreen(0);
+        } else
+#endif
+            mediaElement()->enterFullscreen();
         event->setDefaultHandled();
     }
     HTMLInputElement::defaultEventHandler(event);
diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h
index 70b128b..286357d 100644
--- a/WebCore/rendering/style/RenderStyleConstants.h
+++ b/WebCore/rendering/style/RenderStyleConstants.h
@@ -79,6 +79,7 @@ enum PseudoId {
     METER_HORIZONTAL_BAR, METER_HORIZONTAL_OPTIMUM, METER_HORIZONTAL_SUBOPTIMAL, METER_HORIZONTAL_EVEN_LESS_GOOD,
     METER_VERTICAL_BAR, METER_VERTICAL_OPTIMUM, METER_VERTICAL_SUBOPTIMAL, METER_VERTICAL_EVEN_LESS_GOOD, 
     AFTER_LAST_INTERNAL_PSEUDOID,
+    FULL_SCREEN, FULL_SCREEN_DOCUMENT,
     FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
     FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON,
     PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 56f96b5..f53227d 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,36 @@
+2010-07-27  Jer Noble  <jer.noble at apple.com>
+
+        Reviewed by Eric Carlson.
+
+        Add JavaScript API to allow a page to go fullscreen.
+        rdar://problem/6867795
+
+        Added chrome client overrides which support entering and exiting full screen.  A new preference has
+        been added (setFullScreenEnabled:) to control at runtime whether full screen support is enabled 
+        (defaults to disabled).  Added a new WebKitFullScreenListener callback object which notifies WebCore
+        when the chrome has started/finished its full screen animation.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::supportsFullscreenForElement):
+        (WebChromeClient::enterFullscreenForElement):
+        (WebChromeClient::exitFullscreenForElement):
+        (-[WebKitFullScreenListener initWithElement:]):
+        (-[WebKitFullScreenListener webkitWillEnterFullScreen]):
+        (-[WebKitFullScreenListener webkitDidEnterFullScreen]):
+        (-[WebKitFullScreenListener webkitWillExitFullScreen]):
+        (-[WebKitFullScreenListener webkitDidExitFullScreen]):
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences setFullScreenEnabled:]):
+        (-[WebPreferences fullScreenEnabled]):
+        * WebView/WebUIDelegatePrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChangedNotification:]):
+
 2010-08-27  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig
index f2b4c09..8f8c213 100644
--- a/WebKit/mac/Configurations/FeatureDefines.xcconfig
+++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig
@@ -71,6 +71,7 @@ ENABLE_FILTERS_macosx = ENABLE_FILTERS;
 
 ENABLE_FILE_WRITER = ;
 ENABLE_FILE_SYSTEM = ;
+ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API;
 ENABLE_GEOLOCATION = ENABLE_GEOLOCATION;
 
 ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME));
@@ -120,4 +121,4 @@ ENABLE_XHTMLMP = ;
 ENABLE_XPATH = ENABLE_XPATH;
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index e5de14d..5f3b727 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -164,6 +164,12 @@ public:
     virtual void enterFullscreenForNode(WebCore::Node*);
     virtual void exitFullscreenForNode(WebCore::Node*);
 #endif
+    
+#if ENABLE(FULLSCREEN_API)
+    virtual bool supportsFullScreenForElement(const WebCore::Element*);
+    virtual void enterFullScreenForElement(WebCore::Element*);
+    virtual void exitFullScreenForElement(WebCore::Element*);
+#endif
 
     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 2c2616d..d973e2b 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -110,6 +110,16 @@ using namespace WebCore;
 - (id)initWithGeolocation:(Geolocation*)geolocation;
 @end
 
+#if ENABLE(FULLSCREEN_API)
+ at interface WebKitFullScreenListener : NSObject <WebKitFullScreenListener>
+{
+    RefPtr<Element> _element;
+}
+
+- (id)initWithElement:(Element*)element;
+ at end
+#endif
+
 WebChromeClient::WebChromeClient(WebView *webView) 
     : m_webView(webView)
 {
@@ -815,6 +825,29 @@ void WebChromeClient::exitFullscreenForNode(Node*)
 
 #endif
 
+#if ENABLE(FULLSCREEN_API)
+
+bool WebChromeClient::supportsFullScreenForElement(const Element* element)
+{
+    return CallUIDelegateReturningBoolean(false, m_webView, @selector(webView:supportsFullScreenForElement:), kit(const_cast<WebCore::Element*>(element)));
+}
+
+void WebChromeClient::enterFullScreenForElement(Element* element)
+{
+    WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+    CallUIDelegate(m_webView, @selector(webView:enterFullScreenForElement:listener:), kit(element), listener);
+    [listener release];
+}
+
+void WebChromeClient::exitFullScreenForElement(Element* element)
+{
+    WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
+    CallUIDelegate(m_webView, @selector(webView:exitFullScreenForElement:listener:), kit(element), listener);
+    [listener release];
+}
+
+#endif
+
 void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -919,3 +952,41 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca
 }
 
 @end
+
+#if ENABLE(FULLSCREEN_API)
+ at implementation WebKitFullScreenListener
+- (id)initWithElement:(Element*)element
+{
+    if (!(self = [super init]))
+        return nil;
+    
+    _element = element;
+    return self;
+}
+
+- (void)webkitWillEnterFullScreen
+{
+    if (_element)
+        _element->document()->webkitWillEnterFullScreenForElement(_element.get());
+}
+
+- (void)webkitDidEnterFullScreen
+{
+    if (_element)
+        _element->document()->webkitDidEnterFullScreenForElement(_element.get());
+}
+
+- (void)webkitWillExitFullScreen
+{
+    if (_element)
+        _element->document()->webkitWillExitFullScreenForElement(_element.get());
+}
+
+- (void)webkitDidExitFullScreen
+{
+    if (_element)
+        _element->document()->webkitDidExitFullScreenForElement(_element.get());
+}
+
+ at end
+#endif
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 86f6d85..3b750ff 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -97,6 +97,7 @@
 #define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled"
 #define WebKitPaginateDuringLayoutEnabledPreferenceKey @"WebKitPaginateDuringLayoutEnabled"
 #define WebKitDNSPrefetchingEnabledPreferenceKey @"WebKitDNSPrefetchingEnabled"
+#define WebKitFullScreenEnabledPreferenceKey @"WebKitFullScreenEnabled"
 #define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled"
 
 // These are private both because callers should be using the cover methods and because the
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index eae2d8d..a4a5383 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -365,6 +365,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitFrameFlatteningEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitDNSPrefetchingEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitFullScreenEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitMemoryInfoEnabledPreferenceKey,
         [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
         [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
@@ -1346,6 +1347,16 @@ static NSString *classIBCreatorID = nil;
     [self _setStringValue:value forKey:key];
 }
 
+- (void)setFullScreenEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
+}
+
+- (BOOL)fullScreenEnabled
+{
+    return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 45c2a24..783038d 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -206,4 +206,10 @@ extern NSString *WebPreferencesRemovedNotification;
 // For WebView's use only.
 - (void)willAddToWebView;
 - (void)didRemoveFromWebView;
+
+// Full screen support is dependent on WebCore/WebKit being
+// compiled with ENABLE_FULLSCREEN_API. 
+- (void)setFullScreenEnabled:(BOOL)flag;
+- (BOOL)fullScreenEnabled;
+
 @end
diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h
index 0fb120c..22752ae 100644
--- a/WebKit/mac/WebView/WebUIDelegatePrivate.h
+++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h
@@ -95,6 +95,15 @@ enum {
 - (void)deny;
 @end
 
+#if ENABLE(FULLSCREEN_API)
+ at protocol WebKitFullScreenListener<NSObject>
+- (void)webkitWillEnterFullScreen;
+- (void)webkitDidEnterFullScreen;
+- (void)webkitWillExitFullScreen;
+- (void)webkitDidExitFullScreen;
+ at end
+#endif
+
 @interface NSObject (WebUIDelegatePrivate)
 
 - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message;
@@ -164,4 +173,10 @@ enum {
 */
 - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame;
 
+#if ENABLE(FULLSCREEN_API)
+- (BOOL)webView:(WebView *)sender supportsFullScreenForElement:(DOMElement *)element;
+- (void)webView:(WebView *)sender enterFullScreenForElement:(DOMElement *)element;
+- (void)webView:(WebView *)sender exitFullScreenForElement:(DOMElement *)element;
+#endif
+
 @end
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 322dd45..a8c405c 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1438,6 +1438,9 @@ static bool fastDocumentTeardownEnabled()
     settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
     settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]);
     settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]);
+#if ENABLE(FULLSCREEN_API)
+    settings->setFullScreenEnabled([preferences fullScreenEnabled]);
+#endif
     settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]);
 
     // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index dad41a7..c0b9002 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-07-27  Jer Noble  <jer.noble at apple.com>
+
+        Reviewed by Eric Carlson.
+
+        Add JavaScript API to allow a page to go fullscreen.
+        rdar://problem/6867795
+        
+        Added basic full screen support to DumpRenderTree: when a webView requests
+        that DumpRenderTree go "full screen", just call the provided callback listener object's
+        will/did Enter/Exit full screen methods.  Also, register a new user default which 
+        enables full screen support.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues):
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webView:supportsFullscreenForElement:]):
+        (-[UIDelegate webView:enterFullscreenForElement:listener:]):
+        (-[UIDelegate webView:exitFullscreenForElement:listener:]):
+
 2010-08-27  Benjamin Poulain  <benjamin.poulain at nokia.com>
 
         Unreviewed. Add myself to the committers list.
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 12a4a50..e756ebf 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -389,6 +389,7 @@ static void resetDefaultsToConsistentValues()
     [defaults setObject:@"0.500000 0.500000 0.500000" forKey:@"AppleOtherHighlightColor"];
     [defaults setObject:[NSArray arrayWithObject:@"en"] forKey:@"AppleLanguages"];
     [defaults setBool:YES forKey:WebKitEnableFullDocumentTeardownPreferenceKey];
+    [defaults setBool:YES forKey:WebKitFullScreenEnabledPreferenceKey];
 
     // Scrollbars are drawn either using AppKit (which uses NSUserDefaults) or using HIToolbox (which uses CFPreferences / kCFPreferencesAnyApplication / kCFPreferencesCurrentUser / kCFPreferencesAnyHost)
     [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"];
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
index f9afdb1..6194c26 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
@@ -227,6 +227,23 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
     return NO;
 }
 
+- (BOOL)webView:(WebView *)webView supportsFullScreenForElement:(DOMElement*)element
+{
+    return YES;
+}
+
+- (void)webView:(WebView *)webView enterFullScreenForElement:(DOMElement*)element listener:(NSObject<WebKitFullScreenListener>*)listener
+{
+    [listener webkitWillEnterFullScreen];
+    [listener webkitDidEnterFullScreen];
+}
+
+- (void)webView:(WebView *)webView exitFullScreenForElement:(DOMElement*)element listener:(NSObject<WebKitFullScreenListener>*)listener
+{
+    [listener webkitWillExitFullScreen];
+    [listener webkitDidExitFullScreen];
+}
+
 - (BOOL)webView:(WebView *)webView didPressMissingPluginButton:(DOMElement *)element
 {
     printf("MISSING PLUGIN BUTTON PRESSED\n");

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list