aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-09-12 15:34:20 +0200
committerGitHub <noreply@github.com>2024-09-12 13:34:20 +0000
commit4839cdf1764eac2b520692d2b9c3da002b509d01 (patch)
tree2bd7c2a1402a35d62106741aaa829de75bd3a34e /components/script/dom/element.rs
parent37ab4b98259d45c9efd3645ebc961ca518adb5c6 (diff)
downloadservo-4839cdf1764eac2b520692d2b9c3da002b509d01.tar.gz
servo-4839cdf1764eac2b520692d2b9c3da002b509d01.zip
Add `width` and `height` presentational hints for table-related elements (#33405)
We were only parsing the `width` attribute as a presentation hint for `<table>`, `<td>` and `<th>`. This patch also handles `<colgroup>` and `<col>`. Also, we weren't parsing `height` at all, now we do it for `<table>`, `<td>`, `<th>`, `<tr>`, `<tbody>`, `<thead>` and `<tfoot>`. One test is now crashing, but this was an existing issue: #33423 Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 2447e078efb..a3f10fcb4d8 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -850,6 +850,8 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
this.get_width()
} else if let Some(this) = self.downcast::<HTMLTableCellElement>() {
this.get_width()
+ } else if let Some(this) = self.downcast::<HTMLTableColElement>() {
+ this.get_width()
} else if let Some(this) = self.downcast::<HTMLHRElement>() {
// https://html.spec.whatwg.org/multipage/#the-hr-element-2:attr-hr-width
this.get_width()
@@ -886,6 +888,14 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
this.get_height()
} else if let Some(this) = self.downcast::<HTMLImageElement>() {
this.get_height()
+ } else if let Some(this) = self.downcast::<HTMLTableElement>() {
+ this.get_height()
+ } else if let Some(this) = self.downcast::<HTMLTableCellElement>() {
+ this.get_height()
+ } else if let Some(this) = self.downcast::<HTMLTableRowElement>() {
+ this.get_height()
+ } else if let Some(this) = self.downcast::<HTMLTableSectionElement>() {
+ this.get_height()
} else {
LengthOrPercentageOrAuto::Auto
};