Add BoxFragment::is_inline_box() (#34233)

A helper function to check for inline boxes.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-11-12 16:50:20 +01:00 committed by GitHub
parent ae029242f8
commit bf75f17348
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -15,6 +15,7 @@ use style::Zero;
use super::{BaseFragment, BaseFragmentInfo, CollapsedBlockMargins, Fragment};
use crate::cell::ArcRefCell;
use crate::formatting_contexts::Baselines;
use crate::fragment_tree::FragmentFlags;
use crate::geom::{
AuOrAuto, LengthPercentageOrAuto, PhysicalPoint, PhysicalRect, PhysicalSides, ToLogical,
};
@ -325,4 +326,11 @@ impl BoxFragment {
convert_to_au_or_auto(PhysicalSides::new(top, right, bottom, left))
}
/// Whether this is a non-replaced inline-level box whose inner display type is `flow`.
/// <https://drafts.csswg.org/css-display-3/#inline-box>
pub(crate) fn is_inline_box(&self) -> bool {
self.style.get_box().display.is_inline_flow() &&
!self.base.flags.contains(FragmentFlags::IS_REPLACED)
}
}