mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
LibWeb: Set textarea
rows and cols default value if 0
The cols and rows attributes are limited to only positive numbers with fallback. The cols IDL attribute's default value is 20. The rows IDL attribute's default value is 2. The default value was returned only for the negative number. I added an additional check for the case when the attribute is 0 to match the specification.
This commit is contained in:
parent
5723ed3443
commit
205155a7ab
Notes:
github-actions[bot]
2024-10-29 22:38:06 +00:00
Author: https://github.com/pbrw 🔰
Commit: 205155a7ab
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2035
Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 2 deletions
|
@ -291,7 +291,7 @@ unsigned HTMLTextAreaElement::cols() const
|
|||
{
|
||||
// The cols and rows attributes are limited to only positive numbers with fallback. The cols IDL attribute's default value is 20.
|
||||
if (auto cols_string = get_attribute(HTML::AttributeNames::cols); cols_string.has_value()) {
|
||||
if (auto cols = parse_non_negative_integer(*cols_string); cols.has_value())
|
||||
if (auto cols = parse_non_negative_integer(*cols_string); cols.has_value() && *cols > 0)
|
||||
return *cols;
|
||||
}
|
||||
return 20;
|
||||
|
@ -307,7 +307,7 @@ unsigned HTMLTextAreaElement::rows() const
|
|||
{
|
||||
// The cols and rows attributes are limited to only positive numbers with fallback. The rows IDL attribute's default value is 2.
|
||||
if (auto rows_string = get_attribute(HTML::AttributeNames::rows); rows_string.has_value()) {
|
||||
if (auto rows = parse_non_negative_integer(*rows_string); rows.has_value())
|
||||
if (auto rows = parse_non_negative_integer(*rows_string); rows.has_value() && *rows > 0)
|
||||
return *rows;
|
||||
}
|
||||
return 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue