| 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 "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/PseudoElement.h" | 28 #include "core/dom/PseudoElement.h" |
| 29 | 29 |
| 30 #include "core/dom/FirstLetterPseudoElement.h" | 30 #include "core/dom/FirstLetterPseudoElement.h" |
| 31 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
| 32 #include "core/rendering/RenderObject.h" | 32 #include "core/layout/LayoutObject.h" |
| 33 #include "core/rendering/RenderQuote.h" | 33 #include "core/rendering/RenderQuote.h" |
| 34 #include "core/rendering/style/ContentData.h" | 34 #include "core/rendering/style/ContentData.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 PassRefPtrWillBeRawPtr<PseudoElement> PseudoElement::create(Element* parent, Pse
udoId pseudoId) | 38 PassRefPtrWillBeRawPtr<PseudoElement> PseudoElement::create(Element* parent, Pse
udoId pseudoId) |
| 39 { | 39 { |
| 40 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId)); | 40 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId)); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 setParentOrShadowHostNode(0); | 109 setParentOrShadowHostNode(0); |
| 110 removedFrom(parent.get()); | 110 removedFrom(parent.get()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void PseudoElement::attach(const AttachContext& context) | 113 void PseudoElement::attach(const AttachContext& context) |
| 114 { | 114 { |
| 115 ASSERT(!renderer()); | 115 ASSERT(!renderer()); |
| 116 | 116 |
| 117 Element::attach(context); | 117 Element::attach(context); |
| 118 | 118 |
| 119 RenderObject* renderer = this->renderer(); | 119 LayoutObject* renderer = this->renderer(); |
| 120 if (!renderer) | 120 if (!renderer) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 RenderStyle* style = renderer->style(); | 123 RenderStyle* style = renderer->style(); |
| 124 if (style->styleType() != BEFORE && style->styleType() != AFTER) | 124 if (style->styleType() != BEFORE && style->styleType() != AFTER) |
| 125 return; | 125 return; |
| 126 ASSERT(style->contentData()); | 126 ASSERT(style->contentData()); |
| 127 | 127 |
| 128 for (const ContentData* content = style->contentData(); content; content = c
ontent->next()) { | 128 for (const ContentData* content = style->contentData(); content; content = c
ontent->next()) { |
| 129 RenderObject* child = content->createRenderer(document(), style); | 129 LayoutObject* child = content->createRenderer(document(), style); |
| 130 if (renderer->isChildAllowed(child, style)) { | 130 if (renderer->isChildAllowed(child, style)) { |
| 131 renderer->addChild(child); | 131 renderer->addChild(child); |
| 132 if (child->isQuote()) | 132 if (child->isQuote()) |
| 133 toRenderQuote(child)->attachQuote(); | 133 toRenderQuote(child)->attachQuote(); |
| 134 } else | 134 } else |
| 135 child->destroy(); | 135 child->destroy(); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool PseudoElement::rendererIsNeeded(const RenderStyle& style) | 139 bool PseudoElement::rendererIsNeeded(const RenderStyle& style) |
| 140 { | 140 { |
| 141 return pseudoElementRendererIsNeeded(&style); | 141 return pseudoElementRendererIsNeeded(&style); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void PseudoElement::didRecalcStyle(StyleRecalcChange) | 144 void PseudoElement::didRecalcStyle(StyleRecalcChange) |
| 145 { | 145 { |
| 146 if (!renderer()) | 146 if (!renderer()) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 // The renderers inside pseudo elements are anonymous so they don't get noti
fied of recalcStyle and must have | 149 // The renderers inside pseudo elements are anonymous so they don't get noti
fied of recalcStyle and must have |
| 150 // the style propagated downward manually similar to RenderObject::propagate
StyleToAnonymousChildren. | 150 // the style propagated downward manually similar to LayoutObject::propagate
StyleToAnonymousChildren. |
| 151 RenderObject* renderer = this->renderer(); | 151 LayoutObject* renderer = this->renderer(); |
| 152 for (RenderObject* child = renderer->nextInPreOrder(renderer); child; child
= child->nextInPreOrder(renderer)) { | 152 for (LayoutObject* child = renderer->nextInPreOrder(renderer); child; child
= child->nextInPreOrder(renderer)) { |
| 153 // We only manage the style for the generated content items. | 153 // We only manage the style for the generated content items. |
| 154 if (!child->isText() && !child->isQuote() && !child->isImage()) | 154 if (!child->isText() && !child->isQuote() && !child->isImage()) |
| 155 continue; | 155 continue; |
| 156 | 156 |
| 157 child->setPseudoStyle(renderer->style()); | 157 child->setPseudoStyle(renderer->style()); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| OLD | NEW |