mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibHTML: Support width/height attributes on images
This commit is contained in:
parent
088237a25f
commit
b240500107
Notes:
sideshowbarker
2024-07-19 11:47:12 +09:00
Author: https://github.com/deoxxa
Commit: b240500107
Pull-request: https://github.com/SerenityOS/serenity/pull/634
3 changed files with 34 additions and 3 deletions
|
@ -29,6 +29,32 @@ void HTMLImageElement::load_image(const String& src)
|
|||
}
|
||||
}
|
||||
|
||||
int HTMLImageElement::preferred_width() const
|
||||
{
|
||||
bool ok = false;
|
||||
int width = attribute("width").to_int(ok);
|
||||
if (ok)
|
||||
return width;
|
||||
|
||||
if (m_bitmap)
|
||||
return m_bitmap->width();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HTMLImageElement::preferred_height() const
|
||||
{
|
||||
bool ok = false;
|
||||
int height = attribute("height").to_int(ok);
|
||||
if (ok)
|
||||
return height;
|
||||
|
||||
if (m_bitmap)
|
||||
return m_bitmap->height();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> HTMLImageElement::create_layout_node(const StyleResolver& resolver, const StyleProperties* parent_style) const
|
||||
{
|
||||
auto style = resolver.resolve_style(*this, parent_style);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue