Browse Source

LibWeb: Remove reference counting for `CSS::StyleProperties`

`AK::CopyOnWrite` already does reference counting, so there is no need
to do it again.
Jonne Ransijn 8 months ago
parent
commit
07cd7d479f
100 changed files with 179 additions and 188 deletions
  1. 4 4
      Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp
  2. 1 2
      Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp
  3. 1 1
      Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
  4. 35 35
      Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
  5. 4 4
      Userland/Libraries/LibWeb/CSS/StyleComputer.h
  6. 0 7
      Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
  7. 1 4
      Userland/Libraries/LibWeb/CSS/StyleProperties.h
  8. 19 19
      Userland/Libraries/LibWeb/DOM/Element.cpp
  9. 12 10
      Userland/Libraries/LibWeb/DOM/Element.h
  10. 1 1
      Userland/Libraries/LibWeb/Dump.cpp
  11. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp
  12. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h
  13. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
  14. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
  15. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
  16. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
  17. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
  18. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
  19. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
  20. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
  21. 4 4
      Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
  22. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
  23. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
  24. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
  25. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
  26. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
  27. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp
  28. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h
  29. 1 1
      Userland/Libraries/LibWeb/Layout/AudioBox.cpp
  30. 1 1
      Userland/Libraries/LibWeb/Layout/AudioBox.h
  31. 1 1
      Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
  32. 1 1
      Userland/Libraries/LibWeb/Layout/BlockContainer.h
  33. 1 1
      Userland/Libraries/LibWeb/Layout/Box.cpp
  34. 1 1
      Userland/Libraries/LibWeb/Layout/Box.h
  35. 1 1
      Userland/Libraries/LibWeb/Layout/BreakNode.cpp
  36. 1 1
      Userland/Libraries/LibWeb/Layout/BreakNode.h
  37. 1 1
      Userland/Libraries/LibWeb/Layout/CanvasBox.cpp
  38. 1 1
      Userland/Libraries/LibWeb/Layout/CanvasBox.h
  39. 1 1
      Userland/Libraries/LibWeb/Layout/CheckBox.cpp
  40. 1 1
      Userland/Libraries/LibWeb/Layout/CheckBox.h
  41. 1 1
      Userland/Libraries/LibWeb/Layout/FormAssociatedLabelableNode.h
  42. 1 1
      Userland/Libraries/LibWeb/Layout/FrameBox.cpp
  43. 1 1
      Userland/Libraries/LibWeb/Layout/FrameBox.h
  44. 1 1
      Userland/Libraries/LibWeb/Layout/ImageBox.cpp
  45. 1 1
      Userland/Libraries/LibWeb/Layout/ImageBox.h
  46. 1 1
      Userland/Libraries/LibWeb/Layout/InlineNode.cpp
  47. 1 1
      Userland/Libraries/LibWeb/Layout/InlineNode.h
  48. 1 1
      Userland/Libraries/LibWeb/Layout/Label.cpp
  49. 1 1
      Userland/Libraries/LibWeb/Layout/Label.h
  50. 1 1
      Userland/Libraries/LibWeb/Layout/LabelableNode.h
  51. 1 1
      Userland/Libraries/LibWeb/Layout/ListItemBox.cpp
  52. 1 1
      Userland/Libraries/LibWeb/Layout/ListItemBox.h
  53. 1 1
      Userland/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp
  54. 1 1
      Userland/Libraries/LibWeb/Layout/ListItemMarkerBox.h
  55. 2 2
      Userland/Libraries/LibWeb/Layout/Node.cpp
  56. 2 2
      Userland/Libraries/LibWeb/Layout/Node.h
  57. 1 1
      Userland/Libraries/LibWeb/Layout/RadioButton.cpp
  58. 1 1
      Userland/Libraries/LibWeb/Layout/RadioButton.h
  59. 1 1
      Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp
  60. 1 1
      Userland/Libraries/LibWeb/Layout/ReplacedBox.h
  61. 1 1
      Userland/Libraries/LibWeb/Layout/SVGBox.cpp
  62. 1 1
      Userland/Libraries/LibWeb/Layout/SVGBox.h
  63. 1 1
      Userland/Libraries/LibWeb/Layout/SVGClipBox.cpp
  64. 1 1
      Userland/Libraries/LibWeb/Layout/SVGClipBox.h
  65. 1 1
      Userland/Libraries/LibWeb/Layout/SVGForeignObjectBox.cpp
  66. 1 1
      Userland/Libraries/LibWeb/Layout/SVGForeignObjectBox.h
  67. 1 1
      Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
  68. 1 1
      Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
  69. 1 1
      Userland/Libraries/LibWeb/Layout/SVGGraphicsBox.cpp
  70. 1 1
      Userland/Libraries/LibWeb/Layout/SVGGraphicsBox.h
  71. 1 1
      Userland/Libraries/LibWeb/Layout/SVGImageBox.cpp
  72. 1 1
      Userland/Libraries/LibWeb/Layout/SVGImageBox.h
  73. 1 1
      Userland/Libraries/LibWeb/Layout/SVGMaskBox.cpp
  74. 1 1
      Userland/Libraries/LibWeb/Layout/SVGMaskBox.h
  75. 1 1
      Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp
  76. 1 1
      Userland/Libraries/LibWeb/Layout/SVGSVGBox.h
  77. 1 1
      Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp
  78. 1 1
      Userland/Libraries/LibWeb/Layout/SVGTextBox.h
  79. 1 1
      Userland/Libraries/LibWeb/Layout/SVGTextPathBox.cpp
  80. 1 1
      Userland/Libraries/LibWeb/Layout/SVGTextPathBox.h
  81. 1 1
      Userland/Libraries/LibWeb/Layout/TableWrapper.cpp
  82. 1 1
      Userland/Libraries/LibWeb/Layout/TableWrapper.h
  83. 4 4
      Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
  84. 1 1
      Userland/Libraries/LibWeb/Layout/VideoBox.cpp
  85. 1 1
      Userland/Libraries/LibWeb/Layout/VideoBox.h
  86. 1 1
      Userland/Libraries/LibWeb/Layout/Viewport.cpp
  87. 1 1
      Userland/Libraries/LibWeb/Layout/Viewport.h
  88. 1 1
      Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
  89. 1 1
      Userland/Libraries/LibWeb/SVG/SVGAElement.h
  90. 1 1
      Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp
  91. 1 1
      Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h
  92. 4 4
      Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp
  93. 1 1
      Userland/Libraries/LibWeb/SVG/SVGDefsElement.h
  94. 1 1
      Userland/Libraries/LibWeb/SVG/SVGDescElement.cpp
  95. 1 1
      Userland/Libraries/LibWeb/SVG/SVGDescElement.h
  96. 1 1
      Userland/Libraries/LibWeb/SVG/SVGElement.cpp
  97. 1 1
      Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp
  98. 1 1
      Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.h
  99. 1 1
      Userland/Libraries/LibWeb/SVG/SVGGElement.cpp
  100. 1 1
      Userland/Libraries/LibWeb/SVG/SVGGElement.h

+ 4 - 4
Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp

@@ -954,13 +954,13 @@ void KeyframeEffect::update_style_properties()
     if (!target)
     if (!target)
         return;
         return;
 
 
-    CSS::StyleProperties* style = nullptr;
+    Optional<CSS::StyleProperties&> style = {};
     if (!pseudo_element_type().has_value())
     if (!pseudo_element_type().has_value())
         style = target->computed_css_values();
         style = target->computed_css_values();
     else
     else
         style = target->pseudo_element_computed_css_values(pseudo_element_type().value());
         style = target->pseudo_element_computed_css_values(pseudo_element_type().value());
 
 
-    if (!style)
+    if (!style.has_value())
         return;
         return;
 
 
     auto animated_properties_before_update = style->animated_property_values();
     auto animated_properties_before_update = style->animated_property_values();
@@ -970,8 +970,8 @@ void KeyframeEffect::update_style_properties()
 
 
     // Traversal of the subtree is necessary to update the animated properties inherited from the target element.
     // Traversal of the subtree is necessary to update the animated properties inherited from the target element.
     target->for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
     target->for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
