diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-11-12 16:50:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 15:50:20 +0000 |
commit | bf75f17348d4174127973d19c72e405dbc5efaa3 (patch) | |
tree | 8b372576d62d11f57b6dc42e2a1ddafa854dc5a8 /components/layout_2020/fragment_tree/box_fragment.rs | |
parent | ae029242f82459233a683c7623121dde6cae3f5b (diff) | |
download | servo-bf75f17348d4174127973d19c72e405dbc5efaa3.tar.gz servo-bf75f17348d4174127973d19c72e405dbc5efaa3.zip |
Add `BoxFragment::is_inline_box()` (#34233)
A helper function to check for inline boxes.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/fragment_tree/box_fragment.rs')
-rw-r--r-- | components/layout_2020/fragment_tree/box_fragment.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/layout_2020/fragment_tree/box_fragment.rs b/components/layout_2020/fragment_tree/box_fragment.rs index 6e1039200e2..7b0284efea6 100644 --- a/components/layout_2020/fragment_tree/box_fragment.rs +++ b/components/layout_2020/fragment_tree/box_fragment.rs @@ -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) + } } |