Skip to content
  • shinyak@chromium.org's avatar
    HTMLMediaElement should not use Element::ensureShadowRoot() · e733cfbd
    shinyak@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=77936
    
    Reviewed by Hajime Morita.
    
    Source/WebCore:
    
    a video element and an audio element add UserAgentShadowRoot dynamically, and they assume that it's the oldest ShadowRoot.
    However an AuthorShadowRoot could be added by a user before a video element and an audio element add UserAgentShadowRoot.
    It breaks the assumption that the UserAgentShadowRoot is the oldest.
    
    If the UserAgentShadowRoot is not the oldest, the AuthorShadowRoot a page author added might be ignored.
    Since the timing to add UserAgentShadowRoot is not known by a user, the fact that UserAgentShadorRoot is
    not the oldest will cause inconsistent behavior.
    
    Adding AuthorShadowRoot to a video element and an audio element is allowed by this patch.
    
    Test: fast/dom/shadow/shadowdom-for-media.html
    
    * dom/ShadowRoot.cpp:
    (WebCore::allowsAuthorShadowRoot):
    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::createShadowSubtree):
    (WebCore):
    (WebCore::HTMLMediaElement::willAddAuthorShadowRoot):
    (WebCore::HTMLMediaElement::createMediaControls):
    * html/HTMLMediaElement.h:
    (HTMLMediaElement):
    
    LayoutTests:
    
    Adding Shadow DOM to a video element and an audio element is allowed now.
    
    * fast/dom/shadow/shadow-disable-expected.txt:
    * fast/dom/shadow/shadow-disable.html:
    * fast/dom/shadow/shadowdom-for-media-expected.txt: Added.
    * fast/dom/shadow/shadowdom-for-media.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e733cfbd