diff --git a/blink/renderer/modules/delegated_ink/delegated_ink_trail_presenter.cc b/blink/renderer/modules/delegated_ink/delegated_ink_trail_presenter.cc index e3ce3227178..a9c6b8ee8e6 100644 --- a/blink/renderer/modules/delegated_ink/delegated_ink_trail_presenter.cc +++ b/blink/renderer/modules/delegated_ink/delegated_ink_trail_presenter.cc @@ -65,24 +65,26 @@ void DelegatedInkTrailPresenter::updateInkTrailStartPoint( } LayoutView* layout_view = local_frame_->ContentLayoutObject(); - DCHECK(layout_view); - const float effective_zoom = layout_view->StyleRef().EffectiveZoom(); - - PhysicalOffset physical_point(LayoutUnit(evt->x()), LayoutUnit(evt->y())); - physical_point.Scale(effective_zoom); - physical_point = layout_view->LocalToAbsolutePoint( - physical_point, kTraverseDocumentBoundaries); - gfx::PointF point = ToGfxPointF(FloatPoint(physical_point)); - LayoutBox* layout_box = nullptr; if (presentation_area_) { layout_box = presentation_area_->GetLayoutBox(); - DCHECK(layout_box); } else { // If presentation_area_ wasn't provided, then default to the layout // viewport. layout_box = layout_view; } + // The layout might not be initialized or the associated element deleted from + // the DOM. + if (!layout_box || !layout_view) + return; + + const float effective_zoom = layout_view->StyleRef().EffectiveZoom(); + + PhysicalOffset physical_point(LayoutUnit(evt->x()), LayoutUnit(evt->y())); + physical_point.Scale(effective_zoom); + physical_point = layout_view->LocalToAbsolutePoint( + physical_point, kTraverseDocumentBoundaries); + gfx::PointF point = ToGfxPointF(FloatPoint(physical_point)); // Intersect with the visible viewport so that the presentation area can't // extend beyond the edges of the window or over the scrollbars. The frame diff --git a/blink/web_tests/external/wpt/delegated-ink/delete-presentation-area.html b/blink/web_tests/external/wpt/delegated-ink/delete-presentation-area.html new file mode 100644 index 00000000000..2408c7eeaf5 --- /dev/null +++ b/blink/web_tests/external/wpt/delegated-ink/delete-presentation-area.html @@ -0,0 +1,21 @@ + + + + + + + + +