mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
LibWeb: Don't crash when resolving style of grid template properties
Previously, attempting to get the computed value for a grid-template-rows or grid-template-columns property would cause a crash if the element had no associated paintable.
This commit is contained in:
parent
fa907029ee
commit
779de840af
Notes:
github-actions[bot]
2024-09-18 16:39:13 +00:00
Author: https://github.com/tcl3
Commit: 779de840af
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1431
Reviewed-by: https://github.com/kalenikaliaksandr ✅
3 changed files with 26 additions and 6 deletions
|
@ -523,14 +523,18 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
|
|||
// For grid-template-columns and grid-template-rows the resolved value is the used value.
|
||||
// https://www.w3.org/TR/css-grid-2/#resolved-track-list-standalone
|
||||
if (property_id == PropertyID::GridTemplateColumns) {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
if (auto used_values_for_grid_template_columns = paintable_box.used_values_for_grid_template_columns()) {
|
||||
return used_values_for_grid_template_columns;
|
||||
if (layout_node.paintable()) {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
if (auto used_values_for_grid_template_columns = paintable_box.used_values_for_grid_template_columns()) {
|
||||
return used_values_for_grid_template_columns;
|
||||
}
|
||||
}
|
||||
} else if (property_id == PropertyID::GridTemplateRows) {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
if (auto used_values_for_grid_template_rows = paintable_box.used_values_for_grid_template_rows()) {
|
||||
return used_values_for_grid_template_rows;
|
||||
if (layout_node.paintable()) {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
if (auto used_values_for_grid_template_rows = paintable_box.used_values_for_grid_template_rows()) {
|
||||
return used_values_for_grid_template_rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue