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(PassRefPtr<Widget> widget) { if (widget == m_widget) return; if (m_widget) { moveWidgetToParentSoon(m_widget.get(), 0); clearWidget(); } m_widget = widget; if (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 (with a non-null // style pointer). if (style()) { if (!needsLayout()) updateWidgetGeometry(); if (style()->visibility() != VISIBLE) m_widget->hide(); else { m_widget->show(); repaint(); } } moveWidgetToParentSoon(m_widget.get(), m_frameView); } if (AXObjectCache* cache = document().existingAXObjectCache()) cache->childrenChanged(this); }
void RenderWidget::updateWidgetPosition() { if (!m_widget || !node()) // Check the node in case destroy() has been called. return; bool boundsChanged = updateWidgetGeometry(); // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget && m_widget->isFrameView()) { FrameView* frameView = toFrameView(m_widget.get()); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((boundsChanged || frameView->needsLayout()) && frameView->frame().page()) frameView->layout(); } }
void RenderWidget::updateWidgetPosition() { if (!m_widget) return; WeakPtr<RenderWidget> weakThis = createWeakPtr(); bool widgetSizeChanged = updateWidgetGeometry(); if (!weakThis) return; // if the frame size got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size. if (m_widget->isFrameView()) { FrameView* frameView = toFrameView(m_widget.get()); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((widgetSizeChanged || frameView->needsLayout()) && frameView->frame().page()) frameView->layout(); } }
RenderWidget::ChildWidgetState RenderWidget::updateWidgetPosition() { if (!m_widget) return ChildWidgetState::Destroyed; WeakPtr<RenderWidget> weakThis = createWeakPtr(); bool widgetSizeChanged = updateWidgetGeometry(); if (!weakThis || !m_widget) return ChildWidgetState::Destroyed; // if the frame size got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size. if (is<FrameView>(*m_widget)) { FrameView& frameView = downcast<FrameView>(*m_widget); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((widgetSizeChanged || frameView.needsLayout()) && frameView.frame().page()) frameView.layout(); } return ChildWidgetState::Valid; }
void RenderWidget::updateOnWidgetChange() { Widget* widget = this->widget(); if (!widget) return; if (!style()) return; if (!needsLayout()) updateWidgetGeometry(); if (style()->visibility() != VISIBLE) { widget->hide(); } else { widget->show(); // FIXME: Why do we repaint in this case, but not the other? repaint(); } }
void RenderWidget::updateOnWidgetChange() { Widget* widget = this->widget(); if (!widget) return; if (!style()) return; if (!needsLayout()) updateWidgetGeometry(); if (style()->visibility() != VISIBLE) { widget->hide(); } else { widget->show(); // FIXME: Why do we issue a full paint invalidation in this case, but not the other? setShouldDoFullPaintInvalidation(true); } }