2024-12-20 15:53:18 +00:00
|
|
|
/*
|
2025-04-10 10:26:22 +01:00
|
|
|
* Copyright (c) 2024-2025, Sam Atkins <sam@ladybird.org>
|
2024-12-20 15:53:18 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-04-10 10:26:22 +01:00
|
|
|
#include <LibURL/URL.h>
|
|
|
|
#include <LibWeb/CSS/URL.h>
|
2024-12-20 15:53:18 +00:00
|
|
|
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
|
|
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
2025-04-10 16:04:34 +01:00
|
|
|
#include <LibWeb/Forward.h>
|
2024-12-20 15:53:18 +00:00
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
enum class CorsMode {
|
|
|
|
NoCors,
|
|
|
|
Cors,
|
|
|
|
};
|
|
|
|
|
2025-04-10 10:26:22 +01:00
|
|
|
using StyleResourceURL = Variant<::URL::URL, CSS::URL>;
|
|
|
|
|
2025-04-10 12:09:39 +01:00
|
|
|
// AD-HOC: See comment inside fetch_a_style_resource() implementation.
|
|
|
|
using StyleSheetOrDocument = Variant<GC::Ref<CSSStyleSheet>, GC::Ref<DOM::Document>>;
|
|
|
|
|
2024-12-20 15:53:18 +00:00
|
|
|
// https://drafts.csswg.org/css-values-4/#fetch-a-style-resource
|
2025-04-30 12:33:29 +01:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<Fetch::Infrastructure::FetchController>> fetch_a_style_resource(StyleResourceURL const& url, StyleSheetOrDocument, Fetch::Infrastructure::Request::Destination, CorsMode, Fetch::Infrastructure::FetchAlgorithms::ProcessResponseConsumeBodyFunction process_response);
|
2024-12-20 15:53:18 +00:00
|
|
|
|
2025-04-10 16:04:34 +01:00
|
|
|
// https://drafts.csswg.org/css-images-4/#fetch-an-external-image-for-a-stylesheet
|
|
|
|
GC::Ptr<HTML::SharedResourceRequest> fetch_an_external_image_for_a_stylesheet(StyleResourceURL const&, StyleSheetOrDocument);
|
|
|
|
|
2025-05-02 17:25:56 +01:00
|
|
|
// https://drafts.csswg.org/css-values-5/#apply-request-modifiers-from-url-value
|
|
|
|
void apply_request_modifiers_from_url_value(URL const&, GC::Ref<Fetch::Infrastructure::Request>);
|
|
|
|
|
2024-12-20 15:53:18 +00:00
|
|
|
}
|