|
@@ -700,9 +700,10 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
|
|
auto height_of_containing_block = available_space.height.to_px();
|
|
auto height_of_containing_block = available_space.height.to_px();
|
|
auto height_of_containing_block_as_length = CSS::Length::make_px(height_of_containing_block);
|
|
auto height_of_containing_block_as_length = CSS::Length::make_px(height_of_containing_block);
|
|
|
|
|
|
- auto solve_for_top = [&] {
|
|
|
|
- top = CSS::Length::make_px(
|
|
|
|
|
|
+ auto solve_for = [&](CSS::Length length) {
|
|
|
|
+ return CSS::Length::make_px(
|
|
height_of_containing_block
|
|
height_of_containing_block
|
|
|
|
+ - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
- margin_top.length().to_px(box)
|
|
- margin_top.length().to_px(box)
|
|
- box.computed_values().border_top().width
|
|
- box.computed_values().border_top().width
|
|
- box.computed_values().padding().top().length().to_px(box)
|
|
- box.computed_values().padding().top().length().to_px(box)
|
|
@@ -710,71 +711,32 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
|
|
- box.computed_values().padding().bottom().length().to_px(box)
|
|
- box.computed_values().padding().bottom().length().to_px(box)
|
|
- box.computed_values().border_bottom().width
|
|
- box.computed_values().border_bottom().width
|
|
- margin_bottom.length().to_px(box)
|
|
- margin_bottom.length().to_px(box)
|
|
- - bottom.resolved(box, height_of_containing_block_as_length).to_px(box));
|
|
|
|
|
|
+ - bottom.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
+ + length.to_px(box));
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ auto solve_for_top = [&] {
|
|
|
|
+ top = solve_for(top.resolved(box, height_of_containing_block_as_length));
|
|
};
|
|
};
|
|
|
|
|
|
auto solve_for_bottom = [&] {
|
|
auto solve_for_bottom = [&] {
|
|
- bottom = CSS::Length::make_px(
|
|
|
|
- height_of_containing_block
|
|
|
|
- - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - margin_top.length().to_px(box)
|
|
|
|
- - box.computed_values().border_top().width
|
|
|
|
- - box.computed_values().padding().top().length().to_px(box)
|
|
|
|
- - height.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().padding().bottom().length().to_px(box)
|
|
|
|
- - box.computed_values().border_bottom().width
|
|
|
|
- - margin_bottom.length().to_px(box));
|
|
|
|
|
|
+ bottom = solve_for(bottom.resolved(box, height_of_containing_block_as_length));
|
|
};
|
|
};
|
|
|
|
|
|
auto solve_for_height = [&] {
|
|
auto solve_for_height = [&] {
|
|
- height = CSS::Size::make_px(
|
|
|
|
- height_of_containing_block
|
|
|
|
- - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - margin_top.length().to_px(box)
|
|
|
|
- - box.computed_values().border_top().width
|
|
|
|
- - box.computed_values().padding().top().length().to_px(box)
|
|
|
|
- - box.computed_values().padding().bottom().length().to_px(box)
|
|
|
|
- - box.computed_values().border_bottom().width
|
|
|
|
- - margin_bottom.length().to_px(box)
|
|
|
|
- - bottom.resolved(box, height_of_containing_block_as_length).to_px(box));
|
|
|
|
|
|
+ height = CSS::Size::make_length(solve_for(height.resolved(box, height_of_containing_block_as_length)));
|
|
};
|
|
};
|
|
|
|
|
|
auto solve_for_margin_top = [&] {
|
|
auto solve_for_margin_top = [&] {
|
|
- margin_top = CSS::Length::make_px(
|
|
|
|
- height_of_containing_block
|
|
|
|
- - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().border_top().width
|
|
|
|
- - box.computed_values().padding().top().length().to_px(box)
|
|
|
|
- - height.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().padding().bottom().length().to_px(box)
|
|
|
|
- - box.computed_values().border_bottom().width
|
|
|
|
- - margin_bottom.length().to_px(box)
|
|
|
|
- - bottom.resolved(box, height_of_containing_block_as_length).to_px(box));
|
|
|
|
|
|
+ margin_top = solve_for(margin_top.length());
|
|
};
|
|
};
|
|
|
|
|
|
auto solve_for_margin_bottom = [&] {
|
|
auto solve_for_margin_bottom = [&] {
|
|
- margin_bottom = CSS::Length::make_px(
|
|
|
|
- height_of_containing_block
|
|
|
|
- - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - margin_top.length().to_px(box)
|
|
|
|
- - box.computed_values().border_top().width
|
|
|
|
- - box.computed_values().padding().top().length().to_px(box)
|
|
|
|
- - height.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().padding().bottom().length().to_px(box)
|
|
|
|
- - box.computed_values().border_bottom().width
|
|
|
|
- - bottom.resolved(box, height_of_containing_block_as_length).to_px(box));
|
|
|
|
|
|
+ margin_bottom = solve_for(margin_bottom.length());
|
|
};
|
|
};
|
|
|
|
|
|
auto solve_for_margin_top_and_margin_bottom = [&] {
|
|
auto solve_for_margin_top_and_margin_bottom = [&] {
|
|
- auto remainder = height_of_containing_block
|
|
|
|
- - top.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().border_top().width
|
|
|
|
- - box.computed_values().padding().top().length().to_px(box)
|
|
|
|
- - height.resolved(box, height_of_containing_block_as_length).to_px(box)
|
|
|
|
- - box.computed_values().padding().bottom().length().to_px(box)
|
|
|
|
- - box.computed_values().border_bottom().width
|
|
|
|
- - bottom.resolved(box, height_of_containing_block_as_length).to_px(box);
|
|
|
|
-
|
|
|
|
|
|
+ auto remainder = solve_for(CSS::Length::make_px(margin_top.length().to_px(box) + margin_bottom.length().to_px(box))).to_px(box);
|
|
margin_top = CSS::Length::make_px(remainder / 2);
|
|
margin_top = CSS::Length::make_px(remainder / 2);
|
|
margin_bottom = CSS::Length::make_px(remainder / 2);
|
|
margin_bottom = CSS::Length::make_px(remainder / 2);
|
|
};
|
|
};
|