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" | |
31 #include "core/dom/Node.h" | 30 #include "core/dom/Node.h" |
32 #include "core/dom/NodeRenderingTraversal.h" | 31 #include "core/dom/NodeRenderingTraversal.h" |
33 #include "core/rendering/RenderObject.h" | |
34 #include "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
35 | 33 |
36 namespace blink { | 34 namespace blink { |
37 | 35 |
38 class ContainerNode; | 36 class ContainerNode; |
| 37 class RenderObject; |
39 class RenderStyle; | 38 class RenderStyle; |
40 | 39 |
41 class RenderTreeBuilder { | 40 class RenderTreeBuilder { |
42 STACK_ALLOCATED(); | 41 STACK_ALLOCATED(); |
43 public: | 42 public: |
44 RenderTreeBuilder(Node*, RenderStyle*); | 43 RenderTreeBuilder(Node* node, RenderStyle* style) |
| 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 } |
45 | 60 |
46 void createRendererForTextIfNeeded(); | 61 void createRendererForTextIfNeeded(); |
47 void createRendererForElementIfNeeded(); | 62 void createRendererForElementIfNeeded(); |
48 | 63 |
49 private: | 64 private: |
50 RenderObject* parentRenderer() const; | 65 RenderObject* parentRenderer() const; |
51 RenderObject* nextRenderer() const; | 66 RenderObject* nextRenderer() const; |
52 bool shouldCreateRenderer() const; | 67 bool shouldCreateRenderer() const; |
53 RenderStyle& style() const; | 68 RenderStyle& style() const; |
54 | 69 |
55 RawPtrWillBeMember<Node> m_node; | 70 RawPtrWillBeMember<Node> m_node; |
56 RawPtrWillBeMember<RenderObject> m_renderingParent; | 71 RawPtrWillBeMember<ContainerNode> m_renderingParent; |
57 NodeRenderingTraversal::ParentDetails m_parentDetails; | 72 NodeRenderingTraversal::ParentDetails m_parentDetails; |
58 mutable RefPtr<RenderStyle> m_style; | 73 mutable RefPtr<RenderStyle> m_style; |
59 }; | 74 }; |
60 | 75 |
61 } // namespace blink | 76 } // namespace blink |
62 | 77 |
63 #endif | 78 #endif |
OLD | NEW |