mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibWeb: Remove reference counting for CSS::StyleProperties
`AK::CopyOnWrite` already does reference counting, so there is no need to do it again.
This commit is contained in:
parent
e636f3976d
commit
07cd7d479f
Notes:
github-actions[bot]
2024-10-27 12:27:19 +00:00
Author: https://github.com/yyny
Commit: 07cd7d479f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1980
125 changed files with 207 additions and 216 deletions
|
@ -28,7 +28,7 @@ void HTMLAudioElement::initialize(JS::Realm& realm)
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
|
||||
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_paused() override;
|
||||
|
|
|
@ -26,7 +26,7 @@ void HTMLBRElement::initialize(JS::Realm& realm)
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class HTMLBRElement final : public HTMLElement {
|
|||
public:
|
||||
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:
|
||||
virtual bool is_html_br_element() const override { return true; }
|
||||
|
|
|
@ -128,7 +128,7 @@ WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
|
||||
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 {
|
||||
No,
|
||||
|
|
|
@ -32,7 +32,7 @@ void HTMLIFrameElement::initialize(JS::Realm& realm)
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class HTMLIFrameElement final
|
|||
public:
|
||||
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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:dimension-attributes
|
||||
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;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ JS::NonnullGCPtr<ValidityState const> HTMLInputElement::validity() const
|
|||
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)
|
||||
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.
|
||||
// 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.
|
||||
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)
|
||||
|
@ -126,7 +126,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
|
|||
if (type_state() == TypeAttributeState::RadioButton)
|
||||
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)
|
||||
|
|
|
@ -59,7 +59,7 @@ class HTMLInputElement final
|
|||
public:
|
||||
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;
|
||||
|
||||
enum class TypeAttributeState {
|
||||
|
|
|
@ -27,7 +27,7 @@ void HTMLLabelElement::initialize(JS::Realm& realm)
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class HTMLLabelElement final : public HTMLElement {
|
|||
public:
|
||||
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_); }
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ String HTMLObjectElement::data() const
|
|||
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) {
|
||||
case Representation::Children:
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
|
||||
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_paused() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue