Changeset 84706 in webkit


Ignore:
Timestamp:
Apr 22, 2011 4:52:44 PM (13 years ago)
Author:
jer.noble@apple.com
Message:

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.
Location:
trunk
Files:
5 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r84696 r84706  
     12011-04-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Full Screen from within an <iframe> does not cause <iframe> to resize.
     6        https://bugs.webkit.org/show_bug.cgi?id=58638
     7
     8        * fullscreen/full-screen-frameset-expected.txt: Added.
     9        * fullscreen/full-screen-frameset.html: Added.
     10        * fullscreen/content/inner.html: Added.
     11        * fullscreen/full-screen-iframe-allowed-expected.txt: Updated.
     12        * fullscreen/full-screen-iframe-allowed.html: Add a button with which to trigger
     13            full screen mode in Safari.
     14        * fullscreen/full-screen-iframe-not-allowed-expected.txt: Updated.
     15        * fullscreen/full-screen-iframe-not-allowed.html: Ditto.
     16        * fullscreen/resources/allowed.html: Added.
     17        * fullscreen/resources/inner.html: Added.
     18
    1192011-04-22  Xiaomei Ji  <xji@chromium.org>
    220
  • trunk/LayoutTests/fullscreen/full-screen-iframe-allowed-expected.txt

    r81038 r84706  
    11Test for bug 56264: Handle entering full screen security restrictions
    22
    3 To test manually, press Space - the page should enter full screen mode.
     3To test manually, click the "Go full screen" button - the page should enter full screen mode.
    44
    55EVENT(webkitfullscreenchange)
    6 SUCCEED - entered full screen!
     6TEST(document.getElementById('frame').contentDocument.width==document.width) OK
    77END OF TEST
    88
  • trunk/LayoutTests/fullscreen/full-screen-iframe-allowed.html

    r81038 r84706  
    11<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=56264">bug 56264</a>:
    22Handle entering full screen security restrictions</p>
    3 <p>To test manually, press Space - the page should enter full screen mode.</p>
     3<p>To test manually, click the "Go full screen" button - the page should enter full screen mode.</p>
    44<script src="full-screen-test.js"></script>
    55<script>
     
    88
    99    waitForEvent(frame.contentDocument, 'webkitfullscreenchange', function() {
    10             consoleWrite("SUCCEED - entered full screen!");
     10            test("document.getElementById('frame').contentDocument.width==document.width")
    1111            endTest();
    1212    });
     
    2323}
    2424</script>
    25 <iframe id="frame" src="about:blank" onload="runTest()" webkitallowfullscreen>
     25<iframe id="frame" src="resources/inner.html" width="300" height="100" onload="runTest()" webkitallowfullscreen>
    2626</iframe>
  • trunk/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt

    r81038 r84706  
    11Test for bug 56264: Handle entering full screen security restrictions
    22
    3 To test manually, press Space - the page should not enter full screen mode.
     3To test manually, click the "Go full screen" button - the page should not enter full screen mode.
    44
    55SUCCEED - did not enter full screen!
  • trunk/LayoutTests/fullscreen/full-screen-iframe-not-allowed.html

    r81038 r84706  
    11<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=56264">bug 56264</a>:
    22Handle entering full screen security restrictions</p>
    3 <p>To test manually, press Space - the page should not enter full screen mode.</p>
     3<p>To test manually, click the "Go full screen" button - the page should not enter full screen mode.</p>
    44<script src="full-screen-test.js"></script>
    55<script>
     
    2323}
    2424</script>
    25 <iframe id="frame" src="about:blank" onload="runTest()">
     25<iframe id="frame" src="resources/inner.html" onload="runTest()">
    2626</iframe>
  • trunk/Source/WebCore/ChangeLog

    r84701 r84706  
     12011-04-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Full Screen from within an <iframe> does not cause <iframe> to resize.
     6        https://bugs.webkit.org/show_bug.cgi?id=58638
     7
     8        Tests: fullscreen/full-screen-frameset.html
     9
     10        * css/CSSStyleSelector.cpp:
     11        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Add the
     12            -webkit-full-screen pseudo class to frame elements which contain
     13            full screen elements.
     14        * css/fullscreen.css:
     15        (iframe:-webkit-full-screen): Add iframe-specific styling rules.
     16        * dom/Document.cpp:
     17        (WebCore::Document::setContainsFullScreenElementRecursively): Added.  Walk up each
     18            successive document owner element, calling setContainsFullScreenElement() if
     19            owner is a frame element.
     20        (WebCore::Document::fullScreenIsAllowedForElement): Use the new Element::isFrameElementBase
     21            call instead of checking the element's tag name.
     22        (WebCore::Document::webkitWillEnterFullScreenForElement): Mark any containing
     23            iframes as containing a full screen element.
     24        (WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
     25        * dom/Element.h:
     26        (WebCore::Element::isFrameElementBase): Added.
     27        * html/HTMLFrameElement.h:
     28        (WebCore::HTMLFrameElement::allowFullScreen): Disable full screen from within
     29            HTMLFrameElements.
     30        * html/HTMLFrameElementBase.cpp:
     31        (WebCore::HTMLFrameElementBase::setContainsFullScreenElement): Added.
     32        * html/HTMLFrameElementBase.h:
     33        (WebCore::HTMLFrameElementBase::containsFullScreenElement): Added.
     34        (WebCore::HTMLFrameElementBase::isFrameElementBase): Added.
     35
    1362011-04-22  Michael Saboff  <msaboff@apple.com>
    237
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r84609 r84706  
    6060#include "HTMLDocument.h"
    6161#include "HTMLElement.h"
     62#include "HTMLFrameElementBase.h"
    6263#include "HTMLInputElement.h"
    6364#include "HTMLNames.h"
     
    29462947                // that element. Also, an <iframe>, <object> or <embed> element whose child browsing
    29472948                // context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
     2949                if (e->isFrameElementBase() && static_cast<HTMLFrameElementBase*>(e)->containsFullScreenElement())
     2950                    return true;
    29482951                if (!e->document()->webkitIsFullScreen())
    29492952                    return false;
  • trunk/Source/WebCore/css/fullscreen.css

    r83654 r84706  
    2323}
    2424
     25iframe:-webkit-full-screen {
     26    margin: 0 !important;
     27    padding: 0 !important;
     28    border: 0 !important;
     29    position: fixed !important;
     30    height: 100% !important;
     31    width: 100% !important;
     32    left: 0 !important;
     33    top: 0 !important;
     34}
     35
    2536video:-webkit-full-page-media:-webkit-full-screen::-webkit-media-controls-panel {
    2637    bottom: 0px;
  • trunk/Source/WebCore/dom/Document.cpp

    r84688 r84706  
    47754775    ASSERT(element);
    47764776    while (HTMLFrameOwnerElement* ownerElement = element->document()->ownerElement()) {
    4777         if (!ownerElement->hasTagName(frameTag) && !ownerElement->hasTagName(iframeTag))
     4777        if (!ownerElement->isFrameElementBase())
    47784778            continue;
    47794779
     
    48134813    page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
    48144814}
    4815    
     4815
     4816static void setContainsFullScreenElementRecursively(Element* element, bool contains)
     4817{
     4818    if (!element)
     4819        return;
     4820
     4821    do {
     4822        if (!element->isFrameElementBase())
     4823            continue;
     4824       
     4825        static_cast<HTMLFrameElementBase*>(element)->setContainsFullScreenElement(contains);
     4826    } while ((element = element->document()->ownerElement()));
     4827}
     4828
    48164829void Document::webkitWillEnterFullScreenForElement(Element* element)
    48174830{
     
    48244837        m_fullScreenElement->detach();
    48254838
     4839    setContainsFullScreenElementRecursively(ownerElement(), true);
     4840   
    48264841    recalcStyle(Force);
    48274842   
     
    48504865void Document::webkitWillExitFullScreenForElement(Element*)
    48514866{
     4867    setContainsFullScreenElementRecursively(ownerElement(), false);
     4868   
    48524869    if (m_fullScreenRenderer) {
    48534870        m_fullScreenRenderer->setAnimating(true);
  • trunk/Source/WebCore/dom/Element.h

    r84665 r84706  
    322322    virtual bool isInRange() const { return false; }
    323323    virtual bool isOutOfRange() const { return false; }
     324    virtual bool isFrameElementBase() const { return false; }
    324325
    325326    virtual bool formControlValueMatchesRenderer() const { return false; }
  • trunk/Source/WebCore/html/HTMLFrameElement.h

    r82747 r84706  
    4747    virtual void parseMappedAttribute(Attribute*);
    4848
     49#if ENABLE(FULLSCREEN_API)
     50    virtual bool allowFullScreen() const { return false; }
     51#endif
     52
    4953    bool m_frameBorder;
    5054    bool m_frameBorderSet;
  • trunk/Source/WebCore/html/HTMLFrameElementBase.cpp

    r84506 r84706  
    289289    return hasAttribute(webkitallowfullscreenAttr);
    290290}
     291
     292void HTMLFrameElementBase::setContainsFullScreenElement(bool contains)
     293{
     294    m_containsFullScreenElement = contains;
     295    setNeedsStyleRecalc(SyntheticStyleChange);
     296}
    291297#endif
    292298
  • trunk/Source/WebCore/html/HTMLFrameElementBase.h

    r81038 r84706  
    4646#if ENABLE(FULLSCREEN_API)
    4747    virtual bool allowFullScreen() const;
     48    virtual void setContainsFullScreenElement(bool);
     49    virtual bool containsFullScreenElement() const { return m_containsFullScreenElement; };
    4850#endif
    4951
     
    6264   
    6365    virtual bool isURLAttribute(Attribute*) const;
     66    virtual bool isFrameElementBase() const { return true; }
    6467
    6568    virtual void willRemove();
     
    9497    bool m_viewSource;
    9598    bool m_remainsAliveOnRemovalFromTree;
     99
     100#if ENABLE(FULLSCREEN_API)
     101    bool m_containsFullScreenElement;
     102#endif
    96103};
    97104
  • trunk/Source/WebKit/mac/ChangeLog

    r84646 r84706  
     12011-04-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Full Screen from within an <iframe> does not cause <iframe> to resize.
     6        https://bugs.webkit.org/show_bug.cgi?id=58638
     7
     8        Tests: fullscreen/full-screen-frameset-allowed.html
     9               fullscreen/full-screen-frameset-not-allowed.html
     10
     11        Return the _element's document instead of the WKView's document, which
     12        will be different in the case of elements within <iframe>s.
     13
     14        * WebView/WebFullScreenController.mm:
     15        (-[WebFullScreenController _document]):
     16
    1172011-04-22  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm

    r83458 r84706  
    770770- (Document*)_document
    771771{
    772     return core([[[self webView] mainFrame] DOMDocument]);
     772    return _element->document();
    773773}
    774774
  • trunk/Source/WebKit2/ChangeLog

    r84702 r84706  
     12011-04-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Daniel Bates.
     4
     5        Full Screen from within an <iframe> does not cause <iframe> to resize.
     6        https://bugs.webkit.org/show_bug.cgi?id=58638
     7
     8        Tests: fullscreen/full-screen-frameset-allowed.html
     9               fullscreen/full-screen-frameset-not-allowed.html
     10
     11        * UIProcess/mac/WKFullScreenWindowController.mm:
     12        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Cancel the background animation
     13            if the full screen animation finishes first.
     14        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
     15        (WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): m_fullScreenRootLayer was uninitialized.
     16
    1172011-04-22  Sam Weinig  <sam@webkit.org>
    218
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r81901 r84706  
    246246        [animationView addSubview:_webView positioned:NSWindowBelow relativeTo:_layerHostingView.get()];
    247247        [_webView setFrame:[animationView bounds]];
     248
     249        [CATransaction begin];
     250        [CATransaction setDisableActions:YES];
     251        [[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
     252        [CATransaction commit];
    248253       
    249254        // FIXME: In Barolo, orderIn will animate, which is not what we want.  Find a way
  • trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm

    r84698 r84706  
    118118WebFullScreenManagerMac::WebFullScreenManagerMac(WebPage* page)
    119119    : WebFullScreenManager(page)
     120    , m_fullScreenRootLayer(0)
    120121{
    121122    m_enterFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganEnterFullScreenAnimation finished:&WebFullScreenManagerMac::finishedEnterFullScreenAnimation]);
Note: See TracChangeset for help on using the changeset viewer.