| 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 29 matching lines...) Expand all Loading... |
| 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, Compu
tedStyle* 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 ASSERT(!element.isSlotOrActiveInsertionPoint()); | 50 DCHECK(!element.isSlotOrActiveInsertionPoint()); |
| 51 if (element.isFirstLetterPseudoElement()) { | 51 if (element.isFirstLetterPseudoElement()) { |
| 52 if (LayoutObject* nextLayoutObject = FirstLetterPseudoElement::firstLett
erTextLayoutObject(element)) | 52 if (LayoutObject* nextLayoutObject = FirstLetterPseudoElement::firstLett
erTextLayoutObject(element)) |
| 53 m_layoutObjectParent = nextLayoutObject->parent(); | 53 m_layoutObjectParent = nextLayoutObject->parent(); |
| 54 } else if (ContainerNode* containerNode = LayoutTreeBuilderTraversal::parent
(element)) { | 54 } else if (ContainerNode* containerNode = LayoutTreeBuilderTraversal::parent
(element)) { |
| 55 m_layoutObjectParent = containerNode->layoutObject(); | 55 m_layoutObjectParent = containerNode->layoutObject(); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const | 59 LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const |
| 60 { | 60 { |
| 61 ASSERT(m_layoutObjectParent); | 61 DCHECK(m_layoutObjectParent); |
| 62 | 62 |
| 63 if (m_node->isInTopLayer()) | 63 if (m_node->isInTopLayer()) |
| 64 return LayoutTreeBuilderTraversal::nextInTopLayer(*m_node); | 64 return LayoutTreeBuilderTraversal::nextInTopLayer(*m_node); |
| 65 | 65 |
| 66 if (m_node->isFirstLetterPseudoElement()) | 66 if (m_node->isFirstLetterPseudoElement()) |
| 67 return FirstLetterPseudoElement::firstLetterTextLayoutObject(*m_node); | 67 return FirstLetterPseudoElement::firstLetterTextLayoutObject(*m_node); |
| 68 | 68 |
| 69 return LayoutTreeBuilder::nextLayoutObject(); | 69 return LayoutTreeBuilder::nextLayoutObject(); |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Note: Adding newLayoutObject instead of layoutObject(). layoutObject() ma
y be a child of newLayoutObject. | 144 // Note: Adding newLayoutObject instead of layoutObject(). layoutObject() ma
y be a child of newLayoutObject. |
| 145 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); | 145 parentLayoutObject->addChild(newLayoutObject, nextLayoutObject); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void LayoutTreeBuilderForText::createLayoutObject() | 148 void LayoutTreeBuilderForText::createLayoutObject() |
| 149 { | 149 { |
| 150 ComputedStyle& style = m_layoutObjectParent->mutableStyleRef(); | 150 ComputedStyle& style = m_layoutObjectParent->mutableStyleRef(); |
| 151 | 151 |
| 152 ASSERT(m_node->textLayoutObjectIsNeeded(style, *m_layoutObjectParent)); | 152 DCHECK(m_node->textLayoutObjectIsNeeded(style, *m_layoutObjectParent)); |
| 153 | 153 |
| 154 LayoutText* newLayoutObject = m_node->createTextLayoutObject(style); | 154 LayoutText* newLayoutObject = m_node->createTextLayoutObject(style); |
| 155 if (!m_layoutObjectParent->isChildAllowed(newLayoutObject, style)) { | 155 if (!m_layoutObjectParent->isChildAllowed(newLayoutObject, style)) { |
| 156 newLayoutObject->destroy(); | 156 newLayoutObject->destroy(); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Make sure the LayoutObject already knows it is going to be added to a Lay
outFlowThread before we set the style | 160 // Make sure the LayoutObject already knows it is going to be added to a Lay
outFlowThread before we set the style |
| 161 // for the first time. Otherwise code using inLayoutFlowThread() in the styl
eWillChange and styleDidChange will fail. | 161 // for the first time. Otherwise code using inLayoutFlowThread() in the styl
eWillChange and styleDidChange will fail. |
| 162 newLayoutObject->setIsInsideFlowThread(m_layoutObjectParent->isInsideFlowThr
ead()); | 162 newLayoutObject->setIsInsideFlowThread(m_layoutObjectParent->isInsideFlowThr
ead()); |
| 163 | 163 |
| 164 LayoutObject* nextLayoutObject = this->nextLayoutObject(); | 164 LayoutObject* nextLayoutObject = this->nextLayoutObject(); |
| 165 m_node->setLayoutObject(newLayoutObject); | 165 m_node->setLayoutObject(newLayoutObject); |
| 166 // Parent takes care of the animations, no need to call setAnimatableStyle. | 166 // Parent takes care of the animations, no need to call setAnimatableStyle. |
| 167 newLayoutObject->setStyle(&style); | 167 newLayoutObject->setStyle(&style); |
| 168 m_layoutObjectParent->addChild(newLayoutObject, nextLayoutObject); | 168 m_layoutObjectParent->addChild(newLayoutObject, nextLayoutObject); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |