Changeset 87660 in webkit


Ignore:
Timestamp:
May 29, 2011 7:05:30 PM (13 years ago)
Author:
jer.noble@apple.com
Message:

2011-05-29 Jer Noble <jer.noble@apple.com>

Reviewed by Simon Fraser.

Embedded Vimeo video, when taken fullscreen, is overlapped by content from the enclosing page
https://bugs.webkit.org/show_bug.cgi?id=61712

  • fullscreen/full-screen-iframe-zIndex-expected.txt: Added.
  • fullscreen/full-screen-iframe-zIndex.html: Added.
  • platform/mac/fullscreen/full-screen-iframe-zIndex-expected.png: Added.

2011-05-29 Jer Noble <jer.noble@apple.com>

Reviewed by Simon Fraser.

Embedded Vimeo video, when taken fullscreen, is overlapped by content from the enclosing page
https://bugs.webkit.org/show_bug.cgi?id=61712

Tests: fullscreen/full-screen-iframe-zIndex.html

Walk up the ancestor chain for the full-screen element, marking them as full-screen
ancestors. Then, we apply a pseudo-class to those elements, which disable all their
stacking-context-creating styles. Set the z-index of all full-screen elements (and
the iframes which contain them) to a large value, ensuring they appear above other
sibling elements.

This new behavior replaces the previous "-webkit-full-screen-media-document" behavior
and pesudo-class, so remove it and replace it with the new pseudo-class.

  • css/CSSSelector.cpp: (WebCore::nameToPseudoTypeMap): Add -webkit-full-screen-ancestor and remove

-webkit-full-screen-media-document.

(WebCore::CSSSelector::pseudoId): Add PseudoFullScreenAncestor and remove

PseudoFullScreenMediaDocument

(WebCore::CSSSelector::extractPseudoType): Ditto.

  • css/CSSSelector.h: Ditto.
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Remove the

PseudoFullScreenMediaDocument implementation and replace it with
PseudoFullScreenAncestor.

  • css/fullscreen.css: (:-webkit-full-screen): Add a z-index property. (:-webkit-full-screen-ancestor:not(iframe)): Added. Reset the z-index to

auto, and reset other stacking-context creating properties.

  • dom/Document.cpp: (WebCore::Document::setContainsFullScreenElementRecursively): Recurse up every element

instead of just the iframe elements.

(WebCore::Document::webkitWillEnterFullScreenForElement): Ditto.

  • dom/Element.cpp: (WebCore::Element::willRemove): Reset our parent's containsFullScreenElement property. (WebCore::Element::insertedIntoTree): Ditto. (WebCore::Element::containsFullScreenElement): Moved here from HTMLElementBase. (WebCore::Element::setContainsFullScreenElement): Ditto.
  • dom/Element.h:
  • dom/ElementRareData.h: (WebCore::ElementRareData::ElementRareData): Added ivar and initializer for

m_containsFullScreenElement.

  • html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::HTMLFrameElementBase): Removed ivar and initializer. (WebCore::HTMLFrameElementBase::setContainsFullScreenElement): Moved into Element.
  • html/HTMLFrameElementBase.h:
  • rendering/style/RenderStyleConstants.h:
