| 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 ImageResourceClient { | 148 class RenderObject : public NoBaseWillBeGarbageCollectedFinalized<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*); |
| 160 | 161 |
| 161 virtual const char* renderName() const = 0; | 162 virtual const char* renderName() const = 0; |
| 162 | 163 |
| 163 String debugName() const; | 164 String debugName() const; |
| 164 | 165 |
| 165 RenderObject* parent() const { return m_parent; } | 166 RenderObject* parent() const { return m_parent; } |
| 166 bool isDescendantOf(const RenderObject*) const; | 167 bool isDescendantOf(const RenderObject*) const; |
| 167 | 168 |
| 168 RenderObject* previousSibling() const { return m_previous; } | 169 RenderObject* previousSibling() const { return m_previous; } |
| 169 RenderObject* nextSibling() const { return m_next; } | 170 RenderObject* nextSibling() const { return m_next; } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 336 |
| 336 void showRenderObject() const; | 337 void showRenderObject() const; |
| 337 // We don't make printedCharacters an optional parameter so that | 338 // We don't make printedCharacters an optional parameter so that |
| 338 // showRenderObject can be called from gdb easily. | 339 // showRenderObject can be called from gdb easily. |
| 339 void showRenderObject(int printedCharacters) const; | 340 void showRenderObject(int printedCharacters) 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; | 341 void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char
* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLab
el2 = 0, int depth = 0) const; |
| 341 #endif | 342 #endif |
| 342 | 343 |
| 343 static RenderObject* createObject(Element*, RenderStyle*); | 344 static RenderObject* createObject(Element*, RenderStyle*); |
| 344 | 345 |
| 346 #if !ENABLE(OILPAN) |
| 345 // RenderObjects are allocated out of the rendering partition. | 347 // RenderObjects are allocated out of the rendering partition. |
| 346 void* operator new(size_t); | 348 void* operator new(size_t); |
| 347 void operator delete(void*); | 349 void operator delete(void*); |
| 350 #endif |
| 348 | 351 |
| 349 public: | 352 public: |
| 350 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } | 353 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } |
| 351 | 354 |
| 352 virtual bool isBoxModelObject() const { return false; } | 355 virtual bool isBoxModelObject() const { return false; } |
| 353 virtual bool isBR() const { return false; } | 356 virtual bool isBR() const { return false; } |
| 354 virtual bool isCanvas() const { return false; } | 357 virtual bool isCanvas() const { return false; } |
| 355 virtual bool isCounter() const { return false; } | 358 virtual bool isCounter() const { return false; } |
| 356 virtual bool isDetailsMarker() const { return false; } | 359 virtual bool isDetailsMarker() const { return false; } |
| 357 virtual bool isEmbeddedObject() const { return false; } | 360 virtual bool isEmbeddedObject() const { return false; } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 611 |
| 609 virtual void updateDragState(bool dragOn); | 612 virtual void updateDragState(bool dragOn); |
| 610 | 613 |
| 611 RenderView* view() const { return document().renderView(); }; | 614 RenderView* view() const { return document().renderView(); }; |
| 612 FrameView* frameView() const { return document().view(); }; | 615 FrameView* frameView() const { return document().view(); }; |
| 613 | 616 |
| 614 bool isRooted() const; | 617 bool isRooted() const; |
| 615 | 618 |
| 616 Node* node() const | 619 Node* node() const |
| 617 { | 620 { |
| 618 return isAnonymous() ? 0 : m_node; | 621 return isAnonymous() ? 0 : m_node.get(); |
| 619 } | 622 } |
| 620 | 623 |
| 621 Node* nonPseudoNode() const | 624 Node* nonPseudoNode() const |
| 622 { | 625 { |
| 623 return isPseudoElement() ? 0 : node(); | 626 return isPseudoElement() ? 0 : node(); |
| 624 } | 627 } |
| 625 | 628 |
| 626 // FIXME: Why does RenderWidget need this? | 629 // FIXME: Why does RenderWidget need this? |
| 627 void clearNode() { m_node = 0; } | 630 void clearNode() { m_node = nullptr; } |
| 628 | 631 |
| 629 // Returns the styled node that caused the generation of this renderer. | 632 // Returns the styled node that caused the generation of this renderer. |
| 630 // This is the same as node() except for renderers of :before and :after | 633 // This is the same as node() except for renderers of :before and :after |
| 631 // pseudo elements for which their parent node is returned. | 634 // pseudo elements for which their parent node is returned. |
| 632 Node* generatingNode() const { return isPseudoElement() ? node()->parentOrSh
adowHostNode() : node(); } | 635 Node* generatingNode() const { return isPseudoElement() ? node()->parentOrSh
adowHostNode() : node(); } |
| 633 | 636 |
| 634 Document& document() const { return m_node->document(); } | 637 Document& document() const { return m_node->document(); } |
| 635 LocalFrame* frame() const { return document().frame(); } | 638 LocalFrame* frame() const { return document().frame(); } |
| 636 | 639 |
| 637 bool hasOutlineAnnotation() const; | 640 bool hasOutlineAnnotation() const; |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 void markContainingBlockChainForPaintInvalidation() | 1159 void markContainingBlockChainForPaintInvalidation() |
| 1157 { | 1160 { |
| 1158 for (RenderObject* container = this->container(); container && !containe
r->shouldCheckForPaintInvalidation(); container = container->container()) | 1161 for (RenderObject* container = this->container(); container && !containe
r->shouldCheckForPaintInvalidation(); container = container->container()) |
| 1159 container->setMayNeedPaintInvalidation(true); | 1162 container->setMayNeedPaintInvalidation(true); |
| 1160 } | 1163 } |
| 1161 | 1164 |
| 1162 static bool isAllowedToModifyRenderTreeStructure(Document&); | 1165 static bool isAllowedToModifyRenderTreeStructure(Document&); |
| 1163 | 1166 |
| 1164 RefPtr<RenderStyle> m_style; | 1167 RefPtr<RenderStyle> m_style; |
| 1165 | 1168 |
| 1166 Node* m_node; | 1169 RawPtrWillBeMember<Node> m_node; |
| 1167 | 1170 |
| 1168 RenderObject* m_parent; | 1171 RawPtrWillBeMember<RenderObject> m_parent; |
| 1169 RenderObject* m_previous; | 1172 RawPtrWillBeMember<RenderObject> m_previous; |
| 1170 RenderObject* m_next; | 1173 RawPtrWillBeMember<RenderObject> m_next; |
| 1171 | 1174 |
| 1172 #if ENABLE(ASSERT) | 1175 #if ENABLE(ASSERT) |
| 1173 unsigned m_hasAXObject : 1; | 1176 unsigned m_hasAXObject : 1; |
| 1174 unsigned m_setNeedsLayoutForbidden : 1; | 1177 unsigned m_setNeedsLayoutForbidden : 1; |
| 1178 #if ENABLE(OILPAN) |
| 1179 protected: |
| 1180 unsigned m_didCallDestroy : 1; |
| 1181 |
| 1182 private: |
| 1183 #endif |
| 1175 #endif | 1184 #endif |
| 1176 | 1185 |
| 1177 #define ADD_BOOLEAN_BITFIELD(name, Name) \ | 1186 #define ADD_BOOLEAN_BITFIELD(name, Name) \ |
| 1178 private:\ | 1187 private:\ |
| 1179 unsigned m_##name : 1;\ | 1188 unsigned m_##name : 1;\ |
| 1180 public:\ | 1189 public:\ |
| 1181 bool name() const { return m_##name; }\ | 1190 bool name() const { return m_##name; }\ |
| 1182 void set##Name(bool name) { m_##name = name; }\ | 1191 void set##Name(bool name) { m_##name = name; }\ |
| 1183 | 1192 |
| 1184 class RenderObjectBitfields { | 1193 class RenderObjectBitfields { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 void showTree(const blink::RenderObject*); | 1541 void showTree(const blink::RenderObject*); |
| 1533 void showLineTree(const blink::RenderObject*); | 1542 void showLineTree(const blink::RenderObject*); |
| 1534 void showRenderTree(const blink::RenderObject* object1); | 1543 void showRenderTree(const blink::RenderObject* object1); |
| 1535 // We don't make object2 an optional parameter so that showRenderTree | 1544 // We don't make object2 an optional parameter so that showRenderTree |
| 1536 // can be called from gdb easily. | 1545 // can be called from gdb easily. |
| 1537 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); | 1546 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); |
| 1538 | 1547 |
| 1539 #endif | 1548 #endif |
| 1540 | 1549 |
| 1541 #endif // RenderObject_h | 1550 #endif // RenderObject_h |
| OLD | NEW |