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 22 matching lines...) Expand all Loading... |
33 #include "core/layout/Layer.h" | 33 #include "core/layout/Layer.h" |
34 #include "core/paint/BoxPainter.h" | 34 #include "core/paint/BoxPainter.h" |
35 #include "core/paint/PartPainter.h" | 35 #include "core/paint/PartPainter.h" |
36 #include "core/plugins/PluginView.h" | 36 #include "core/plugins/PluginView.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 : LayoutReplaced(element) |
44 // Reference counting is used to prevent the part from being destroyed | 44 // Reference counting is used to prevent the part from being destroyed |
45 // 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. |
46 , m_refCount(1) | 46 , m_refCount(1) |
47 { | 47 { |
48 ASSERT(element); | 48 ASSERT(element); |
49 frameView()->addPart(this); | 49 frameView()->addPart(this); |
50 setInline(false); | 50 setInline(false); |
51 } | 51 } |
52 | 52 |
53 void RenderPart::deref() | 53 void RenderPart::deref() |
54 { | 54 { |
55 if (--m_refCount <= 0) | 55 if (--m_refCount <= 0) |
56 postDestroy(); | 56 postDestroy(); |
57 } | 57 } |
58 | 58 |
59 void RenderPart::willBeDestroyed() | 59 void RenderPart::willBeDestroyed() |
60 { | 60 { |
61 frameView()->removePart(this); | 61 frameView()->removePart(this); |
62 | 62 |
63 if (AXObjectCache* cache = document().existingAXObjectCache()) { | 63 if (AXObjectCache* cache = document().existingAXObjectCache()) { |
64 cache->childrenChanged(this->parent()); | 64 cache->childrenChanged(this->parent()); |
65 cache->remove(this); | 65 cache->remove(this); |
66 } | 66 } |
67 | 67 |
68 Element* element = toElement(node()); | 68 Element* element = toElement(node()); |
69 if (element && element->isFrameOwnerElement()) | 69 if (element && element->isFrameOwnerElement()) |
70 toHTMLFrameOwnerElement(element)->setWidget(nullptr); | 70 toHTMLFrameOwnerElement(element)->setWidget(nullptr); |
71 | 71 |
72 RenderReplaced::willBeDestroyed(); | 72 LayoutReplaced::willBeDestroyed(); |
73 } | 73 } |
74 | 74 |
75 void RenderPart::destroy() | 75 void RenderPart::destroy() |
76 { | 76 { |
77 willBeDestroyed(); | 77 willBeDestroyed(); |
78 clearNode(); | 78 clearNode(); |
79 deref(); | 79 deref(); |
80 } | 80 } |
81 | 81 |
82 RenderPart::~RenderPart() | 82 RenderPart::~RenderPart() |
83 { | 83 { |
84 ASSERT(m_refCount <= 0); | 84 ASSERT(m_refCount <= 0); |
85 } | 85 } |
86 | 86 |
87 Widget* RenderPart::widget() const | 87 Widget* RenderPart::widget() const |
88 { | 88 { |
89 // 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. |
90 Element* element = toElement(node()); | 90 Element* element = toElement(node()); |
91 | 91 |
92 if (element && element->isFrameOwnerElement()) | 92 if (element && element->isFrameOwnerElement()) |
93 return toHTMLFrameOwnerElement(element)->ownedWidget(); | 93 return toHTMLFrameOwnerElement(element)->ownedWidget(); |
94 | 94 |
95 return 0; | 95 return 0; |
96 } | 96 } |
97 | 97 |
98 LayerType RenderPart::layerTypeRequired() const | 98 LayerType RenderPart::layerTypeRequired() const |
99 { | 99 { |
100 LayerType type = RenderReplaced::layerTypeRequired(); | 100 LayerType type = LayoutReplaced::layerTypeRequired(); |
101 if (type != NoLayer) | 101 if (type != NoLayer) |
102 return type; | 102 return type; |
103 return ForcedLayer; | 103 return ForcedLayer; |
104 } | 104 } |
105 | 105 |
106 bool RenderPart::requiresAcceleratedCompositing() const | 106 bool RenderPart::requiresAcceleratedCompositing() const |
107 { | 107 { |
108 // There are two general cases in which we can return true. First, if this i
s a plugin | 108 // There are two general cases in which we can return true. First, if this i
s a plugin |
109 // renderer and the plugin has a layer, then we need a layer. Second, if thi
s is | 109 // renderer and the plugin has a layer, then we need a layer. Second, if thi
s is |
110 // a renderer with a contentDocument and that document needs a layer, then w
e need | 110 // a renderer with a contentDocument and that document needs a layer, then w
e need |
(...skipping 11 matching lines...) Expand all Loading... |
122 if (Document* contentDocument = element->contentDocument()) { | 122 if (Document* contentDocument = element->contentDocument()) { |
123 if (RenderView* view = contentDocument->renderView()) | 123 if (RenderView* view = contentDocument->renderView()) |
124 return view->usesCompositing(); | 124 return view->usesCompositing(); |
125 } | 125 } |
126 | 126 |
127 return false; | 127 return false; |
128 } | 128 } |
129 | 129 |
130 bool RenderPart::needsPreferredWidthsRecalculation() const | 130 bool RenderPart::needsPreferredWidthsRecalculation() const |
131 { | 131 { |
132 if (RenderReplaced::needsPreferredWidthsRecalculation()) | 132 if (LayoutReplaced::needsPreferredWidthsRecalculation()) |
133 return true; | 133 return true; |
134 return embeddedContentBox(); | 134 return embeddedContentBox(); |
135 } | 135 } |
136 | 136 |
137 bool RenderPart::nodeAtPointOverWidget(const HitTestRequest& request, HitTestRes
ult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accu
mulatedOffset, HitTestAction action) | 137 bool RenderPart::nodeAtPointOverWidget(const HitTestRequest& request, HitTestRes
ult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accu
mulatedOffset, HitTestAction action) |
138 { | 138 { |
139 bool hadResult = result.innerNode(); | 139 bool hadResult = result.innerNode(); |
140 bool inside = RenderReplaced::nodeAtPoint(request, result, locationInContain
er, accumulatedOffset, action); | 140 bool inside = LayoutReplaced::nodeAtPoint(request, result, locationInContain
er, accumulatedOffset, action); |
141 | 141 |
142 // Check to see if we are really over the widget itself (and not just in the
border/padding area). | 142 // Check to see if we are really over the widget itself (and not just in the
border/padding area). |
143 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode()
== node()) | 143 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode()
== node()) |
144 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); | 144 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); |
145 return inside; | 145 return inside; |
146 } | 146 } |
147 | 147 |
148 bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& resul
t, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOff
set, HitTestAction action) | 148 bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& resul
t, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOff
set, HitTestAction action) |
149 { | 149 { |
150 if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameConten
t()) | 150 if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameConten
t()) |
(...skipping 25 matching lines...) Expand all Loading... |
176 | 176 |
177 CompositingReasons RenderPart::additionalCompositingReasons() const | 177 CompositingReasons RenderPart::additionalCompositingReasons() const |
178 { | 178 { |
179 if (requiresAcceleratedCompositing()) | 179 if (requiresAcceleratedCompositing()) |
180 return CompositingReasonIFrame; | 180 return CompositingReasonIFrame; |
181 return CompositingReasonNone; | 181 return CompositingReasonNone; |
182 } | 182 } |
183 | 183 |
184 void RenderPart::styleDidChange(StyleDifference diff, const LayoutStyle* oldStyl
e) | 184 void RenderPart::styleDidChange(StyleDifference diff, const LayoutStyle* oldStyl
e) |
185 { | 185 { |
186 RenderReplaced::styleDidChange(diff, oldStyle); | 186 LayoutReplaced::styleDidChange(diff, oldStyle); |
187 Widget* widget = this->widget(); | 187 Widget* widget = this->widget(); |
188 | 188 |
189 if (!widget) | 189 if (!widget) |
190 return; | 190 return; |
191 | 191 |
192 // If the iframe has custom scrollbars, recalculate their style. | 192 // If the iframe has custom scrollbars, recalculate their style. |
193 if (widget && widget->isFrameView()) | 193 if (widget && widget->isFrameView()) |
194 toFrameView(widget)->recalculateCustomScrollbarStyle(); | 194 toFrameView(widget)->recalculateCustomScrollbarStyle(); |
195 | 195 |
196 if (style()->visibility() != VISIBLE) { | 196 if (style()->visibility() != VISIBLE) { |
(...skipping 19 matching lines...) Expand all Loading... |
216 { | 216 { |
217 PartPainter(*this).paintContents(paintInfo, paintOffset); | 217 PartPainter(*this).paintContents(paintInfo, paintOffset); |
218 } | 218 } |
219 | 219 |
220 CursorDirective RenderPart::getCursor(const LayoutPoint& point, Cursor& cursor)
const | 220 CursorDirective RenderPart::getCursor(const LayoutPoint& point, Cursor& cursor)
const |
221 { | 221 { |
222 if (widget() && widget()->isPluginView()) { | 222 if (widget() && widget()->isPluginView()) { |
223 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. | 223 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. |
224 return DoNotSetCursor; | 224 return DoNotSetCursor; |
225 } | 225 } |
226 return RenderReplaced::getCursor(point, cursor); | 226 return LayoutReplaced::getCursor(point, cursor); |
227 } | 227 } |
228 | 228 |
229 void RenderPart::updateOnWidgetChange() | 229 void RenderPart::updateOnWidgetChange() |
230 { | 230 { |
231 Widget* widget = this->widget(); | 231 Widget* widget = this->widget(); |
232 if (!widget) | 232 if (!widget) |
233 return; | 233 return; |
234 | 234 |
235 if (!style()) | 235 if (!style()) |
236 return; | 236 return; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (widget->frameRect() == newFrame) | 309 if (widget->frameRect() == newFrame) |
310 return false; | 310 return false; |
311 | 311 |
312 RefPtrWillBeRawPtr<RenderPart> protector(this); | 312 RefPtrWillBeRawPtr<RenderPart> protector(this); |
313 RefPtrWillBeRawPtr<Node> protectedNode(node()); | 313 RefPtrWillBeRawPtr<Node> protectedNode(node()); |
314 widget->setFrameRect(newFrame); | 314 widget->setFrameRect(newFrame); |
315 return widget->frameRect().size() != newFrame.size(); | 315 return widget->frameRect().size() != newFrame.size(); |
316 } | 316 } |
317 | 317 |
318 } | 318 } |
OLD | NEW |