| 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 |
| 11 * contributors may be used to endorse or promote products derived from | 11 * contributors may be used to endorse or promote products derived from |
| 12 * this software without specific prior written permission. | 12 * this software without specific prior written permission. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/shadow/ShadowRoot.h" | 28 #include "core/dom/shadow/ShadowRoot.h" |
| 29 | 29 |
| 30 #include "bindings/v8/ExceptionMessages.h" | |
| 31 #include "bindings/v8/ExceptionState.h" | 30 #include "bindings/v8/ExceptionState.h" |
| 32 #include "core/css/StyleSheetList.h" | 31 #include "core/css/StyleSheetList.h" |
| 33 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/dom/ElementTraversal.h" | 33 #include "core/dom/ElementTraversal.h" |
| 35 #include "core/dom/StyleEngine.h" | 34 #include "core/dom/StyleEngine.h" |
| 36 #include "core/dom/Text.h" | 35 #include "core/dom/Text.h" |
| 37 #include "core/dom/shadow/ElementShadow.h" | 36 #include "core/dom/shadow/ElementShadow.h" |
| 38 #include "core/dom/shadow/InsertionPoint.h" | 37 #include "core/dom/shadow/InsertionPoint.h" |
| 39 #include "core/dom/shadow/ShadowRootRareData.h" | 38 #include "core/dom/shadow/ShadowRootRareData.h" |
| 40 #include "core/editing/markup.h" | 39 #include "core/editing/markup.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 { | 120 { |
| 122 if (type() != AuthorShadowRoot) | 121 if (type() != AuthorShadowRoot) |
| 123 return false; | 122 return false; |
| 124 if (ShadowRoot* older = olderShadowRoot()) | 123 if (ShadowRoot* older = olderShadowRoot()) |
| 125 return older->type() == UserAgentShadowRoot; | 124 return older->type() == UserAgentShadowRoot; |
| 126 return true; | 125 return true; |
| 127 } | 126 } |
| 128 | 127 |
| 129 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& exceptionState) | 128 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& exceptionState) |
| 130 { | 129 { |
| 131 exceptionState.throwDOMException(DataCloneError, ExceptionMessages::failedTo
Execute("cloneNode", "ShadowRoot", "ShadowRoot nodes are not clonable.")); | 130 exceptionState.throwDOMException(DataCloneError, "ShadowRoot nodes are not c
lonable."); |
| 132 return 0; | 131 return 0; |
| 133 } | 132 } |
| 134 | 133 |
| 135 String ShadowRoot::innerHTML() const | 134 String ShadowRoot::innerHTML() const |
| 136 { | 135 { |
| 137 return createMarkup(this, ChildrenOnly); | 136 return createMarkup(this, ChildrenOnly); |
| 138 } | 137 } |
| 139 | 138 |
| 140 void ShadowRoot::setInnerHTML(const String& markup, ExceptionState& exceptionSta
te) | 139 void ShadowRoot::setInnerHTML(const String& markup, ExceptionState& exceptionSta
te) |
| 141 { | 140 { |
| 142 if (isOrphan()) { | 141 if (isOrphan()) { |
| 143 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
failedToExecute("setInnerHTML", "ShadowRoot", "The ShadowRoot does not have a ho
st.")); | 142 exceptionState.throwDOMException(InvalidAccessError, "The ShadowRoot doe
s not have a host."); |
| 144 return; | 143 return; |
| 145 } | 144 } |
| 146 | 145 |
| 147 if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(mark
up, host(), AllowScriptingContent, "innerHTML", exceptionState)) | 146 if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(mark
up, host(), AllowScriptingContent, "innerHTML", exceptionState)) |
| 148 replaceChildrenWithFragment(this, fragment.release(), exceptionState); | 147 replaceChildrenWithFragment(this, fragment.release(), exceptionState); |
| 149 } | 148 } |
| 150 | 149 |
| 151 bool ShadowRoot::childTypeAllowed(NodeType type) const | 150 bool ShadowRoot::childTypeAllowed(NodeType type) const |
| 152 { | 151 { |
| 153 switch (type) { | 152 switch (type) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 410 |
| 412 StyleSheetList* ShadowRoot::styleSheets() | 411 StyleSheetList* ShadowRoot::styleSheets() |
| 413 { | 412 { |
| 414 if (!ensureShadowRootRareData()->styleSheets()) | 413 if (!ensureShadowRootRareData()->styleSheets()) |
| 415 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 414 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
| 416 | 415 |
| 417 return m_shadowRootRareData->styleSheets(); | 416 return m_shadowRootRareData->styleSheets(); |
| 418 } | 417 } |
| 419 | 418 |
| 420 } | 419 } |
| OLD | NEW |