OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class SlotAssignment; | 45 class SlotAssignment; |
46 class StyleSheetList; | 46 class StyleSheetList; |
47 | 47 |
48 enum class ShadowRootType { UserAgent, V0, Open, Closed }; | 48 enum class ShadowRootType { UserAgent, V0, Open, Closed }; |
49 | 49 |
50 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope { | 50 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope { |
51 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
52 USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); | 52 USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); |
53 | 53 |
54 public: | 54 public: |
55 // FIXME: Current implementation does not work well if a shadow root is dynami
cally created. | 55 // FIXME: Current implementation does not work well if a shadow root is |
56 // So multiple shadow subtrees in several elements are prohibited. | 56 // dynamically created. So multiple shadow subtrees in several elements are |
57 // See https://github.com/w3c/webcomponents/issues/102 and http://crbug.com/23
4020 | 57 // prohibited. |
| 58 // See https://github.com/w3c/webcomponents/issues/102 and |
| 59 // http://crbug.com/234020 |
58 static ShadowRoot* create(Document& document, ShadowRootType type) { | 60 static ShadowRoot* create(Document& document, ShadowRootType type) { |
59 return new ShadowRoot(document, type); | 61 return new ShadowRoot(document, type); |
60 } | 62 } |
61 | 63 |
62 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implementa
tion is simpler. | 64 // Disambiguate between Node and TreeScope hierarchies; TreeScope's |
| 65 // implementation is simpler. |
63 using TreeScope::document; | 66 using TreeScope::document; |
64 using TreeScope::getElementById; | 67 using TreeScope::getElementById; |
65 | 68 |
66 // Make protected methods from base class public here. | 69 // Make protected methods from base class public here. |
67 using TreeScope::setDocument; | 70 using TreeScope::setDocument; |
68 using TreeScope::setParentTreeScope; | 71 using TreeScope::setParentTreeScope; |
69 | 72 |
70 Element& host() const { | 73 Element& host() const { |
71 DCHECK(parentOrShadowHostNode()); | 74 DCHECK(parentOrShadowHostNode()); |
72 return *toElement(parentOrShadowHostNode()); | 75 return *toElement(parentOrShadowHostNode()); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 treeScope, | 195 treeScope, |
193 treeScope->rootNode().isShadowRoot(), | 196 treeScope->rootNode().isShadowRoot(), |
194 treeScope.rootNode().isShadowRoot()); | 197 treeScope.rootNode().isShadowRoot()); |
195 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); | 198 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); |
196 | 199 |
197 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&); | 200 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&); |
198 | 201 |
199 } // namespace blink | 202 } // namespace blink |
200 | 203 |
201 #endif // ShadowRoot_h | 204 #endif // ShadowRoot_h |
OLD | NEW |