mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Take into account display: table
etc in offset* queries (#32448)
* layout: Take into account `display: table` etc in offset* queries The specification says that for deciding whether an element should be used for offset* queries, a browser should take into account whether the element is a table cell or table. This change makes that happen. Co-authored-by: Oriol Brufau <obrufau@igalia.com> * Only tag HTML elements if they are in the HTML namespace --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
35bbcc0d95
commit
f4c9b310d5
11 changed files with 60 additions and 127 deletions
|
@ -89,14 +89,21 @@ where
|
|||
});
|
||||
|
||||
let threadsafe_node = node.to_threadsafe();
|
||||
let flags = match threadsafe_node.as_element() {
|
||||
Some(element) if element.is_body_element_of_html_element_root() => {
|
||||
FragmentFlags::IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT
|
||||
},
|
||||
Some(element) if element.get_local_name() == &local_name!("br") => {
|
||||
FragmentFlags::IS_BR_ELEMENT
|
||||
},
|
||||
_ => FragmentFlags::empty(),
|
||||
let mut flags = FragmentFlags::empty();
|
||||
|
||||
if let Some(element) = threadsafe_node.as_html_element() {
|
||||
if element.is_body_element_of_html_element_root() {
|
||||
flags.insert(FragmentFlags::IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT);
|
||||
}
|
||||
match element.get_local_name() {
|
||||
&local_name!("br") => {
|
||||
flags.insert(FragmentFlags::IS_BR_ELEMENT);
|
||||
},
|
||||
&local_name!("table") | &local_name!("th") | &local_name!("td") => {
|
||||
flags.insert(FragmentFlags::IS_TABLE_TH_OR_TD_ELEMENT);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
};
|
||||
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue