Repository: LadybirdBrowser/ladybird
File: Libraries/LibWeb/HTML/HTMLImageElement.cpp (C++)

Code before:
}

void HTMLImageElement::adopted_from(DOM::Document& old_document)
{
    old_document.unregister_viewport_client(*this);
    document().register_viewport_client(*this);

    m_document_observer->set_document(document());
    if (!old_document.is_fully_active() && document().is_fully_active()) {
        if (auto callback = m_document_observer->document_became_active())
            callback->function()();
    }
}

void HTMLImageElement::visit_edges(Cell::Visitor& visitor)
{
    Base::visit_edges(visitor);
    image_provider_visit_edges(visitor);
    visitor.visit(m_current_request);
    visitor.visit(m_pending_request);
    visitor.visit(m_document_observer);
    visitor.visit(m_dimension_attribute_source);
    visit_lazy_loading_element(visitor);
}

// https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:dimension-attribute-source
DOM::Element const& HTMLImageElement::dimension_attribute_source() const
{
    if (m_dimension_attribute_source)
        return *m_dimension_attribute_source;
    return *this;
}

void HTMLImageElement::set_dimension_attribute_source(DOM::Element const* source)
{
    if (m_dimension_attribute_source.ptr() != source) {
        m_dimension_attribute_source = source;
        set_needs_style_update(true);
    }
}

bool HTMLImageElement::is_presentational_hint(FlyString const& name) const
{
    if (Base::is_presentational_hint(name))
        return true;

    return first_is_one_of(name,
        HTML::AttributeNames::hspace,
        HTML::AttributeNames::vspace,
        HTML::AttributeNames::border);
}

Review comment (suggestion):
This URL doesn't seem to link to anything. Maybe you meant https://html.spec.whatwg.org/multipage/embedded-content.html#concept-img-dimension-attribute-source ? Not sure how that happened but they do move definitions around sometimes.

Code after:
}

void HTMLImageElement::adopted_from(DOM::Document& old_document)
{
    old_document.unregister_viewport_client(*this);
    document().register_viewport_client(*this);

    m_document_observer->set_document(document());
    if (!old_document.is_fully_active() && document().is_fully_active()) {
        if (auto callback = m_document_observer->document_became_active())
            callback->function()();
    }
}

void HTMLImageElement::visit_edges(Cell::Visitor& visitor)
{
    Base::visit_edges(visitor);
    image_provider_visit_edges(visitor);
    visitor.visit(m_current_request);
    visitor.visit(m_pending_request);
    visitor.visit(m_document_observer);
    visitor.visit(m_dimension_attribute_source);
    visit_lazy_loading_element(visitor);
}

// https://html.spec.whatwg.org/multipage/embedded-content.html#concept-img-dimension-attribute-source
DOM::Element const& HTMLImageElement::dimension_attribute_source() const
{
    if (m_dimension_attribute_source)
        return *m_dimension_attribute_source;
    return *this;
}

void HTMLImageElement::set_dimension_attribute_source(DOM::Element const* source)
{
    if (m_dimension_attribute_source.ptr() != source) {
        m_dimension_attribute_source = source;
        set_needs_style_update(true);
    }
}

bool HTMLImageElement::is_presentational_hint(FlyString const& name) const
{
    if (Base::is_presentational_hint(name))
        return true;

    return first_is_one_of(name,
        HTML::AttributeNames::hspace,
        HTML::AttributeNames::vspace,
        HTML::AttributeNames::border);
}