1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

LibWeb: Make CSS ParsingContext's Document* be const

The only reason it wasn't const before (and why we had a const_cast
hack) was to support ImageStyleValue's constructor taking it, which no
longer applies. `hack_count--;` :^)
This commit is contained in:
Sam Atkins 2021-10-22 20:59:45 +01:00 committed by Andreas Kling
parent 0f393771b7
commit f645ed199e
2 changed files with 5 additions and 6 deletions

View file

@ -34,7 +34,7 @@ static void log_parse_error(const SourceLocation& location = SourceLocation::cur
namespace Web::CSS {
ParsingContext::ParsingContext(DOM::Document& document)
ParsingContext::ParsingContext(DOM::Document const& document)
: m_document(&document)
{
}
@ -3888,8 +3888,7 @@ RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const& document, StringV
auto integer = string.to_int();
if (integer.has_value())
return CSS::LengthStyleValue::create(CSS::Length::make_px(integer.value()));
// FIXME: The const_cast is a hack.
return parse_css_value(CSS::ParsingContext(const_cast<DOM::Document&>(document)), string);
return parse_css_value(CSS::ParsingContext(document), string);
}
}