-        auto* element_style = element.computed_css_values();
-        if (!element_style || !element.layout_node())
+        auto element_style = element.computed_css_values();
+        if (!element_style.has_value() || !element.layout_node())
             return TraversalDecision::Continue;
             return TraversalDecision::Continue;
 
 
         for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
         for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {

+ 1 - 2
Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp

@@ -520,8 +520,7 @@ WebIDL::ExceptionOr<void> ElementInlineCSSStyleDeclaration::set_css_text(StringV
 
 
     // 3. Parse the given value and, if the return value is not the empty list, insert the items in the list into the declarations, in specified order.
     // 3. Parse the given value and, if the return value is not the empty list, insert the items in the list into the declarations, in specified order.
     auto style = parse_css_style_attribute(CSS::Parser::ParsingContext(m_element->document()), css_text, *m_element.ptr());
     auto style = parse_css_style_attribute(CSS::Parser::ParsingContext(m_element->document()), css_text, *m_element.ptr());
-    auto custom_properties = TRY_OR_THROW_OOM(vm(), style->custom_properties().clone());
-    set_the_declarations(style->properties(), move(custom_properties));
+    set_the_declarations(style->properties(), style->custom_properties());
 
 
     // 4. Update style attribute for the CSS declaration block.
     // 4. Update style attribute for the CSS declaration block.
     update_style_attribute();
     update_style_attribute();

+ 1 - 1
Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp

@@ -581,7 +581,7 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
         auto style = m_element->document().style_computer().compute_style(const_cast<DOM::Element&>(*m_element), m_pseudo_element);
         auto style = m_element->document().style_computer().compute_style(const_cast<DOM::Element&>(*m_element), m_pseudo_element);
 
 
         // FIXME: This is a stopgap until we implement shorthand -> longhand conversion.
         // FIXME: This is a stopgap until we implement shorthand -> longhand conversion.
-        auto value = style->maybe_null_property(property_id);
+        auto value = style.maybe_null_property(property_id);
         if (!value) {
         if (!value) {
             dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id={:#x}) No value for property ID in newly computed style case.", to_underlying(property_id));
             dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id={:#x}) No value for property ID in newly computed style case.", to_underlying(property_id));
             return {};
             return {};

+ 35 - 35
Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

@@ -1172,7 +1172,7 @@ static void compute_transitioned_properties(StyleProperties const& style, DOM::E
     auto const source_declaration = style.transition_property_source();
     auto const source_declaration = style.transition_property_source();
     if (!source_declaration)
     if (!source_declaration)
         return;
         return;
-    if (!element.computed_css_values())
+    if (!element.computed_css_values().has_value())
         return;
         return;
     if (source_declaration == element.cached_transition_property_source())
     if (source_declaration == element.cached_transition_property_source())
         return;
         return;
@@ -1482,13 +1482,13 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
     // Then we apply the declarations from the matched rules in cascade order:
     // Then we apply the declarations from the matched rules in cascade order:
 
 
     // Normal user agent declarations
     // Normal user agent declarations
-    auto previous_origin_style = style.clone();
-    auto previous_layer_style = style.clone();
+    auto previous_origin_style = style;
+    auto previous_layer_style = style;
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::No, previous_origin_style, previous_layer_style);
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::No, previous_origin_style, previous_layer_style);
 
 
     // Normal user declarations
     // Normal user declarations
-    previous_origin_style = style.clone();
-    previous_layer_style = style.clone();
+    previous_origin_style = style;
+    previous_layer_style = style;
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::No, previous_origin_style, previous_layer_style);
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::No, previous_origin_style, previous_layer_style);
 
 
     // Author presentational hints
     // Author presentational hints
@@ -1497,7 +1497,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
     // however for the purpose of the revert keyword (but not for the revert-layer keyword) it is considered
     // however for the purpose of the revert keyword (but not for the revert-layer keyword) it is considered
     // part of the author origin."
     // part of the author origin."
     // https://drafts.csswg.org/css-cascade-5/#author-presentational-hint-origin
     // https://drafts.csswg.org/css-cascade-5/#author-presentational-hint-origin
-    previous_origin_style = style.clone();
+    previous_origin_style = style;
     if (!pseudo_element.has_value()) {
     if (!pseudo_element.has_value()) {
         element.apply_presentational_hints(style);
         element.apply_presentational_hints(style);
 
 
@@ -1520,7 +1520,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
 
 
     // Normal author declarations, ordered by @layer, with un-@layer-ed rules last
     // Normal author declarations, ordered by @layer, with un-@layer-ed rules last
     for (auto const& layer : matching_rule_set.author_rules) {
     for (auto const& layer : matching_rule_set.author_rules) {
-        previous_layer_style = style.clone();
+        previous_layer_style = style;
         cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::No, previous_origin_style, previous_layer_style);
         cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::No, previous_origin_style, previous_layer_style);
     }
     }
 
 
@@ -1587,20 +1587,20 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
     }
     }
 
 
     // Important author declarations, with un-@layer-ed rules first, followed by each @layer in reverse order.
     // Important author declarations, with un-@layer-ed rules first, followed by each @layer in reverse order.
-    previous_origin_style = style.clone();
+    previous_origin_style = style;
     for (auto const& layer : matching_rule_set.author_rules.in_reverse()) {
     for (auto const& layer : matching_rule_set.author_rules.in_reverse()) {
-        previous_layer_style = style.clone();
+        previous_layer_style = style;
         cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::Yes, previous_origin_style, previous_layer_style);
         cascade_declarations(style, element, pseudo_element, layer.rules, CascadeOrigin::Author, Important::Yes, previous_origin_style, previous_layer_style);
     }
     }
 
 
     // Important user declarations
     // Important user declarations
-    previous_origin_style = style.clone();
-    previous_layer_style = style.clone();
+    previous_origin_style = style;
+    previous_layer_style = style;
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::Yes, previous_origin_style, previous_layer_style);
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_rules, CascadeOrigin::User, Important::Yes, previous_origin_style, previous_layer_style);
 
 
     // Important user agent declarations
     // Important user agent declarations
-    previous_origin_style = style.clone();
-    previous_layer_style = style.clone();
+    previous_origin_style = style;
+    previous_layer_style = style;
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::Yes, previous_origin_style, previous_layer_style);
     cascade_declarations(style, element, pseudo_element, matching_rule_set.user_agent_rules, CascadeOrigin::UserAgent, Important::Yes, previous_origin_style, previous_layer_style);
 
 
     // Transition declarations [css-transitions-1]
     // Transition declarations [css-transitions-1]
@@ -1624,7 +1624,7 @@ NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(JS::Realm& i
 {
 {
     auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
     auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
 
 
-    if (!parent_element || !parent_element->computed_css_values())
+    if (!parent_element || !parent_element->computed_css_values().has_value())
         return property_initial_value(initial_value_context_realm, property_id);
         return property_initial_value(initial_value_context_realm, property_id);
     return parent_element->computed_css_values()->property(property_id);
     return parent_element->computed_css_values()->property(property_id);
 }
 }
@@ -1814,12 +1814,12 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
     CSSPixels font_size_in_px = 16;
     CSSPixels font_size_in_px = 16;
 
 
     Gfx::FontPixelMetrics font_pixel_metrics;
     Gfx::FontPixelMetrics font_pixel_metrics;
-    if (parent_element && parent_element->computed_css_values())
+    if (parent_element && parent_element->computed_css_values().has_value())
         font_pixel_metrics = parent_element->computed_css_values()->first_available_computed_font().pixel_metrics();
         font_pixel_metrics = parent_element->computed_css_values()->first_available_computed_font().pixel_metrics();
     else
     else
         font_pixel_metrics = Platform::FontPlugin::the().default_font().pixel_metrics();
         font_pixel_metrics = Platform::FontPlugin::the().default_font().pixel_metrics();
     auto parent_font_size = [&]() -> CSSPixels {
     auto parent_font_size = [&]() -> CSSPixels {
-        if (!parent_element || !parent_element->computed_css_values())
+        if (!parent_element || !parent_element->computed_css_values().has_value())
             return font_size_in_px;
             return font_size_in_px;
         auto value = parent_element->computed_css_values()->property(CSS::PropertyID::FontSize);
         auto value = parent_element->computed_css_values()->property(CSS::PropertyID::FontSize);
         if (value->is_length()) {
         if (value->is_length()) {
@@ -1870,7 +1870,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
                 // If the specified value font-size is math then the computed value of font-size is obtained by multiplying
                 // If the specified value font-size is math then the computed value of font-size is obtained by multiplying
                 // the inherited value of font-size by a nonzero scale factor calculated by the following procedure:
                 // the inherited value of font-size by a nonzero scale factor calculated by the following procedure:
                 // 1. Let A be the inherited math-depth value, B the computed math-depth value, C be 0.71 and S be 1.0
                 // 1. Let A be the inherited math-depth value, B the computed math-depth value, C be 0.71 and S be 1.0
-                int inherited_math_depth = parent_element && parent_element->computed_css_values()
+                int inherited_math_depth = parent_element && parent_element->computed_css_values().has_value()
                     ? parent_element->computed_css_values()->math_depth()
                     ? parent_element->computed_css_values()->math_depth()
                     : InitialValues::math_depth();
                     : InitialValues::math_depth();
                 int computed_math_depth = math_depth;
                 int computed_math_depth = math_depth;
@@ -1910,7 +1910,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
             //       larger may compute the font size to the next entry in the table,
             //       larger may compute the font size to the next entry in the table,
             //       and smaller may compute the font size to the previous entry in the table.
             //       and smaller may compute the font size to the previous entry in the table.
             if (keyword == Keyword::Smaller || keyword == Keyword::Larger) {
             if (keyword == Keyword::Smaller || keyword == Keyword::Larger) {
-                if (parent_element && parent_element->computed_css_values()) {
+                if (parent_element && parent_element->computed_css_values().has_value()) {
                     font_size_in_px = CSSPixels::nearest_value_for(parent_element->computed_css_values()->first_available_computed_font().pixel_metrics().size);
                     font_size_in_px = CSSPixels::nearest_value_for(parent_element->computed_css_values()->first_available_computed_font().pixel_metrics().size);
                 }
                 }
             }
             }
@@ -2172,7 +2172,7 @@ static BoxTypeTransformation required_box_type_transformation(StyleProperties co
     auto const* parent = pseudo_element.has_value() ? &element : element.parent_element();
     auto const* parent = pseudo_element.has_value() ? &element : element.parent_element();
 
 
     // A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1]
     // A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1]
-    if (parent && parent->computed_css_values()) {
+    if (parent && parent->computed_css_values().has_value()) {
         auto const& parent_display = parent->computed_css_values()->display();
         auto const& parent_display = parent->computed_css_values()->display();
         if (parent_display.is_grid_inside() || parent_display.is_flex_inside())
         if (parent_display.is_grid_inside() || parent_display.is_flex_inside())
             return BoxTypeTransformation::Blockify;
             return BoxTypeTransformation::Blockify;
@@ -2271,30 +2271,30 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El
         style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display));
         style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display));
 }
 }
 
 
-NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
+StyleProperties StyleComputer::create_document_style() const
 {
 {
-    auto style = StyleProperties::create();
+    StyleProperties style = {};
     compute_math_depth(style, nullptr, {});
     compute_math_depth(style, nullptr, {});
     compute_font(style, nullptr, {});
     compute_font(style, nullptr, {});
     compute_defaulted_values(style, nullptr, {});
     compute_defaulted_values(style, nullptr, {});
     absolutize_values(style);
     absolutize_values(style);
-    style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())));
-    style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())));
-    style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
+    style.set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())));
+    style.set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())));
+    style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
     return style;
     return style;
 }
 }
 
 
-NonnullRefPtr<StyleProperties> StyleComputer::compute_style(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
+StyleProperties StyleComputer::compute_style(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
 {
 {
-    return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::Normal).release_nonnull();
+    return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::Normal).release_value();
 }
 }
 
 
-RefPtr<StyleProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
+Optional<StyleProperties> StyleComputer::compute_pseudo_element_style_if_needed(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element) const
 {
 {
     return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::CreatePseudoElementStyleIfNeeded);
     return compute_style_impl(element, move(pseudo_element), ComputeStyleMode::CreatePseudoElementStyleIfNeeded);
 }
 }
 
 
-RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, ComputeStyleMode mode) const
+Optional<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, ComputeStyleMode mode) const
 {
 {
     build_rule_cache_if_needed();
     build_rule_cache_if_needed();
 
 
@@ -2306,14 +2306,14 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
         // Merge back inline styles
         // Merge back inline styles
         if (auto inline_style = element.inline_style()) {
         if (auto inline_style = element.inline_style()) {
             for (auto const& property : inline_style->properties())
             for (auto const& property : inline_style->properties())
-                style->set_property(property.property_id, property.value);
+                style.set_property(property.property_id, property.value);
         }
         }
         return style;
         return style;
     }
     }
 
 
     ScopeGuard guard { [&element]() { element.set_needs_style_update(false); } };
     ScopeGuard guard { [&element]() { element.set_needs_style_update(false); } };
 
 
