OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/rendering/RenderWidget.h" | 25 #include "core/rendering/RenderWidget.h" |
26 | 26 |
27 #include "core/accessibility/AXObjectCache.h" | 27 #include "core/accessibility/AXObjectCache.h" |
28 #include "core/page/Frame.h" | 28 #include "core/page/Frame.h" |
29 #include "core/platform/graphics/GraphicsContext.h" | 29 #include "core/platform/graphics/GraphicsContext.h" |
30 #include "core/rendering/HitTestResult.h" | 30 #include "core/rendering/HitTestResult.h" |
31 #include "core/rendering/RenderLayer.h" | 31 #include "core/rendering/RenderLayer.h" |
32 #include "core/rendering/RenderLayerBacking.h" | 32 #include "core/rendering/RenderLayerBacking.h" |
33 #include "core/rendering/RenderView.h" | 33 #include "core/rendering/RenderView.h" |
34 #include "core/rendering/RenderWidgetProtector.h" | |
35 | 34 |
36 using namespace std; | 35 using namespace std; |
37 | 36 |
38 namespace WebCore { | 37 namespace WebCore { |
39 | 38 |
40 static HashMap<const Widget*, RenderWidget*>& widgetRendererMap() | 39 static HashMap<const Widget*, RenderWidget*>& widgetRendererMap() |
41 { | 40 { |
42 static HashMap<const Widget*, RenderWidget*>* staticWidgetRendererMap = new
HashMap<const Widget*, RenderWidget*>; | 41 static HashMap<const Widget*, RenderWidget*>* staticWidgetRendererMap = new
HashMap<const Widget*, RenderWidget*>; |
43 return *staticWidgetRendererMap; | 42 return *staticWidgetRendererMap; |
44 } | 43 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 104 |
106 setWidget(0); | 105 setWidget(0); |
107 | 106 |
108 RenderReplaced::willBeDestroyed(); | 107 RenderReplaced::willBeDestroyed(); |
109 } | 108 } |
110 | 109 |
111 void RenderWidget::destroy() | 110 void RenderWidget::destroy() |
112 { | 111 { |
113 willBeDestroyed(); | 112 willBeDestroyed(); |
114 | 113 |
115 // Grab the arena from node()->document()->renderArena() before clearing the
node pointer. | |
116 // Clear the node before deref-ing, as this may be deleted when deref is cal
led. | 114 // Clear the node before deref-ing, as this may be deleted when deref is cal
led. |
117 RenderArena* arena = renderArena(); | |
118 clearNode(); | 115 clearNode(); |
119 deref(arena); | 116 deref(); |
120 } | 117 } |
121 | 118 |
122 RenderWidget::~RenderWidget() | 119 RenderWidget::~RenderWidget() |
123 { | 120 { |
124 ASSERT(m_refCount <= 0); | 121 ASSERT(m_refCount <= 0); |
125 clearWidget(); | 122 clearWidget(); |
126 } | 123 } |
127 | 124 |
128 // Widgets are always placed on integer boundaries, so rounding the size is actu
ally | 125 // Widgets are always placed on integer boundaries, so rounding the size is actu
ally |
129 // the desired behavior. This function is here because it's otherwise seldom wha
t we | 126 // the desired behavior. This function is here because it's otherwise seldom wha
t we |
(...skipping 11 matching lines...) Expand all Loading... |
141 IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect()); | 138 IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect()); |
142 IntRect newFrame = roundedIntRect(frame); | 139 IntRect newFrame = roundedIntRect(frame); |
143 bool clipChanged = m_clipRect != clipRect; | 140 bool clipChanged = m_clipRect != clipRect; |
144 bool boundsChanged = m_widget->frameRect() != newFrame; | 141 bool boundsChanged = m_widget->frameRect() != newFrame; |
145 | 142 |
146 if (!boundsChanged && !clipChanged) | 143 if (!boundsChanged && !clipChanged) |
147 return false; | 144 return false; |
148 | 145 |
149 m_clipRect = clipRect; | 146 m_clipRect = clipRect; |
150 | 147 |
151 RenderWidgetProtector protector(this); | |
152 RefPtr<Node> protectedNode(node()); | 148 RefPtr<Node> protectedNode(node()); |
153 m_widget->setFrameRect(newFrame); | 149 m_widget->setFrameRect(newFrame); |
154 | 150 |
155 if (clipChanged && !boundsChanged) | 151 if (clipChanged && !boundsChanged) |
156 m_widget->clipRectChanged(); | 152 m_widget->clipRectChanged(); |
157 | 153 |
158 if (hasLayer() && layer()->isComposited()) | 154 if (hasLayer() && layer()->isComposited()) |
159 layer()->backing()->updateAfterWidgetResize(); | 155 layer()->backing()->updateAfterWidgetResize(); |
160 | 156 |
161 return boundsChanged; | 157 return boundsChanged; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf
fset), paintInfo.rect); | 307 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf
fset), paintInfo.rect); |
312 } | 308 } |
313 | 309 |
314 void RenderWidget::setOverlapTestResult(bool isOverlapped) | 310 void RenderWidget::setOverlapTestResult(bool isOverlapped) |
315 { | 311 { |
316 ASSERT(m_widget); | 312 ASSERT(m_widget); |
317 ASSERT(m_widget->isFrameView()); | 313 ASSERT(m_widget->isFrameView()); |
318 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); | 314 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); |
319 } | 315 } |
320 | 316 |
321 void RenderWidget::deref(RenderArena *arena) | 317 void RenderWidget::deref() |
322 { | 318 { |
323 if (--m_refCount <= 0) | 319 if (--m_refCount <= 0) |
324 arenaDelete(arena, this); | 320 postDestroy(); |
325 } | 321 } |
326 | 322 |
327 void RenderWidget::updateWidgetPosition() | 323 void RenderWidget::updateWidgetPosition() |
328 { | 324 { |
329 if (!m_widget || !node()) // Check the node in case destroy() has been calle
d. | 325 if (!m_widget || !node()) // Check the node in case destroy() has been calle
d. |
330 return; | 326 return; |
331 | 327 |
332 bool boundsChanged = updateWidgetGeometry(); | 328 bool boundsChanged = updateWidgetGeometry(); |
333 | 329 |
334 // if the frame bounds got changed, or if view needs layout (possibly indica
ting | 330 // if the frame bounds got changed, or if view needs layout (possibly indica
ting |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor
) const | 376 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor
) const |
381 { | 377 { |
382 if (widget() && widget()->isPluginView()) { | 378 if (widget() && widget()->isPluginView()) { |
383 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. | 379 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. |
384 return DoNotSetCursor; | 380 return DoNotSetCursor; |
385 } | 381 } |
386 return RenderReplaced::getCursor(point, cursor); | 382 return RenderReplaced::getCursor(point, cursor); |
387 } | 383 } |
388 | 384 |
389 } // namespace WebCore | 385 } // namespace WebCore |
OLD | NEW |