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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 { | 141 { |
142 if (isOrphan()) { | 142 if (isOrphan()) { |
143 exceptionState.throwDOMException(InvalidAccessError, "The ShadowRoot doe
s not have a host."); | 143 exceptionState.throwDOMException(InvalidAccessError, "The ShadowRoot doe
s not have a host."); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(mark
up, host(), AllowScriptingContent, "innerHTML", exceptionState)) | 147 if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(mark
up, host(), AllowScriptingContent, "innerHTML", exceptionState)) |
148 replaceChildrenWithFragment(this, fragment.release(), exceptionState); | 148 replaceChildrenWithFragment(this, fragment.release(), exceptionState); |
149 } | 149 } |
150 | 150 |
151 bool ShadowRoot::childTypeAllowed(NodeType type) const | |
152 { | |
153 switch (type) { | |
154 case ELEMENT_NODE: | |
155 case PROCESSING_INSTRUCTION_NODE: | |
156 case COMMENT_NODE: | |
157 case TEXT_NODE: | |
158 case CDATA_SECTION_NODE: | |
159 return true; | |
160 default: | |
161 return false; | |
162 } | |
163 } | |
164 | |
165 void ShadowRoot::recalcStyle(StyleRecalcChange change) | 151 void ShadowRoot::recalcStyle(StyleRecalcChange change) |
166 { | 152 { |
167 // ShadowRoot doesn't support custom callbacks. | 153 // ShadowRoot doesn't support custom callbacks. |
168 ASSERT(!hasCustomStyleCallbacks()); | 154 ASSERT(!hasCustomStyleCallbacks()); |
169 | 155 |
170 // If we're propagating an Inherit change and this ShadowRoot resets | 156 // If we're propagating an Inherit change and this ShadowRoot resets |
171 // inheritance we don't need to look at the children. | 157 // inheritance we don't need to look at the children. |
172 if (change <= Inherit && resetStyleInheritance() && !needsStyleRecalc() && !
childNeedsStyleRecalc()) | 158 if (change <= Inherit && resetStyleInheritance() && !needsStyleRecalc() && !
childNeedsStyleRecalc()) |
173 return; | 159 return; |
174 | 160 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 402 |
417 StyleSheetList* ShadowRoot::styleSheets() | 403 StyleSheetList* ShadowRoot::styleSheets() |
418 { | 404 { |
419 if (!ensureShadowRootRareData()->styleSheets()) | 405 if (!ensureShadowRootRareData()->styleSheets()) |
420 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 406 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
421 | 407 |
422 return m_shadowRootRareData->styleSheets(); | 408 return m_shadowRootRareData->styleSheets(); |
423 } | 409 } |
424 | 410 |
425 } | 411 } |
OLD | NEW |