-    auto style = StyleProperties::create();
+    StyleProperties style = {};
     // 1. Perform the cascade. This produces the "specified style"
     // 1. Perform the cascade. This produces the "specified style"
     bool did_match_any_pseudo_element_rules = false;
     bool did_match_any_pseudo_element_rules = false;
     compute_cascaded_values(style, element, pseudo_element, did_match_any_pseudo_element_rules, mode);
     compute_cascaded_values(style, element, pseudo_element, did_match_any_pseudo_element_rules, mode);
@@ -2323,17 +2323,17 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
 
 
         // Bail if no pseudo-element rules matched.
         // Bail if no pseudo-element rules matched.
         if (!did_match_any_pseudo_element_rules)
         if (!did_match_any_pseudo_element_rules)
-            return nullptr;
+            return {};
 
 
         // Bail if no pseudo-element would be generated due to...
         // Bail if no pseudo-element would be generated due to...
         // - content: none
         // - content: none
         // - content: normal (for ::before and ::after)
         // - content: normal (for ::before and ::after)
         bool content_is_normal = false;
         bool content_is_normal = false;
-        if (auto content_value = style->maybe_null_property(CSS::PropertyID::Content)) {
+        if (auto content_value = style.maybe_null_property(CSS::PropertyID::Content)) {
             if (content_value->is_keyword()) {
             if (content_value->is_keyword()) {
                 auto content = content_value->as_keyword().keyword();
                 auto content = content_value->as_keyword().keyword();
                 if (content == CSS::Keyword::None)
                 if (content == CSS::Keyword::None)
-                    return nullptr;
+                    return {};
                 content_is_normal = content == CSS::Keyword::Normal;
                 content_is_normal = content == CSS::Keyword::Normal;
             } else {
             } else {
                 content_is_normal = false;
                 content_is_normal = false;
@@ -2343,7 +2343,7 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
             content_is_normal = true;
             content_is_normal = true;
         }
         }
         if (content_is_normal && first_is_one_of(*pseudo_element, CSS::Selector::PseudoElement::Type::Before, CSS::Selector::PseudoElement::Type::After)) {
         if (content_is_normal && first_is_one_of(*pseudo_element, CSS::Selector::PseudoElement::Type::Before, CSS::Selector::PseudoElement::Type::After)) {
-            return nullptr;
+            return {};
         }
         }
     }
     }
 
 
@@ -2371,7 +2371,7 @@ RefPtr<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& element,
     // 9. Transition declarations [css-transitions-1]
     // 9. Transition declarations [css-transitions-1]
     // Theoretically this should be part of the cascade, but it works with computed values, which we don't have until now.
     // Theoretically this should be part of the cascade, but it works with computed values, which we don't have until now.
     compute_transitioned_properties(style, element, pseudo_element);
     compute_transitioned_properties(style, element, pseudo_element);
-    if (auto const* previous_style = element.computed_css_values()) {
+    if (auto previous_style = element.computed_css_values(); previous_style.has_value()) {
         start_needed_transitions(*previous_style, style, element, pseudo_element);
         start_needed_transitions(*previous_style, style, element, pseudo_element);
     }
     }
 
 

+ 4 - 4
Userland/Libraries/LibWeb/CSS/StyleComputer.h

@@ -134,10 +134,10 @@ public:
     void push_ancestor(DOM::Element const&);
     void push_ancestor(DOM::Element const&);
     void pop_ancestor(DOM::Element const&);
     void pop_ancestor(DOM::Element const&);
 
 
-    NonnullRefPtr<StyleProperties> create_document_style() const;
+    StyleProperties create_document_style() const;
 
 
-    NonnullRefPtr<StyleProperties> compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
-    RefPtr<StyleProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
+    StyleProperties compute_style(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type> = {}) const;
+    Optional<StyleProperties> compute_pseudo_element_style_if_needed(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>) const;
 
 
     Vector<MatchingRule> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::Selector::PseudoElement::Type>, FlyString const& qualified_layer_name = {}) const;
     Vector<MatchingRule> collect_matching_rules(DOM::Element const&, CascadeOrigin, Optional<CSS::Selector::PseudoElement::Type>, FlyString const& qualified_layer_name = {}) const;
 
 
@@ -176,7 +176,7 @@ private:
 
 
     [[nodiscard]] bool should_reject_with_ancestor_filter(Selector const&) const;
     [[nodiscard]] bool should_reject_with_ancestor_filter(Selector const&) const;
 
 
-    RefPtr<StyleProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
+    Optional<StyleProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
     void compute_cascaded_values(StyleProperties&, DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_pseudo_element_rules, ComputeStyleMode) const;
     void compute_cascaded_values(StyleProperties&, DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_pseudo_element_rules, ComputeStyleMode) const;
     static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_ascending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
     static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_ascending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
     static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_descending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);
     static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_descending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);

+ 0 - 7
Userland/Libraries/LibWeb/CSS/StyleProperties.cpp

@@ -53,13 +53,6 @@ NonnullRefPtr<StyleProperties::Data> StyleProperties::Data::clone() const
     return clone;
     return clone;
 }
 }
 
 
-NonnullRefPtr<StyleProperties> StyleProperties::clone() const
-{
-    auto cloned = adopt_ref(*new StyleProperties);
-    cloned->m_data = m_data;
-    return cloned;
-}
-
 bool StyleProperties::is_property_important(CSS::PropertyID property_id) const
 bool StyleProperties::is_property_important(CSS::PropertyID property_id) const
 {
 {
     size_t n = to_underlying(property_id);
     size_t n = to_underlying(property_id);

+ 1 - 4
Userland/Libraries/LibWeb/CSS/StyleProperties.h

@@ -19,7 +19,7 @@
 
 
 namespace Web::CSS {
 namespace Web::CSS {
 
 
-class StyleProperties : public RefCounted<StyleProperties> {
+class StyleProperties {
 public:
 public:
     static constexpr size_t number_of_properties = to_underlying(CSS::last_property_id) + 1;
     static constexpr size_t number_of_properties = to_underlying(CSS::last_property_id) + 1;
 
 
@@ -48,9 +48,6 @@ private:
 public:
 public:
     StyleProperties() = default;
     StyleProperties() = default;
 
 
-    static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); }
-    NonnullRefPtr<StyleProperties> clone() const;
-
     template<typename Callback>
     template<typename Callback>
     inline void for_each_property(Callback callback) const
     inline void for_each_property(Callback callback) const
     {
     {

+ 19 - 19
Userland/Libraries/LibWeb/DOM/Element.cpp

@@ -385,16 +385,16 @@ Vector<String> Element::get_attribute_names() const
     return names;
     return names;
 }
 }
 
 
-JS::GCPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> Element::create_layout_node(CSS::StyleProperties style)
 {
 {
     if (local_name() == "noscript" && document().is_scripting_enabled())
     if (local_name() == "noscript" && document().is_scripting_enabled())
         return nullptr;
         return nullptr;
 
 
-    auto display = style->display();
+    auto display = style.display();
     return create_layout_node_for_display_type(document(), display, move(style), this);
     return create_layout_node_for_display_type(document(), display, move(style), this);
 }
 }
 
 
-JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, NonnullRefPtr<CSS::StyleProperties> style, Element* element)
+JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, CSS::StyleProperties style, Element* element)
 {
 {
     if (display.is_table_inside() || display.is_table_row_group() || display.is_table_header_group() || display.is_table_footer_group() || display.is_table_row())
     if (display.is_table_inside() || display.is_table_row_group() || display.is_table_header_group() || display.is_table_footer_group() || display.is_table_row())
         return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
         return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
@@ -540,14 +540,14 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
     // Tables must not inherit -libweb-* values for text-align.
     // Tables must not inherit -libweb-* values for text-align.
     // FIXME: Find the spec for this.
     // FIXME: Find the spec for this.
     if (is<HTML::HTMLTableElement>(*this)) {
     if (is<HTML::HTMLTableElement>(*this)) {
-        auto text_align = new_computed_css_values->text_align();
+        auto text_align = new_computed_css_values.text_align();
         if (text_align.has_value() && (text_align.value() == CSS::TextAlign::LibwebLeft || text_align.value() == CSS::TextAlign::LibwebCenter || text_align.value() == CSS::TextAlign::LibwebRight))
         if (text_align.has_value() && (text_align.value() == CSS::TextAlign::LibwebLeft || text_align.value() == CSS::TextAlign::LibwebCenter || text_align.value() == CSS::TextAlign::LibwebRight))
-            new_computed_css_values->set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Start));
+            new_computed_css_values.set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Start));
     }
     }
 
 
     CSS::RequiredInvalidationAfterStyleChange invalidation;
     CSS::RequiredInvalidationAfterStyleChange invalidation;
-    if (m_computed_css_values)
-        invalidation = compute_required_invalidation(*m_computed_css_values, *new_computed_css_values);
+    if (m_computed_css_values.has_value())
+        invalidation = compute_required_invalidation(*m_computed_css_values, new_computed_css_values);
     else
     else
         invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
         invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
 
 
@@ -562,9 +562,9 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
         auto new_pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed(*this, pseudo_element);
         auto new_pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed(*this, pseudo_element);
 
 
         // TODO: Can we be smarter about invalidation?
         // TODO: Can we be smarter about invalidation?
-        if (pseudo_element_style && new_pseudo_element_style) {
+        if (pseudo_element_style.has_value() && new_pseudo_element_style.has_value()) {
             invalidation |= compute_required_invalidation(*pseudo_element_style, *new_pseudo_element_style);
             invalidation |= compute_required_invalidation(*pseudo_element_style, *new_pseudo_element_style);
-        } else if (pseudo_element_style || new_pseudo_element_style) {
+        } else if (pseudo_element_style.has_value() || new_pseudo_element_style.has_value()) {
             invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
             invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
         }
         }
 
 
@@ -595,7 +595,7 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
                 continue;
                 continue;
 
 
             auto pseudo_element_style = pseudo_element_computed_css_values(pseudo_element_type);
             auto pseudo_element_style = pseudo_element_computed_css_values(pseudo_element_type);
