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

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

Issue 1803933002: Use correct cascading order for Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for review comment #16 Created 4 years, 9 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
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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 if (ShadowRoot* root = shadowRoot()) { 1899 if (ShadowRoot* root = shadowRoot()) {
1900 if (root->isV1()) { 1900 if (root->isV1()) {
1901 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree."); 1901 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree.");
1902 return nullptr; 1902 return nullptr;
1903 } 1903 }
1904 if (root->type() == ShadowRootType::UserAgent) { 1904 if (root->type() == ShadowRootType::UserAgent) {
1905 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree."); 1905 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree.");
1906 return nullptr; 1906 return nullptr;
1907 } 1907 }
1908 } 1908 }
1909 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV0);
1910
1909 return createShadowRootInternal(ShadowRootType::V0, exceptionState); 1911 return createShadowRootInternal(ShadowRootType::V0, exceptionState);
1910 } 1912 }
1911 1913
1912 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e) 1914 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e)
1913 { 1915 {
1914 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 1916 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
1915 1917
1916 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow); 1918 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow);
1917 1919
1918 const AtomicString& tagName = localName(); 1920 const AtomicString& tagName = localName();
(...skipping 18 matching lines...) Expand all
1937 if (!tagNameIsSupported) { 1939 if (!tagNameIsSupported) {
1938 exceptionState.throwDOMException(NotSupportedError, "This element does n ot support attachShadow"); 1940 exceptionState.throwDOMException(NotSupportedError, "This element does n ot support attachShadow");
1939 return nullptr; 1941 return nullptr;
1940 } 1942 }
1941 1943
1942 if (shadowRootInitDict.hasMode() && shadowRoot()) { 1944 if (shadowRootInitDict.hasMode() && shadowRoot()) {
1943 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree."); 1945 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree.");
1944 return nullptr; 1946 return nullptr;
1945 } 1947 }
1946 1948
1949 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV1);
1950
1947 ShadowRootType type = ShadowRootType::V0; 1951 ShadowRootType type = ShadowRootType::V0;
1948 if (shadowRootInitDict.hasMode()) 1952 if (shadowRootInitDict.hasMode())
1949 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed; 1953 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed;
1950 1954
1951 if (type == ShadowRootType::Closed) 1955 if (type == ShadowRootType::Closed)
1952 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed); 1956 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed);
1953 else if (type == ShadowRootType::Open) 1957 else if (type == ShadowRootType::Open)
1954 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen); 1958 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen);
1955 1959
1956 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, e xceptionState); 1960 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, e xceptionState);
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 { 3666 {
3663 #if ENABLE(OILPAN) 3667 #if ENABLE(OILPAN)
3664 if (hasRareData()) 3668 if (hasRareData())
3665 visitor->trace(elementRareData()); 3669 visitor->trace(elementRareData());
3666 visitor->trace(m_elementData); 3670 visitor->trace(m_elementData);
3667 #endif 3671 #endif
3668 ContainerNode::trace(visitor); 3672 ContainerNode::trace(visitor);
3669 } 3673 }
3670 3674
3671 } // namespace blink 3675 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698