OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 } | 1906 } |
1907 return createShadowRootInternal(ShadowRootType::V0, exceptionState); | 1907 return createShadowRootInternal(ShadowRootType::V0, exceptionState); |
1908 } | 1908 } |
1909 | 1909 |
1910 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri
ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat
e) | 1910 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri
ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat
e) |
1911 { | 1911 { |
1912 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); | 1912 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); |
1913 | 1913 |
1914 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi
ngFeatures::Feature::ElementAttachShadow); | 1914 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi
ngFeatures::Feature::ElementAttachShadow); |
1915 | 1915 |
| 1916 const AtomicString& tagName = localName(); |
| 1917 bool tagNameIsSupported = isCustomElement() |
| 1918 || tagName == HTMLNames::articleTag |
| 1919 || tagName == HTMLNames::asideTag |
| 1920 || tagName == HTMLNames::blockquoteTag |
| 1921 || tagName == HTMLNames::bodyTag |
| 1922 || tagName == HTMLNames::divTag |
| 1923 || tagName == HTMLNames::footerTag |
| 1924 || tagName == HTMLNames::h1Tag |
| 1925 || tagName == HTMLNames::h2Tag |
| 1926 || tagName == HTMLNames::h3Tag |
| 1927 || tagName == HTMLNames::h4Tag |
| 1928 || tagName == HTMLNames::h5Tag |
| 1929 || tagName == HTMLNames::h6Tag |
| 1930 || tagName == HTMLNames::headerTag |
| 1931 || tagName == HTMLNames::navTag |
| 1932 || tagName == HTMLNames::pTag |
| 1933 || tagName == HTMLNames::sectionTag |
| 1934 || tagName == HTMLNames::spanTag; |
| 1935 if (!tagNameIsSupported) { |
| 1936 exceptionState.throwDOMException(NotSupportedError, "This element does n
ot support attachShadow"); |
| 1937 return nullptr; |
| 1938 } |
| 1939 |
1916 if (shadowRootInitDict.hasMode() && shadowRoot()) { | 1940 if (shadowRootInitDict.hasMode() && shadowRoot()) { |
1917 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot
be created on a host which already hosts a shadow tree."); | 1941 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot
be created on a host which already hosts a shadow tree."); |
1918 return nullptr; | 1942 return nullptr; |
1919 } | 1943 } |
1920 | 1944 |
1921 ShadowRootType type = ShadowRootType::V0; | 1945 ShadowRootType type = ShadowRootType::V0; |
1922 if (shadowRootInitDict.hasMode()) | 1946 if (shadowRootInitDict.hasMode()) |
1923 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad
owRootType::Closed; | 1947 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad
owRootType::Closed; |
1924 | 1948 |
1925 if (type == ShadowRootType::Closed) | 1949 if (type == ShadowRootType::Closed) |
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 { | 3639 { |
3616 #if ENABLE(OILPAN) | 3640 #if ENABLE(OILPAN) |
3617 if (hasRareData()) | 3641 if (hasRareData()) |
3618 visitor->trace(elementRareData()); | 3642 visitor->trace(elementRareData()); |
3619 visitor->trace(m_elementData); | 3643 visitor->trace(m_elementData); |
3620 #endif | 3644 #endif |
3621 ContainerNode::trace(visitor); | 3645 ContainerNode::trace(visitor); |
3622 } | 3646 } |
3623 | 3647 |
3624 } // namespace blink | 3648 } // namespace blink |
OLD | NEW |