Explorar o código

LibWeb: Skip hit testing a line box fragment if it has no container

The container appears to be null for certain elements such as the
"update your browser" box when clicking on the document during certain
parts of loading. Skipping it works fine, but should obviously be
fixed, so it prints a debug output when this happens.
Luke Wilde %!s(int64=2) %!d(string=hai) anos
pai
achega
bee4df7bfb
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

+ 4 - 0
Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

@@ -673,6 +673,10 @@ Optional<HitTestResult> PaintableWithLines::hit_test(Gfx::FloatPoint const& posi
         for (auto& fragment : line_box.fragments()) {
             if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paint_box()->stacking_context())
                 continue;
+            if (!fragment.layout_node().containing_block()) {
+                dbgln("FIXME: PaintableWithLines::hit_test(): Missing containing block on {}", fragment.layout_node().debug_description());
+                continue;
+            }
             auto fragment_absolute_rect = fragment.absolute_rect();
             if (fragment_absolute_rect.contains(position)) {
                 if (is<Layout::BlockContainer>(fragment.layout_node()) && fragment.layout_node().paintable())