diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-03-09 10:13:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-09 09:13:19 +0000 |
commit | 1f23ec2b27789c356a6283d9005079b6e9b1e66b (patch) | |
tree | df5256c59df043d12dd2630e2a3cf90e0a62672c /components/layout_2020/fragment_tree/base_fragment.rs | |
parent | 55f908653f6fb02c344459319a7ca87487cfa4bf (diff) | |
download | servo-1f23ec2b27789c356a6283d9005079b6e9b1e66b.tar.gz servo-1f23ec2b27789c356a6283d9005079b6e9b1e66b.zip |
layout: Do not inherit node and fragment flags in anonymous boxes (#31586)
This doesn't really have observable behavior right now, as much as I
tried to trigger some kind of bug. On the other hand, it's just wrong
and is very obvious when you dump the Fragment tree. If you create a
`display: table-cell` that is a child of the `<body>` all parts of the
anonymous table are flagged as if they are the `<body>` element.
Diffstat (limited to 'components/layout_2020/fragment_tree/base_fragment.rs')
-rw-r--r-- | components/layout_2020/fragment_tree/base_fragment.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout_2020/fragment_tree/base_fragment.rs index a43e375f26c..d84dde30111 100644 --- a/components/layout_2020/fragment_tree/base_fragment.rs +++ b/components/layout_2020/fragment_tree/base_fragment.rs @@ -47,8 +47,8 @@ impl BaseFragment { /// Information necessary to construct a new BaseFragment. #[derive(Clone, Copy, Debug, Serialize)] pub(crate) struct BaseFragmentInfo { - /// The tag to use for the new BaseFragment. - pub tag: Tag, + /// The tag to use for the new BaseFragment, if it is not an anonymous Fragment. + pub tag: Option<Tag>, /// The flags to use for the new BaseFragment. pub flags: FragmentFlags, @@ -57,7 +57,14 @@ pub(crate) struct BaseFragmentInfo { impl BaseFragmentInfo { pub(crate) fn new_for_node(node: OpaqueNode) -> Self { Self { - tag: Tag::new(node), + tag: Some(Tag::new(node)), + flags: FragmentFlags::empty(), + } + } + + pub(crate) fn anonymous() -> Self { + Self { + tag: None, flags: FragmentFlags::empty(), } } @@ -66,7 +73,7 @@ impl BaseFragmentInfo { impl From<BaseFragmentInfo> for BaseFragment { fn from(info: BaseFragmentInfo) -> Self { Self { - tag: Some(info.tag), + tag: info.tag, debug_id: DebugId::new(), flags: info.flags, } |