mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
LibWeb: Resolve padding against 0 and not inf for indefinite width more
In particular, in BFC: - Non-floating, non-replaced elements - Floating, non-replaced elements - Floating, replaced elements The first two regressed in1d76126abe
The third one seems to have been introduced by this regression, as it was seemingly copied from compute_width_for_floating_box in7f9ede07bc
This commit is contained in:
parent
0ec522ab54
commit
f4446cdf8c
Notes:
sideshowbarker
2024-07-17 17:06:59 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/f4446cdf8c Pull-request: https://github.com/SerenityOS/serenity/pull/19520
7 changed files with 56 additions and 6 deletions
|
@ -0,0 +1,6 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x16 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
|
||||
Box <div#box1> at (8,8) content-size 784x0 flex-container(row) [FFC] children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 0x0 flex-item [BFC] children: not-inline
|
||||
Box <div#box2> at (8,8) content-size 0x0 floating flex-container(row) [FFC] children: not-inline
|
|
@ -0,0 +1,6 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x80 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x64 children: not-inline
|
||||
Box <div#box1> at (8,8) content-size 784x64 flex-container(row) [FFC] children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 16x64 flex-item [BFC] children: not-inline
|
||||
ImageBox <img#box2> at (24,24) content-size 16x32 floating flex-container(row) children: not-inline
|
|
@ -0,0 +1,6 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x16 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
|
||||
Box <div#box1> at (8,8) content-size 784x0 flex-container(row) [FFC] children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 0x0 flex-item [BFC] children: not-inline
|
||||
Box <div#box2> at (8,8) content-size 0x0 flex-container(row) [FFC] children: not-inline
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html><html><head><style>
|
||||
#box1 {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#box2 {
|
||||
display: flex;
|
||||
padding: 100%;
|
||||
float: left;
|
||||
}
|
||||
</style></head><body><div id="box1"><div><div id="box2">
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html><html><head><style>
|
||||
#box1 {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#box2 {
|
||||
display: flex;
|
||||
padding: 100%;
|
||||
float: left;
|
||||
}
|
||||
</style></head><body><div id="box1"><div><img id="box2"/>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html><html><head><style>
|
||||
#box1 {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#box2 {
|
||||
display: flex;
|
||||
padding: 100%;
|
||||
}
|
||||
</style></head><body><div id="box1"><div><div id="box2">
|
|
@ -164,8 +164,8 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
|
|||
|
||||
auto margin_left = CSS::Length::make_auto();
|
||||
auto margin_right = CSS::Length::make_auto();
|
||||
auto const padding_left = computed_values.padding().left().to_px(box, width_of_containing_block);
|
||||
auto const padding_right = computed_values.padding().right().to_px(box, width_of_containing_block);
|
||||
auto const padding_left = computed_values.padding().left().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
auto const padding_right = computed_values.padding().right().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
|
||||
auto& box_state = m_state.get_mutable(box);
|
||||
box_state.border_left = computed_values.border_left().width;
|
||||
|
@ -291,8 +291,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Avai
|
|||
|
||||
auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve);
|
||||
auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve);
|
||||
auto const padding_left = computed_values.padding().left().to_px(box, width_of_containing_block);
|
||||
auto const padding_right = computed_values.padding().right().to_px(box, width_of_containing_block);
|
||||
auto const padding_left = computed_values.padding().left().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
auto const padding_right = computed_values.padding().right().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
|
||||
// If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
|
||||
if (margin_left.is_auto())
|
||||
|
@ -371,8 +371,8 @@ void BlockFormattingContext::compute_width_for_block_level_replaced_element_in_n
|
|||
// non-replaced block-level elements are applied to determine the margins.
|
||||
auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve);
|
||||
auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve);
|
||||
auto const padding_left = computed_values.padding().left().to_px(box, width_of_containing_block);
|
||||
auto const padding_right = computed_values.padding().right().to_px(box, width_of_containing_block);
|
||||
auto const padding_left = computed_values.padding().left().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
auto const padding_right = computed_values.padding().right().resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box);
|
||||
|
||||
// If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
|
||||
if (margin_left.is_auto())
|
||||
|
|
Loading…
Add table
Reference in a new issue