Skip to content
Permalink
Browse files
2011-04-19 Jer Noble <jer.noble@apple.com>
        Reviewed by Daniel Bates.

        Full Screen from within an <iframe> does not cause <iframe> to resize.
        https://bugs.webkit.org/show_bug.cgi?id=58638

        * fullscreen/full-screen-frameset-expected.txt: Added.
        * fullscreen/full-screen-frameset.html: Added.
        * fullscreen/content/inner.html: Added.
        * fullscreen/full-screen-iframe-allowed-expected.txt: Updated.
        * fullscreen/full-screen-iframe-allowed.html: Add a button with which to trigger
            full screen mode in Safari.
        * fullscreen/full-screen-iframe-not-allowed-expected.txt: Updated.
        * fullscreen/full-screen-iframe-not-allowed.html: Ditto.
        * fullscreen/resources/allowed.html: Added.
        * fullscreen/resources/inner.html: Added.
2011-04-19  Jer Noble  <jer.noble@apple.com>

        Reviewed by Daniel Bates.

        Full Screen from within an <iframe> does not cause <iframe> to resize.
        https://bugs.webkit.org/show_bug.cgi?id=58638

        Tests: fullscreen/full-screen-frameset.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Add the
            -webkit-full-screen pseudo class to frame elements which contain
            full screen elements.
        * css/fullscreen.css:
        (iframe:-webkit-full-screen): Add iframe-specific styling rules.
        * dom/Document.cpp:
        (WebCore::Document::setContainsFullScreenElementRecursively): Added.  Walk up each
            successive document owner element, calling setContainsFullScreenElement() if
            owner is a frame element.
        (WebCore::Document::fullScreenIsAllowedForElement): Use the new Element::isFrameElementBase
            call instead of checking the element's tag name.
        (WebCore::Document::webkitWillEnterFullScreenForElement): Mark any containing
            iframes as containing a full screen element.
        (WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
        * dom/Element.h:
        (WebCore::Element::isFrameElementBase): Added.
        * html/HTMLFrameElement.h:
        (WebCore::HTMLFrameElement::allowFullScreen): Disable full screen from within
            HTMLFrameElements.
        * html/HTMLFrameElementBase.cpp:
        (WebCore::HTMLFrameElementBase::setContainsFullScreenElement): Added.
        * html/HTMLFrameElementBase.h:
        (WebCore::HTMLFrameElementBase::containsFullScreenElement): Added.
        (WebCore::HTMLFrameElementBase::isFrameElementBase): Added.
2011-04-19  Jer Noble  <jer.noble@apple.com>

        Reviewed by Daniel Bates.

        Full Screen from within an <iframe> does not cause <iframe> to resize.
        https://bugs.webkit.org/show_bug.cgi?id=58638

        Tests: fullscreen/full-screen-frameset-allowed.html
               fullscreen/full-screen-frameset-not-allowed.html

        Return the _element's document instead of the WKView's document, which
        will be different in the case of elements within <iframe>s.

        * WebView/WebFullScreenController.mm:
        (-[WebFullScreenController _document]):
2011-04-19  Jer Noble  <jer.noble@apple.com>

        Reviewed by Daniel Bates.

        Full Screen from within an <iframe> does not cause <iframe> to resize.
        https://bugs.webkit.org/show_bug.cgi?id=58638

        Tests: fullscreen/full-screen-frameset-allowed.html
               fullscreen/full-screen-frameset-not-allowed.html

        * UIProcess/mac/WKFullScreenWindowController.mm:
        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Cancel the background animation
            if the full screen animation finishes first.
        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
        (WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): m_fullScreenRootLayer was uninitialized.

Canonical link: https://commits.webkit.org/74435@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Apr 22, 2011
1 parent 817177b commit d68b71c54bd2ea6cb82fc2efd09723c6c914eb04
@@ -1,3 +1,21 @@
2011-04-19 Jer Noble <jer.noble@apple.com>

Reviewed by Daniel Bates.

Full Screen from within an <iframe> does not cause <iframe> to resize.
https://bugs.webkit.org/show_bug.cgi?id=58638

* fullscreen/full-screen-frameset-expected.txt: Added.
* fullscreen/full-screen-frameset.html: Added.
* fullscreen/content/inner.html: Added.
* fullscreen/full-screen-iframe-allowed-expected.txt: Updated.
* fullscreen/full-screen-iframe-allowed.html: Add a button with which to trigger
full screen mode in Safari.
* fullscreen/full-screen-iframe-not-allowed-expected.txt: Updated.
* fullscreen/full-screen-iframe-not-allowed.html: Ditto.
* fullscreen/resources/allowed.html: Added.
* fullscreen/resources/inner.html: Added.

2011-04-22 Xiaomei Ji <xji@chromium.org>

Rebaseline after r84659.
@@ -0,0 +1,17 @@


--------
Frame: 'header'
--------
Test for bug 58638: Do not allow fullscreen from within a <frame> element, even with the webkitallowfullscreen attribute set.

To test manually, click the "Go full screen" button - the page should not enter full screen mode.

SUCCEED - did not enter full screen!
END OF TEST


--------
Frame: 'frame'
--------
Go full screen
@@ -0,0 +1,35 @@
<script src="full-screen-test.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpChildFramesAsText();

var waitingFor = 2;
function runTest() {
if (--waitingFor)
return;
var frame = document.getElementById('frame');

waitForEvent(frame.contentDocument, 'webkitfullscreenchange', function() {
consoleWrite("FAIL - entered full screen!");
endTest();
if (layoutTestController)
layoutTestController.notifyDone();
});

runWithKeyDown(function() {

setTimeout(function() {
consoleWrite("SUCCEED - did not enter full screen!");
endTest();
if (layoutTestController)
layoutTestController.notifyDone();
}, 50);

frame.contentDocument.documentElement.webkitRequestFullScreen();
});
}
</script>
<frameset rows="150,*">
<frame name="header" src="resources/not-allowed.html" webkitfullscreenallowed onload="runTest()">
<frame id="frame" src="resources/inner.html" onload="runTest()">
</frameset>
@@ -1,8 +1,8 @@
Test for bug 56264: Handle entering full screen security restrictions

To test manually, press Space - the page should enter full screen mode.
To test manually, click the "Go full screen" button - the page should enter full screen mode.

EVENT(webkitfullscreenchange)
SUCCEED - entered full screen!
TEST(document.getElementById('frame').contentDocument.width==document.width) OK
END OF TEST

@@ -1,13 +1,13 @@
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=56264">bug 56264</a>:
Handle entering full screen security restrictions</p>
<p>To test manually, press Space - the page should enter full screen mode.</p>
<p>To test manually, click the "Go full screen" button - the page should enter full screen mode.</p>
<script src="full-screen-test.js"></script>
<script>
function runTest() {
var frame = document.getElementById('frame');

waitForEvent(frame.contentDocument, 'webkitfullscreenchange', function() {
consoleWrite("SUCCEED - entered full screen!");
test("document.getElementById('frame').contentDocument.width==document.width")
endTest();
});

@@ -22,5 +22,5 @@
});
}
</script>
<iframe id="frame" src="about:blank" onload="runTest()" webkitallowfullscreen>
<iframe id="frame" src="resources/inner.html" width="300" height="100" onload="runTest()" webkitallowfullscreen>
</iframe>
@@ -1,6 +1,6 @@
Test for bug 56264: Handle entering full screen security restrictions

To test manually, press Space - the page should not enter full screen mode.
To test manually, click the "Go full screen" button - the page should not enter full screen mode.

SUCCEED - did not enter full screen!
END OF TEST
@@ -1,6 +1,6 @@
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=56264">bug 56264</a>:
Handle entering full screen security restrictions</p>
<p>To test manually, press Space - the page should not enter full screen mode.</p>
<p>To test manually, click the "Go full screen" button - the page should not enter full screen mode.</p>
<script src="full-screen-test.js"></script>
<script>
function runTest() {
@@ -22,5 +22,5 @@
});
}
</script>
<iframe id="frame" src="about:blank" onload="runTest()">
<iframe id="frame" src="resources/inner.html" onload="runTest()">
</iframe>
@@ -0,0 +1,3 @@
<body>
<button onclick="document.documentElement.webkitRequestFullScreen()">Go full screen</button>
</body>
@@ -0,0 +1,7 @@
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=58638">bug 58638</a>:
Do not allow fullscreen from within a &lt;frame&gt; element, even with the <i>webkitallowfullscreen</i> attribute set.</p>
<p>To test manually, click the "Go full screen" button - the page should not enter full screen mode.</p>
<div id="console"></div>
<script>
top.console = document.getElementById('console');
</script>
@@ -1,3 +1,38 @@
2011-04-19 Jer Noble <jer.noble@apple.com>

