Explorar o código

LibWeb: Create Layout::Box for `display: inline-grid`

This makes us actually run a GridFormattingContext instead of rendering
inline-grid elements as nothing. :^)
Andreas Kling %!s(int64=2) %!d(string=hai) anos
pai
achega
9174ffd7e6

+ 10 - 0
Tests/LibWeb/Layout/expected/grid/inline-grid-simple.txt

@@ -0,0 +1,10 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (0,0) content-size 800x33.46875 [BFC] children: inline
+    line 0 width: 42.953125, height: 33.46875, bottom: 33.46875, baseline: 13.53125
+      frag 0 from Box start: 0, length: 0, rect: [8,8 26.953125x17.46875]
+    Box <body> at (8,8) content-size 26.953125x17.46875 [GFC] children: not-inline
+      BlockContainer <(anonymous)> at (8,8) content-size 26.953125x17.46875 [BFC] children: inline
+        line 0 width: 26.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+          frag 0 from TextNode start: 0, length: 3, rect: [8,8 26.953125x17.46875]
+            "whf"
+        TextNode <#text>

+ 5 - 0
Tests/LibWeb/Layout/input/grid/inline-grid-simple.html

@@ -0,0 +1,5 @@
+<!doctype html><style>
+body {
+    display: inline-grid;
+}
+</style><body>whf

+ 2 - 0
Userland/Libraries/LibWeb/DOM/Element.cpp

@@ -338,6 +338,8 @@ JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Docume
             return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
         if (display.is_flex_inside())
             return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
+        if (display.is_grid_inside())
+            return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
         dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", MUST(display.to_string()));
         return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
     }