@@ -634,32 +634,29 @@ static NonnullRefPtr<StyleValue> get_inherit_value(CSS::PropertyID property_id,
634
634
{
635
635
if (!element || !element->parent_element () || !element->parent_element ()->specified_css_values ())
636
636
return property_initial_value (property_id);
637
- auto const & map = element->parent_element ()->specified_css_values ()->properties ();
638
- auto it = map.find (property_id);
639
- VERIFY (it != map.end ());
640
- return *it->value ;
637
+ return element->parent_element ()->specified_css_values ()->property (property_id).release_value ();
641
638
};
642
639
643
640
void StyleComputer::compute_defaulted_property_value (StyleProperties& style, DOM::Element const * element, CSS::PropertyID property_id) const
644
641
{
645
642
// FIXME: If we don't know the correct initial value for a property, we fall back to InitialStyleValue.
646
643
647
- auto it = style.m_property_values . find (property_id);
648
- if (it == style. m_property_values . end () ) {
644
+ auto & value_slot = style.m_property_values [ to_underlying (property_id)] ;
645
+ if (!value_slot ) {
649
646
if (is_inherited_property (property_id))
650
- style.m_property_values . set (property_id, get_inherit_value (property_id, element) );
647
+ style.m_property_values [ to_underlying (property_id)] = get_inherit_value (property_id, element);
651
648
else
652
- style.m_property_values . set (property_id, property_initial_value (property_id) );
649
+ style.m_property_values [ to_underlying (property_id)] = property_initial_value (property_id);
653
650
return ;
654
651
}
655
652
656
- if (it-> value ->is_initial ()) {
657
- it-> value = property_initial_value (property_id);
653
+ if (value_slot ->is_initial ()) {
654
+ value_slot = property_initial_value (property_id);
658
655
return ;
659
656
}
660
657
661
- if (it-> value ->is_inherit ()) {
662
- it-> value = get_inherit_value (property_id, element);
658
+ if (value_slot ->is_inherit ()) {
659
+ value_slot = get_inherit_value (property_id, element);
663
660
return ;
664
661
}
665
662
}
@@ -869,8 +866,10 @@ void StyleComputer::absolutize_values(StyleProperties& style, DOM::Element const
869
866
// FIXME: Get the root element font.
870
867
float root_font_size = 10 ;
871
868
872
- for (auto & it : style.properties ()) {
873
- it.value ->visit_lengths ([&](Length& length) {
869
+ for (auto & value_slot : style.m_property_values ) {
870
+ if (!value_slot)
871
+ continue ;
872
+ value_slot->visit_lengths ([&](Length& length) {
874
873
if (length.is_absolute () || length.is_relative ()) {
875
874
auto px = length.to_px (viewport_rect, font_metrics, root_font_size);
876
875
length = Length::make_px (px);
0 commit comments