Reviewed by Daniel Bates.

Full Screen from within an <iframe> does not cause <iframe> to resize.
https://bugs.webkit.org/show_bug.cgi?id=58638

Tests: fullscreen/full-screen-frameset.html

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Add the
-webkit-full-screen pseudo class to frame elements which contain
full screen elements.
* css/fullscreen.css:
(iframe:-webkit-full-screen): Add iframe-specific styling rules.
* dom/Document.cpp:
(WebCore::Document::setContainsFullScreenElementRecursively): Added. Walk up each
successive document owner element, calling setContainsFullScreenElement() if
owner is a frame element.
(WebCore::Document::fullScreenIsAllowedForElement): Use the new Element::isFrameElementBase
call instead of checking the element's tag name.
(WebCore::Document::webkitWillEnterFullScreenForElement): Mark any containing
iframes as containing a full screen element.
(WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
* dom/Element.h:
(WebCore::Element::isFrameElementBase): Added.
* html/HTMLFrameElement.h:
(WebCore::HTMLFrameElement::allowFullScreen): Disable full screen from within
HTMLFrameElements.
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::setContainsFullScreenElement): Added.
* html/HTMLFrameElementBase.h:
(WebCore::HTMLFrameElementBase::containsFullScreenElement): Added.
(WebCore::HTMLFrameElementBase::isFrameElementBase): Added.

2011-04-22 Michael Saboff <msaboff@apple.com>

Reviewed by Maciej Stachowiak.
@@ -59,6 +59,7 @@
#include "FrameView.h"
#include "HTMLDocument.h"
#include "HTMLElement.h"
#include "HTMLFrameElementBase.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HTMLTextAreaElement.h"
@@ -2945,6 +2946,8 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
// 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->isFrameElementBase() && static_cast<HTMLFrameElementBase*>(e)->containsFullScreenElement())
return true;
if (!e->document()->webkitIsFullScreen())
return false;
if (e != e->document()->webkitCurrentFullScreenElement())
@@ -22,6 +22,17 @@ img:-webkit-full-screen {
max-width: 100%;
}

iframe:-webkit-full-screen {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
position: fixed !important;
height: 100% !important;
width: 100% !important;
left: 0 !important;
top: 0 !important;
}

video:-webkit-full-page-media:-webkit-full-screen::-webkit-media-controls-panel {
bottom: 0px;
}
@@ -4774,7 +4774,7 @@ bool Document::fullScreenIsAllowedForElement(Element* element) const
{
ASSERT(element);
while (HTMLFrameOwnerElement* ownerElement = element->document()->ownerElement()) {
if (!ownerElement->hasTagName(frameTag) && !ownerElement->hasTagName(iframeTag))
if (!ownerElement->isFrameElementBase())
continue;

if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen())
@@ -4812,7 +4812,20 @@ void Document::webkitCancelFullScreen()

page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
}


static void setContainsFullScreenElementRecursively(Element* element, bool contains)
{
if (!element)
return;

do {
if (!element->isFrameElementBase())
continue;

static_cast<HTMLFrameElementBase*>(element)->setContainsFullScreenElement(contains);
} while ((element = element->document()->ownerElement()));
}

