summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-12 21:07:52 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-12 21:28:55 +0200
commitfdfda6dec20101013bb33633e657f06ef2a1ea96 (patch)
tree2157f8281cd9bc33a6984455c4831c397d2bd30c /Libraries/LibWeb/Layout
parent15f4043a7a80f52c0fa05c4e69771e758464cd20 (diff)
downloadserenity-fdfda6dec20101013bb33633e657f06ef2a1ea96.zip
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
Diffstat (limited to 'Libraries/LibWeb/Layout')
-rw-r--r--Libraries/LibWeb/Layout/LayoutFrame.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutFrame.cpp b/Libraries/LibWeb/Layout/LayoutFrame.cpp
index 7dbfb75730..94fe436125 100644
--- a/Libraries/LibWeb/Layout/LayoutFrame.cpp
+++ b/Libraries/LibWeb/Layout/LayoutFrame.cpp
@@ -53,9 +53,8 @@ void LayoutFrame::layout(LayoutMode layout_mode)
set_has_intrinsic_width(true);
set_has_intrinsic_height(true);
// FIXME: Do proper error checking, etc.
- bool ok;
- set_intrinsic_width(node().attribute(HTML::AttributeNames::width).to_int(ok));
- set_intrinsic_height(node().attribute(HTML::AttributeNames::height).to_int(ok));
+ set_intrinsic_width(node().attribute(HTML::AttributeNames::width).to_int().value_or(300));
+ set_intrinsic_height(node().attribute(HTML::AttributeNames::height).to_int().value_or(150));
LayoutReplaced::layout(layout_mode);
}