mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +00:00
LibWeb: Remove the totally ad-hoc parse_html_length()
All clients of this API have been migrated to HTML dimension value parsing instead.
This commit is contained in:
parent
7df62c64b7
commit
434970f022
2 changed files with 1 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
|
@ -5132,27 +5132,6 @@ RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, Str
|
|||
return parser.parse_as_supports();
|
||||
}
|
||||
|
||||
RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const& document, StringView string)
|
||||
{
|
||||
if (string.is_null())
|
||||
return nullptr;
|
||||
|
||||
auto integer = string.to_int();
|
||||
if (integer.has_value())
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(integer.value()));
|
||||
|
||||
{
|
||||
// FIXME: This is both ad-hoc and inefficient (note the String allocation!)
|
||||
String string_copy(string);
|
||||
char const* endptr = nullptr;
|
||||
auto double_value = strtod(string_copy.characters(), const_cast<char**>(&endptr));
|
||||
if (endptr != string_copy.characters())
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(double_value));
|
||||
}
|
||||
|
||||
return parse_css_value(CSS::ParsingContext(document), string);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#current-dimension-value
|
||||
static RefPtr<CSS::StyleValue> parse_current_dimension_value(float value, Utf8View input, Utf8View::Iterator position)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue