OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
7 * Copyright (C) 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2011 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/dom/LayoutTreeBuilder.h" | 27 #include "core/dom/LayoutTreeBuilder.h" |
28 | 28 |
29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
30 #include "core/SVGNames.h" | 30 #include "core/SVGNames.h" |
31 #include "core/css/resolver/StyleResolver.h" | 31 #include "core/css/resolver/StyleResolver.h" |
32 #include "core/dom/FirstLetterPseudoElement.h" | 32 #include "core/dom/FirstLetterPseudoElement.h" |
33 #include "core/dom/Fullscreen.h" | 33 #include "core/dom/Fullscreen.h" |
| 34 #include "core/dom/MarkerPseudoElement.h" |
34 #include "core/dom/Node.h" | 35 #include "core/dom/Node.h" |
35 #include "core/dom/PseudoElement.h" | 36 #include "core/dom/PseudoElement.h" |
36 #include "core/dom/Text.h" | 37 #include "core/dom/Text.h" |
37 #include "core/dom/shadow/InsertionPoint.h" | 38 #include "core/dom/shadow/InsertionPoint.h" |
38 #include "core/layout/LayoutFullScreen.h" | 39 #include "core/layout/LayoutFullScreen.h" |
39 #include "core/layout/LayoutObject.h" | 40 #include "core/layout/LayoutObject.h" |
40 #include "core/layout/LayoutText.h" | 41 #include "core/layout/LayoutText.h" |
41 #include "core/layout/LayoutView.h" | 42 #include "core/layout/LayoutView.h" |
42 #include "core/svg/SVGElement.h" | 43 #include "core/svg/SVGElement.h" |
43 #include "platform/RuntimeEnabledFeatures.h" | 44 #include "platform/RuntimeEnabledFeatures.h" |
(...skipping 16 matching lines...) Expand all Loading... |
60 LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const | 61 LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const |
61 { | 62 { |
62 ASSERT(m_layoutObjectParent); | 63 ASSERT(m_layoutObjectParent); |
63 | 64 |
64 if (m_node->isInTopLayer()) | 65 if (m_node->isInTopLayer()) |
65 return LayoutTreeBuilderTraversal::nextInTopLayer(*m_node); | 66 return LayoutTreeBuilderTraversal::nextInTopLayer(*m_node); |
66 | 67 |
67 if (m_node->isFirstLetterPseudoElement()) | 68 if (m_node->isFirstLetterPseudoElement()) |
68 return FirstLetterPseudoElement::firstLetterTextRenderer(*m_node); | 69 return FirstLetterPseudoElement::firstLetterTextRenderer(*m_node); |
69 | 70 |
| 71 if (m_node->isMarkerPseudoElement()) { |
| 72 LayoutObject* parentLayoutObject = this->parentLayoutObject(); |
| 73 ASSERT(parentLayoutObject); |
| 74 |
| 75 return MarkerPseudoElement::firstNonMarkerChild(parentLayoutObject); |
| 76 } |
| 77 |
70 return LayoutTreeBuilder::nextLayoutObject(); | 78 return LayoutTreeBuilder::nextLayoutObject(); |
71 } | 79 } |
72 | 80 |
73 LayoutObject* LayoutTreeBuilderForElement::parentLayoutObject() const | 81 LayoutObject* LayoutTreeBuilderForElement::parentLayoutObject() const |
74 { | 82 { |
75 LayoutObject* parentLayoutObject = LayoutTreeBuilder::parentLayoutObject(); | 83 LayoutObject* parentLayoutObject = LayoutTreeBuilder::parentLayoutObject(); |
76 | 84 |
| 85 if (m_node->isMarkerPseudoElement()) { |
| 86 if (LayoutObject* markerLayoutObject = MarkerPseudoElement::parentOfFirs
tLineBox(m_layoutObjectParent, nullptr)) |
| 87 return markerLayoutObject; |
| 88 } |
| 89 |
77 if (parentLayoutObject) { | 90 if (parentLayoutObject) { |
78 // FIXME: Guarding this by parentLayoutObject isn't quite right as the s
pec for | 91 // FIXME: Guarding this by parentRenderer isn't quite right as the spec
for |
79 // top layer only talks about display: none ancestors so putting a <dial
og> inside an | 92 // top layer only talks about display: none ancestors so putting a <dial
og> inside an |
80 // <optgroup> seems like it should still work even though this check wil
l prevent it. | 93 // <optgroup> seems like it should still work even though this check wil
l prevent it. |
81 if (m_node->isInTopLayer()) | 94 if (m_node->isInTopLayer()) |
82 return m_node->document().layoutView(); | 95 return m_node->document().layoutView(); |
83 } | 96 } |
84 | 97 |
85 return parentLayoutObject; | 98 return parentLayoutObject; |
86 } | 99 } |
87 | 100 |
88 bool LayoutTreeBuilderForElement::shouldCreateLayoutObject() const | 101 bool LayoutTreeBuilderForElement::shouldCreateLayoutObject() const |
89 { | 102 { |
90 if (!m_layoutObjectParent) | 103 if (!m_layoutObjectParent) |
91 return false; | 104 return false; |
92 | 105 |
93 // FIXME: Should the following be in SVGElement::layoutObjectIsNeeded()? | 106 // FIXME: Should the following be in SVGElement::layoutObjectIsNeeded()? |
94 if (m_node->isSVGElement()) { | 107 if (m_node->isSVGElement()) { |
95 // SVG elements only render when inside <svg>, or if the element is an <
svg> itself. | 108 // SVG elements only render when inside <svg>, or if the element is an <
svg> itself. |
96 if (!isSVGSVGElement(*m_node) && (!m_layoutObjectParent->node() || !m_la
youtObjectParent->node()->isSVGElement())) | 109 if (!isSVGSVGElement(*m_node) && (!m_layoutObjectParent->node() || !m_la
youtObjectParent->node()->isSVGElement())) |
97 return false; | 110 return false; |
98 if (!toSVGElement(m_node)->isValid()) | 111 if (!toSVGElement(m_node)->isValid()) |
99 return false; | 112 return false; |
100 } | 113 } |
101 | 114 |
102 LayoutObject* parentLayoutObject = this->parentLayoutObject(); | 115 LayoutObject* parentLayoutObject = this->parentLayoutObject(); |
103 if (!parentLayoutObject) | 116 if (!parentLayoutObject) |
104 return false; | 117 return false; |
105 if (!parentLayoutObject->canHaveChildren()) | 118 if (!parentLayoutObject->canHaveChildren()) |
106 return false; | 119 return false; |
107 | 120 |
| 121 if (m_node->isMarkerPseudoElement()) |
| 122 return true; |
| 123 |
108 return m_node->layoutObjectIsNeeded(style()); | 124 return m_node->layoutObjectIsNeeded(style()); |
109 } | 125 } |
110 | 126 |
111 ComputedStyle& LayoutTreeBuilderForElement::style() const | 127 ComputedStyle& LayoutTreeBuilderForElement::style() const |
112 { | 128 { |
113 if (!m_style) | 129 if (!m_style) |
114 m_style = m_node->styleForLayoutObject(); | 130 m_style = m_node->styleForLayoutObject(); |
115 return *m_style; | 131 return *m_style; |
116 } | 132 } |
117 | 133 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 newLayoutObject->setFlowThreadState(parentLayoutObject->flowThreadState()); | 182 newLayoutObject->setFlowThreadState(parentLayoutObject->flowThreadState()); |
167 | 183 |
168 LayoutObject* nextLayoutObject = this->nextLayoutObject(); | 184 LayoutObject* nextLayoutObject = this->nextLayoutObject(); |
169 m_node->setLayoutObject(newLayoutObject); | 185 m_node->setLayoutObject(newLayoutObject); |
170 // Parent takes care of the animations, no need to call setAnimatableStyle. | 186 // Parent takes care of the animations, no need to call setAnimatableStyle. |
171 newLayoutObject->setStyle(&style); | 187 newLayoutObject->setStyle(&style); |
172 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); | 188 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); |
173 } | 189 } |
174 | 190 |
175 } | 191 } |
OLD | NEW |