Accept zero values on some width/height attributes on table elements (#33425)

We were incorrectly using `AttrValue::from_nonzero_dimension` to parse
some attributes, instead of `AttrValue::from_dimension`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-12 17:10:11 +02:00 committed by GitHub
parent 4839cdf176
commit b048bf80a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 4 additions and 35 deletions

View file

@ -101,7 +101,7 @@ impl VirtualMethods for HTMLTableColElement {
} }
attr attr
}, },
local_name!("width") => AttrValue::from_nonzero_dimension(value.into()), local_name!("width") => AttrValue::from_dimension(value.into()),
_ => self _ => self
.super_type() .super_type()
.unwrap() .unwrap()

View file

@ -521,7 +521,7 @@ impl VirtualMethods for HTMLTableElement {
match *local_name { match *local_name {
local_name!("border") => AttrValue::from_u32(value.into(), 1), local_name!("border") => AttrValue::from_u32(value.into(), 1),
local_name!("width") => AttrValue::from_nonzero_dimension(value.into()), local_name!("width") => AttrValue::from_nonzero_dimension(value.into()),
local_name!("height") => AttrValue::from_nonzero_dimension(value.into()), local_name!("height") => AttrValue::from_dimension(value.into()),
local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()), local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()),
_ => self _ => self
.super_type() .super_type()

View file

@ -182,7 +182,7 @@ impl VirtualMethods for HTMLTableRowElement {
fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue { fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue {
match *local_name { match *local_name {
local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()), local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()),
local_name!("height") => AttrValue::from_nonzero_dimension(value.into()), local_name!("height") => AttrValue::from_dimension(value.into()),
_ => self _ => self
.super_type() .super_type()
.unwrap() .unwrap()

View file

@ -120,7 +120,7 @@ impl VirtualMethods for HTMLTableSectionElement {
fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue { fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue {
match *local_name { match *local_name {
local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()), local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()),
local_name!("height") => AttrValue::from_nonzero_dimension(value.into()), local_name!("height") => AttrValue::from_dimension(value.into()),
_ => self _ => self
.super_type() .super_type()
.unwrap() .unwrap()

View file

@ -1702,30 +1702,3 @@
[<source height="0px"> mapping to <img> height property] [<source height="0px"> mapping to <img> height property]
expected: FAIL expected: FAIL
[<table height="0"> mapping to <table> height property]
expected: FAIL
[<table height="0%"> mapping to <table> height property]
expected: FAIL
[<table height="0px"> mapping to <table> height property]
expected: FAIL
[<tr height="0"> mapping to <tr> height property]
expected: FAIL
[<tr height="0%"> mapping to <tr> height property]
expected: FAIL
[<tr height="0px"> mapping to <tr> height property]
expected: FAIL
[<col width="0"> mapping to <col> width property]
expected: FAIL
[<col width="0%"> mapping to <col> width property]
expected: FAIL
[<col width="0px"> mapping to <col> width property]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-column-width.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-row-height.html]
expected: FAIL