-            if (!pseudo_element_style)
+            if (!pseudo_element_style.has_value())
                 continue;
                 continue;
 
 
             if (auto* node_with_style = dynamic_cast<Layout::NodeWithStyle*>(pseudo_element->layout_node.ptr())) {
             if (auto* node_with_style = dynamic_cast<Layout::NodeWithStyle*>(pseudo_element->layout_node.ptr())) {
@@ -609,17 +609,17 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
     return invalidation;
     return invalidation;
 }
 }
 
 
-NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> type)
+CSS::StyleProperties Element::resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> type)
 {
 {
     auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this, type);
     auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this, type);
-    auto properties = CSS::StyleProperties::create();
+    CSS::StyleProperties properties = {};
 
 
     for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
     for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
         auto property_id = (CSS::PropertyID)i;
         auto property_id = (CSS::PropertyID)i;
         auto maybe_value = element_computed_style->property(property_id);
         auto maybe_value = element_computed_style->property(property_id);
         if (!maybe_value.has_value())
         if (!maybe_value.has_value())
             continue;
             continue;
-        properties->set_property(property_id, maybe_value.release_value().value);
+        properties.set_property(property_id, maybe_value.release_value().value);
     }
     }
 
 
     return properties;
     return properties;
@@ -627,7 +627,7 @@ NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values(Optional<CSS::S
 
 
 void Element::reset_animated_css_properties()
 void Element::reset_animated_css_properties()
 {
 {
-    if (!m_computed_css_values)
+    if (!m_computed_css_values.has_value())
         return;
         return;
     m_computed_css_values->reset_animated_properties();
     m_computed_css_values->reset_animated_properties();
 }
 }
@@ -2273,25 +2273,25 @@ size_t Element::attribute_list_size() const
     return m_attributes->length();
     return m_attributes->length();
 }
 }
 
 
-void Element::set_computed_css_values(RefPtr<CSS::StyleProperties> style)
+void Element::set_computed_css_values(Optional<CSS::StyleProperties> style)
 {
 {
     m_computed_css_values = move(style);
     m_computed_css_values = move(style);
     computed_css_values_changed();
     computed_css_values_changed();
 }
 }
 
 
-void Element::set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type pseudo_element, RefPtr<CSS::StyleProperties> style)
+void Element::set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type pseudo_element, Optional<CSS::StyleProperties> style)
 {
 {
-    if (!m_pseudo_element_data && !style)
+    if (!m_pseudo_element_data && !style.has_value())
         return;
         return;
     ensure_pseudo_element(pseudo_element).computed_css_values = move(style);
     ensure_pseudo_element(pseudo_element).computed_css_values = move(style);
 }
 }
 
 
-RefPtr<CSS::StyleProperties> Element::pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type type)
+Optional<CSS::StyleProperties&> Element::pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type type)
 {
 {
     auto pseudo_element = get_pseudo_element(type);
     auto pseudo_element = get_pseudo_element(type);
     if (pseudo_element.has_value())
     if (pseudo_element.has_value())
         return pseudo_element->computed_css_values;
         return pseudo_element->computed_css_values;
-    return nullptr;
+    return {};
 }
 }
 
 
 Optional<Element::PseudoElement&> Element::get_pseudo_element(CSS::Selector::PseudoElement::Type type) const
 Optional<Element::PseudoElement&> Element::get_pseudo_element(CSS::Selector::PseudoElement::Type type) const

+ 12 - 10
Userland/Libraries/LibWeb/DOM/Element.h

@@ -6,6 +6,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <AK/Optional.h>
 #include <LibWeb/ARIA/ARIAMixin.h>
 #include <LibWeb/ARIA/ARIAMixin.h>
 #include <LibWeb/Animations/Animatable.h>
 #include <LibWeb/Animations/Animatable.h>
 #include <LibWeb/Bindings/ElementPrototype.h>
 #include <LibWeb/Bindings/ElementPrototype.h>
@@ -14,6 +15,7 @@
 #include <LibWeb/CSS/CountersSet.h>
 #include <LibWeb/CSS/CountersSet.h>
 #include <LibWeb/CSS/Selector.h>
 #include <LibWeb/CSS/Selector.h>
 #include <LibWeb/CSS/StyleInvalidation.h>
 #include <LibWeb/CSS/StyleInvalidation.h>
+#include <LibWeb/CSS/StyleProperties.h>
 #include <LibWeb/CSS/StyleProperty.h>
 #include <LibWeb/CSS/StyleProperty.h>
 #include <LibWeb/DOM/ChildNode.h>
 #include <LibWeb/DOM/ChildNode.h>
 #include <LibWeb/DOM/NonDocumentTypeChildNode.h>
 #include <LibWeb/DOM/NonDocumentTypeChildNode.h>
@@ -183,13 +185,13 @@ public:
     JS::GCPtr<Layout::NodeWithStyle> layout_node();
     JS::GCPtr<Layout::NodeWithStyle> layout_node();
     JS::GCPtr<Layout::NodeWithStyle const> layout_node() const;
     JS::GCPtr<Layout::NodeWithStyle const> layout_node() const;
 
 
-    CSS::StyleProperties* computed_css_values() { return m_computed_css_values.ptr(); }
-    CSS::StyleProperties const* computed_css_values() const { return m_computed_css_values.ptr(); }
-    void set_computed_css_values(RefPtr<CSS::StyleProperties>);
-    NonnullRefPtr<CSS::StyleProperties> resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> = {});
+    Optional<CSS::StyleProperties>& computed_css_values() { return m_computed_css_values; }
+    Optional<CSS::StyleProperties> const& computed_css_values() const { return m_computed_css_values; }
+    void set_computed_css_values(Optional<CSS::StyleProperties>);
+    CSS::StyleProperties resolved_css_values(Optional<CSS::Selector::PseudoElement::Type> = {});
 
 
-    void set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type, RefPtr<CSS::StyleProperties>);
-    RefPtr<CSS::StyleProperties> pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type);
+    void set_pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type, Optional<CSS::StyleProperties>);
+    Optional<CSS::StyleProperties&> pseudo_element_computed_css_values(CSS::Selector::PseudoElement::Type);
 
 
     void reset_animated_css_properties();
     void reset_animated_css_properties();
 
 
@@ -235,13 +237,13 @@ public:
     JS::NonnullGCPtr<Geometry::DOMRect> get_bounding_client_rect() const;
     JS::NonnullGCPtr<Geometry::DOMRect> get_bounding_client_rect() const;
     JS::NonnullGCPtr<Geometry::DOMRectList> get_client_rects() const;
     JS::NonnullGCPtr<Geometry::DOMRectList> get_client_rects() const;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>);
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties);
     virtual void adjust_computed_style(CSS::StyleProperties&) { }
     virtual void adjust_computed_style(CSS::StyleProperties&) { }
 
 
     virtual void did_receive_focus() { }
     virtual void did_receive_focus() { }
     virtual void did_lose_focus() { }
     virtual void did_lose_focus() { }
 
 
-    static JS::GCPtr<Layout::NodeWithStyle> create_layout_node_for_display_type(DOM::Document&, CSS::Display const&, NonnullRefPtr<CSS::StyleProperties>, Element*);
+    static JS::GCPtr<Layout::NodeWithStyle> create_layout_node_for_display_type(DOM::Document&, CSS::Display const&, CSS::StyleProperties, Element*);
 
 
     void set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::Selector::PseudoElement::Type, JS::GCPtr<Layout::NodeWithStyle>);
     void set_pseudo_element_node(Badge<Layout::TreeBuilder>, CSS::Selector::PseudoElement::Type, JS::GCPtr<Layout::NodeWithStyle>);
     JS::GCPtr<Layout::NodeWithStyle> get_pseudo_element_node(CSS::Selector::PseudoElement::Type) const;
     JS::GCPtr<Layout::NodeWithStyle> get_pseudo_element_node(CSS::Selector::PseudoElement::Type) const;
@@ -456,12 +458,12 @@ private:
     JS::GCPtr<DOMTokenList> m_class_list;
     JS::GCPtr<DOMTokenList> m_class_list;
     JS::GCPtr<ShadowRoot> m_shadow_root;
     JS::GCPtr<ShadowRoot> m_shadow_root;
 
 
-    RefPtr<CSS::StyleProperties> m_computed_css_values;
+    Optional<CSS::StyleProperties> m_computed_css_values;
     HashMap<FlyString, CSS::StyleProperty> m_custom_properties;
     HashMap<FlyString, CSS::StyleProperty> m_custom_properties;
 
 
     struct PseudoElement {
     struct PseudoElement {
         JS::GCPtr<Layout::NodeWithStyle> layout_node;
         JS::GCPtr<Layout::NodeWithStyle> layout_node;
-        RefPtr<CSS::StyleProperties> computed_css_values;
+        Optional<CSS::StyleProperties> computed_css_values;
         HashMap<FlyString, CSS::StyleProperty> custom_properties;
         HashMap<FlyString, CSS::StyleProperty> custom_properties;
     };
     };
     // TODO: CSS::Selector::PseudoElement::Type includes a lot of pseudo-elements that exist in shadow trees,
     // TODO: CSS::Selector::PseudoElement::Type includes a lot of pseudo-elements that exist in shadow trees,

+ 1 - 1
Userland/Libraries/LibWeb/Dump.cpp

@@ -394,7 +394,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
         }
         }
     }
     }
 
 
