mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07: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:
parent
6215a9c2cb
commit
ee3a73ddbb
61 changed files with 262 additions and 262 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue