| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/Text.h" | 36 #include "core/dom/Text.h" |
| 37 #include "core/layout/LayoutFullScreen.h" | 37 #include "core/layout/LayoutFullScreen.h" |
| 38 #include "core/layout/LayoutObject.h" | 38 #include "core/layout/LayoutObject.h" |
| 39 #include "core/layout/LayoutText.h" | 39 #include "core/layout/LayoutText.h" |
| 40 #include "core/layout/LayoutView.h" | 40 #include "core/layout/LayoutView.h" |
| 41 #include "core/svg/SVGElement.h" | 41 #include "core/svg/SVGElement.h" |
| 42 #include "platform/RuntimeEnabledFeatures.h" | 42 #include "platform/RuntimeEnabledFeatures.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 LayoutTreeBuilderForElement::LayoutTreeBuilderForElement(Element& element, Layou
tStyle* style) | 46 LayoutTreeBuilderForElement::LayoutTreeBuilderForElement(Element& element, Compu
tedStyle* 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* nextLayoutObject = FirstLetterPseudoElement::firstLett
erTextRenderer(element)) | 51 if (LayoutObject* nextLayoutObject = FirstLetterPseudoElement::firstLett
erTextRenderer(element)) |
| 52 m_layoutObjectParent = nextLayoutObject->parent(); | 52 m_layoutObjectParent = nextLayoutObject->parent(); |
| 53 } else if (ContainerNode* containerNode = NodeRenderingTraversal::parent(ele
ment)) { | 53 } else if (ContainerNode* containerNode = NodeRenderingTraversal::parent(ele
ment)) { |
| 54 m_layoutObjectParent = containerNode->layoutObject(); | 54 m_layoutObjectParent = containerNode->layoutObject(); |
| 55 } | 55 } |
| 56 } | 56 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 LayoutObject* parentLayoutObject = this->parentLayoutObject(); | 100 LayoutObject* parentLayoutObject = this->parentLayoutObject(); |
| 101 if (!parentLayoutObject) | 101 if (!parentLayoutObject) |
| 102 return false; | 102 return false; |
| 103 if (!parentLayoutObject->canHaveChildren()) | 103 if (!parentLayoutObject->canHaveChildren()) |
| 104 return false; | 104 return false; |
| 105 | 105 |
| 106 return m_node->layoutObjectIsNeeded(style()); | 106 return m_node->layoutObjectIsNeeded(style()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 LayoutStyle& LayoutTreeBuilderForElement::style() const | 109 ComputedStyle& LayoutTreeBuilderForElement::style() const |
| 110 { | 110 { |
| 111 if (!m_style) | 111 if (!m_style) |
| 112 m_style = m_node->styleForLayoutObject(); | 112 m_style = m_node->styleForLayoutObject(); |
| 113 return *m_style; | 113 return *m_style; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void LayoutTreeBuilderForElement::createLayoutObject() | 116 void LayoutTreeBuilderForElement::createLayoutObject() |
| 117 { | 117 { |
| 118 LayoutStyle& style = this->style(); | 118 ComputedStyle& style = this->style(); |
| 119 | 119 |
| 120 LayoutObject* newLayoutObject = m_node->createLayoutObject(style); | 120 LayoutObject* newLayoutObject = m_node->createLayoutObject(style); |
| 121 if (!newLayoutObject) | 121 if (!newLayoutObject) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 LayoutObject* parentLayoutObject = this->parentLayoutObject(); | 124 LayoutObject* parentLayoutObject = this->parentLayoutObject(); |
| 125 | 125 |
| 126 if (!parentLayoutObject->isChildAllowed(newLayoutObject, style)) { | 126 if (!parentLayoutObject->isChildAllowed(newLayoutObject, style)) { |
| 127 newLayoutObject->destroy(); | 127 newLayoutObject->destroy(); |
| 128 return; | 128 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Note: Adding newLayoutObject instead of layoutObject(). layoutObject() ma
y be a child of newLayoutObject. | 145 // Note: Adding newLayoutObject instead of layoutObject(). layoutObject() ma
y be a child of newLayoutObject. |
| 146 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); | 146 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void LayoutTreeBuilderForText::createLayoutObject() | 149 void LayoutTreeBuilderForText::createLayoutObject() |
| 150 { | 150 { |
| 151 LayoutObject* parentLayoutObject = this->parentLayoutObject(); | 151 LayoutObject* parentLayoutObject = this->parentLayoutObject(); |
| 152 LayoutStyle& style = parentLayoutObject->mutableStyleRef(); | 152 ComputedStyle& style = parentLayoutObject->mutableStyleRef(); |
| 153 | 153 |
| 154 ASSERT(m_node->textRendererIsNeeded(style, *parentLayoutObject)); | 154 ASSERT(m_node->textRendererIsNeeded(style, *parentLayoutObject)); |
| 155 | 155 |
| 156 LayoutText* newLayoutObject = m_node->createTextRenderer(style); | 156 LayoutText* newLayoutObject = m_node->createTextRenderer(style); |
| 157 if (!parentLayoutObject->isChildAllowed(newLayoutObject, style)) { | 157 if (!parentLayoutObject->isChildAllowed(newLayoutObject, style)) { |
| 158 newLayoutObject->destroy(); | 158 newLayoutObject->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 newLayoutObject->setFlowThreadState(parentLayoutObject->flowThreadState()); | 164 newLayoutObject->setFlowThreadState(parentLayoutObject->flowThreadState()); |
| 165 | 165 |
| 166 LayoutObject* nextLayoutObject = this->nextLayoutObject(); | 166 LayoutObject* nextLayoutObject = this->nextLayoutObject(); |
| 167 m_node->setLayoutObject(newLayoutObject); | 167 m_node->setLayoutObject(newLayoutObject); |
| 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 newLayoutObject->setStyle(&style); | 169 newLayoutObject->setStyle(&style); |
| 170 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); | 170 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } | 173 } |
| OLD | NEW |