mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Allow calc() values in image sizes attribute
Note that we currently can't resolve calc() values without a layout node, so when normalizing an image's source set, we'll flush any pending layout updates and hope that gives us an up-to-date layout node. I've left a FIXME about implementing this in a more elegant and less layout-thrashy way, as that will require more architectural work.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 18:38:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/95097e47a7 Pull-request: https://github.com/SerenityOS/serenity/pull/20250
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <LibWeb/CSS/Length.h>
|
||||
#include <LibWeb/CSS/CalculatedOr.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
@@ -33,7 +33,7 @@ struct ImageSourceAndPixelDensity {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#source-set
|
||||
struct SourceSet {
|
||||
static SourceSet create(DOM::Document const&, String default_source, String srcset, String sizes);
|
||||
static SourceSet create(DOM::Element const&, String default_source, String srcset, String sizes);
|
||||
|
||||
[[nodiscard]] bool is_empty() const;
|
||||
|
||||
@@ -41,15 +41,15 @@ struct SourceSet {
|
||||
[[nodiscard]] ImageSourceAndPixelDensity select_an_image_source();
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#normalise-the-source-densities
|
||||
void normalize_source_densities();
|
||||
void normalize_source_densities(DOM::Element const&);
|
||||
|
||||
SourceSet();
|
||||
|
||||
Vector<ImageSource> m_sources;
|
||||
CSS::Length m_source_size;
|
||||
CSS::LengthOrCalculated m_source_size;
|
||||
};
|
||||
|
||||
SourceSet parse_a_srcset_attribute(StringView);
|
||||
CSS::Length parse_a_sizes_attribute(DOM::Document const&, StringView);
|
||||
[[nodiscard]] CSS::LengthOrCalculated parse_a_sizes_attribute(DOM::Document const&, StringView);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user