Add web platform test

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-06-02 01:56:48 +02:00
parent cb0088babd
commit 0bef4ed35c
7 changed files with 102 additions and 3 deletions

View file

@ -1307,7 +1307,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
));
}
// https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
// https://html.spec.whatwg.org/multipage/#the-hr-element-2
if let Some(size_info) = self
.downcast::<HTMLHRElement>()
.and_then(|hr_element| hr_element.get_size_info())

View file

@ -92,7 +92,7 @@ impl HTMLHRElementMethods<crate::DomTypeHolder> for HTMLHRElement {
/// The result of applying the the presentational hint for the `size` attribute.
///
/// (This attribute can mean different things depending on it's value and other attributes)
/// (This attribute can mean different things depending on its value and other attributes)
#[allow(clippy::enum_variant_names)]
pub(crate) enum SizePresentationalHint {
SetHeightTo(Size),
@ -123,7 +123,7 @@ impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement> {
}
fn get_size_info(self) -> Option<SizePresentationalHint> {
// https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
// https://html.spec.whatwg.org/multipage/#the-hr-element-2
let element = self.upcast::<Element>();
let size_value = element
.get_attr_val_for_layout(&ns!(), &local_name!("size"))

View file

@ -351498,6 +351498,32 @@
{}
]
],
"size-with-color-or-noshade.html": [
"db1d583934e6df482cde846eda757e010e7d0310",
[
null,
[
[
"/html/rendering/non-replaced-elements/the-hr-element-0/size-with-color-or-noshade-ref.html",
"=="
]
],
{}
]
],
"size.html": [
"2162131b853ed77917ab373f4fb2c70c536e453c",
[
null,
[
[
"/html/rendering/non-replaced-elements/the-hr-element-0/size-ref.html",
"=="
]
],
{}
]
],
"width.html": [
"a436d2ae25a6b03f320bda066f32c374b84e0d92",
[
@ -479883,6 +479909,14 @@
"5cd35c83ada3470ad7a16d14a5028b01596bb60c",
[]
],
"size-ref.html": [
"03a21eb45737ef46247d8bdd61fe5ea0dcefef3e",
[]
],
"size-with-color-or-noshade-ref.html": [
"d6300e250d97d113e9ef358daa300de4bd593850",
[]
],
"width-ref.html": [
"71e7651c1ab6927f1be436ef8ff749f920924562",
[]

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
#foo {
height: 50px;
box-sizing: border-box;
}
#bar {
border-bottom-width: 0px;
box-sizing: border-box;
}
</style>
</head>
<body>
<hr id="foo">
<hr id="bar">
</body>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
hr {
border-width: 25px;
}
</style>
</head>
<body>
<hr color="black">
<hr color="totally-not-a-color">
<hr noshade>
<hr color="black" noshade>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2" />
<title>hr elements: Tests behaviour of a size attribute with color/noshade attributes present</title>
<link rel="author" title="Simon Wülker" href="mailto:simon.wuelker@arcor.de">
<link rel="match" href="/html/rendering/non-replaced-elements/the-hr-element-0/size-with-color-or-noshade-ref.html">
<meta name="assert" content="This checks that the size attribute of a hr element changes the border widths when color/noshade attributes are present">
<body>
<hr size=50 color="black">
<hr size=50 color="totally-not-a-color">
<hr size=50 noshade>
<hr size=50 color="black" noshade>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2" />
<title>hr elements: Tests behaviour of a size attribute without color/noshade attributes</title>
<link rel="author" title="Simon Wülker" href="mailto:simon.wuelker@arcor.de">
<link rel="match" href="/html/rendering/non-replaced-elements/the-hr-element-0/size-ref.html">
<meta name="assert" content="This checks that the size attribute of a hr element changes its height.">
<body>
<hr size=50>
<hr size=1>
</body>
</html>