| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 103 } |
| 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 | |
| 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. | |
| 117 RenderArena* arena = renderArena(); | |
| 118 clearNode(); | 113 clearNode(); |
| 119 deref(arena); | 114 deref(); |
| 120 } | 115 } |
| 121 | 116 |
| 122 RenderWidget::~RenderWidget() | 117 RenderWidget::~RenderWidget() |
| 123 { | 118 { |
| 124 ASSERT(m_refCount <= 0); | 119 ASSERT(m_refCount <= 0); |
| 125 clearWidget(); | 120 clearWidget(); |
| 126 } | 121 } |
| 127 | 122 |
| 128 // Widgets are always placed on integer boundaries, so rounding the size is actu
ally | 123 // 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 | 124 // 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()); | 136 IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect()); |
| 142 IntRect newFrame = roundedIntRect(frame); | 137 IntRect newFrame = roundedIntRect(frame); |
| 143 bool clipChanged = m_clipRect != clipRect; | 138 bool clipChanged = m_clipRect != clipRect; |
| 144 bool boundsChanged = m_widget->frameRect() != newFrame; | 139 bool boundsChanged = m_widget->frameRect() != newFrame; |
| 145 | 140 |
| 146 if (!boundsChanged && !clipChanged) | 141 if (!boundsChanged && !clipChanged) |
| 147 return false; | 142 return false; |
| 148 | 143 |
| 149 m_clipRect = clipRect; | 144 m_clipRect = clipRect; |
| 150 | 145 |
| 151 RenderWidgetProtector protector(this); | 146 RefPtr<RenderWidget> protector(this); |
| 152 RefPtr<Node> protectedNode(node()); | 147 RefPtr<Node> protectedNode(node()); |
| 153 m_widget->setFrameRect(newFrame); | 148 m_widget->setFrameRect(newFrame); |
| 154 | 149 |
| 155 if (clipChanged && !boundsChanged) | 150 if (clipChanged && !boundsChanged) |
| 156 m_widget->clipRectChanged(); | 151 m_widget->clipRectChanged(); |
| 157 | 152 |
| 158 if (hasLayer() && layer()->isComposited()) | 153 if (hasLayer() && layer()->isComposited()) |
| 159 layer()->backing()->updateAfterWidgetResize(); | 154 layer()->backing()->updateAfterWidgetResize(); |
| 160 | 155 |
| 161 return boundsChanged; | 156 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); | 306 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf
fset), paintInfo.rect); |
| 312 } | 307 } |
| 313 | 308 |
| 314 void RenderWidget::setOverlapTestResult(bool isOverlapped) | 309 void RenderWidget::setOverlapTestResult(bool isOverlapped) |
| 315 { | 310 { |
| 316 ASSERT(m_widget); | 311 ASSERT(m_widget); |
| 317 ASSERT(m_widget->isFrameView()); | 312 ASSERT(m_widget->isFrameView()); |
| 318 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); | 313 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); |
| 319 } | 314 } |
| 320 | 315 |
| 321 void RenderWidget::deref(RenderArena *arena) | 316 void RenderWidget::deref() |
| 322 { | 317 { |
| 323 if (--m_refCount <= 0) | 318 if (--m_refCount <= 0) |
| 324 arenaDelete(arena, this); | 319 postDestroy(); |
| 325 } | 320 } |
| 326 | 321 |
| 327 void RenderWidget::updateWidgetPosition() | 322 void RenderWidget::updateWidgetPosition() |
| 328 { | 323 { |
| 329 if (!m_widget || !node()) // Check the node in case destroy() has been calle
d. | 324 if (!m_widget || !node()) // Check the node in case destroy() has been calle
d. |
| 330 return; | 325 return; |
| 331 | 326 |
| 332 bool boundsChanged = updateWidgetGeometry(); | 327 bool boundsChanged = updateWidgetGeometry(); |
| 333 | 328 |
| 334 // if the frame bounds got changed, or if view needs layout (possibly indica
ting | 329 // 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 | 375 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor
) const |
| 381 { | 376 { |
| 382 if (widget() && widget()->isPluginView()) { | 377 if (widget() && widget()->isPluginView()) { |
| 383 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. | 378 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. |
| 384 return DoNotSetCursor; | 379 return DoNotSetCursor; |
| 385 } | 380 } |
| 386 return RenderReplaced::getCursor(point, cursor); | 381 return RenderReplaced::getCursor(point, cursor); |
| 387 } | 382 } |
| 388 | 383 |
| 389 } // namespace WebCore | 384 } // namespace WebCore |
| OLD | NEW |