Location:
trunk
Files:
3 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87659 r87660  
     12011-05-29  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Embedded Vimeo video, when taken fullscreen, is overlapped by content from the enclosing page
     6        https://bugs.webkit.org/show_bug.cgi?id=61712
     7
     8        * fullscreen/full-screen-iframe-zIndex-expected.txt: Added.
     9        * fullscreen/full-screen-iframe-zIndex.html: Added.
     10        * platform/mac/fullscreen/full-screen-iframe-zIndex-expected.png: Added.
     11
    1122011-05-29  Adam Barth  <abarth@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r87657 r87660  
     12011-05-29  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Embedded Vimeo video, when taken fullscreen, is overlapped by content from the enclosing page
     6        https://bugs.webkit.org/show_bug.cgi?id=61712
     7
     8        Tests: fullscreen/full-screen-iframe-zIndex.html
     9
     10        Walk up the ancestor chain for the full-screen element, marking them as full-screen
     11        ancestors. Then, we apply a pseudo-class to those elements, which disable all their
     12        stacking-context-creating styles.  Set the z-index of all full-screen elements (and
     13        the iframes which contain them) to a large value, ensuring they appear above other
     14        sibling elements.
     15
     16        This new behavior replaces the previous "-webkit-full-screen-media-document" behavior
     17        and pesudo-class, so remove it and replace it with the new pseudo-class.
     18
     19        * css/CSSSelector.cpp:
     20        (WebCore::nameToPseudoTypeMap): Add -webkit-full-screen-ancestor and remove
     21            -webkit-full-screen-media-document.
     22        (WebCore::CSSSelector::pseudoId): Add PseudoFullScreenAncestor and remove
     23            PseudoFullScreenMediaDocument
     24        (WebCore::CSSSelector::extractPseudoType): Ditto.
     25        * css/CSSSelector.h: Ditto.
     26        * css/CSSStyleSelector.cpp:
     27        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Remove the
     28            PseudoFullScreenMediaDocument implementation and replace it with
     29            PseudoFullScreenAncestor.
     30        * css/fullscreen.css:
     31        (:-webkit-full-screen): Add a z-index property.
     32        (:-webkit-full-screen-ancestor:not(iframe)): Added.  Reset the z-index to
     33            auto, and reset other stacking-context creating properties.
     34        * dom/Document.cpp:
     35        (WebCore::Document::setContainsFullScreenElementRecursively): Recurse up every element
     36            instead of just the iframe elements.
     37        (WebCore::Document::webkitWillEnterFullScreenForElement): Ditto.
     38        * dom/Element.cpp:
     39        (WebCore::Element::willRemove): Reset our parent's containsFullScreenElement property.
     40        (WebCore::Element::insertedIntoTree): Ditto.
     41        (WebCore::Element::containsFullScreenElement): Moved here from HTMLElementBase.
     42        (WebCore::Element::setContainsFullScreenElement): Ditto.
     43        * dom/Element.h:
     44        * dom/ElementRareData.h:
     45        (WebCore::ElementRareData::ElementRareData): Added ivar and initializer for
     46            m_containsFullScreenElement.
     47        * html/HTMLFrameElementBase.cpp:
     48        (WebCore::HTMLFrameElementBase::HTMLFrameElementBase): Removed ivar and initializer.
     49        (WebCore::HTMLFrameElementBase::setContainsFullScreenElement): Moved into Element.
     50        * html/HTMLFrameElementBase.h:
     51        * rendering/style/RenderStyleConstants.h:
     52
    1532011-05-29  Dan Bernstein  <mitz@apple.com>
    254
  • trunk/Source/WebCore/css/CSSSelector.cpp

    r87235 r87660  
    150150    case PseudoFullScreenDocument:
    151151        return FULL_SCREEN_DOCUMENT;
    152     case PseudoFullScreenMediaDocument:
    153         return FULL_SCREEN_MEDIA_DOCUMENT;
     152    case PseudoFullScreenAncestor:
     153        return FULL_SCREEN_ANCESTOR;
    154154    case PseudoAnimatingFullScreenTransition:
    155155        return ANIMATING_FULL_SCREEN_TRANSITION;
     
    299299    DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen"));
    300300    DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document"));
    301     DEFINE_STATIC_LOCAL(AtomicString, fullScreenMediaDocument, ("-webkit-full-screen-media-document"));
     301    DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen-ancestor"));
    302302    DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition"));
    303303#endif
     
    379379        nameToPseudoType->set(fullScreen.impl(), CSSSelector::PseudoFullScreen);
    380380        nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFullScreenDocument);
    381         nameToPseudoType->set(fullScreenMediaDocument.impl(), CSSSelector::PseudoFullScreenMediaDocument);
     381        nameToPseudoType->set(fullScreenAncestor.impl(), CSSSelector::PseudoFullScreenAncestor);
    382382        nameToPseudoType->set(animatingFullScreenTransition.impl(), CSSSelector::PseudoAnimatingFullScreenTransition);
    383383#endif
     
    481481    case PseudoFullScreen:
    482482    case PseudoFullScreenDocument:
    483     case PseudoFullScreenMediaDocument:
     483    case PseudoFullScreenAncestor:
    484484    case PseudoAnimatingFullScreenTransition:
    485485#endif
  • trunk/Source/WebCore/css/CSSSelector.h

    r87235 r87660  
    181181            PseudoFullScreen,
    182182            PseudoFullScreenDocument,
    183             PseudoFullScreenMediaDocument,
     183            PseudoFullScreenAncestor,
    184184            PseudoAnimatingFullScreenTransition,
    185185#endif
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r87474 r87660  
    29092909                    return false;
    29102910                return e->document()->isAnimatingFullScreen();
    2911             case CSSSelector::PseudoFullScreenMediaDocument:
    2912                 if (!e->document()->webkitIsFullScreen())
    2913                     return false;
    2914 #if ENABLE(VIDEO)
    2915                 if (!e->document()->webkitCurrentFullScreenElement() || !e->document()->webkitCurrentFullScreenElement()->isMediaElement())
    2916                     return false;
    2917 #endif
    2918                 return true;
     2911            case CSSSelector::PseudoFullScreenAncestor:
     2912                return e->containsFullScreenElement();
    29192913            case CSSSelector::PseudoFullScreenDocument:
    29202914                // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
  • trunk/Source/WebCore/css/fullscreen.css

    r87102 r87660  
    11:-webkit-full-screen {
    22    background-color: white;
     3    z-index:2147483647;
    34}
    45
     
    78}
    89
    9 :root:-webkit-full-screen-media-document *:not(:-webkit-full-screen) {
     10:-webkit-full-screen-ancestor:not(iframe) {
    1011    z-index: auto !important;
    1112    opacity: 1 !important;
  • trunk/Source/WebCore/dom/Document.cpp

    r87657 r87660  
    48674867}
    48684868
    4869 static void setContainsFullScreenElementRecursively(Element* element, bool contains)
    4870 {
    4871     if (!element)
    4872         return;
    4873 
    4874     do {
    4875         if (!element->isFrameElementBase())
    4876             continue;
    4877        
    4878         static_cast<HTMLFrameElementBase*>(element)->setContainsFullScreenElement(contains);
    4879     } while ((element = element->document()->ownerElement()));
     4869void Document::setContainsFullScreenElementRecursively(Element* element, bool contains)
     4870{
     4871    while (element) {
     4872        element->setContainsFullScreenElement(contains);
     4873        element = (element->parentElement() ? element->parentElement() : element->document()->ownerElement());
     4874    }
    48804875}
    48814876
     
    48904885        m_fullScreenElement->detach();
    48914886
    4892     setContainsFullScreenElementRecursively(ownerElement(), true);
     4887    setContainsFullScreenElementRecursively(m_fullScreenElement->parentElement() ? m_fullScreenElement->parentElement() : ownerElement(), true);
    48934888   
    48944889    recalcStyle(Force);
  • trunk/Source/WebCore/dom/Document.h

    r87635 r87660  
    10831083    bool isAnimatingFullScreen() const;
    10841084    void setAnimatingFullScreen(bool);
     1085    static void setContainsFullScreenElementRecursively(Element*, bool);
    10851086#endif
    10861087
  • trunk/Source/WebCore/dom/Element.cpp

    r87645 r87660  
    942942}
    943943
     944void Element::willRemove()
     945{
     946#if ENABLE(FULLSCREEN_API)
     947    if (containsFullScreenElement() && parentElement())
     948        document()->setContainsFullScreenElementRecursively(parentElement(), false);
     949#endif
     950    ContainerNode::willRemove();
     951}
     952
    944953void Element::insertedIntoDocument()
    945954{
     
    981990    if (ShadowRoot* shadow = shadowRoot())
    982991        shadow->insertedIntoTree(true);
     992
     993#if ENABLE(FULLSCREEN_API)
     994    if (parentElement() && containsFullScreenElement() && !parentElement()->containsFullScreenElement())
     995        document()->setContainsFullScreenElementRecursively(parentElement(), true);
     996#endif
    983997}
    984998
     
    18991913    document()->requestFullScreenForElement(this, flags, Document::EnforceIFrameAllowFulScreenRequirement);
    19001914}
     1915
     1916bool Element::containsFullScreenElement() const
     1917{
     1918    return hasRareData() ? rareData()->m_containsFullScreenElement : false;
     1919}
     1920
     1921void Element::setContainsFullScreenElement(bool flag)
     1922{
     1923    ensureRareData()->m_containsFullScreenElement = flag;
     1924    setNeedsStyleRecalc(SyntheticStyleChange);
     1925}
    19011926#endif   
    19021927
  • trunk/Source/WebCore/dom/Element.h

    r87657 r87660  
    356356   
    357357    void webkitRequestFullScreen(unsigned short flags);
     358    virtual bool containsFullScreenElement() const;
     359    virtual void setContainsFullScreenElement(bool);
    358360#endif
    359361
     
    369371    }
    370372
     373    virtual void willRemove();
    371374    virtual void insertedIntoDocument();
    372375    virtual void removedFromDocument();
  • trunk/Source/WebCore/dom/ElementRareData.h

    r83256 r87660  
    4949    OwnPtr<DatasetDOMStringMap> m_datasetDOMStringMap;
    5050    OwnPtr<ClassList> m_classList;
     51
     52#if ENABLE(FULLSCREEN_API)
     53    bool m_containsFullScreenElement;
     54#endif
    5155};
    5256
     
    5963    : m_minimumSizeForResizing(defaultMinimumSizeForResizing())
    6064    , m_shadowRoot(0)
     65#if ENABLE(FULLSCREEN_API)
     66    , m_containsFullScreenElement(false)
     67#endif
    6168{
    6269}
  • trunk/Source/WebCore/html/HTMLFrameElementBase.cpp

    r86503 r87660  
    5353    , m_viewSource(false)
    5454    , m_remainsAliveOnRemovalFromTree(false)
    55 #if ENABLE(FULLSCREEN_API)
    56     , m_containsFullScreenElement(false)
    57 #endif
    5855{
    5956}
     
    289286    return hasAttribute(webkitallowfullscreenAttr);
    290287}
    291 
    292 void HTMLFrameElementBase::setContainsFullScreenElement(bool contains)
    293 {
    294     m_containsFullScreenElement = contains;
    295     setNeedsStyleRecalc(SyntheticStyleChange);
    296 }
    297288#endif
    298289
  • trunk/Source/WebCore/html/HTMLFrameElementBase.h

    r86491 r87660  
    4646#if ENABLE(FULLSCREEN_API)
    4747    virtual bool allowFullScreen() const;
    48     virtual void setContainsFullScreenElement(bool);
    49     virtual bool containsFullScreenElement() const { return m_containsFullScreenElement; };
    5048#endif
    5149
     
    9997    bool m_viewSource;
    10098    bool m_remainsAliveOnRemovalFromTree;
    101 
    102 #if ENABLE(FULLSCREEN_API)
    103     bool m_containsFullScreenElement;
    104 #endif
    10599};
    106100
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r87475 r87660  
    7979    INPUT_LIST_BUTTON, VISITED_LINK,
    8080    AFTER_LAST_INTERNAL_PSEUDOID,
    81     FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT, ANIMATING_FULL_SCREEN_TRANSITION,
     81    FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
    8282    FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
    8383    FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON,
Note: See TracChangeset for help on using the changeset viewer.