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 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class LayoutObject; | 39 class LayoutObject; |
40 class LayoutStyle; | 40 class LayoutStyle; |
41 | 41 |
42 template <typename NodeType> | 42 template <typename NodeType> |
43 class LayoutTreeBuilder { | 43 class LayoutTreeBuilder { |
44 STACK_ALLOCATED(); | 44 STACK_ALLOCATED(); |
45 protected: | 45 protected: |
46 LayoutTreeBuilder(NodeType& node, LayoutObject* renderingParent) | 46 LayoutTreeBuilder(NodeType& node, LayoutObject* layoutObjectParent) |
47 : m_node(node) | 47 : m_node(node) |
48 , m_renderingParent(renderingParent) | 48 , m_layoutObjectParent(layoutObjectParent) |
49 { | 49 { |
50 ASSERT(!node.renderer()); | 50 ASSERT(!node.layoutObject()); |
51 ASSERT(node.needsAttach()); | 51 ASSERT(node.needsAttach()); |
52 ASSERT(node.document().inStyleRecalc()); | 52 ASSERT(node.document().inStyleRecalc()); |
53 | 53 |
54 // FIXME: We should be able to ASSERT(node->inActiveDocument()) but chil
drenChanged is called | 54 // FIXME: We should be able to ASSERT(node->inActiveDocument()) but chil
drenChanged is called |
55 // before ChildNodeInsertionNotifier in ContainerNode's methods and some
implementations | 55 // before ChildNodeInsertionNotifier in ContainerNode's methods and some
implementations |
56 // will trigger a layout inside childrenChanged. | 56 // will trigger a layout inside childrenChanged. |
57 // Mainly HTMLTextAreaElement::childrenChanged calls HTMLTextFormControl
Element::setSelectionRange | 57 // Mainly HTMLTextAreaElement::childrenChanged calls HTMLTextFormControl
Element::setSelectionRange |
58 // which does an updateLayoutIgnorePendingStylesheets. | 58 // which does an updateLayoutIgnorePendingStylesheets. |
59 } | 59 } |
60 | 60 |
61 LayoutObject* parentRenderer() const { return m_renderingParent; } | 61 LayoutObject* parentRenderer() const { return m_layoutObjectParent; } |
62 | 62 |
63 LayoutObject* nextRenderer() const | 63 LayoutObject* nextRenderer() const |
64 { | 64 { |
65 ASSERT(m_renderingParent); | 65 ASSERT(m_layoutObjectParent); |
66 | 66 |
67 // Avoid an O(N^2) walk over the children when reattaching all children
of a node. | 67 // Avoid an O(N^2) walk over the children when reattaching all children
of a node. |
68 if (m_renderingParent->node() && m_renderingParent->node()->needsAttach(
)) | 68 if (m_layoutObjectParent->node() && m_layoutObjectParent->node()->needsA
ttach()) |
69 return 0; | 69 return 0; |
70 | 70 |
71 return NodeRenderingTraversal::nextSiblingRenderer(*m_node); | 71 return NodeRenderingTraversal::nextSiblingRenderer(*m_node); |
72 } | 72 } |
73 | 73 |
74 RawPtrWillBeMember<NodeType> m_node; | 74 RawPtrWillBeMember<NodeType> m_node; |
75 RawPtrWillBeMember<LayoutObject> m_renderingParent; | 75 RawPtrWillBeMember<LayoutObject> m_layoutObjectParent; |
76 }; | 76 }; |
77 | 77 |
78 class LayoutTreeBuilderForElement : public LayoutTreeBuilder<Element> { | 78 class LayoutTreeBuilderForElement : public LayoutTreeBuilder<Element> { |
79 public: | 79 public: |
80 LayoutTreeBuilderForElement(Element&, LayoutStyle*); | 80 LayoutTreeBuilderForElement(Element&, LayoutStyle*); |
81 | 81 |
82 void createLayoutObjectIfNeeded() | 82 void createLayoutObjectIfNeeded() |
83 { | 83 { |
84 if (shouldCreateRenderer()) | 84 if (shouldCreateRenderer()) |
85 createLayoutObject(); | 85 createLayoutObject(); |
(...skipping 13 matching lines...) Expand all Loading... |
99 public: | 99 public: |
100 LayoutTreeBuilderForText(Text& text, LayoutObject* renderingParent) | 100 LayoutTreeBuilderForText(Text& text, LayoutObject* renderingParent) |
101 : LayoutTreeBuilder(text, renderingParent) { } | 101 : LayoutTreeBuilder(text, renderingParent) { } |
102 | 102 |
103 void createLayoutObject(); | 103 void createLayoutObject(); |
104 }; | 104 }; |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
107 | 107 |
108 #endif | 108 #endif |
OLD | NEW |