OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool draggable; | 138 bool draggable; |
139 }; | 139 }; |
140 | 140 |
141 typedef WTF::HashMap<const RenderLayer*, Vector<LayoutRect> > LayerHitTestRects; | 141 typedef WTF::HashMap<const RenderLayer*, Vector<LayoutRect> > LayerHitTestRects; |
142 | 142 |
143 #ifndef NDEBUG | 143 #ifndef NDEBUG |
144 const int showTreeCharacterOffset = 39; | 144 const int showTreeCharacterOffset = 39; |
145 #endif | 145 #endif |
146 | 146 |
147 // Base class for all rendering tree objects. | 147 // Base class for all rendering tree objects. |
148 class RenderObject : public NoBaseWillBeGarbageCollectedFinalized<RenderObject>,
public ImageResourceClient { | 148 class RenderObject : public ImageResourceClient { |
149 friend class RenderBlock; | 149 friend class RenderBlock; |
150 friend class RenderBlockFlow; | 150 friend class RenderBlockFlow; |
151 friend class RenderLayerReflectionInfo; // For setParent | 151 friend class RenderLayerReflectionInfo; // For setParent |
152 friend class RenderLayerScrollableArea; // For setParent. | 152 friend class RenderLayerScrollableArea; // For setParent. |
153 friend class RenderObjectChildList; | 153 friend class RenderObjectChildList; |
154 WTF_MAKE_NONCOPYABLE(RenderObject); | 154 WTF_MAKE_NONCOPYABLE(RenderObject); |
155 public: | 155 public: |
156 // Anonymous objects should pass the document as their node, and they will t
hen automatically be | 156 // Anonymous objects should pass the document as their node, and they will t
hen automatically be |
157 // marked as anonymous in the constructor. | 157 // marked as anonymous in the constructor. |
158 explicit RenderObject(Node*); | 158 explicit RenderObject(Node*); |
159 virtual ~RenderObject(); | 159 virtual ~RenderObject(); |
160 virtual void trace(Visitor*); | |
161 | 160 |
162 virtual const char* renderName() const = 0; | 161 virtual const char* renderName() const = 0; |
163 | 162 |
164 String debugName() const; | 163 String debugName() const; |
165 | 164 |
166 RenderObject* parent() const { return m_parent; } | 165 RenderObject* parent() const { return m_parent; } |
167 bool isDescendantOf(const RenderObject*) const; | 166 bool isDescendantOf(const RenderObject*) const; |
168 | 167 |
169 RenderObject* previousSibling() const { return m_previous; } | 168 RenderObject* previousSibling() const { return m_previous; } |
170 RenderObject* nextSibling() const { return m_next; } | 169 RenderObject* nextSibling() const { return m_next; } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 335 |
337 void showRenderObject() const; | 336 void showRenderObject() const; |
338 // We don't make printedCharacters an optional parameter so that | 337 // We don't make printedCharacters an optional parameter so that |
339 // showRenderObject can be called from gdb easily. | 338 // showRenderObject can be called from gdb easily. |
340 void showRenderObject(int printedCharacters) const; | 339 void showRenderObject(int printedCharacters) const; |
341 void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char
* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLab
el2 = 0, int depth = 0) const; | 340 void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char
* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLab
el2 = 0, int depth = 0) const; |
342 #endif | 341 #endif |
343 | 342 |
344 static RenderObject* createObject(Element*, RenderStyle*); | 343 static RenderObject* createObject(Element*, RenderStyle*); |
345 | 344 |
346 #if !ENABLE(OILPAN) | |
347 // RenderObjects are allocated out of the rendering partition. | 345 // RenderObjects are allocated out of the rendering partition. |
348 void* operator new(size_t); | 346 void* operator new(size_t); |
349 void operator delete(void*); | 347 void operator delete(void*); |
350 #endif | |
351 | 348 |
352 public: | 349 public: |
353 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } | 350 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } |
354 | 351 |
355 virtual bool isBoxModelObject() const { return false; } | 352 virtual bool isBoxModelObject() const { return false; } |
356 virtual bool isBR() const { return false; } | 353 virtual bool isBR() const { return false; } |
357 virtual bool isCanvas() const { return false; } | 354 virtual bool isCanvas() const { return false; } |
358 virtual bool isCounter() const { return false; } | 355 virtual bool isCounter() const { return false; } |
359 virtual bool isDetailsMarker() const { return false; } | 356 virtual bool isDetailsMarker() const { return false; } |
360 virtual bool isEmbeddedObject() const { return false; } | 357 virtual bool isEmbeddedObject() const { return false; } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 608 |
612 virtual void updateDragState(bool dragOn); | 609 virtual void updateDragState(bool dragOn); |
613 | 610 |
614 RenderView* view() const { return document().renderView(); }; | 611 RenderView* view() const { return document().renderView(); }; |
615 FrameView* frameView() const { return document().view(); }; | 612 FrameView* frameView() const { return document().view(); }; |
616 | 613 |
617 bool isRooted() const; | 614 bool isRooted() const; |
618 | 615 |
619 Node* node() const | 616 Node* node() const |
620 { | 617 { |
621 return isAnonymous() ? 0 : m_node.get(); | 618 return isAnonymous() ? 0 : m_node; |
622 } | 619 } |
623 | 620 |
624 Node* nonPseudoNode() const | 621 Node* nonPseudoNode() const |
625 { | 622 { |
626 return isPseudoElement() ? 0 : node(); | 623 return isPseudoElement() ? 0 : node(); |
627 } | 624 } |
628 | 625 |
629 // FIXME: Why does RenderWidget need this? | 626 // FIXME: Why does RenderWidget need this? |
630 void clearNode() { m_node = nullptr; } | 627 void clearNode() { m_node = 0; } |
631 | 628 |
632 // Returns the styled node that caused the generation of this renderer. | 629 // Returns the styled node that caused the generation of this renderer. |
633 // This is the same as node() except for renderers of :before and :after | 630 // This is the same as node() except for renderers of :before and :after |
634 // pseudo elements for which their parent node is returned. | 631 // pseudo elements for which their parent node is returned. |
635 Node* generatingNode() const { return isPseudoElement() ? node()->parentOrSh
adowHostNode() : node(); } | 632 Node* generatingNode() const { return isPseudoElement() ? node()->parentOrSh
adowHostNode() : node(); } |
636 | 633 |
637 Document& document() const { return m_node->document(); } | 634 Document& document() const { return m_node->document(); } |
638 LocalFrame* frame() const { return document().frame(); } | 635 LocalFrame* frame() const { return document().frame(); } |
639 | 636 |
640 bool hasOutlineAnnotation() const; | 637 bool hasOutlineAnnotation() const; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 void markContainingBlockChainForPaintInvalidation() | 1156 void markContainingBlockChainForPaintInvalidation() |
1160 { | 1157 { |
1161 for (RenderObject* container = this->container(); container && !containe
r->shouldCheckForPaintInvalidation(); container = container->container()) | 1158 for (RenderObject* container = this->container(); container && !containe
r->shouldCheckForPaintInvalidation(); container = container->container()) |
1162 container->setMayNeedPaintInvalidation(true); | 1159 container->setMayNeedPaintInvalidation(true); |
1163 } | 1160 } |
1164 | 1161 |
1165 static bool isAllowedToModifyRenderTreeStructure(Document&); | 1162 static bool isAllowedToModifyRenderTreeStructure(Document&); |
1166 | 1163 |
1167 RefPtr<RenderStyle> m_style; | 1164 RefPtr<RenderStyle> m_style; |
1168 | 1165 |
1169 RawPtrWillBeMember<Node> m_node; | 1166 Node* m_node; |
1170 | 1167 |
1171 RawPtrWillBeMember<RenderObject> m_parent; | 1168 RenderObject* m_parent; |
1172 RawPtrWillBeMember<RenderObject> m_previous; | 1169 RenderObject* m_previous; |
1173 RawPtrWillBeMember<RenderObject> m_next; | 1170 RenderObject* m_next; |
1174 | 1171 |
1175 #if ENABLE(ASSERT) | 1172 #if ENABLE(ASSERT) |
1176 unsigned m_hasAXObject : 1; | 1173 unsigned m_hasAXObject : 1; |
1177 unsigned m_setNeedsLayoutForbidden : 1; | 1174 unsigned m_setNeedsLayoutForbidden : 1; |
1178 #endif | 1175 #endif |
1179 | 1176 |
1180 #define ADD_BOOLEAN_BITFIELD(name, Name) \ | 1177 #define ADD_BOOLEAN_BITFIELD(name, Name) \ |
1181 private:\ | 1178 private:\ |
1182 unsigned m_##name : 1;\ | 1179 unsigned m_##name : 1;\ |
1183 public:\ | 1180 public:\ |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 void showTree(const blink::RenderObject*); | 1532 void showTree(const blink::RenderObject*); |
1536 void showLineTree(const blink::RenderObject*); | 1533 void showLineTree(const blink::RenderObject*); |
1537 void showRenderTree(const blink::RenderObject* object1); | 1534 void showRenderTree(const blink::RenderObject* object1); |
1538 // We don't make object2 an optional parameter so that showRenderTree | 1535 // We don't make object2 an optional parameter so that showRenderTree |
1539 // can be called from gdb easily. | 1536 // can be called from gdb easily. |
1540 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); | 1537 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); |
1541 | 1538 |
1542 #endif | 1539 #endif |
1543 | 1540 |
1544 #endif // RenderObject_h | 1541 #endif // RenderObject_h |
OLD | NEW |