void Document::webkitWillEnterFullScreenForElement(Element* element)
{
ASSERT(element);
@@ -4823,6 +4836,8 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
if (m_fullScreenElement != documentElement())
m_fullScreenElement->detach();

setContainsFullScreenElementRecursively(ownerElement(), true);

recalcStyle(Force);

if (m_fullScreenRenderer) {
@@ -4849,6 +4864,8 @@ void Document::webkitDidEnterFullScreenForElement(Element*)

void Document::webkitWillExitFullScreenForElement(Element*)
{
setContainsFullScreenElementRecursively(ownerElement(), false);

if (m_fullScreenRenderer) {
m_fullScreenRenderer->setAnimating(true);
#if USE(ACCELERATED_COMPOSITING)
@@ -321,6 +321,7 @@ class Element : public ContainerNode {
virtual bool hasUnacceptableValue() const { return false; }
virtual bool isInRange() const { return false; }
virtual bool isOutOfRange() const { return false; }
virtual bool isFrameElementBase() const { return false; }

virtual bool formControlValueMatchesRenderer() const { return false; }
virtual void setFormControlValueMatchesRenderer(bool) { }
@@ -46,6 +46,10 @@ class HTMLFrameElement : public HTMLFrameElementBase {

virtual void parseMappedAttribute(Attribute*);

#if ENABLE(FULLSCREEN_API)
virtual bool allowFullScreen() const { return false; }
#endif

bool m_frameBorder;
bool m_frameBorderSet;

@@ -288,6 +288,12 @@ bool HTMLFrameElementBase::allowFullScreen() const
{
return hasAttribute(webkitallowfullscreenAttr);
}

void HTMLFrameElementBase::setContainsFullScreenElement(bool contains)
{
m_containsFullScreenElement = contains;
setNeedsStyleRecalc(SyntheticStyleChange);
}
#endif

} // namespace WebCore
@@ -45,6 +45,8 @@ class HTMLFrameElementBase : public HTMLFrameOwnerElement {
void setRemainsAliveOnRemovalFromTree(bool);
#if ENABLE(FULLSCREEN_API)
virtual bool allowFullScreen() const;
virtual void setContainsFullScreenElement(bool);
virtual bool containsFullScreenElement() const { return m_containsFullScreenElement; };
#endif

protected:
@@ -61,6 +63,7 @@ class HTMLFrameElementBase : public HTMLFrameOwnerElement {
virtual void setFocus(bool);

virtual bool isURLAttribute(Attribute*) const;
virtual bool isFrameElementBase() const { return true; }

virtual void willRemove();
void checkInDocumentTimerFired(Timer<HTMLFrameElementBase>*);
@@ -93,6 +96,10 @@ class HTMLFrameElementBase : public HTMLFrameOwnerElement {

bool m_viewSource;
bool m_remainsAliveOnRemovalFromTree;

#if ENABLE(FULLSCREEN_API)
bool m_containsFullScreenElement;
#endif
};

} // namespace WebCore
@@ -1,3 +1,19 @@
2011-04-19 Jer Noble <jer.noble@apple.com>

Reviewed by Daniel Bates.

Full Screen from within an <iframe> does not cause <iframe> to resize.
https://bugs.webkit.org/show_bug.cgi?id=58638

Tests: fullscreen/full-screen-frameset-allowed.html
fullscreen/full-screen-frameset-not-allowed.html

Return the _element's document instead of the WKView's document, which
will be different in the case of elements within <iframe>s.

* WebView/WebFullScreenController.mm:
(-[WebFullScreenController _document]):

2011-04-22 Jer Noble <jer.noble@apple.com>

Reviewed by Maciej Stachowiak.
@@ -769,7 +769,7 @@ - (WebFullscreenWindow *)_fullscreenWindow

- (Document*)_document
{
return core([[[self webView] mainFrame] DOMDocument]);
return _element->document();
}

- (CFTimeInterval)_animationDuration
@@ -1,3 +1,19 @@
2011-04-19 Jer Noble <jer.noble@apple.com>

Reviewed by Daniel Bates.

Full Screen from within an <iframe> does not cause <iframe> to resize.
https://bugs.webkit.org/show_bug.cgi?id=58638

Tests: fullscreen/full-screen-frameset-allowed.html
fullscreen/full-screen-frameset-not-allowed.html

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Cancel the background animation
if the full screen animation finishes first.
* WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
(WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): m_fullScreenRootLayer was uninitialized.

2011-04-22 Sam Weinig <sam@webkit.org>

Reviewed by Brian Weinstein.
@@ -245,6 +245,11 @@ - (void)finishedEnterFullScreenAnimation:(bool)completed
NSView* animationView = [[self _fullScreenWindow] animationView];
[animationView addSubview:_webView positioned:NSWindowBelow relativeTo:_layerHostingView.get()];
[_webView setFrame:[animationView bounds]];

[CATransaction begin];
[CATransaction setDisableActions:YES];
[[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
[CATransaction commit];

// FIXME: In Barolo, orderIn will animate, which is not what we want. Find a way
// to work around this behavior.
@@ -117,6 +117,7 @@ - (void)invalidate

WebFullScreenManagerMac::WebFullScreenManagerMac(WebPage* page)
: WebFullScreenManager(page)
, m_fullScreenRootLayer(0)
{
m_enterFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganEnterFullScreenAnimation finished:&WebFullScreenManagerMac::finishedEnterFullScreenAnimation]);
m_exitFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganExitFullScreenAnimation finished:&WebFullScreenManagerMac::finishedExitFullScreenAnimation]);

0 comments on commit d68b71c

Please sign in to comment.