mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
LibWeb: Don't access layout nodes in StyleComputer
Style computation always happens *before* layout, so we can't rely on things having (or not having) layout nodes, as that information will always be one step behind. Instead, we have to use the DOM to find all the information we need.
This commit is contained in:
parent
cf69cc7f7d
commit
511d4951b0
1 changed files with 3 additions and 3 deletions
|
@ -800,7 +800,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
// Percentages refer to parent element's font size
|
||||
auto percentage = font_size->as_percentage().percentage();
|
||||
auto parent_font_size = size;
|
||||
if (parent_element && parent_element->layout_node() && parent_element->specified_css_values()) {
|
||||
if (parent_element && parent_element->specified_css_values()) {
|
||||
auto value = parent_element->specified_css_values()->property(CSS::PropertyID::FontSize).value();
|
||||
if (value->is_length()) {
|
||||
auto length = static_cast<LengthStyleValue const&>(*value).to_length();
|
||||
|
@ -954,8 +954,8 @@ static BoxTypeTransformation required_box_type_transformation(StyleProperties co
|
|||
// FIXME: Containment in a ruby container inlinifies the box’s display type, as described in [CSS-RUBY-1].
|
||||
|
||||
// A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1]
|
||||
if (element.parent() && element.parent()->layout_node()) {
|
||||
auto const& parent_display = element.parent()->layout_node()->computed_values().display();
|
||||
if (element.parent_element() && element.parent_element()->specified_css_values()) {
|
||||
auto const& parent_display = element.parent_element()->specified_css_values()->display();
|
||||
if (parent_display.is_grid_inside() || parent_display.is_flex_inside())
|
||||
return BoxTypeTransformation::Blockify;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue