OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "core/plugins/PluginView.h" | 34 #include "core/plugins/PluginView.h" |
35 #include "core/rendering/HitTestResult.h" | 35 #include "core/rendering/HitTestResult.h" |
36 #include "core/rendering/RenderLayer.h" | 36 #include "core/rendering/RenderLayer.h" |
37 #include "core/rendering/RenderView.h" | 37 #include "core/rendering/RenderView.h" |
38 #include "core/rendering/svg/RenderSVGRoot.h" | 38 #include "core/rendering/svg/RenderSVGRoot.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 RenderPart::RenderPart(Element* element) | 42 RenderPart::RenderPart(Element* element) |
43 : RenderReplaced(element) | 43 : RenderReplaced(element) |
44 #if !ENABLE(OILPAN) | |
45 // Reference counting is used to prevent the part from being destroyed | 44 // Reference counting is used to prevent the part from being destroyed |
46 // while inside the Widget code, which might not be able to handle that. | 45 // while inside the Widget code, which might not be able to handle that. |
47 , m_refCount(1) | 46 , m_refCount(1) |
48 #endif | |
49 { | 47 { |
50 ASSERT(element); | 48 ASSERT(element); |
51 frameView()->addPart(this); | 49 frameView()->addPart(this); |
52 setInline(false); | 50 setInline(false); |
53 } | 51 } |
54 | 52 |
55 #if !ENABLE(OILPAN) | |
56 void RenderPart::deref() | 53 void RenderPart::deref() |
57 { | 54 { |
58 if (--m_refCount <= 0) | 55 if (--m_refCount <= 0) |
59 postDestroy(); | 56 postDestroy(); |
60 } | 57 } |
61 #endif | |
62 | 58 |
63 void RenderPart::willBeDestroyed() | 59 void RenderPart::willBeDestroyed() |
64 { | 60 { |
65 frameView()->removePart(this); | 61 frameView()->removePart(this); |
66 | 62 |
67 if (AXObjectCache* cache = document().existingAXObjectCache()) { | 63 if (AXObjectCache* cache = document().existingAXObjectCache()) { |
68 cache->childrenChanged(this->parent()); | 64 cache->childrenChanged(this->parent()); |
69 cache->remove(this); | 65 cache->remove(this); |
70 } | 66 } |
71 | 67 |
72 Element* element = toElement(node()); | 68 Element* element = toElement(node()); |
73 if (element && element->isFrameOwnerElement()) | 69 if (element && element->isFrameOwnerElement()) |
74 toHTMLFrameOwnerElement(element)->setWidget(nullptr); | 70 toHTMLFrameOwnerElement(element)->setWidget(nullptr); |
75 | 71 |
76 RenderReplaced::willBeDestroyed(); | 72 RenderReplaced::willBeDestroyed(); |
77 } | 73 } |
78 | 74 |
79 void RenderPart::destroy() | 75 void RenderPart::destroy() |
80 { | 76 { |
81 #if ENABLE(ASSERT) && ENABLE(OILPAN) | |
82 ASSERT(!m_didCallDestroy); | |
83 m_didCallDestroy = true; | |
84 #endif | |
85 willBeDestroyed(); | 77 willBeDestroyed(); |
86 clearNode(); | 78 clearNode(); |
87 #if ENABLE(OILPAN) | |
88 // In Oilpan, postDestroy doesn't delete |this|. So calling it here is safe | |
89 // though |this| will be referred in FrameView. | |
90 postDestroy(); | |
91 #else | |
92 deref(); | 79 deref(); |
93 #endif | |
94 } | 80 } |
95 | 81 |
96 RenderPart::~RenderPart() | 82 RenderPart::~RenderPart() |
97 { | 83 { |
98 #if !ENABLE(OILPAN) | |
99 ASSERT(m_refCount <= 0); | 84 ASSERT(m_refCount <= 0); |
100 #endif | |
101 } | 85 } |
102 | 86 |
103 Widget* RenderPart::widget() const | 87 Widget* RenderPart::widget() const |
104 { | 88 { |
105 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem
ent. | 89 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem
ent. |
106 Element* element = toElement(node()); | 90 Element* element = toElement(node()); |
107 | 91 |
108 if (element && element->isFrameOwnerElement()) | 92 if (element && element->isFrameOwnerElement()) |
109 return toHTMLFrameOwnerElement(element)->ownedWidget(); | 93 return toHTMLFrameOwnerElement(element)->ownedWidget(); |
110 | 94 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (widget->frameRect() == newFrame) | 313 if (widget->frameRect() == newFrame) |
330 return false; | 314 return false; |
331 | 315 |
332 RefPtrWillBeRawPtr<RenderPart> protector(this); | 316 RefPtrWillBeRawPtr<RenderPart> protector(this); |
333 RefPtrWillBeRawPtr<Node> protectedNode(node()); | 317 RefPtrWillBeRawPtr<Node> protectedNode(node()); |
334 widget->setFrameRect(newFrame); | 318 widget->setFrameRect(newFrame); |
335 return widget->frameRect().size() != newFrame.size(); | 319 return widget->frameRect().size() != newFrame.size(); |
336 } | 320 } |
337 | 321 |
338 } | 322 } |
OLD | NEW |