1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:27:35 +00:00

AK: Rename downcast<T> => verify_cast<T>

This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
This commit is contained in:
Andreas Kling 2021-06-24 19:53:42 +02:00
parent 6215a9c2cb
commit ee3a73ddbb
61 changed files with 262 additions and 262 deletions

View file

@ -278,11 +278,11 @@ Optional<float> StyleProperties::flex_grow_factor() const
auto value = property(CSS::PropertyID::FlexGrow);
if (!value.has_value())
return {};
if (value.value()->is_length() && downcast<CSS::LengthStyleValue>(value.value().ptr())->to_length().raw_value() == 0)
if (value.value()->is_length() && verify_cast<CSS::LengthStyleValue>(value.value().ptr())->to_length().raw_value() == 0)
return { 0 };
if (!value.value()->is_numeric())
return {};
auto numeric = downcast<CSS::NumericStyleValue>(value.value().ptr());
auto numeric = verify_cast<CSS::NumericStyleValue>(value.value().ptr());
return numeric->value();
}
@ -291,11 +291,11 @@ Optional<float> StyleProperties::flex_shrink_factor() const
auto value = property(CSS::PropertyID::FlexShrink);
if (!value.has_value())
return {};
if (value.value()->is_length() && downcast<CSS::LengthStyleValue>(value.value().ptr())->to_length().raw_value() == 0)
if (value.value()->is_length() && verify_cast<CSS::LengthStyleValue>(value.value().ptr())->to_length().raw_value() == 0)
return { 0 };
if (!value.value()->is_numeric())
return {};
auto numeric = downcast<CSS::NumericStyleValue>(value.value().ptr());
auto numeric = verify_cast<CSS::NumericStyleValue>(value.value().ptr());
return numeric->value();
}