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

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

Issue 1869773004: Move shadowCascadeOrder to Document from StyleEngine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ASSERT and insert DCHECK_NE Created 4 years, 8 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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 if (ShadowRoot* root = shadowRoot()) { 1901 if (ShadowRoot* root = shadowRoot()) {
1902 if (root->isV1()) { 1902 if (root->isV1()) {
1903 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree."); 1903 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree.");
1904 return nullptr; 1904 return nullptr;
1905 } 1905 }
1906 if (root->type() == ShadowRootType::UserAgent) { 1906 if (root->type() == ShadowRootType::UserAgent) {
1907 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree."); 1907 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree.");
1908 return nullptr; 1908 return nullptr;
1909 } 1909 }
1910 } 1910 }
1911 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV0); 1911 document().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCascadeV0);
1912 1912
1913 return createShadowRootInternal(ShadowRootType::V0, exceptionState); 1913 return createShadowRootInternal(ShadowRootType::V0, exceptionState);
1914 } 1914 }
1915 1915
1916 RawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scriptState, const S hadowRootInit& shadowRootInitDict, ExceptionState& exceptionState) 1916 RawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scriptState, const S hadowRootInit& shadowRootInitDict, ExceptionState& exceptionState)
1917 { 1917 {
1918 DCHECK(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 1918 DCHECK(RuntimeEnabledFeatures::shadowDOMV1Enabled());
1919 1919
1920 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow); 1920 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow);
1921 1921
(...skipping 19 matching lines...) Expand all
1941 if (!tagNameIsSupported) { 1941 if (!tagNameIsSupported) {
1942 exceptionState.throwDOMException(NotSupportedError, "This element does n ot support attachShadow"); 1942 exceptionState.throwDOMException(NotSupportedError, "This element does n ot support attachShadow");
1943 return nullptr; 1943 return nullptr;
1944 } 1944 }
1945 1945
1946 if (shadowRootInitDict.hasMode() && shadowRoot()) { 1946 if (shadowRootInitDict.hasMode() && shadowRoot()) {
1947 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree."); 1947 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree.");
1948 return nullptr; 1948 return nullptr;
1949 } 1949 }
1950 1950
1951 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV1); 1951 document().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCascadeV1);
1952 1952
1953 ShadowRootType type = ShadowRootType::V0; 1953 ShadowRootType type = ShadowRootType::V0;
1954 if (shadowRootInitDict.hasMode()) 1954 if (shadowRootInitDict.hasMode())
1955 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed; 1955 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed;
1956 1956
1957 if (type == ShadowRootType::Closed) 1957 if (type == ShadowRootType::Closed)
1958 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed); 1958 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed);
1959 else if (type == ShadowRootType::Open) 1959 else if (type == ShadowRootType::Open)
1960 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen); 1960 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen);
1961 1961
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 3678
3679 DEFINE_TRACE(Element) 3679 DEFINE_TRACE(Element)
3680 { 3680 {
3681 if (hasRareData()) 3681 if (hasRareData())
3682 visitor->trace(elementRareData()); 3682 visitor->trace(elementRareData());
3683 visitor->trace(m_elementData); 3683 visitor->trace(m_elementData);
3684 ContainerNode::trace(visitor); 3684 ContainerNode::trace(visitor);
3685 } 3685 }
3686 3686
3687 } // namespace blink 3687 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698