mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
This reduces the number of recompiled files as follow: - Bitmap.h: 1309 -> 101 - ImmutableBitmap.h: 1218 -> 75
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibGfx/ImmutableBitmap.h>
|
|
#include <LibWeb/Layout/ImageBox.h>
|
|
#include <LibWeb/Layout/ImageProvider.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
void ImageProvider::did_update_alt_text(ImageBox& layout_node)
|
|
{
|
|
layout_node.dom_node_did_update_alt_text({});
|
|
}
|
|
|
|
Optional<CSSPixelSize> ImageProvider::intrinsic_size() const
|
|
{
|
|
auto width = intrinsic_width();
|
|
auto height = intrinsic_height();
|
|
if (!width.has_value() || !height.has_value())
|
|
return {};
|
|
|
|
return CSSPixelSize { *width, *height };
|
|
}
|
|
|
|
RefPtr<Gfx::ImmutableBitmap> ImageProvider::current_image_bitmap() const
|
|
{
|
|
return current_image_bitmap_sized(intrinsic_size().value_or({}).to_type<int>());
|
|
}
|
|
|
|
RefPtr<Gfx::ImmutableBitmap> ImageProvider::default_image_bitmap() const
|
|
{
|
|
return default_image_bitmap_sized(intrinsic_size().value_or({}).to_type<int>());
|
|
}
|
|
|
|
RefPtr<Gfx::ImmutableBitmap> ImageProvider::default_image_bitmap_sized(Gfx::IntSize size) const
|
|
{
|
|
// Defer to the current image by default.
|
|
return current_image_bitmap_sized(size);
|
|
}
|
|
|
|
}
|