| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 11 matching lines...) Expand all Loading... |
| 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 "core/dom/PseudoElement.h" | 27 #include "core/dom/PseudoElement.h" |
| 28 | 28 |
| 29 #include "core/dom/FirstLetterPseudoElement.h" | 29 #include "core/dom/FirstLetterPseudoElement.h" |
| 30 #include "core/frame/UseCounter.h" | 30 #include "core/frame/UseCounter.h" |
| 31 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
| 32 #include "core/layout/GeneratedChildren.h" |
| 32 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
| 33 #include "core/layout/LayoutQuote.h" | 34 #include "core/layout/LayoutQuote.h" |
| 34 #include "core/style/ContentData.h" | 35 #include "core/style/ContentData.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 PseudoElement* PseudoElement::create(Element* parent, PseudoId pseudoId) { | 39 PseudoElement* PseudoElement::create(Element* parent, PseudoId pseudoId) { |
| 39 return new PseudoElement(parent, pseudoId); | 40 return new PseudoElement(parent, pseudoId); |
| 40 } | 41 } |
| 41 | 42 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 void PseudoElement::attachLayoutTree(const AttachContext& context) { | 120 void PseudoElement::attachLayoutTree(const AttachContext& context) { |
| 120 DCHECK(!layoutObject()); | 121 DCHECK(!layoutObject()); |
| 121 | 122 |
| 122 Element::attachLayoutTree(context); | 123 Element::attachLayoutTree(context); |
| 123 | 124 |
| 124 LayoutObject* layoutObject = this->layoutObject(); | 125 LayoutObject* layoutObject = this->layoutObject(); |
| 125 if (!layoutObject) | 126 if (!layoutObject) |
| 126 return; | 127 return; |
| 127 | 128 |
| 129 // This is to ensure that bypassing the canHaveGeneratedChildren check in |
| 130 // StyleResolver::createPseudoElementIfNeeded does not result in the |
| 131 // backdrop pseudo element's layout object becoming the child of a layout |
| 132 // object that doesn't allow children. |
| 133 DCHECK(layoutObject->parent()); |
| 134 DCHECK(canHaveGeneratedChildren(*layoutObject->parent())); |
| 135 |
| 128 ComputedStyle& style = layoutObject->mutableStyleRef(); | 136 ComputedStyle& style = layoutObject->mutableStyleRef(); |
| 129 if (style.styleType() != PseudoIdBefore && style.styleType() != PseudoIdAfter) | 137 if (style.styleType() != PseudoIdBefore && style.styleType() != PseudoIdAfter) |
| 130 return; | 138 return; |
| 131 DCHECK(style.contentData()); | 139 DCHECK(style.contentData()); |
| 132 | 140 |
| 133 for (const ContentData* content = style.contentData(); content; | 141 for (const ContentData* content = style.contentData(); content; |
| 134 content = content->next()) { | 142 content = content->next()) { |
| 135 LayoutObject* child = content->createLayoutObject(document(), style); | 143 LayoutObject* child = content->createLayoutObject(document(), style); |
| 136 if (layoutObject->isChildAllowed(child, style)) { | 144 if (layoutObject->isChildAllowed(child, style)) { |
| 137 layoutObject->addChild(child); | 145 layoutObject->addChild(child); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 LayoutObject* ancestor = layoutObject()->parent(); | 197 LayoutObject* ancestor = layoutObject()->parent(); |
| 190 while (ancestor->isAnonymous() || | 198 while (ancestor->isAnonymous() || |
| 191 (ancestor->node() && ancestor->node()->isPseudoElement())) { | 199 (ancestor->node() && ancestor->node()->isPseudoElement())) { |
| 192 DCHECK(ancestor->parent()); | 200 DCHECK(ancestor->parent()); |
| 193 ancestor = ancestor->parent(); | 201 ancestor = ancestor->parent(); |
| 194 } | 202 } |
| 195 return ancestor->node(); | 203 return ancestor->node(); |
| 196 } | 204 } |
| 197 | 205 |
| 198 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |