| 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 |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef RenderTreeBuilder_h | 26 #ifndef RenderTreeBuilder_h |
| 27 #define RenderTreeBuilder_h | 27 #define RenderTreeBuilder_h |
| 28 | 28 |
| 29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
| 30 #include "core/dom/FirstLetterPseudoElement.h" |
| 30 #include "core/dom/Node.h" | 31 #include "core/dom/Node.h" |
| 31 #include "core/dom/NodeRenderingTraversal.h" | 32 #include "core/dom/NodeRenderingTraversal.h" |
| 33 #include "core/rendering/RenderObject.h" |
| 32 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
| 33 | 35 |
| 34 namespace blink { | 36 namespace blink { |
| 35 | 37 |
| 36 class ContainerNode; | 38 class ContainerNode; |
| 37 class RenderObject; | |
| 38 class RenderStyle; | 39 class RenderStyle; |
| 39 | 40 |
| 40 class RenderTreeBuilder { | 41 class RenderTreeBuilder { |
| 41 STACK_ALLOCATED(); | 42 STACK_ALLOCATED(); |
| 42 public: | 43 public: |
| 43 RenderTreeBuilder(Node* node, RenderStyle* style) | 44 RenderTreeBuilder(Node*, RenderStyle*); |
| 44 : m_node(node) | |
| 45 , m_renderingParent(nullptr) | |
| 46 , m_style(style) | |
| 47 { | |
| 48 ASSERT(!node->renderer()); | |
| 49 ASSERT(node->needsAttach()); | |
| 50 ASSERT(node->document().inStyleRecalc()); | |
| 51 | |
| 52 // FIXME: We should be able to ASSERT(node->inActiveDocument()) but chil
drenChanged is called | |
| 53 // before ChildNodeInsertionNotifier in ContainerNode's methods and some
implementations | |
| 54 // will trigger a layout inside childrenChanged. | |
| 55 // Mainly HTMLTextAreaElement::childrenChanged calls HTMLTextFormControl
Element::setSelectionRange | |
| 56 // which does an updateLayoutIgnorePendingStylesheets. | |
| 57 | |
| 58 m_renderingParent = NodeRenderingTraversal::parent(node, &m_parentDetail
s); | |
| 59 } | |
| 60 | 45 |
| 61 void createRendererForTextIfNeeded(); | 46 void createRendererForTextIfNeeded(); |
| 62 void createRendererForElementIfNeeded(); | 47 void createRendererForElementIfNeeded(); |
| 63 | 48 |
| 64 private: | 49 private: |
| 65 RenderObject* parentRenderer() const; | 50 RenderObject* parentRenderer() const; |
| 66 RenderObject* nextRenderer() const; | 51 RenderObject* nextRenderer() const; |
| 67 bool shouldCreateRenderer() const; | 52 bool shouldCreateRenderer() const; |
| 68 RenderStyle& style() const; | 53 RenderStyle& style() const; |
| 69 | 54 |
| 70 RawPtrWillBeMember<Node> m_node; | 55 RawPtrWillBeMember<Node> m_node; |
| 71 RawPtrWillBeMember<ContainerNode> m_renderingParent; | 56 RawPtrWillBeMember<RenderObject> m_renderingParent; |
| 72 NodeRenderingTraversal::ParentDetails m_parentDetails; | 57 NodeRenderingTraversal::ParentDetails m_parentDetails; |
| 73 mutable RefPtr<RenderStyle> m_style; | 58 mutable RefPtr<RenderStyle> m_style; |
| 74 }; | 59 }; |
| 75 | 60 |
| 76 } // namespace blink | 61 } // namespace blink |
| 77 | 62 |
| 78 #endif | 63 #endif |
| OLD | NEW |