mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
parent
15f4043a7a
commit
fdfda6dec2
Notes:
sideshowbarker
2024-07-19 05:41:49 +09:00
Author: https://github.com/awesomekling
Commit: fdfda6dec2
55 changed files with 354 additions and 455 deletions
|
@ -47,22 +47,12 @@ HTMLCanvasElement::~HTMLCanvasElement()
|
|||
|
||||
int HTMLCanvasElement::requested_width() const
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned width = attribute(HTML::AttributeNames::width).to_int(ok);
|
||||
if (ok)
|
||||
return width;
|
||||
|
||||
return 300;
|
||||
return attribute(HTML::AttributeNames::width).to_int().value_or(300);
|
||||
}
|
||||
|
||||
int HTMLCanvasElement::requested_height() const
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned height = attribute(HTML::AttributeNames::height).to_int(ok);
|
||||
if (ok)
|
||||
return height;
|
||||
|
||||
return 150;
|
||||
return attribute(HTML::AttributeNames::height).to_int().value_or(150);
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> HTMLCanvasElement::create_layout_node(const StyleProperties* parent_style) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue