| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public: | 48 public: |
| 49 // FIXME: We will support multiple shadow subtrees, however current implemen
tation does not work well | 49 // FIXME: We will support multiple shadow subtrees, however current implemen
tation does not work well |
| 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 PassRefPtr<ShadowRoot> create(Document& document, ShadowRootType type
) | 58 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR
ootType type) |
| 59 { | 59 { |
| 60 return adoptRef(new ShadowRoot(document, type)); | 60 return adoptRefWillBeRefCountedGarbageCollected(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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 { | 159 { |
| 160 return adjustedFocusedElement(); | 160 return adjustedFocusedElement(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); | 163 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); |
| 164 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); | 164 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad
owRoot(), treeScope.rootNode().isShadowRoot()); |
| 165 | 165 |
| 166 } // namespace | 166 } // namespace |
| 167 | 167 |
| 168 #endif | 168 #endif |
| OLD | NEW |