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

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

Issue 1407183002: Rename ShadowRootType::OpenByDefault to ShadowRootType::V0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1-attach-shadow
Patch Set: Created 5 years, 2 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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 } 1908 }
1909 1909
1910 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, ExceptionState& exceptionState) 1910 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, ExceptionState& exceptionState)
1911 { 1911 {
1912 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementCreateShadowRoot); 1912 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementCreateShadowRoot);
1913 ShadowRoot* root = shadowRoot(); 1913 ShadowRoot* root = shadowRoot();
1914 if (root && (root->type() == ShadowRootType::Open || root->type() == ShadowR ootType::Closed)) { 1914 if (root && (root->type() == ShadowRootType::Open || root->type() == ShadowR ootType::Closed)) {
1915 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts this type of shadow tree."); 1915 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts this type of shadow tree.");
1916 return nullptr; 1916 return nullptr;
1917 } 1917 }
1918 return createShadowRootInternal(ShadowRootType::OpenByDefault, exceptionStat e); 1918 return createShadowRootInternal(ShadowRootType::V0, exceptionState);
1919 } 1919 }
1920 1920
1921 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e) 1921 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e)
1922 { 1922 {
1923 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 1923 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
1924 1924
1925 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow); 1925 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow);
1926 1926
1927 if (shadowRootInitDict.hasMode() && shadowRoot()) { 1927 if (shadowRootInitDict.hasMode() && shadowRoot()) {
1928 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree."); 1928 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree.");
1929 return nullptr; 1929 return nullptr;
1930 } 1930 }
1931 1931
1932 ShadowRootType type = ShadowRootType::OpenByDefault; 1932 ShadowRootType type = ShadowRootType::V0;
1933 if (shadowRootInitDict.hasMode()) 1933 if (shadowRootInitDict.hasMode())
1934 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed; 1934 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed;
1935 1935
1936 if (type == ShadowRootType::Closed) { 1936 if (type == ShadowRootType::Closed) {
1937 if (!RuntimeEnabledFeatures::shadowRootClosedModeEnabled()) { 1937 if (!RuntimeEnabledFeatures::shadowRootClosedModeEnabled()) {
1938 exceptionState.throwDOMException(NotSupportedError, "Closed shadow r oot is not supported yet."); 1938 exceptionState.throwDOMException(NotSupportedError, "Closed shadow r oot is not supported yet.");
1939 return nullptr; 1939 return nullptr;
1940 } 1940 }
1941 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed); 1941 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed);
1942 } else if (type == ShadowRootType::Open) { 1942 } else if (type == ShadowRootType::Open) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 if (!elementShadow) 1975 if (!elementShadow)
1976 return nullptr; 1976 return nullptr;
1977 return elementShadow->youngestShadowRoot(); 1977 return elementShadow->youngestShadowRoot();
1978 } 1978 }
1979 1979
1980 ShadowRoot* Element::openShadowRoot() const 1980 ShadowRoot* Element::openShadowRoot() const
1981 { 1981 {
1982 ShadowRoot* root = shadowRoot(); 1982 ShadowRoot* root = shadowRoot();
1983 if (!root) 1983 if (!root)
1984 return nullptr; 1984 return nullptr;
1985 return root->type() == ShadowRootType::OpenByDefault || root->type() == Shad owRootType::Open ? root : nullptr; 1985 return root->type() == ShadowRootType::V0 || root->type() == ShadowRootType: :Open ? root : nullptr;
1986 } 1986 }
1987 1987
1988 ShadowRoot* Element::closedShadowRoot() const 1988 ShadowRoot* Element::closedShadowRoot() const
1989 { 1989 {
1990 ShadowRoot* root = shadowRoot(); 1990 ShadowRoot* root = shadowRoot();
1991 if (!root) 1991 if (!root)
1992 return nullptr; 1992 return nullptr;
1993 return root->type() == ShadowRootType::Closed ? root : nullptr; 1993 return root->type() == ShadowRootType::Closed ? root : nullptr;
1994 } 1994 }
1995 1995
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 { 3563 {
3564 #if ENABLE(OILPAN) 3564 #if ENABLE(OILPAN)
3565 if (hasRareData()) 3565 if (hasRareData())
3566 visitor->trace(elementRareData()); 3566 visitor->trace(elementRareData());
3567 visitor->trace(m_elementData); 3567 visitor->trace(m_elementData);
3568 #endif 3568 #endif
3569 ContainerNode::trace(visitor); 3569 ContainerNode::trace(visitor);
3570 } 3570 }
3571 3571
3572 } // namespace blink 3572 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698