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

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.h

Issue 935283002: Rename {Author,UserAgent}ShadowRoot to {Open,Closed}ShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix inspector tests Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class ShadowRoot final : public DocumentFragment, public TreeScope, public Doubl yLinkedListNode<ShadowRoot> { 46 class ShadowRoot final : public DocumentFragment, public TreeScope, public Doubl yLinkedListNode<ShadowRoot> {
47 DEFINE_WRAPPERTYPEINFO(); 47 DEFINE_WRAPPERTYPEINFO();
48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot);
49 friend class WTF::DoublyLinkedListNode<ShadowRoot>; 49 friend class WTF::DoublyLinkedListNode<ShadowRoot>;
50 public: 50 public:
51 // FIXME: We will support multiple shadow subtrees, however current implemen tation does not work well 51 // FIXME: We will support multiple shadow subtrees, however current implemen tation does not work well
52 // if a shadow root is dynamically created. So we prohibit multiple shadow s ubtrees 52 // if a shadow root is dynamically created. So we prohibit multiple shadow s ubtrees
53 // in several elements for a while. 53 // in several elements for a while.
54 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. 54 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs.
55 enum ShadowRootType { 55 enum ShadowRootType {
56 UserAgentShadowRoot = 0, 56 ClosedShadowRoot = 0,
57 AuthorShadowRoot 57 OpenShadowRoot
58 }; 58 };
59 59
60 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR ootType type) 60 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR ootType type)
61 { 61 {
62 return adoptRefWillBeNoop(new ShadowRoot(document, type)); 62 return adoptRefWillBeNoop(new ShadowRoot(document, type));
63 } 63 }
64 64
65 void recalcStyle(StyleRecalcChange); 65 void recalcStyle(StyleRecalcChange);
66 66
67 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler. 67 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler.
68 using TreeScope::document; 68 using TreeScope::document;
69 using TreeScope::getElementById; 69 using TreeScope::getElementById;
70 70
71 Element* host() const { return toElement(parentOrShadowHostNode()); } 71 Element* host() const { return toElement(parentOrShadowHostNode()); }
72 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } 72 ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
73 73
74 ShadowRoot* youngerShadowRoot() const { return prev(); } 74 ShadowRoot* youngerShadowRoot() const { return prev(); }
75 75
76 ShadowRoot* olderShadowRootForBindings() const; 76 ShadowRoot* olderShadowRootForBindings() const;
77 bool shouldExposeToBindings() const { return type() == AuthorShadowRoot; } 77 bool shouldExposeToBindings() const { return type() == OpenShadowRoot; }
78 78
79 bool isYoungest() const { return !youngerShadowRoot(); } 79 bool isYoungest() const { return !youngerShadowRoot(); }
80 bool isOldest() const { return !olderShadowRoot(); } 80 bool isOldest() const { return !olderShadowRoot(); }
81 81
82 virtual void attach(const AttachContext& = AttachContext()) override; 82 virtual void attach(const AttachContext& = AttachContext()) override;
83 83
84 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; 84 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
85 virtual void removedFrom(ContainerNode*) override; 85 virtual void removedFrom(ContainerNode*) override;
86 86
87 void registerScopedHTMLStyleChild(); 87 void registerScopedHTMLStyleChild();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return adjustedFocusedElement(); 162 return adjustedFocusedElement();
163 } 163 }
164 164
165 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); 165 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
166 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot()); 166 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot());
167 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); 167 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
168 168
169 } // namespace blink 169 } // namespace blink
170 170
171 #endif // ShadowRoot_h 171 #endif // ShadowRoot_h
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/ElementShadow.cpp ('k') | Source/core/editing/iterators/CharacterIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698