LibWeb: Set children of button layout box to be non-inline

When modifying the button layout during tree building to use flex for
vertical alignment, let's explicitly set the button box's children to
be non-inline. It doesn't make sense to layout the button as an IFC
when its only child is a flex container.
This commit is contained in:
Aliaksandr Kalenik 2023-09-10 22:14:25 +02:00 committed by Andreas Kling
parent 38d9c4d19c
commit 0160d921e9
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00
6 changed files with 28 additions and 37 deletions

View file

@ -1,24 +1,22 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x47.671875 children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.84375
frag 0 from BlockContainer start: 0, length: 0, rect: [8,8 61.1875x47.671875]
BlockContainer <div.ib> at (8,8) content-size 61.1875x47.671875 inline-block [BFC] children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.84375
frag 0 from BlockContainer start: 0, length: 0, rect: [9,26 17.828125x21.84375]
frag 1 from TextNode start: 0, length: 1, rect: [28,30 8x17.46875]
BlockContainer <body> at (8,8) content-size 784x47.6875 children: inline
line 0 width: 61.1875, height: 47.6875, bottom: 47.6875, baseline: 33.84375
frag 0 from BlockContainer start: 0, length: 0, rect: [8,8 61.1875x47.6875]
BlockContainer <div.ib> at (8,8) content-size 61.1875x47.6875 inline-block [BFC] children: inline
line 0 width: 61.1875, height: 47.6875, bottom: 47.6875, baseline: 33.84375
frag 0 from BlockContainer start: 0, length: 0, rect: [9,24 17.828125x21.84375]
frag 1 from TextNode start: 0, length: 1, rect: [28,28 8x17.46875]
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.671875]
frag 2 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.6875]
TextNode <#text>
BlockContainer <div.label> at (9,26) content-size 17.828125x21.84375 inline-block [BFC] children: inline
BlockContainer <div.label> at (9,24) content-size 17.828125x21.84375 inline-block [BFC] children: inline
line 0 width: 17.828125, height: 21.84375, bottom: 21.84375, baseline: 16.921875
frag 0 from TextNode start: 0, length: 1, rect: [9,26 17.828125x21.84375]
frag 0 from TextNode start: 0, length: 1, rect: [9,24 17.828125x21.84375]
"A"
TextNode <#text>
TextNode <#text>
BlockContainer <button> at (41,10) content-size 23.359375x43.671875 inline-block [BFC] children: inline
line 0 width: 23.359375, height: 43.671875, bottom: 43.671875, baseline: 33.84375
frag 0 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.6875]
BlockContainer <button> at (41,10) content-size 23.359375x43.6875 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.6875 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.6875 flex-item [BFC] children: inline
line 0 width: 23.359375, height: 43.6875, bottom: 43.6875, baseline: 33.84375
@ -29,12 +27,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x47.671875]
PaintableWithLines (BlockContainer<DIV>.ib) [8,8 61.1875x47.671875]
PaintableWithLines (BlockContainer<DIV>.label) [8,25 19.828125x23.84375]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x47.6875]
PaintableWithLines (BlockContainer<DIV>.ib) [8,8 61.1875x47.6875]
PaintableWithLines (BlockContainer<DIV>.label) [8,23 19.828125x23.84375]
TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<BUTTON>) [36,8 33.359375x47.671875]
PaintableWithLines (BlockContainer<BUTTON>) [36,8 33.359375x47.6875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.6875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.6875]
TextPaintable (TextNode<#text>)

View file

@ -1,11 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x419.203125 children: inline
line 0 width: 430, height: 419.203125, bottom: 419.203125, baseline: 422
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x415.203125]
BlockContainer <button> at (13,10) content-size 420x415.203125 inline-block [BFC] children: inline
line 0 width: 420, height: 415.203125, bottom: 415.203125, baseline: 420
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x420]
BlockContainer <body> at (8,8) content-size 784x424 children: inline
line 0 width: 430, height: 424, bottom: 424, baseline: 420
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x420]
BlockContainer <button> at (13,10) content-size 420x420 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 420x420 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 420x420 flex-item [BFC] children: inline
line 0 width: 420, height: 420, bottom: 420, baseline: 420
@ -17,8 +15,8 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x419.203125]
PaintableWithLines (BlockContainer<BUTTON>) [8,8 430x419.203125] overflow: [9,9 428x421]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x424]
PaintableWithLines (BlockContainer<BUTTON>) [8,8 430x424]
PaintableWithLines (BlockContainer(anonymous)) [13,10 420x420]
PaintableWithLines (BlockContainer(anonymous)) [13,10 420x420]
ImagePaintable (ImageBox<IMG>) [13,10 420x420]

View file

@ -1,11 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x21.46875 children: inline
line 0 width: 59.921875, height: 21.46875, bottom: 21.46875, baseline: 15.53125
line 0 width: 59.921875, height: 21.46875, bottom: 21.46875, baseline: 13.53125
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 49.921875x17.46875]
BlockContainer <button> at (13,10) content-size 49.921875x17.46875 inline-block [BFC] children: inline
line 0 width: 49.921875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 49.921875x17.46875]
BlockContainer <button> at (13,10) content-size 49.921875x17.46875 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 flex-item [BFC] children: inline
line 0 width: 49.921875, height: 17.46875, bottom: 17.46875, baseline: 13.53125

View file

@ -1,11 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x56.40625 children: inline
line 0 width: 121.65625, height: 56.40625, bottom: 56.40625, baseline: 42.59375
line 0 width: 121.65625, height: 56.40625, bottom: 56.40625, baseline: 40.59375
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 111.65625x52.40625]
BlockContainer <button> at (13,10) content-size 111.65625x52.40625 inline-block [BFC] children: inline
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 111.65625x52.40625]
BlockContainer <button> at (13,10) content-size 111.65625x52.40625 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 flex-item [BFC] children: inline
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375

View file

@ -1,11 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x21.46875 children: inline
line 0 width: 47.21875, height: 21.46875, bottom: 21.46875, baseline: 15.53125
line 0 width: 47.21875, height: 21.46875, bottom: 21.46875, baseline: 13.53125
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 37.21875x17.46875]
BlockContainer <button> at (13,10) content-size 37.21875x17.46875 inline-block [BFC] children: inline
line 0 width: 37.21875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 37.21875x17.46875]
BlockContainer <button> at (13,10) content-size 37.21875x17.46875 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 flex-item [BFC] children: inline
line 0 width: 37.21875, height: 17.46875, bottom: 17.46875, baseline: 13.53125

View file

@ -411,6 +411,7 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
flex_wrapper->append_child(*content_box_wrapper);
parent.append_child(*flex_wrapper);
parent.set_children_are_inline(false);
}
return {};