serenity
serenity copied to clipboard
Ladybird: input with width set to auto has wrong size
Test page:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
input {
width: auto;
border: 1px solid red;
}
</style>
</head>
<body>
<input />
First is Chrome, second is Ladybird:
Note that weirdly, adding a placeholder to the input will make the width grow to cover the placeholder text:
Real world example:
When width is set to auto it seems Ladybird doesn't care about the size attribute (which defaults to 20) anymore.
When
widthis set toautoit seems Ladybird doesn't care about thesizeattribute (which defaults to20) anymore.
The way we set the width usually is this CSS:
https://github.com/SerenityOS/serenity/blob/17b22250b6afa30366903b314a62b78a8a94fb79/Userland/Libraries/LibWeb/CSS/Default.css#L32
So as soon as the user sets width to something, that no longer applies.
I guess HTMLInputElement need to catch the width: auto somewhere and implement its own width calculation. And then probably get rid of that CSS line.
Hmmm, looks like that has width: 100% set. That's a different issue, but yeah, we're definitely doing something wrong there!