2021-02-21 13:36:34 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-21 13:36:34 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/URL.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
|
|
class CSSImportRule : public CSSRule {
|
|
|
|
|
AK_MAKE_NONCOPYABLE(CSSImportRule);
|
|
|
|
|
AK_MAKE_NONMOVABLE(CSSImportRule);
|
|
|
|
|
|
|
|
|
|
public:
|
2021-09-12 18:33:23 -03:00
|
|
|
static NonnullRefPtr<CSSImportRule> create(AK::URL url)
|
2021-02-21 13:36:34 -03:00
|
|
|
{
|
2021-04-23 11:46:57 -03:00
|
|
|
return adopt_ref(*new CSSImportRule(move(url)));
|
2021-02-21 13:36:34 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~CSSImportRule();
|
|
|
|
|
|
2021-09-12 18:33:23 -03:00
|
|
|
const AK::URL& url() const { return m_url; }
|
2021-02-21 13:36:34 -03:00
|
|
|
|
2021-02-21 13:44:17 -03:00
|
|
|
bool has_import_result() const { return !m_style_sheet.is_null(); }
|
2021-03-07 12:14:04 -03:00
|
|
|
RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; }
|
|
|
|
|
const RefPtr<CSSStyleSheet> loaded_style_sheet() const { return m_style_sheet; }
|
2021-04-03 06:55:37 -03:00
|
|
|
void set_style_sheet(const RefPtr<CSSStyleSheet>& style_sheet) { m_style_sheet = style_sheet; }
|
2021-02-21 13:44:17 -03:00
|
|
|
|
2021-02-21 13:36:34 -03:00
|
|
|
virtual StringView class_name() const { return "CSSImportRule"; };
|
|
|
|
|
virtual Type type() const { return Type::Import; };
|
|
|
|
|
|
|
|
|
|
private:
|
2021-09-12 18:33:23 -03:00
|
|
|
explicit CSSImportRule(AK::URL);
|
2021-02-21 13:36:34 -03:00
|
|
|
|
2021-09-12 18:33:23 -03:00
|
|
|
AK::URL m_url;
|
2021-03-07 12:14:04 -03:00
|
|
|
RefPtr<CSSStyleSheet> m_style_sheet;
|
2021-02-21 13:36:34 -03:00
|
|
|
};
|
|
|
|
|
|
2021-03-18 17:50:52 -03:00
|
|
|
template<>
|
|
|
|
|
inline bool CSSRule::fast_is<CSSImportRule>() const { return type() == CSSRule::Type::Import; }
|
|
|
|
|
|
2021-02-21 13:36:34 -03:00
|
|
|
}
|