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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // if a shadow root is dynamically created. So we prohibit multiple shadow s
ubtrees | 50 // if a shadow root is dynamically created. So we prohibit multiple shadow s
ubtrees |
51 // in several elements for a while. | 51 // in several elements for a while. |
52 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. | 52 // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. |
53 enum ShadowRootType { | 53 enum ShadowRootType { |
54 UserAgentShadowRoot = 0, | 54 UserAgentShadowRoot = 0, |
55 AuthorShadowRoot | 55 AuthorShadowRoot |
56 }; | 56 }; |
57 | 57 |
58 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR
ootType type) | 58 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR
ootType type) |
59 { | 59 { |
60 return adoptRefWillBeRefCountedGarbageCollected(new ShadowRoot(document,
type)); | 60 return adoptRefWillBeNoop(new ShadowRoot(document, type)); |
61 } | 61 } |
62 | 62 |
63 void recalcStyle(StyleRecalcChange); | 63 void recalcStyle(StyleRecalcChange); |
64 | 64 |
65 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen
tation is simpler. | 65 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen
tation is simpler. |
66 using TreeScope::document; | 66 using TreeScope::document; |
67 using TreeScope::getElementById; | 67 using TreeScope::getElementById; |
68 | 68 |
69 Element* host() const { return toElement(parentOrShadowHostNode()); } | 69 Element* host() const { return toElement(parentOrShadowHostNode()); } |
70 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } | 70 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 { | 160 { |
161 return adjustedFocusedElement(); | 161 return adjustedFocusedElement(); |
162 } | 162 } |
163 | 163 |
164 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 164 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
165 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 165 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
166 | 166 |
167 } // namespace | 167 } // namespace |
168 | 168 |
169 #endif | 169 #endif |
OLD | NEW |