mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibWeb: Copy button style properties for generated table and cell
This commit is contained in:
parent
637c74ac93
commit
89305f1481
4 changed files with 37 additions and 3 deletions
|
@ -0,0 +1,26 @@
|
|||
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: 54.40625
|
||||
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: 52.40625
|
||||
frag 0 from TableWrapper start: 0, length: 0, rect: [13,10 111.65625x52.40625]
|
||||
TableWrapper <(anonymous)> at (13,10) content-size 111.65625x52.40625 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-cell [BFC] children: inline
|
||||
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375
|
||||
frag 0 from TextNode start: 0, length: 4, rect: [13,10 111.65625x52.40625]
|
||||
"Test"
|
||||
TextNode <#text>
|
||||
|
||||
PaintableWithLines (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x56.40625]
|
||||
PaintableWithLines (BlockContainer<BUTTON>) [8,8 121.65625x56.40625]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableBox (Box(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 111.65625x52.40625]
|
||||
TextPaintable (TextNode<#text>)
|
|
@ -0,0 +1,7 @@
|
|||
<style>
|
||||
button {
|
||||
font-size: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<button>Test</button>
|
|
@ -208,6 +208,7 @@ public:
|
|||
Gfx::Font const& font() const { return *m_font; }
|
||||
CSSPixels line_height() const { return m_line_height; }
|
||||
void set_line_height(CSSPixels line_height) { m_line_height = line_height; }
|
||||
void set_font(Gfx::Font const& font) { m_font = font; }
|
||||
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
|
||||
const CSS::AbstractImageStyleValue* list_style_image() const { return m_list_style_image; }
|
||||
|
||||
|
|
|
@ -380,19 +380,19 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
auto& parent = *dom_node.layout_node();
|
||||
|
||||
// If the box does not overflow in the vertical axis, then it is centered vertically.
|
||||
auto table_computed_values = CSS::ComputedValues();
|
||||
auto table_computed_values = parent.computed_values().clone_inherited_values();
|
||||
static_cast<CSS::MutableComputedValues&>(table_computed_values).set_display(CSS::Display::from_short(CSS::Display::Short::Table));
|
||||
static_cast<CSS::MutableComputedValues&>(table_computed_values).set_height(CSS::Size::make_percentage(CSS::Percentage(100)));
|
||||
|
||||
auto cell_computed_values = CSS::ComputedValues();
|
||||
auto cell_computed_values = parent.computed_values().clone_inherited_values();
|
||||
static_cast<CSS::MutableComputedValues&>(cell_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableCell });
|
||||
static_cast<CSS::MutableComputedValues&>(cell_computed_values).set_vertical_align(CSS::VerticalAlign::Middle);
|
||||
static_cast<CSS::MutableComputedValues&>(cell_computed_values).set_white_space(CSS::WhiteSpace::Nowrap);
|
||||
|
||||
auto table_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(table_computed_values));
|
||||
auto cell_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(cell_computed_values));
|
||||
|
||||
cell_wrapper->set_line_height(parent.line_height());
|
||||
cell_wrapper->set_font(parent.font());
|
||||
cell_wrapper->set_children_are_inline(parent.children_are_inline());
|
||||
|
||||
Vector<JS::Handle<Node>> sequence;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue