mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
55
Libraries/LibWeb/HTML/SourceSet.h
Normal file
55
Libraries/LibWeb/HTML/SourceSet.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Variant.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/CSS/CalculatedOr.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#image-source
|
||||
struct ImageSource {
|
||||
struct PixelDensityDescriptorValue {
|
||||
double value { 0 };
|
||||
};
|
||||
|
||||
struct WidthDescriptorValue {
|
||||
CSSPixels value { 0 };
|
||||
};
|
||||
|
||||
String url;
|
||||
Variant<Empty, PixelDensityDescriptorValue, WidthDescriptorValue> descriptor;
|
||||
};
|
||||
|
||||
struct ImageSourceAndPixelDensity {
|
||||
ImageSource source;
|
||||
double pixel_density { 1.0f };
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#source-set
|
||||
struct SourceSet {
|
||||
static SourceSet create(DOM::Element const& element, String const& default_source, String const& srcset, String const& sizes, HTML::HTMLImageElement const* img = nullptr);
|
||||
|
||||
[[nodiscard]] bool is_empty() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#select-an-image-source-from-a-source-set
|
||||
[[nodiscard]] ImageSourceAndPixelDensity select_an_image_source();
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#normalise-the-source-densities
|
||||
void normalize_source_densities(DOM::Element const&);
|
||||
|
||||
SourceSet();
|
||||
|
||||
Vector<ImageSource> m_sources;
|
||||
CSS::LengthOrCalculated m_source_size;
|
||||
};
|
||||
|
||||
SourceSet parse_a_srcset_attribute(StringView);
|
||||
[[nodiscard]] CSS::LengthOrCalculated parse_a_sizes_attribute(DOM::Element const& element, StringView sizes, HTML::HTMLImageElement const* img = nullptr);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue