mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
layout: Ensure IFC for abspos with inline-level original display (#39041)
Absolutely positioned elements get blockified, but their static position still depends on the original display. Therefore, if we encounter an abspos with an inline-level original display, we will now ensure that it's handled in an inline formatting context. This way its static position will correctly take into account things like `text-align`. Testing: Several WPT tests are now passing. Fixes: #39017 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
665ee150a6
commit
9264ef1a95
17 changed files with 42 additions and 44 deletions
|
@ -15,6 +15,7 @@ use servo_arc::Arc;
|
|||
use style::dom::{NodeInfo, TNode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::Overflow;
|
||||
use style::values::specified::box_::DisplayOutside;
|
||||
use style_traits::CSSPixel;
|
||||
|
||||
use crate::cell::ArcRefCell;
|
||||
|
@ -338,6 +339,12 @@ impl<'dom> IncrementalBoxTreeUpdate<'dom> {
|
|||
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(_)
|
||||
if box_style.position.is_absolutely_positioned() =>
|
||||
{
|
||||
// If the outer type of its original display changed from block to inline,
|
||||
// a block-level abspos needs to be placed in an inline formatting context,
|
||||
// see [`BlockContainerBuilder::handle_absolutely_positioned_element()`].
|
||||
if box_style.original_display.outside() == DisplayOutside::Inline {
|
||||
return None;
|
||||
}
|
||||
DirtyRootBoxTreeNode::AbsolutelyPositionedBlockLevelBox(
|
||||
block_level_box.clone(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue