mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Delete AudioPaintable::layout_box()
No need for this method when we could reach into DOM node directly from Paintable.
This commit is contained in:
parent
33a8fbd22c
commit
d3f40e9a72
|
|
@ -47,6 +47,11 @@ Layout::AudioBox* HTMLAudioElement::layout_node()
|
|||
return static_cast<Layout::AudioBox*>(Node::layout_node());
|
||||
}
|
||||
|
||||
bool HTMLAudioElement::should_paint() const
|
||||
{
|
||||
return has_attribute(HTML::AttributeNames::controls) || is_scripting_disabled();
|
||||
}
|
||||
|
||||
Layout::AudioBox const* HTMLAudioElement::layout_node() const
|
||||
{
|
||||
return static_cast<Layout::AudioBox const*>(Node::layout_node());
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ public:
|
|||
Layout::AudioBox* layout_node();
|
||||
Layout::AudioBox const* layout_node() const;
|
||||
|
||||
bool should_paint() const;
|
||||
|
||||
private:
|
||||
HTMLAudioElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,15 +34,9 @@ GC::Ptr<Painting::Paintable> AudioBox::create_paintable() const
|
|||
return Painting::AudioPaintable::create(*this);
|
||||
}
|
||||
|
||||
bool AudioBox::should_paint() const
|
||||
{
|
||||
auto const& audio_element = dom_node();
|
||||
return audio_element.has_attribute(HTML::AttributeNames::controls) || audio_element.is_scripting_disabled();
|
||||
}
|
||||
|
||||
void AudioBox::prepare_for_replaced_layout()
|
||||
{
|
||||
if (should_paint()) {
|
||||
if (dom_node().should_paint()) {
|
||||
set_natural_width(300);
|
||||
set_natural_height(40);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ public:
|
|||
|
||||
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
|
||||
|
||||
bool should_paint() const;
|
||||
|
||||
private:
|
||||
AudioBox(DOM::Document&, DOM::Element&, GC::Ref<CSS::ComputedProperties>);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,22 +29,13 @@ AudioPaintable::AudioPaintable(Layout::AudioBox const& layout_box)
|
|||
{
|
||||
}
|
||||
|
||||
Layout::AudioBox& AudioPaintable::layout_box()
|
||||
{
|
||||
return static_cast<Layout::AudioBox&>(layout_node());
|
||||
}
|
||||
|
||||
Layout::AudioBox const& AudioPaintable::layout_box() const
|
||||
{
|
||||
return static_cast<Layout::AudioBox const&>(layout_node());
|
||||
}
|
||||
|
||||
void AudioPaintable::paint(DisplayListRecordingContext& context, PaintPhase phase) const
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
|
||||
if (!layout_box().should_paint())
|
||||
auto const& audio_element = as<HTML::HTMLAudioElement const>(*dom_node());
|
||||
if (audio_element.should_paint())
|
||||
return;
|
||||
|
||||
Base::paint(context, phase);
|
||||
|
|
@ -58,8 +49,6 @@ void AudioPaintable::paint(DisplayListRecordingContext& context, PaintPhase phas
|
|||
context.display_list_recorder().add_clip_rect(audio_rect.to_type<int>());
|
||||
|
||||
ScopedCornerRadiusClip corner_clip { context, audio_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
|
||||
|
||||
auto const& audio_element = layout_box().dom_node();
|
||||
auto mouse_position = MediaPaintable::mouse_position(context, audio_element);
|
||||
paint_media_controls(context, audio_element, audio_rect, mouse_position);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ public:
|
|||
|
||||
virtual void paint(DisplayListRecordingContext&, PaintPhase) const override;
|
||||
|
||||
Layout::AudioBox& layout_box();
|
||||
Layout::AudioBox const& layout_box() const;
|
||||
|
||||
private:
|
||||
explicit AudioPaintable(Layout::AudioBox const&);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user