Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: Source/core/rendering/RenderWidget.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderView.cpp ('k') | Source/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 else 76 else
77 child->removeFromParent(); 77 child->removeFromParent();
78 return; 78 return;
79 } 79 }
80 WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove(child, parent); 80 WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove(child, parent);
81 } 81 }
82 82
83 RenderWidget::RenderWidget(Element* element) 83 RenderWidget::RenderWidget(Element* element)
84 : RenderReplaced(element) 84 : RenderReplaced(element)
85 , m_widget(0) 85 , m_widget(0)
86 , m_frameView(element->document()->view()) 86 , m_frameView(element->document().view())
87 // Reference counting is used to prevent the widget from being 87 // Reference counting is used to prevent the widget from being
88 // destroyed while inside the Widget code, which might not be 88 // destroyed while inside the Widget code, which might not be
89 // able to handle that. 89 // able to handle that.
90 , m_refCount(1) 90 , m_refCount(1)
91 { 91 {
92 view()->addWidget(this); 92 view()->addWidget(this);
93 } 93 }
94 94
95 void RenderWidget::willBeDestroyed() 95 void RenderWidget::willBeDestroyed()
96 { 96 {
97 if (RenderView* v = view()) 97 if (RenderView* v = view())
98 v->removeWidget(this); 98 v->removeWidget(this);
99 99
100 if (AXObjectCache* cache = document()->existingAXObjectCache()) { 100 if (AXObjectCache* cache = document().existingAXObjectCache()) {
101 cache->childrenChanged(this->parent()); 101 cache->childrenChanged(this->parent());
102 cache->remove(this); 102 cache->remove(this);
103 } 103 }
104 104
105 setWidget(0); 105 setWidget(0);
106 106
107 RenderReplaced::willBeDestroyed(); 107 RenderReplaced::willBeDestroyed();
108 } 108 }
109 109
110 void RenderWidget::destroy() 110 void RenderWidget::destroy()
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (style()->visibility() != VISIBLE) 191 if (style()->visibility() != VISIBLE)
192 m_widget->hide(); 192 m_widget->hide();
193 else { 193 else {
194 m_widget->show(); 194 m_widget->show();
195 repaint(); 195 repaint();
196 } 196 }
197 } 197 }
198 moveWidgetToParentSoon(m_widget.get(), m_frameView); 198 moveWidgetToParentSoon(m_widget.get(), m_frameView);
199 } 199 }
200 200
201 if (AXObjectCache* cache = document()->existingAXObjectCache()) 201 if (AXObjectCache* cache = document().existingAXObjectCache())
202 cache->childrenChanged(this); 202 cache->childrenChanged(this);
203 } 203 }
204 204
205 void RenderWidget::layout() 205 void RenderWidget::layout()
206 { 206 {
207 ASSERT(needsLayout()); 207 ASSERT(needsLayout());
208 208
209 clearNeedsLayout(); 209 clearNeedsLayout();
210 } 210 }
211 211
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect); 289 clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect);
290 } 290 }
291 291
292 if (m_widget) 292 if (m_widget)
293 paintContents(paintInfo, paintOffset); 293 paintContents(paintInfo, paintOffset);
294 294
295 if (style()->hasBorderRadius()) 295 if (style()->hasBorderRadius())
296 paintInfo.context->restore(); 296 paintInfo.context->restore();
297 297
298 // Paint a partially transparent wash over selected widgets. 298 // Paint a partially transparent wash over selected widgets.
299 if (isSelected() && !document()->printing()) { 299 if (isSelected() && !document().printing()) {
300 // FIXME: selectionRect() is in absolute, not painting coordinates. 300 // FIXME: selectionRect() is in absolute, not painting coordinates.
301 paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), select ionBackgroundColor()); 301 paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), select ionBackgroundColor());
302 } 302 }
303 303
304 if (hasLayer() && layer()->canResize()) 304 if (hasLayer() && layer()->canResize())
305 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf fset), paintInfo.rect); 305 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf fset), paintInfo.rect);
306 } 306 }
307 307
308 void RenderWidget::setIsOverlapped(bool isOverlapped) 308 void RenderWidget::setIsOverlapped(bool isOverlapped)
309 { 309 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const 374 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const
375 { 375 {
376 if (widget() && widget()->isPluginView()) { 376 if (widget() && widget()->isPluginView()) {
377 // A plug-in is responsible for setting the cursor when the pointer is o ver it. 377 // A plug-in is responsible for setting the cursor when the pointer is o ver it.
378 return DoNotSetCursor; 378 return DoNotSetCursor;
379 } 379 }
380 return RenderReplaced::getCursor(point, cursor); 380 return RenderReplaced::getCursor(point, cursor);
381 } 381 }
382 382
383 } // namespace WebCore 383 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderView.cpp ('k') | Source/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698