Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/core/dom/Element.cpp

Issue 1223473004: Prohibit createShadowRoot({mode: 'open'}) on existing shadow root. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot); 1821 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot);
1822 return createShadowRoot(exceptionState); 1822 return createShadowRoot(exceptionState);
1823 } 1823 }
1824 1824
1825 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exception State) 1825 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exception State)
1826 { 1826 {
1827 ASSERT(RuntimeEnabledFeatures::createShadowRootWithParameterEnabled()); 1827 ASSERT(RuntimeEnabledFeatures::createShadowRootWithParameterEnabled());
1828 UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParamet er); 1828 UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParamet er);
1829 1829
1830 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot); 1830 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot);
1831 // TODO(kochi): Add support for closed shadow root. crbug.com/459136 1831
1832 if (shadowRootInitDict.hasMode() && shadowRootInitDict.mode() == "closed") { 1832 if (shadowRootInitDict.hasMode()) {
1833 exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet."); 1833 if (shadowRoot()) {
1834 return nullptr; 1834 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a shadow tree.");
1835 return nullptr;
1836 }
1837 // TODO(kochi): Add support for closed shadow root. crbug.com/459136
1838 if (shadowRootInitDict.mode() == "closed") {
1839 exceptionState.throwDOMException(NotSupportedError, "Closed shadow r oot is not implemented yet.");
1840 return nullptr;
1841 }
1835 } 1842 }
1836 1843
1837 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRoot(exceptionState) ; 1844 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRoot(exceptionState) ;
1838 1845
1839 if (shadowRootInitDict.hasDelegatesFocus()) 1846 if (shadowRootInitDict.hasDelegatesFocus())
1840 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus()); 1847 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus());
1841 1848
1842 return shadowRoot.release(); 1849 return shadowRoot.release();
1843 } 1850 }
1844 1851
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
3429 { 3436 {
3430 #if ENABLE(OILPAN) 3437 #if ENABLE(OILPAN)
3431 if (hasRareData()) 3438 if (hasRareData())
3432 visitor->trace(elementRareData()); 3439 visitor->trace(elementRareData());
3433 visitor->trace(m_elementData); 3440 visitor->trace(m_elementData);
3434 #endif 3441 #endif
3435 ContainerNode::trace(visitor); 3442 ContainerNode::trace(visitor);
3436 } 3443 }
3437 3444
3438 } // namespace blink 3445 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698