-    if (show_specified_style && layout_node.dom_node() && layout_node.dom_node()->is_element() && verify_cast<DOM::Element>(layout_node.dom_node())->computed_css_values()) {
+    if (show_specified_style && layout_node.dom_node() && layout_node.dom_node()->is_element() && verify_cast<DOM::Element>(layout_node.dom_node())->computed_css_values().has_value()) {
         struct NameAndValue {
         struct NameAndValue {
             FlyString name;
             FlyString name;
             String value;
             String value;

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp

@@ -28,7 +28,7 @@ void HTMLAudioElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::AudioBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::AudioBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h

@@ -25,7 +25,7 @@ private:
 
 
     virtual void initialize(JS::Realm&) override;
     virtual void initialize(JS::Realm&) override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     virtual void on_playing() override;
     virtual void on_playing() override;
     virtual void on_paused() override;
     virtual void on_paused() override;

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp

@@ -26,7 +26,7 @@ void HTMLBRElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBRElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBRElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLBRElement.h

@@ -17,7 +17,7 @@ class HTMLBRElement final : public HTMLElement {
 public:
 public:
     virtual ~HTMLBRElement() override;
     virtual ~HTMLBRElement() override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
 private:
 private:
     virtual bool is_html_br_element() const override { return true; }
     virtual bool is_html_br_element() const override { return true; }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp

@@ -128,7 +128,7 @@ WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
     return {};
     return {};
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::CanvasBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::CanvasBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h

@@ -47,7 +47,7 @@ private:
 
 
     virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
     virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     enum class HasOrCreatedContext {
     enum class HasOrCreatedContext {
         No,
         No,

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp

@@ -32,7 +32,7 @@ void HTMLIFrameElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLIFrameElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLIFrameElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h

@@ -23,7 +23,7 @@ class HTMLIFrameElement final
 public:
 public:
     virtual ~HTMLIFrameElement() override;
     virtual ~HTMLIFrameElement() override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     void set_current_navigation_was_lazy_loaded(bool value);
     void set_current_navigation_was_lazy_loaded(bool value);
 
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp

@@ -110,7 +110,7 @@ void HTMLImageElement::form_associated_element_attribute_changed(FlyString const
     }
     }
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLImageElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
     return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLImageElement.h

@@ -123,7 +123,7 @@ private:
     // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:dimension-attributes
     // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:dimension-attributes
     virtual bool supports_dimension_attributes() const override { return true; }
     virtual bool supports_dimension_attributes() const override { return true; }
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     virtual void did_set_viewport_rect(CSSPixelRect const&) override;
     virtual void did_set_viewport_rect(CSSPixelRect const&) override;
 
 

+ 4 - 4
Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp

@@ -98,7 +98,7 @@ JS::NonnullGCPtr<ValidityState const> HTMLInputElement::validity() const
     return vm.heap().allocate<ValidityState>(realm, realm);
     return vm.heap().allocate<ValidityState>(realm, realm);
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     if (type_state() == TypeAttributeState::Hidden)
     if (type_state() == TypeAttributeState::Hidden)
         return nullptr;
         return nullptr;
@@ -113,8 +113,8 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
     // This specification introduces the appearance property to provide some control over this behavior.
     // This specification introduces the appearance property to provide some control over this behavior.
     // In particular, using appearance: none allows authors to suppress the native appearance of widgets,
     // In particular, using appearance: none allows authors to suppress the native appearance of widgets,
     // giving them a primitive appearance where CSS can be used to restyle them.
     // giving them a primitive appearance where CSS can be used to restyle them.
-    if (style->appearance() == CSS::Appearance::None) {
-        return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
+    if (style.appearance() == CSS::Appearance::None) {
+        return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
     }
     }
 
 
     if (type_state() == TypeAttributeState::SubmitButton || type_state() == TypeAttributeState::Button || type_state() == TypeAttributeState::ResetButton)
     if (type_state() == TypeAttributeState::SubmitButton || type_state() == TypeAttributeState::Button || type_state() == TypeAttributeState::ResetButton)
@@ -126,7 +126,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
     if (type_state() == TypeAttributeState::RadioButton)
     if (type_state() == TypeAttributeState::RadioButton)
         return heap().allocate_without_realm<Layout::RadioButton>(document(), *this, move(style));
         return heap().allocate_without_realm<Layout::RadioButton>(document(), *this, move(style));
 
 
-    return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
+    return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
 }
 }
 
 
 void HTMLInputElement::adjust_computed_style(CSS::StyleProperties& style)
 void HTMLInputElement::adjust_computed_style(CSS::StyleProperties& style)

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLInputElement.h

@@ -59,7 +59,7 @@ class HTMLInputElement final
 public:
 public:
     virtual ~HTMLInputElement() override;
     virtual ~HTMLInputElement() override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
     virtual void adjust_computed_style(CSS::StyleProperties&) override;
     virtual void adjust_computed_style(CSS::StyleProperties&) override;
 
 
     enum class TypeAttributeState {
     enum class TypeAttributeState {

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp

@@ -27,7 +27,7 @@ void HTMLLabelElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLabelElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLabelElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::Label>(document(), this, move(style));
     return heap().allocate_without_realm<Layout::Label>(document(), this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h

@@ -17,7 +17,7 @@ class HTMLLabelElement final : public HTMLElement {
 public:
 public:
     virtual ~HTMLLabelElement() override;
     virtual ~HTMLLabelElement() override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     Optional<String> for_() const { return attribute(HTML::AttributeNames::for_); }
     Optional<String> for_() const { return attribute(HTML::AttributeNames::for_); }
 
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp

@@ -136,7 +136,7 @@ String HTMLObjectElement::data() const
     return MUST(document().parse_url(*data).to_string());
     return MUST(document().parse_url(*data).to_string());
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     switch (m_representation) {
     switch (m_representation) {
     case Representation::Children:
     case Representation::Children:

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h

@@ -58,7 +58,7 @@ private:
 
 
     virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
     virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const;
     bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const;
 
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp

@@ -62,7 +62,7 @@ void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String>
     }
     }
 }
 }
 
 
-JS::GCPtr<Layout::Node> HTMLVideoElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> HTMLVideoElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::VideoBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::VideoBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h

@@ -60,7 +60,7 @@ private:
     // https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
     // https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
     virtual bool supports_dimension_attributes() const override { return true; }
     virtual bool supports_dimension_attributes() const override { return true; }
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     virtual void on_playing() override;
     virtual void on_playing() override;
     virtual void on_paused() override;
     virtual void on_paused() override;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/AudioBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(AudioBox);
 JS_DEFINE_ALLOCATOR(AudioBox);
 
 
-AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
+AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
     : ReplacedBox(document, element, move(style))
     : ReplacedBox(document, element, move(style))
 {
 {
     set_natural_width(300);
     set_natural_width(300);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/AudioBox.h

@@ -23,7 +23,7 @@ public:
     virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
     virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
 
 
 private:
 private:
-    AudioBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
+    AudioBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
 };
 };
 
 
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/BlockContainer.cpp

@@ -9,7 +9,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
+BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
     : Box(document, node, move(style))
     : Box(document, node, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/BlockContainer.h

@@ -16,7 +16,7 @@ class BlockContainer : public Box {
     JS_CELL(BlockContainer, Box);
     JS_CELL(BlockContainer, Box);
 
 
 public:
 public:
-    BlockContainer(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
+    BlockContainer(DOM::Document&, DOM::Node*, CSS::StyleProperties);
     BlockContainer(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     BlockContainer(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     virtual ~BlockContainer() override;
     virtual ~BlockContainer() override;
 
 

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Box.cpp

@@ -14,7 +14,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-Box::Box(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
+Box::Box(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
     : NodeWithStyleAndBoxModelMetrics(document, node, move(style))
     : NodeWithStyleAndBoxModelMetrics(document, node, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Box.h

@@ -55,7 +55,7 @@ public:
     virtual void visit_edges(Cell::Visitor&) override;
     virtual void visit_edges(Cell::Visitor&) override;
 
 
 protected:
 protected:
-    Box(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
+    Box(DOM::Document&, DOM::Node*, CSS::StyleProperties);
     Box(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     Box(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
 
 
 private:
 private:

+ 1 - 1
Userland/Libraries/LibWeb/Layout/BreakNode.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(BreakNode);
 JS_DEFINE_ALLOCATOR(BreakNode);
 
 
-BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, CSS::StyleProperties style)
     : Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))
     : Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/BreakNode.h

@@ -16,7 +16,7 @@ class BreakNode final : public NodeWithStyleAndBoxModelMetrics {
     JS_DECLARE_ALLOCATOR(BreakNode);
     JS_DECLARE_ALLOCATOR(BreakNode);
 
 
 public:
 public:
-    BreakNode(DOM::Document&, HTML::HTMLBRElement&, NonnullRefPtr<CSS::StyleProperties>);
+    BreakNode(DOM::Document&, HTML::HTMLBRElement&, CSS::StyleProperties);
     virtual ~BreakNode() override;
     virtual ~BreakNode() override;
 
 
     const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
     const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/CanvasBox.cpp

@@ -11,7 +11,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(CanvasBox);
 JS_DEFINE_ALLOCATOR(CanvasBox);
 
 
-CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, CSS::StyleProperties style)
     : ReplacedBox(document, element, move(style))
     : ReplacedBox(document, element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/CanvasBox.h

@@ -16,7 +16,7 @@ class CanvasBox final : public ReplacedBox {
     JS_DECLARE_ALLOCATOR(CanvasBox);
     JS_DECLARE_ALLOCATOR(CanvasBox);
 
 
 public:
 public:
-    CanvasBox(DOM::Document&, HTML::HTMLCanvasElement&, NonnullRefPtr<CSS::StyleProperties>);
+    CanvasBox(DOM::Document&, HTML::HTMLCanvasElement&, CSS::StyleProperties);
     virtual ~CanvasBox() override;
     virtual ~CanvasBox() override;
 
 
     virtual void prepare_for_replaced_layout() override;
     virtual void prepare_for_replaced_layout() override;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/CheckBox.cpp

@@ -13,7 +13,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(CheckBox);
 JS_DEFINE_ALLOCATOR(CheckBox);
 
 
-CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+CheckBox::CheckBox(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
     : FormAssociatedLabelableNode(document, element, move(style))
     : FormAssociatedLabelableNode(document, element, move(style))
 {
 {
     set_natural_width(13);
     set_natural_width(13);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/CheckBox.h

@@ -16,7 +16,7 @@ class CheckBox final : public FormAssociatedLabelableNode {
     JS_DECLARE_ALLOCATOR(CheckBox);
     JS_DECLARE_ALLOCATOR(CheckBox);
 
 
 public:
 public:
-    CheckBox(DOM::Document&, HTML::HTMLInputElement&, NonnullRefPtr<CSS::StyleProperties>);
+    CheckBox(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
     virtual ~CheckBox() override;
     virtual ~CheckBox() override;
 
 
 private:
 private:

+ 1 - 1
Userland/Libraries/LibWeb/Layout/FormAssociatedLabelableNode.h

@@ -21,7 +21,7 @@ public:
     HTML::FormAssociatedElement& dom_node() { return dynamic_cast<HTML::FormAssociatedElement&>(LabelableNode::dom_node()); }
     HTML::FormAssociatedElement& dom_node() { return dynamic_cast<HTML::FormAssociatedElement&>(LabelableNode::dom_node()); }
 
 
 protected:
 protected:
-    FormAssociatedLabelableNode(DOM::Document& document, HTML::FormAssociatedElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+    FormAssociatedLabelableNode(DOM::Document& document, HTML::FormAssociatedElement& element, CSS::StyleProperties style)
         : LabelableNode(document, element.form_associated_element_to_html_element(), move(style))
         : LabelableNode(document, element.form_associated_element_to_html_element(), move(style))
     {
     {
     }
     }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/FrameBox.cpp

@@ -13,7 +13,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(FrameBox);
 JS_DEFINE_ALLOCATOR(FrameBox);
 
 
-FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
+FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
     : ReplacedBox(document, element, move(style))
     : ReplacedBox(document, element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/FrameBox.h

@@ -16,7 +16,7 @@ class FrameBox final : public ReplacedBox {
     JS_DECLARE_ALLOCATOR(FrameBox);
     JS_DECLARE_ALLOCATOR(FrameBox);
 
 
 public:
 public:
-    FrameBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
+    FrameBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
     virtual ~FrameBox() override;
     virtual ~FrameBox() override;
 
 
     virtual void prepare_for_replaced_layout() override;
     virtual void prepare_for_replaced_layout() override;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ImageBox.cpp

@@ -15,7 +15,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(ImageBox);
 JS_DEFINE_ALLOCATOR(ImageBox);
 
 
-ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, ImageProvider const& image_provider)
+ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style, ImageProvider const& image_provider)
     : ReplacedBox(document, element, move(style))
     : ReplacedBox(document, element, move(style))
     , m_image_provider(image_provider)
     , m_image_provider(image_provider)
 {
 {

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ImageBox.h

@@ -16,7 +16,7 @@ class ImageBox final : public ReplacedBox {
     JS_DECLARE_ALLOCATOR(ImageBox);
     JS_DECLARE_ALLOCATOR(ImageBox);
 
 
 public:
 public:
-    ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, ImageProvider const&);
+    ImageBox(DOM::Document&, DOM::Element&, CSS::StyleProperties, ImageProvider const&);
     virtual ~ImageBox() override;
     virtual ~ImageBox() override;
 
 
     virtual void prepare_for_replaced_layout() override;
     virtual void prepare_for_replaced_layout() override;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/InlineNode.cpp

@@ -16,7 +16,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(InlineNode);
 JS_DEFINE_ALLOCATOR(InlineNode);
 
 
-InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
+InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
     : Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style))
     : Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/InlineNode.h

@@ -15,7 +15,7 @@ class InlineNode final : public NodeWithStyleAndBoxModelMetrics {
     JS_DECLARE_ALLOCATOR(InlineNode);
     JS_DECLARE_ALLOCATOR(InlineNode);
 
 
 public:
 public:
-    InlineNode(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
+    InlineNode(DOM::Document&, DOM::Element*, CSS::StyleProperties);
     virtual ~InlineNode() override;
     virtual ~InlineNode() override;
 
 
     JS::GCPtr<Painting::PaintableWithLines> create_paintable_for_line_with_index(size_t line_index) const;
     JS::GCPtr<Painting::PaintableWithLines> create_paintable_for_line_with_index(size_t line_index) const;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Label.cpp

@@ -17,7 +17,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(Label);
 JS_DEFINE_ALLOCATOR(Label);
 
 
-Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, NonnullRefPtr<CSS::StyleProperties> style)
+Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, CSS::StyleProperties style)
     : BlockContainer(document, element, move(style))
     : BlockContainer(document, element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Label.h

@@ -16,7 +16,7 @@ class Label final : public BlockContainer {
     JS_DECLARE_ALLOCATOR(Label);
     JS_DECLARE_ALLOCATOR(Label);
 
 
 public:
 public:
-    Label(DOM::Document&, HTML::HTMLLabelElement*, NonnullRefPtr<CSS::StyleProperties>);
+    Label(DOM::Document&, HTML::HTMLLabelElement*, CSS::StyleProperties);
     virtual ~Label() override;
     virtual ~Label() override;
 
 
     static bool is_inside_associated_label(LabelableNode const&, CSSPixelPoint);
     static bool is_inside_associated_label(LabelableNode const&, CSSPixelPoint);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/LabelableNode.h

@@ -19,7 +19,7 @@ public:
     Painting::LabelablePaintable const* paintable() const;
     Painting::LabelablePaintable const* paintable() const;
 
 
 protected:
 protected:
-    LabelableNode(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
+    LabelableNode(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
         : ReplacedBox(document, element, move(style))
         : ReplacedBox(document, element, move(style))
     {
     {
     }
     }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ListItemBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(ListItemBox);
 JS_DEFINE_ALLOCATOR(ListItemBox);
 
 
-ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
+ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, CSS::StyleProperties style)
     : Layout::BlockContainer(document, element, move(style))
     : Layout::BlockContainer(document, element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ListItemBox.h

@@ -16,7 +16,7 @@ class ListItemBox final : public BlockContainer {
     JS_DECLARE_ALLOCATOR(ListItemBox);
     JS_DECLARE_ALLOCATOR(ListItemBox);
 
 
 public:
 public:
-    ListItemBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
+    ListItemBox(DOM::Document&, DOM::Element*, CSS::StyleProperties);
     virtual ~ListItemBox() override;
     virtual ~ListItemBox() override;
 
 
     DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockContainer::dom_node()); }
     DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockContainer::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(ListItemMarkerBox);
 JS_DEFINE_ALLOCATOR(ListItemMarkerBox);
 
 
-ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, CSS::ListStylePosition style_position, size_t index, NonnullRefPtr<CSS::StyleProperties> style)
+ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, CSS::ListStylePosition style_position, size_t index, CSS::StyleProperties style)
     : Box(document, nullptr, move(style))
     : Box(document, nullptr, move(style))
     , m_list_style_type(style_type)
     , m_list_style_type(style_type)
     , m_list_style_position(style_position)
     , m_list_style_position(style_position)

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ListItemMarkerBox.h

@@ -16,7 +16,7 @@ class ListItemMarkerBox final : public Box {
     JS_DECLARE_ALLOCATOR(ListItemMarkerBox);
     JS_DECLARE_ALLOCATOR(ListItemMarkerBox);
 
 
 public:
 public:
-    explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, NonnullRefPtr<CSS::StyleProperties>);
+    explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, CSS::StyleProperties);
     virtual ~ListItemMarkerBox() override;
     virtual ~ListItemMarkerBox() override;
 
 
     Optional<ByteString> const& text() const { return m_text; }
     Optional<ByteString> const& text() const { return m_text; }

+ 2 - 2
Userland/Libraries/LibWeb/Layout/Node.cpp

@@ -261,12 +261,12 @@ bool Node::is_sticky_position() const
     return position == CSS::Positioning::Sticky;
     return position == CSS::Positioning::Sticky;
 }
 }
 
 
-NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> computed_style)
+NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, CSS::StyleProperties computed_style)
     : Node(document, node)
     : Node(document, node)
     , m_computed_values(make<CSS::ComputedValues>())
     , m_computed_values(make<CSS::ComputedValues>())
 {
 {
     m_has_style = true;
     m_has_style = true;
-    apply_style(*computed_style);
+    apply_style(computed_style);
 }
 }
 
 
 NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullOwnPtr<CSS::ComputedValues> computed_values)
 NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullOwnPtr<CSS::ComputedValues> computed_values)

+ 2 - 2
Userland/Libraries/LibWeb/Layout/Node.h

@@ -228,7 +228,7 @@ public:
     virtual void visit_edges(Cell::Visitor& visitor) override;
     virtual void visit_edges(Cell::Visitor& visitor) override;
 
 
 protected:
 protected:
-    NodeWithStyle(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
+    NodeWithStyle(DOM::Document&, DOM::Node*, CSS::StyleProperties);
     NodeWithStyle(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     NodeWithStyle(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
 
 
 private:
 private:
@@ -247,7 +247,7 @@ public:
     BoxModelMetrics const& box_model() const { return m_box_model; }
     BoxModelMetrics const& box_model() const { return m_box_model; }
 
 
 protected:
 protected:
-    NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
+    NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
         : NodeWithStyle(document, node, move(style))
         : NodeWithStyle(document, node, move(style))
     {
     {
     }
     }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/RadioButton.cpp

@@ -14,7 +14,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(RadioButton);
 JS_DEFINE_ALLOCATOR(RadioButton);
 
 
-RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
     : FormAssociatedLabelableNode(document, element, move(style))
     : FormAssociatedLabelableNode(document, element, move(style))
 {
 {
     set_natural_width(12);
     set_natural_width(12);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/RadioButton.h

@@ -16,7 +16,7 @@ class RadioButton final : public FormAssociatedLabelableNode {
     JS_DECLARE_ALLOCATOR(RadioButton);
     JS_DECLARE_ALLOCATOR(RadioButton);
 
 
 public:
 public:
-    RadioButton(DOM::Document&, HTML::HTMLInputElement&, NonnullRefPtr<CSS::StyleProperties>);
+    RadioButton(DOM::Document&, HTML::HTMLInputElement&, CSS::StyleProperties);
     virtual ~RadioButton() override;
     virtual ~RadioButton() override;
 
 
 private:
 private:

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp

@@ -11,7 +11,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-ReplacedBox::ReplacedBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
+ReplacedBox::ReplacedBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
     : Box(document, &element, move(style))
     : Box(document, &element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ReplacedBox.h

@@ -15,7 +15,7 @@ class ReplacedBox : public Box {
     JS_CELL(ReplacedBox, Box);
     JS_CELL(ReplacedBox, Box);
 
 
 public:
 public:
-    ReplacedBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
+    ReplacedBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
     virtual ~ReplacedBox() override;
     virtual ~ReplacedBox() override;
 
 
     DOM::Element const& dom_node() const { return verify_cast<DOM::Element>(*Node::dom_node()); }
     DOM::Element const& dom_node() const { return verify_cast<DOM::Element>(*Node::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGBox.cpp

@@ -8,7 +8,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, NonnullRefPtr<CSS::StyleProperties> style)
+SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, CSS::StyleProperties style)
     : Box(document, &element, move(style))
     : Box(document, &element, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGBox.h

@@ -16,7 +16,7 @@ class SVGBox : public Box {
     JS_CELL(SVGBox, Box);
     JS_CELL(SVGBox, Box);
 
 
 public:
 public:
-    SVGBox(DOM::Document&, SVG::SVGElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGBox(DOM::Document&, SVG::SVGElement&, CSS::StyleProperties);
     virtual ~SVGBox() override = default;
     virtual ~SVGBox() override = default;
 
 
     SVG::SVGElement& dom_node() { return verify_cast<SVG::SVGElement>(*Box::dom_node()); }
     SVG::SVGElement& dom_node() { return verify_cast<SVG::SVGElement>(*Box::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGClipBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGClipBox);
 JS_DEFINE_ALLOCATOR(SVGClipBox);
 
 
-SVGClipBox::SVGClipBox(DOM::Document& document, SVG::SVGClipPathElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGClipBox::SVGClipBox(DOM::Document& document, SVG::SVGClipPathElement& element, CSS::StyleProperties properties)
     : SVGBox(document, element, properties)
     : SVGBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGClipBox.h

@@ -17,7 +17,7 @@ class SVGClipBox : public SVGBox {
     JS_DECLARE_ALLOCATOR(SVGClipBox);
     JS_DECLARE_ALLOCATOR(SVGClipBox);
 
 
 public:
 public:
-    SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGClipBox(DOM::Document&, SVG::SVGClipPathElement&, CSS::StyleProperties);
     virtual ~SVGClipBox() override = default;
     virtual ~SVGClipBox() override = default;
 
 
     SVG::SVGClipPathElement& dom_node() { return verify_cast<SVG::SVGClipPathElement>(SVGBox::dom_node()); }
     SVG::SVGClipPathElement& dom_node() { return verify_cast<SVG::SVGClipPathElement>(SVGBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGForeignObjectBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGForeignObjectBox);
 JS_DEFINE_ALLOCATOR(SVGForeignObjectBox);
 
 
-SVGForeignObjectBox::SVGForeignObjectBox(DOM::Document& document, SVG::SVGForeignObjectElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGForeignObjectBox::SVGForeignObjectBox(DOM::Document& document, SVG::SVGForeignObjectElement& element, CSS::StyleProperties properties)
     : BlockContainer(document, &element, properties)
     : BlockContainer(document, &element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGForeignObjectBox.h

@@ -18,7 +18,7 @@ class SVGForeignObjectBox final : public BlockContainer {
     JS_DECLARE_ALLOCATOR(SVGForeignObjectBox);
     JS_DECLARE_ALLOCATOR(SVGForeignObjectBox);
 
 
 public:
 public:
-    SVGForeignObjectBox(DOM::Document&, SVG::SVGForeignObjectElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGForeignObjectBox(DOM::Document&, SVG::SVGForeignObjectElement&, CSS::StyleProperties);
     virtual ~SVGForeignObjectBox() override = default;
     virtual ~SVGForeignObjectBox() override = default;
 
 
     SVG::SVGForeignObjectElement& dom_node() { return static_cast<SVG::SVGForeignObjectElement&>(*BlockContainer::dom_node()); }
     SVG::SVGForeignObjectElement& dom_node() { return static_cast<SVG::SVGForeignObjectElement&>(*BlockContainer::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp

@@ -14,7 +14,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGGeometryBox);
 JS_DEFINE_ALLOCATOR(SVGGeometryBox);
 
 
-SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, CSS::StyleProperties properties)
     : SVGGraphicsBox(document, element, properties)
     : SVGGraphicsBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h

@@ -17,7 +17,7 @@ class SVGGeometryBox final : public SVGGraphicsBox {
     JS_DECLARE_ALLOCATOR(SVGGeometryBox);
     JS_DECLARE_ALLOCATOR(SVGGeometryBox);
 
 
 public:
 public:
-    SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, CSS::StyleProperties);
     virtual ~SVGGeometryBox() override = default;
     virtual ~SVGGeometryBox() override = default;
 
 
     SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }
     SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGGraphicsBox.cpp

@@ -10,7 +10,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement& element, CSS::StyleProperties properties)
     : SVGBox(document, element, properties)
     : SVGBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGGraphicsBox.h

@@ -16,7 +16,7 @@ class SVGGraphicsBox : public SVGBox {
     JS_CELL(SVGGraphicsBox, SVGBox);
     JS_CELL(SVGGraphicsBox, SVGBox);
 
 
 public:
 public:
-    SVGGraphicsBox(DOM::Document&, SVG::SVGGraphicsElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGGraphicsBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
     virtual ~SVGGraphicsBox() override = default;
     virtual ~SVGGraphicsBox() override = default;
 
 
     SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
     SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGImageBox.cpp

@@ -11,7 +11,7 @@
 
 
 namespace Web::Layout {
 namespace Web::Layout {
 
 
-SVGImageBox::SVGImageBox(DOM::Document& document, SVG::SVGGraphicsElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGImageBox::SVGImageBox(DOM::Document& document, SVG::SVGGraphicsElement& element, CSS::StyleProperties properties)
     : SVGGraphicsBox(document, element, properties)
     : SVGGraphicsBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGImageBox.h

@@ -16,7 +16,7 @@ class SVGImageBox : public SVGGraphicsBox {
     JS_CELL(SVGImageBox, SVGGraphicsBox);
     JS_CELL(SVGImageBox, SVGGraphicsBox);
 
 
 public:
 public:
-    SVGImageBox(DOM::Document&, SVG::SVGGraphicsElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGImageBox(DOM::Document&, SVG::SVGGraphicsElement&, CSS::StyleProperties);
     virtual ~SVGImageBox() override = default;
     virtual ~SVGImageBox() override = default;
 
 
     SVG::SVGImageElement& dom_node() { return static_cast<SVG::SVGImageElement&>(SVGGraphicsBox::dom_node()); }
     SVG::SVGImageElement& dom_node() { return static_cast<SVG::SVGImageElement&>(SVGGraphicsBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGMaskBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGMaskBox);
 JS_DEFINE_ALLOCATOR(SVGMaskBox);
 
 
-SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, CSS::StyleProperties properties)
     : SVGGraphicsBox(document, element, properties)
     : SVGGraphicsBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGMaskBox.h

@@ -17,7 +17,7 @@ class SVGMaskBox : public SVGGraphicsBox {
     JS_DECLARE_ALLOCATOR(SVGMaskBox);
     JS_DECLARE_ALLOCATOR(SVGMaskBox);
 
 
 public:
 public:
-    SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGMaskBox(DOM::Document&, SVG::SVGMaskElement&, CSS::StyleProperties);
     virtual ~SVGMaskBox() override = default;
     virtual ~SVGMaskBox() override = default;
 
 
     virtual bool is_svg_mask_box() const override { return true; }
     virtual bool is_svg_mask_box() const override { return true; }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp

@@ -15,7 +15,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGSVGBox);
 JS_DEFINE_ALLOCATOR(SVGSVGBox);
 
 
-SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, CSS::StyleProperties properties)
     : ReplacedBox(document, element, move(properties))
     : ReplacedBox(document, element, move(properties))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGSVGBox.h

@@ -16,7 +16,7 @@ class SVGSVGBox final : public ReplacedBox {
     JS_DECLARE_ALLOCATOR(SVGSVGBox);
     JS_DECLARE_ALLOCATOR(SVGSVGBox);
 
 
 public:
 public:
-    SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, CSS::StyleProperties);
     virtual ~SVGSVGBox() override = default;
     virtual ~SVGSVGBox() override = default;
 
 
     SVG::SVGSVGElement& dom_node() { return verify_cast<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }
     SVG::SVGSVGElement& dom_node() { return verify_cast<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGTextBox);
 JS_DEFINE_ALLOCATOR(SVGTextBox);
 
 
-SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& element, CSS::StyleProperties properties)
     : SVGGraphicsBox(document, element, properties)
     : SVGGraphicsBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGTextBox.h

@@ -17,7 +17,7 @@ class SVGTextBox final : public SVGGraphicsBox {
     JS_DECLARE_ALLOCATOR(SVGTextBox);
     JS_DECLARE_ALLOCATOR(SVGTextBox);
 
 
 public:
 public:
-    SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGTextBox(DOM::Document&, SVG::SVGTextPositioningElement&, CSS::StyleProperties);
     virtual ~SVGTextBox() override = default;
     virtual ~SVGTextBox() override = default;
 
 
     SVG::SVGTextPositioningElement& dom_node() { return static_cast<SVG::SVGTextPositioningElement&>(SVGGraphicsBox::dom_node()); }
     SVG::SVGTextPositioningElement& dom_node() { return static_cast<SVG::SVGTextPositioningElement&>(SVGGraphicsBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGTextPathBox.cpp

@@ -11,7 +11,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(SVGTextPathBox);
 JS_DEFINE_ALLOCATOR(SVGTextPathBox);
 
 
-SVGTextPathBox::SVGTextPathBox(DOM::Document& document, SVG::SVGTextPathElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
+SVGTextPathBox::SVGTextPathBox(DOM::Document& document, SVG::SVGTextPathElement& element, CSS::StyleProperties properties)
     : SVGGraphicsBox(document, element, properties)
     : SVGGraphicsBox(document, element, properties)
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/SVGTextPathBox.h

@@ -16,7 +16,7 @@ class SVGTextPathBox final : public SVGGraphicsBox {
     JS_DECLARE_ALLOCATOR(SVGTextPathBox);
     JS_DECLARE_ALLOCATOR(SVGTextPathBox);
 
 
 public:
 public:
-    SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, NonnullRefPtr<CSS::StyleProperties>);
+    SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, CSS::StyleProperties);
     virtual ~SVGTextPathBox() override = default;
     virtual ~SVGTextPathBox() override = default;
 
 
     SVG::SVGTextPathElement& dom_node() { return static_cast<SVG::SVGTextPathElement&>(SVGGraphicsBox::dom_node()); }
     SVG::SVGTextPathElement& dom_node() { return static_cast<SVG::SVGTextPathElement&>(SVGGraphicsBox::dom_node()); }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/TableWrapper.cpp

@@ -10,7 +10,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(TableWrapper);
 JS_DEFINE_ALLOCATOR(TableWrapper);
 
 
-TableWrapper::TableWrapper(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
+TableWrapper::TableWrapper(DOM::Document& document, DOM::Node* node, CSS::StyleProperties style)
     : BlockContainer(document, node, move(style))
     : BlockContainer(document, node, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/TableWrapper.h

@@ -15,7 +15,7 @@ class TableWrapper : public BlockContainer {
     JS_DECLARE_ALLOCATOR(TableWrapper);
     JS_DECLARE_ALLOCATOR(TableWrapper);
 
 
 public:
 public:
-    TableWrapper(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
+    TableWrapper(DOM::Document&, DOM::Node*, CSS::StyleProperties);
     TableWrapper(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     TableWrapper(DOM::Document&, DOM::Node*, NonnullOwnPtr<CSS::ComputedValues>);
     virtual ~TableWrapper() override;
     virtual ~TableWrapper() override;
 
 

+ 4 - 4
Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp

@@ -193,7 +193,7 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
     auto& document = element.document();
     auto& document = element.document();
 
 
     auto pseudo_element_style = element.pseudo_element_computed_css_values(pseudo_element);
     auto pseudo_element_style = element.pseudo_element_computed_css_values(pseudo_element);
-    if (!pseudo_element_style)
+    if (!pseudo_element_style.has_value())
         return;
         return;
 
 
     auto initial_quote_nesting_level = m_quote_nesting_level;
     auto initial_quote_nesting_level = m_quote_nesting_level;
@@ -221,7 +221,7 @@ void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Se
             pseudo_element_node->computed_values().list_style_type(),
             pseudo_element_node->computed_values().list_style_type(),
             pseudo_element_node->computed_values().list_style_position(),
             pseudo_element_node->computed_values().list_style_position(),
             0,
             0,
-            *marker_style);
+            marker_style);
         static_cast<ListItemBox&>(*pseudo_element_node).set_marker(list_item_marker);
         static_cast<ListItemBox&>(*pseudo_element_node).set_marker(list_item_marker);
         element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
         element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
         pseudo_element_node->append_child(*list_item_marker);
         pseudo_element_node->append_child(*list_item_marker);
@@ -341,7 +341,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
 
 
     auto& document = dom_node.document();
     auto& document = dom_node.document();
     auto& style_computer = document.style_computer();
     auto& style_computer = document.style_computer();
-    RefPtr<CSS::StyleProperties> style;
+    Optional<CSS::StyleProperties> style;
     CSS::Display display;
     CSS::Display display;
 
 
     if (is<DOM::Element>(dom_node)) {
     if (is<DOM::Element>(dom_node)) {
@@ -429,7 +429,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
     if (is<ListItemBox>(*layout_node)) {
     if (is<ListItemBox>(*layout_node)) {
         auto& element = static_cast<DOM::Element&>(dom_node);
         auto& element = static_cast<DOM::Element&>(dom_node);
         auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Type::Marker);
         auto marker_style = style_computer.compute_style(element, CSS::Selector::PseudoElement::Type::Marker);
-        auto list_item_marker = document.heap().allocate_without_realm<ListItemMarkerBox>(document, layout_node->computed_values().list_style_type(), layout_node->computed_values().list_style_position(), calculate_list_item_index(dom_node), *marker_style);
+        auto list_item_marker = document.heap().allocate_without_realm<ListItemMarkerBox>(document, layout_node->computed_values().list_style_type(), layout_node->computed_values().list_style_position(), calculate_list_item_index(dom_node), marker_style);
         static_cast<ListItemBox&>(*layout_node).set_marker(list_item_marker);
         static_cast<ListItemBox&>(*layout_node).set_marker(list_item_marker);
         element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
         element.set_pseudo_element_node({}, CSS::Selector::PseudoElement::Type::Marker, list_item_marker);
         layout_node->append_child(*list_item_marker);
         layout_node->append_child(*list_item_marker);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/VideoBox.cpp

@@ -12,7 +12,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(VideoBox);
 JS_DEFINE_ALLOCATOR(VideoBox);
 
 
-VideoBox::VideoBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
+VideoBox::VideoBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
     : ReplacedBox(document, element, move(style))
     : ReplacedBox(document, element, move(style))
 {
 {
     document.register_viewport_client(*this);
     document.register_viewport_client(*this);

+ 1 - 1
Userland/Libraries/LibWeb/Layout/VideoBox.h

@@ -27,7 +27,7 @@ public:
     virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
     virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
 
 
 private:
 private:
-    VideoBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
+    VideoBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
 
 
     // ^Document::ViewportClient
     // ^Document::ViewportClient
     virtual void did_set_viewport_rect(CSSPixelRect const&) final;
     virtual void did_set_viewport_rect(CSSPixelRect const&) final;

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Viewport.cpp

@@ -16,7 +16,7 @@ namespace Web::Layout {
 
 
 JS_DEFINE_ALLOCATOR(Viewport);
 JS_DEFINE_ALLOCATOR(Viewport);
 
 
-Viewport::Viewport(DOM::Document& document, NonnullRefPtr<CSS::StyleProperties> style)
+Viewport::Viewport(DOM::Document& document, CSS::StyleProperties style)
     : BlockContainer(document, &document, move(style))
     : BlockContainer(document, &document, move(style))
 {
 {
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/Layout/Viewport.h

@@ -16,7 +16,7 @@ class Viewport final : public BlockContainer {
     JS_DECLARE_ALLOCATOR(Viewport);
     JS_DECLARE_ALLOCATOR(Viewport);
 
 
 public:
 public:
-    explicit Viewport(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
+    explicit Viewport(DOM::Document&, CSS::StyleProperties);
     virtual ~Viewport() override;
     virtual ~Viewport() override;
 
 
     struct TextPosition {
     struct TextPosition {

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGAElement.cpp

@@ -59,7 +59,7 @@ JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
     return *m_rel_list;
     return *m_rel_list;
 }
 }
 
 
-JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGAElement.h

@@ -23,7 +23,7 @@ public:
 
 
     JS::NonnullGCPtr<DOM::DOMTokenList> rel_list();
     JS::NonnullGCPtr<DOM::DOMTokenList> rel_list();
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
 private:
 private:
     SVGAElement(DOM::Document&, DOM::QualifiedName);
     SVGAElement(DOM::Document&, DOM::QualifiedName);

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp

@@ -35,7 +35,7 @@ void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<Strin
         m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
         m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
 }
 }
 
 
-JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
+JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(CSS::StyleProperties)
 {
 {
     // Clip paths are handled as a special case in the TreeBuilder.
     // Clip paths are handled as a special case in the TreeBuilder.
     return nullptr;
     return nullptr;

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h

@@ -40,7 +40,7 @@ public:
         return m_clip_path_units.value_or(ClipPathUnits::UserSpaceOnUse);
         return m_clip_path_units.value_or(ClipPathUnits::UserSpaceOnUse);
     }
     }
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
 private:
 private:
     SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
     SVGClipPathElement(DOM::Document&, DOM::QualifiedName);

+ 4 - 4
Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp

@@ -133,8 +133,8 @@ Optional<CSSPixels> SVGDecodedImageData::intrinsic_width() const
 {
 {
     // https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
     // https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
     m_document->update_style();
     m_document->update_style();
-    auto const* root_element_style = m_root_element->computed_css_values();
-    VERIFY(root_element_style);
+    auto const root_element_style = m_root_element->computed_css_values();
+    VERIFY(root_element_style.has_value());
     auto const& width_value = root_element_style->size_value(CSS::PropertyID::Width);
     auto const& width_value = root_element_style->size_value(CSS::PropertyID::Width);
     if (width_value.is_length() && width_value.length().is_absolute())
     if (width_value.is_length() && width_value.length().is_absolute())
         return width_value.length().absolute_length_to_px();
         return width_value.length().absolute_length_to_px();
@@ -145,8 +145,8 @@ Optional<CSSPixels> SVGDecodedImageData::intrinsic_height() const
 {
 {
     // https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
     // https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS
     m_document->update_style();
     m_document->update_style();
-    auto const* root_element_style = m_root_element->computed_css_values();
-    VERIFY(root_element_style);
+    auto const root_element_style = m_root_element->computed_css_values();
+    VERIFY(root_element_style.has_value());
     auto const& height_value = root_element_style->size_value(CSS::PropertyID::Height);
     auto const& height_value = root_element_style->size_value(CSS::PropertyID::Height);
     if (height_value.is_length() && height_value.length().is_absolute())
     if (height_value.is_length() && height_value.length().is_absolute())
         return height_value.length().absolute_length_to_px();
         return height_value.length().absolute_length_to_px();

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGDefsElement.h

@@ -17,7 +17,7 @@ class SVGDefsElement final : public SVGGraphicsElement {
 public:
 public:
     virtual ~SVGDefsElement();
     virtual ~SVGDefsElement();
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override
     {
     {
         return nullptr;
         return nullptr;
     }
     }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGDescElement.cpp

@@ -25,7 +25,7 @@ void SVGDescElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGDescElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGDescElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> SVGDescElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
+JS::GCPtr<Layout::Node> SVGDescElement::create_layout_node(CSS::StyleProperties)
 {
 {
     return nullptr;
     return nullptr;
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGDescElement.h

@@ -19,7 +19,7 @@ private:
 
 
     virtual void initialize(JS::Realm&) override;
     virtual void initialize(JS::Realm&) override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 };
 };
 
 
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGElement.cpp

@@ -139,7 +139,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGElement::svg_animated_length_for_property
 {
 {
     // FIXME: Create a proper animated value when animations are supported.
     // FIXME: Create a proper animated value when animations are supported.
     auto make_length = [&] {
     auto make_length = [&] {
-        if (auto const* style = computed_css_values(); style) {
+        if (auto const style = computed_css_values(); style.has_value()) {
             if (auto length = style->length_percentage(property); length.has_value())
             if (auto length = style->length_percentage(property); length.has_value())
                 return SVGLength::from_length_percentage(realm(), *length);
                 return SVGLength::from_length_percentage(realm(), *length);
         }
         }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp

@@ -47,7 +47,7 @@ void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
     visitor.visit(m_height);
     visitor.visit(m_height);
 }
 }
 
 
-JS::GCPtr<Layout::Node> SVGForeignObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> SVGForeignObjectElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::SVGForeignObjectBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::SVGForeignObjectBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.h

@@ -18,7 +18,7 @@ class SVGForeignObjectElement final : public SVGGraphicsElement {
 public:
 public:
     virtual ~SVGForeignObjectElement() override;
     virtual ~SVGForeignObjectElement() override;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
     JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
     JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
     JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
     JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGGElement.cpp

@@ -26,7 +26,7 @@ void SVGGElement::initialize(JS::Realm& realm)
     WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGElement);
     WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGElement);
 }
 }
 
 
-JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
+JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(CSS::StyleProperties style)
 {
 {
     return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
     return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGGElement.h

@@ -17,7 +17,7 @@ class SVGGElement final : public SVGGraphicsElement {
 public:
 public:
     virtual ~SVGGElement() override = default;
     virtual ~SVGGElement() override = default;
 
 
-    virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+    virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
 
 
 private:
 private:
     SVGGElement(DOM::Document&, DOM::QualifiedName);
     SVGGElement(DOM::Document&, DOM::QualifiedName);

Some files were not shown because too many files changed in this diff