void RenderWidget::setWidget(PassRefPtr<Widget> widget) { if (widget == m_widget) return; if (m_widget) { moveWidgetToParentSoon(m_widget.get(), 0); view().frameView().willRemoveWidgetFromRenderTree(*m_widget); widgetRendererMap().remove(m_widget.get()); m_widget = nullptr; } m_widget = widget; if (m_widget) { widgetRendererMap().add(m_widget.get(), this); view().frameView().didAddWidgetToRenderTree(*m_widget); // If we've already received a layout, apply the calculated space to the // widget immediately, but we have to have really been fully constructed. if (hasInitializedStyle()) { if (!needsLayout()) { WeakPtr<RenderWidget> weakThis = createWeakPtr(); updateWidgetGeometry(); if (!weakThis) return; } if (style().visibility() != VISIBLE) m_widget->hide(); else { m_widget->show(); repaint(); } } moveWidgetToParentSoon(m_widget.get(), &view().frameView()); } }
void RenderWidget::setWidget(Widget* widget) { if (widget != m_widget) { if (m_widget) { m_widget->removeFromParent(); widgetRendererMap().remove(m_widget); deleteWidget(); } m_widget = widget; if (m_widget) { widgetRendererMap().add(m_widget, this); // if we've already received a layout, apply the calculated space to the // widget immediately, but we have to have really been full constructed (with a non-null // style pointer). if (style()) { if (!needsLayout()) setWidgetGeometry(absoluteContentBox()); if (style()->visibility() != VISIBLE) m_widget->hide(); else m_widget->show(); } m_view->addChild(m_widget); } } }
void RenderWidget::setWidget(Widget* widget) { if (widget != m_widget) { if (m_widget) { // removeFromParent is a no-op on Mac. m_widget->removeFromParent(); widgetRendererMap().remove(m_widget); deleteWidget(); } m_widget = widget; if (m_widget) { widgetRendererMap().add(m_widget, this); // if we've already received a layout, apply the calculated space to the // widget immediately, but we have to have really been full constructed (with a non-null // style pointer). if (!needsLayout() && style()) resizeWidget(m_widget, m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(), m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom()); if (style()) { if (style()->visibility() != VISIBLE) m_widget->hide(); else m_widget->show(); } m_view->addChild(m_widget); } } }
void RenderWidget::destroy() { // We can't call the base class's destroy because we don't // want to unconditionally delete ourselves (we're ref-counted). // So the code below includes copied and pasted contents of // both RenderBox::destroy() and RenderObject::destroy(). // Fix originally made for <rdar://problem/4228818>. animation()->cancelAnimations(this); if (RenderView* v = view()) v->removeWidget(this); if (AXObjectCache::accessibilityEnabled()) { document()->axObjectCache()->childrenChanged(this->parent()); document()->axObjectCache()->remove(this); } remove(); if (m_widget) { if (m_view) m_view->removeChild(m_widget); widgetRendererMap().remove(m_widget); } // removes from override size map if (hasOverrideSize()) setOverrideSize(-1); RenderArena* arena = renderArena(); if (hasLayer()) layer()->clearClipRects(); if (style() && (style()->height().isPercent() || style()->minHeight().isPercent() || style()->maxHeight().isPercent())) RenderBlock::removePercentHeightDescendant(this); setNode(0); if (hasLayer()) layer()->destroy(arena); deref(arena); }
void RenderWidget::destroy() { // We can't call the base class's destroy because we don't // want to unconditionally delete ourselves (we're ref-counted). // So the code below includes copied and pasted contents of // both RenderBox::destroy() and RenderObject::destroy(). // Fix originally made for <rdar://problem/4228818>. animation()->cancelImplicitAnimations(this); if (RenderView* v = view()) v->removeWidget(this); if (AXObjectCache::accessibilityEnabled()) document()->axObjectCache()->remove(this); remove(); if (m_widget) { if (m_view) m_view->removeChild(m_widget); widgetRendererMap().remove(m_widget); } // removes from override size map if (hasOverrideSize()) setOverrideSize(-1); RenderLayer* layer = m_layer; RenderArena* arena = renderArena(); if (layer) layer->clearClipRect(); setNode(0); deref(arena); if (layer) layer->destroy(arena); }
RenderWidget* RenderWidget::find(const Widget* widget) { return widgetRendererMap().get(widget); }