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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 LayoutTreeBuilderForElement::LayoutTreeBuilderForElement(Element& element, Layou tStyle* style) | 46 LayoutTreeBuilderForElement::LayoutTreeBuilderForElement(Element& element, Layou tStyle* style) |
47 : LayoutTreeBuilder(element, nullptr) | 47 : LayoutTreeBuilder(element, nullptr) |
48 , m_style(style) | 48 , m_style(style) |
49 { | 49 { |
50 if (element.isFirstLetterPseudoElement()) { | 50 if (element.isFirstLetterPseudoElement()) { |
51 if (LayoutObject* nextRenderer = FirstLetterPseudoElement::firstLetterTe xtRenderer(element)) | 51 if (LayoutObject* nextRenderer = FirstLetterPseudoElement::firstLetterTe xtRenderer(element)) |
52 m_renderingParent = nextRenderer->parent(); | 52 m_renderingParent = nextRenderer->parent(); |
53 } else if (ContainerNode* containerNode = NodeRenderingTraversal::parent(ele ment)) { | 53 } else if (ContainerNode* containerNode = NodeRenderingTraversal::parent(ele ment)) { |
54 m_renderingParent = containerNode->renderer(); | 54 m_renderingParent = containerNode->layoutObject(); |
Julien - ping for review
2015/03/05 16:19:15
We should probably renaming this one too: m_layout
dsinclair
2015/03/05 16:40:01
Done.
| |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 LayoutObject* LayoutTreeBuilderForElement::nextRenderer() const | 58 LayoutObject* LayoutTreeBuilderForElement::nextRenderer() const |
59 { | 59 { |
60 ASSERT(m_renderingParent); | 60 ASSERT(m_renderingParent); |
61 | 61 |
62 if (m_node->isInTopLayer()) | 62 if (m_node->isInTopLayer()) |
63 return NodeRenderingTraversal::nextInTopLayer(*m_node); | 63 return NodeRenderingTraversal::nextInTopLayer(*m_node); |
64 | 64 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 | 125 |
126 if (!parentRenderer->isChildAllowed(newRenderer, style)) { | 126 if (!parentRenderer->isChildAllowed(newRenderer, style)) { |
127 newRenderer->destroy(); | 127 newRenderer->destroy(); |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 // Make sure the LayoutObject already knows it is going to be added to a Lay outFlowThread before we set the style | 131 // Make sure the LayoutObject already knows it is going to be added to a Lay outFlowThread before we set the style |
132 // for the first time. Otherwise code using inLayoutFlowThread() in the styl eWillChange and styleDidChange will fail. | 132 // for the first time. Otherwise code using inLayoutFlowThread() in the styl eWillChange and styleDidChange will fail. |
133 newRenderer->setFlowThreadState(parentRenderer->flowThreadState()); | 133 newRenderer->setFlowThreadState(parentRenderer->flowThreadState()); |
134 | 134 |
135 LayoutObject* nextRenderer = this->nextRenderer(); | 135 LayoutObject* nextRenderer = this->nextRenderer(); |
Julien - ping for review
2015/03/05 16:19:15
We need to rename nextRenderer et al., I didn't ca
dsinclair
2015/03/05 16:40:01
Yes, they're on my list to cleanup (along with abo
| |
136 m_node->setRenderer(newRenderer); | 136 m_node->setRenderer(newRenderer); |
137 newRenderer->setStyle(&style); // setStyle() can depend on renderer() alread y being set. | 137 newRenderer->setStyle(&style); // setStyle() can depend on layoutObject() al ready being set. |
Julien - ping for review
2015/03/05 16:19:15
s/newRenderer/newLayoutObject/
| |
138 | 138 |
139 if (Fullscreen::isActiveFullScreenElement(*m_node)) { | 139 if (Fullscreen::isActiveFullScreenElement(*m_node)) { |
140 newRenderer = LayoutFullScreen::wrapRenderer(newRenderer, parentRenderer , &m_node->document()); | 140 newRenderer = LayoutFullScreen::wrapRenderer(newRenderer, parentRenderer , &m_node->document()); |
141 if (!newRenderer) | 141 if (!newRenderer) |
142 return; | 142 return; |
143 } | 143 } |
144 | 144 |
145 // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer. | 145 // Note: Adding newRenderer instead of layoutObject(). layoutObject() may be a child of newRenderer. |
146 parentRenderer->addChild(newRenderer, nextRenderer); | 146 parentRenderer->addChild(newRenderer, nextRenderer); |
147 } | 147 } |
148 | 148 |
149 void LayoutTreeBuilderForText::createRenderer() | 149 void LayoutTreeBuilderForText::createRenderer() |
150 { | 150 { |
151 LayoutObject* parentRenderer = this->parentRenderer(); | 151 LayoutObject* parentRenderer = this->parentRenderer(); |
152 LayoutStyle* style = parentRenderer->style(); | 152 LayoutStyle* style = parentRenderer->style(); |
153 | 153 |
154 ASSERT(m_node->textRendererIsNeeded(*style, *parentRenderer)); | 154 ASSERT(m_node->textRendererIsNeeded(*style, *parentRenderer)); |
155 | 155 |
156 LayoutText* newRenderer = m_node->createTextRenderer(style); | 156 LayoutText* newRenderer = m_node->createTextRenderer(style); |
157 if (!parentRenderer->isChildAllowed(newRenderer, *style)) { | 157 if (!parentRenderer->isChildAllowed(newRenderer, *style)) { |
158 newRenderer->destroy(); | 158 newRenderer->destroy(); |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 // Make sure the LayoutObject already knows it is going to be added to a Lay outFlowThread before we set the style | 162 // Make sure the LayoutObject already knows it is going to be added to a Lay outFlowThread before we set the style |
163 // for the first time. Otherwise code using inLayoutFlowThread() in the styl eWillChange and styleDidChange will fail. | 163 // for the first time. Otherwise code using inLayoutFlowThread() in the styl eWillChange and styleDidChange will fail. |
164 newRenderer->setFlowThreadState(parentRenderer->flowThreadState()); | 164 newRenderer->setFlowThreadState(parentRenderer->flowThreadState()); |
165 | 165 |
166 LayoutObject* nextRenderer = this->nextRenderer(); | 166 LayoutObject* nextRenderer = this->nextRenderer(); |
167 m_node->setRenderer(newRenderer); | 167 m_node->setRenderer(newRenderer); |
168 // Parent takes care of the animations, no need to call setAnimatableStyle. | 168 // Parent takes care of the animations, no need to call setAnimatableStyle. |
169 newRenderer->setStyle(style); | 169 newRenderer->setStyle(style); |
170 parentRenderer->addChild(newRenderer, nextRenderer); | 170 parentRenderer->addChild(newRenderer, nextRenderer); |
171 } | 171 } |
172 | 172 |
173 } | 173 } |
OLD | NEW |