| 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" | |
| 33 #include "core/layout/LayoutObject.h" | 32 #include "core/layout/LayoutObject.h" |
| 34 #include "core/layout/LayoutQuote.h" | 33 #include "core/layout/LayoutQuote.h" |
| 35 #include "core/style/ContentData.h" | 34 #include "core/style/ContentData.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 PseudoElement* PseudoElement::create(Element* parent, PseudoId pseudoId) | 38 PseudoElement* PseudoElement::create(Element* parent, PseudoId pseudoId) |
| 40 { | 39 { |
| 41 return new PseudoElement(parent, pseudoId); | 40 return new PseudoElement(parent, pseudoId); |
| 42 } | 41 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void PseudoElement::attachLayoutTree(const AttachContext& context) | 117 void PseudoElement::attachLayoutTree(const AttachContext& context) |
| 119 { | 118 { |
| 120 DCHECK(!layoutObject()); | 119 DCHECK(!layoutObject()); |
| 121 | 120 |
| 122 Element::attachLayoutTree(context); | 121 Element::attachLayoutTree(context); |
| 123 | 122 |
| 124 LayoutObject* layoutObject = this->layoutObject(); | 123 LayoutObject* layoutObject = this->layoutObject(); |
| 125 if (!layoutObject) | 124 if (!layoutObject) |
| 126 return; | 125 return; |
| 127 | 126 |
| 128 // This is to ensure that bypassing the canHaveGeneratedChildren check in | |
| 129 // StyleResolver::createPseudoElementIfNeeded does not result in the | |
| 130 // backdrop pseudo element's layout object becoming the child of a layout | |
| 131 // object that doesn't allow children. | |
| 132 DCHECK(layoutObject->parent()); | |
| 133 DCHECK(canHaveGeneratedChildren(*layoutObject->parent())); | |
| 134 | |
| 135 ComputedStyle& style = layoutObject->mutableStyleRef(); | 127 ComputedStyle& style = layoutObject->mutableStyleRef(); |
| 136 if (style.styleType() != PseudoIdBefore && style.styleType() != PseudoIdAfte
r) | 128 if (style.styleType() != PseudoIdBefore && style.styleType() != PseudoIdAfte
r) |
| 137 return; | 129 return; |
| 138 DCHECK(style.contentData()); | 130 DCHECK(style.contentData()); |
| 139 | 131 |
| 140 for (const ContentData* content = style.contentData(); content; content = co
ntent->next()) { | 132 for (const ContentData* content = style.contentData(); content; content = co
ntent->next()) { |
| 141 LayoutObject* child = content->createLayoutObject(document(), style); | 133 LayoutObject* child = content->createLayoutObject(document(), style); |
| 142 if (layoutObject->isChildAllowed(child, style)) { | 134 if (layoutObject->isChildAllowed(child, style)) { |
| 143 layoutObject->addChild(child); | 135 layoutObject->addChild(child); |
| 144 if (child->isQuote()) | 136 if (child->isQuote()) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // us and our parent so make sure we skip over them. | 187 // us and our parent so make sure we skip over them. |
| 196 LayoutObject* ancestor = layoutObject()->parent(); | 188 LayoutObject* ancestor = layoutObject()->parent(); |
| 197 while (ancestor->isAnonymous() || (ancestor->node() && ancestor->node()->isP
seudoElement())) { | 189 while (ancestor->isAnonymous() || (ancestor->node() && ancestor->node()->isP
seudoElement())) { |
| 198 DCHECK(ancestor->parent()); | 190 DCHECK(ancestor->parent()); |
| 199 ancestor = ancestor->parent(); | 191 ancestor = ancestor->parent(); |
| 200 } | 192 } |
| 201 return ancestor->node(); | 193 return ancestor->node(); |
| 202 } | 194 } |
| 203 | 195 |
| 204 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |