mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:57:35 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -42,11 +42,11 @@ public:
|
|||
LocationObject* location_object() { return m_location_object; }
|
||||
LocationObject const* location_object() const { return m_location_object; }
|
||||
|
||||
JS::Object* web_prototype(const String& class_name) { return m_prototypes.get(class_name).value_or(nullptr); }
|
||||
JS::NativeFunction* web_constructor(const String& class_name) { return m_constructors.get(class_name).value_or(nullptr); }
|
||||
JS::Object* web_prototype(String const& class_name) { return m_prototypes.get(class_name).value_or(nullptr); }
|
||||
JS::NativeFunction* web_constructor(String const& class_name) { return m_constructors.get(class_name).value_or(nullptr); }
|
||||
|
||||
template<typename T>
|
||||
JS::Object& ensure_web_prototype(const String& class_name)
|
||||
JS::Object& ensure_web_prototype(String const& class_name)
|
||||
{
|
||||
auto it = m_prototypes.find(class_name);
|
||||
if (it != m_prototypes.end())
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
JS::NativeFunction& ensure_web_constructor(const String& class_name)
|
||||
JS::NativeFunction& ensure_web_constructor(String const& class_name)
|
||||
{
|
||||
auto it = m_constructors.find(class_name);
|
||||
if (it != m_constructors.end())
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
void set_wrapper(Wrapper&);
|
||||
Wrapper* wrapper() { return m_wrapper; }
|
||||
const Wrapper* wrapper() const { return m_wrapper; }
|
||||
Wrapper const* wrapper() const { return m_wrapper; }
|
||||
|
||||
private:
|
||||
WeakPtr<Wrapper> m_wrapper;
|
||||
|
|
|
@ -32,8 +32,8 @@ public:
|
|||
|
||||
bool has_import_result() const { return !m_style_sheet.is_null(); }
|
||||
RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; }
|
||||
const RefPtr<CSSStyleSheet> loaded_style_sheet() const { return m_style_sheet; }
|
||||
void set_style_sheet(const RefPtr<CSSStyleSheet>& style_sheet) { m_style_sheet = style_sheet; }
|
||||
RefPtr<CSSStyleSheet> const loaded_style_sheet() const { return m_style_sheet; }
|
||||
void set_style_sheet(RefPtr<CSSStyleSheet> const& style_sheet) { m_style_sheet = style_sheet; }
|
||||
|
||||
virtual StringView class_name() const override { return "CSSImportRule"; };
|
||||
virtual Type type() const override { return Type::Import; };
|
||||
|
|
|
@ -69,9 +69,9 @@ public:
|
|||
virtual Optional<StyleProperty> property(PropertyID) const override;
|
||||
virtual bool set_property(PropertyID, StringView css_text) override;
|
||||
|
||||
const Vector<StyleProperty>& properties() const { return m_properties; }
|
||||
const HashMap<String, StyleProperty>& custom_properties() const { return m_custom_properties; }
|
||||
Optional<StyleProperty> custom_property(const String& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
|
||||
Vector<StyleProperty> const& properties() const { return m_properties; }
|
||||
HashMap<String, StyleProperty> const& custom_properties() const { return m_custom_properties; }
|
||||
Optional<StyleProperty> custom_property(String const& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
|
||||
size_t custom_property_count() const { return m_custom_properties.size(); }
|
||||
|
||||
virtual String serialized() const final override;
|
||||
|
|
|
@ -29,8 +29,8 @@ public:
|
|||
|
||||
virtual ~CSSStyleRule() override = default;
|
||||
|
||||
const NonnullRefPtrVector<Selector>& selectors() const { return m_selectors; }
|
||||
const CSSStyleDeclaration& declaration() const { return m_declaration; }
|
||||
NonnullRefPtrVector<Selector> const& selectors() const { return m_selectors; }
|
||||
CSSStyleDeclaration const& declaration() const { return m_declaration; }
|
||||
|
||||
virtual StringView class_name() const override { return "CSSStyleRule"; };
|
||||
virtual Type type() const override { return Type::Style; };
|
||||
|
|
|
@ -152,10 +152,10 @@ public:
|
|||
const CSS::LengthBox& margin() const { return m_noninherited.margin; }
|
||||
const CSS::LengthBox& padding() const { return m_noninherited.padding; }
|
||||
|
||||
const BorderData& border_left() const { return m_noninherited.border_left; }
|
||||
const BorderData& border_top() const { return m_noninherited.border_top; }
|
||||
const BorderData& border_right() const { return m_noninherited.border_right; }
|
||||
const BorderData& border_bottom() const { return m_noninherited.border_bottom; }
|
||||
BorderData const& border_left() const { return m_noninherited.border_left; }
|
||||
BorderData const& border_top() const { return m_noninherited.border_top; }
|
||||
BorderData const& border_right() const { return m_noninherited.border_right; }
|
||||
BorderData const& border_bottom() const { return m_noninherited.border_bottom; }
|
||||
|
||||
const CSS::LengthPercentage& border_bottom_left_radius() const { return m_noninherited.border_bottom_left_radius; }
|
||||
const CSS::LengthPercentage& border_bottom_right_radius() const { return m_noninherited.border_bottom_right_radius; }
|
||||
|
@ -267,12 +267,12 @@ public:
|
|||
void set_font_size(float font_size) { m_inherited.font_size = font_size; }
|
||||
void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }
|
||||
void set_font_variant(CSS::FontVariant font_variant) { m_inherited.font_variant = font_variant; }
|
||||
void set_color(const Color& color) { m_inherited.color = color; }
|
||||
void set_color(Color const& color) { m_inherited.color = color; }
|
||||
void set_content(ContentData const& content) { m_noninherited.content = content; }
|
||||
void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; }
|
||||
void set_image_rendering(CSS::ImageRendering value) { m_inherited.image_rendering = value; }
|
||||
void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; }
|
||||
void set_background_color(const Color& color) { m_noninherited.background_color = color; }
|
||||
void set_background_color(Color const& color) { m_noninherited.background_color = color; }
|
||||
void set_background_layers(Vector<BackgroundLayerData>&& layers) { m_noninherited.background_layers = move(layers); }
|
||||
void set_float(CSS::Float value) { m_noninherited.float_ = value; }
|
||||
void set_clear(CSS::Clear value) { m_noninherited.clear = value; }
|
||||
|
|
|
@ -118,7 +118,7 @@ String Length::to_string() const
|
|||
return String::formatted("{}{}", m_value, unit_name());
|
||||
}
|
||||
|
||||
const char* Length::unit_name() const
|
||||
char const* Length::unit_name() const
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::Cm:
|
||||
|
|
|
@ -116,14 +116,14 @@ public:
|
|||
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(const Length& other) const
|
||||
bool operator==(Length const& other) const
|
||||
{
|
||||
if (is_calculated())
|
||||
return m_calculated_style == other.m_calculated_style;
|
||||
return m_type == other.m_type && m_value == other.m_value;
|
||||
}
|
||||
|
||||
bool operator!=(const Length& other) const
|
||||
bool operator!=(Length const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
float relative_length_to_px(Gfx::IntRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, float font_size, float root_font_size) const;
|
||||
|
||||
private:
|
||||
const char* unit_name() const;
|
||||
char const* unit_name() const;
|
||||
|
||||
Type m_type;
|
||||
float m_value { 0 };
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
static void log_parse_error(const SourceLocation& location = SourceLocation::current())
|
||||
static void log_parse_error(SourceLocation const& location = SourceLocation::current())
|
||||
{
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Parse error (CSS) {}", location);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define REPLACEMENT_CHARACTER 0xFFFD
|
||||
static constexpr u32 TOKENIZER_EOF = 0xFFFFFFFF;
|
||||
|
||||
static inline void log_parse_error(const SourceLocation& location = SourceLocation::current())
|
||||
static inline void log_parse_error(SourceLocation const& location = SourceLocation::current())
|
||||
{
|
||||
dbgln_if(CSS_TOKENIZER_DEBUG, "Parse error (css tokenization) {} ", location);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ static inline bool is_E(u32 code_point)
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
Tokenizer::Tokenizer(StringView input, const String& encoding)
|
||||
Tokenizer::Tokenizer(StringView input, String const& encoding)
|
||||
{
|
||||
auto* decoder = TextCodec::decoder_for(encoding);
|
||||
VERIFY(decoder);
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
class Tokenizer {
|
||||
|
||||
public:
|
||||
explicit Tokenizer(StringView input, const String& encoding);
|
||||
explicit Tokenizer(StringView input, String const& encoding);
|
||||
|
||||
[[nodiscard]] Vector<Token> parse();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ String Ratio::to_string() const
|
|||
return String::formatted("{} / {}", m_first_value, m_second_value);
|
||||
}
|
||||
|
||||
auto Ratio::operator<=>(const Ratio& other) const
|
||||
auto Ratio::operator<=>(Ratio const& other) const
|
||||
{
|
||||
return value() - other.value();
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
|
|||
return !attribute.value.is_empty()
|
||||
&& element.attribute(attribute.name).contains(attribute.value, case_sensitivity);
|
||||
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
|
||||
const auto element_attr_value = element.attribute(attribute.name);
|
||||
auto const element_attr_value = element.attribute(attribute.name);
|
||||
if (element_attr_value.is_empty()) {
|
||||
// If the attribute value on element is empty, the selector is true
|
||||
// if the match value is also empty and false otherwise.
|
||||
|
|
|
@ -862,7 +862,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
float font_size_in_px = 10;
|
||||
|
||||
if (font_size->is_identifier()) {
|
||||
switch (static_cast<const IdentifierStyleValue&>(*font_size).id()) {
|
||||
switch (static_cast<IdentifierStyleValue const&>(*font_size).id()) {
|
||||
case CSS::ValueID::XxSmall:
|
||||
case CSS::ValueID::XSmall:
|
||||
case CSS::ValueID::Small:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
StyleProperties::StyleProperties(const StyleProperties& other)
|
||||
StyleProperties::StyleProperties(StyleProperties const& other)
|
||||
: m_property_values(other.m_property_values)
|
||||
{
|
||||
if (other.m_font) {
|
||||
|
@ -412,7 +412,7 @@ Optional<CSS::Position> StyleProperties::position() const
|
|||
}
|
||||
}
|
||||
|
||||
bool StyleProperties::operator==(const StyleProperties& other) const
|
||||
bool StyleProperties::operator==(StyleProperties const& other) const
|
||||
{
|
||||
if (m_property_values.size() != other.m_property_values.size())
|
||||
return false;
|
||||
|
|
|
@ -20,7 +20,7 @@ class StyleProperties : public RefCounted<StyleProperties> {
|
|||
public:
|
||||
StyleProperties() = default;
|
||||
|
||||
explicit StyleProperties(const StyleProperties&);
|
||||
explicit StyleProperties(StyleProperties const&);
|
||||
|
||||
static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); }
|
||||
|
||||
|
@ -92,10 +92,10 @@ public:
|
|||
m_font = move(font);
|
||||
}
|
||||
|
||||
float line_height(const Layout::Node&) const;
|
||||
float line_height(Layout::Node const&) const;
|
||||
|
||||
bool operator==(const StyleProperties&) const;
|
||||
bool operator!=(const StyleProperties& other) const { return !(*this == other); }
|
||||
bool operator==(StyleProperties const&) const;
|
||||
bool operator!=(StyleProperties const& other) const { return !(*this == other); }
|
||||
|
||||
Optional<CSS::Position> position() const;
|
||||
Optional<int> z_index() const;
|
||||
|
|
|
@ -941,7 +941,7 @@ public:
|
|||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
return m_color == static_cast<const ColorStyleValue&>(other).m_color;
|
||||
return m_color == static_cast<ColorStyleValue const&>(other).m_color;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -1151,7 +1151,7 @@ public:
|
|||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
return m_id == static_cast<const IdentifierStyleValue&>(other).m_id;
|
||||
return m_id == static_cast<IdentifierStyleValue const&>(other).m_id;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -27,7 +27,7 @@ static void on_secure_attribute(ParsedCookie& parsed_cookie);
|
|||
static void on_http_only_attribute(ParsedCookie& parsed_cookie);
|
||||
static Optional<Core::DateTime> parse_date_time(StringView date_string);
|
||||
|
||||
Optional<ParsedCookie> parse_cookie(const String& cookie_string)
|
||||
Optional<ParsedCookie> parse_cookie(String const& cookie_string)
|
||||
{
|
||||
// https://tools.ietf.org/html/rfc6265#section-5.2
|
||||
|
||||
|
@ -293,7 +293,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
|
|||
bool found_month = false;
|
||||
bool found_year = false;
|
||||
|
||||
for (const auto& date_token : date_tokens) {
|
||||
for (auto const& date_token : date_tokens) {
|
||||
if (!found_time && parse_time(date_token)) {
|
||||
found_time = true;
|
||||
} else if (!found_day_of_month && parse_day_of_month(date_token)) {
|
||||
|
@ -333,7 +333,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
|
|||
|
||||
}
|
||||
|
||||
bool IPC::encode(IPC::Encoder& encoder, const Web::Cookie::ParsedCookie& cookie)
|
||||
bool IPC::encode(IPC::Encoder& encoder, Web::Cookie::ParsedCookie const& cookie)
|
||||
{
|
||||
encoder << cookie.name;
|
||||
encoder << cookie.value;
|
||||
|
|
|
@ -24,13 +24,13 @@ struct ParsedCookie {
|
|||
bool http_only_attribute_present { false };
|
||||
};
|
||||
|
||||
Optional<ParsedCookie> parse_cookie(const String& cookie_string);
|
||||
Optional<ParsedCookie> parse_cookie(String const& cookie_string);
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
bool encode(IPC::Encoder&, const Web::Cookie::ParsedCookie&);
|
||||
bool encode(IPC::Encoder&, Web::Cookie::ParsedCookie const&);
|
||||
ErrorOr<void> decode(IPC::Decoder&, Web::Cookie::ParsedCookie&);
|
||||
|
||||
}
|
||||
|
|
|
@ -62,27 +62,27 @@ String Crypto::random_uuid() const
|
|||
bytes[8] |= 1 << 7;
|
||||
bytes[8] &= ~(1 << 6);
|
||||
|
||||
/* 5. Return the string concatenation of
|
||||
«
|
||||
/* 5. Return the string concatenation of
|
||||
«
|
||||
hexadecimal representation of bytes[0],
|
||||
hexadecimal representation of bytes[1],
|
||||
hexadecimal representation of bytes[1],
|
||||
hexadecimal representation of bytes[2],
|
||||
hexadecimal representation of bytes[3],
|
||||
"-",
|
||||
hexadecimal representation of bytes[4],
|
||||
"-",
|
||||
hexadecimal representation of bytes[4],
|
||||
hexadecimal representation of bytes[5],
|
||||
"-",
|
||||
hexadecimal representation of bytes[6],
|
||||
hexadecimal representation of bytes[6],
|
||||
hexadecimal representation of bytes[7],
|
||||
"-",
|
||||
hexadecimal representation of bytes[8],
|
||||
hexadecimal representation of bytes[8],
|
||||
hexadecimal representation of bytes[9],
|
||||
"-",
|
||||
hexadecimal representation of bytes[10],
|
||||
hexadecimal representation of bytes[11],
|
||||
hexadecimal representation of bytes[12],
|
||||
hexadecimal representation of bytes[13],
|
||||
hexadecimal representation of bytes[14],
|
||||
hexadecimal representation of bytes[10],
|
||||
hexadecimal representation of bytes[11],
|
||||
hexadecimal representation of bytes[12],
|
||||
hexadecimal representation of bytes[13],
|
||||
hexadecimal representation of bytes[14],
|
||||
hexadecimal representation of bytes[15]
|
||||
».
|
||||
*/
|
||||
|
|
|
@ -20,11 +20,11 @@ public:
|
|||
virtual ~AbstractRange() override = default;
|
||||
|
||||
Node* start_container() { return m_start_container; }
|
||||
const Node* start_container() const { return m_start_container; }
|
||||
Node const* start_container() const { return m_start_container; }
|
||||
unsigned start_offset() const { return m_start_offset; }
|
||||
|
||||
Node* end_container() { return m_end_container; }
|
||||
const Node* end_container() const { return m_end_container; }
|
||||
Node const* end_container() const { return m_end_container; }
|
||||
unsigned end_offset() const { return m_end_offset; }
|
||||
|
||||
// https://dom.spec.whatwg.org/#range-collapsed
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
CharacterData::CharacterData(Document& document, NodeType type, const String& data)
|
||||
CharacterData::CharacterData(Document& document, NodeType type, String const& data)
|
||||
: Node(document, type)
|
||||
, m_data(data)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
virtual ~CharacterData() override = default;
|
||||
|
||||
const String& data() const { return m_data; }
|
||||
String const& data() const { return m_data; }
|
||||
void set_data(String);
|
||||
|
||||
unsigned length() const { return m_data.length(); }
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
ExceptionOr<void> replace_data(size_t offset, size_t count, String const&);
|
||||
|
||||
protected:
|
||||
explicit CharacterData(Document&, NodeType, const String&);
|
||||
explicit CharacterData(Document&, NodeType, String const&);
|
||||
|
||||
private:
|
||||
String m_data;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
Comment::Comment(Document& document, const String& data)
|
||||
Comment::Comment(Document& document, String const& data)
|
||||
: CharacterData(document, NodeType::COMMENT_NODE, data)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class Comment final : public CharacterData {
|
|||
public:
|
||||
using WrapperType = Bindings::CommentWrapper;
|
||||
|
||||
explicit Comment(Document&, const String&);
|
||||
explicit Comment(Document&, String const&);
|
||||
virtual ~Comment() override = default;
|
||||
|
||||
virtual FlyString node_name() const override { return "#comment"; }
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
{
|
||||
return adopt_ref(*new CustomEvent(event_name, event_init));
|
||||
}
|
||||
static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, CustomEventInit const& event_init)
|
||||
static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, CustomEventInit const& event_init)
|
||||
{
|
||||
return CustomEvent::create(event_name, event_init);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Web::DOM {
|
|||
__ENUMERATE(OperationError) \
|
||||
__ENUMERATE(NotAllowedError)
|
||||
|
||||
static u16 get_legacy_code_for_name(const FlyString& name)
|
||||
static u16 get_legacy_code_for_name(FlyString const& name)
|
||||
{
|
||||
#define __ENUMERATE(ErrorName, code) \
|
||||
if (name == #ErrorName) \
|
||||
|
@ -95,23 +95,23 @@ class DOMException final
|
|||
public:
|
||||
using WrapperType = Bindings::DOMExceptionWrapper;
|
||||
|
||||
static NonnullRefPtr<DOMException> create(const FlyString& name, const FlyString& message)
|
||||
static NonnullRefPtr<DOMException> create(FlyString const& name, FlyString const& message)
|
||||
{
|
||||
return adopt_ref(*new DOMException(name, message));
|
||||
}
|
||||
|
||||
// JS constructor has message first, name second
|
||||
static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, const FlyString& message, const FlyString& name)
|
||||
static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, FlyString const& message, FlyString const& name)
|
||||
{
|
||||
return adopt_ref(*new DOMException(name, message));
|
||||
}
|
||||
|
||||
const FlyString& name() const { return m_name; }
|
||||
const FlyString& message() const { return m_message; }
|
||||
FlyString const& name() const { return m_name; }
|
||||
FlyString const& message() const { return m_message; }
|
||||
u16 code() const { return get_legacy_code_for_name(m_name); }
|
||||
|
||||
protected:
|
||||
DOMException(const FlyString& name, const FlyString& message)
|
||||
DOMException(FlyString const& name, FlyString const& message)
|
||||
: m_name(name)
|
||||
, m_message(message)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ private:
|
|||
#define __ENUMERATE(ErrorName) \
|
||||
class ErrorName final { \
|
||||
public: \
|
||||
static NonnullRefPtr<DOMException> create(const FlyString& message) \
|
||||
static NonnullRefPtr<DOMException> create(FlyString const& message) \
|
||||
{ \
|
||||
return DOMException::create(#ErrorName, message); \
|
||||
} \
|
||||
|
|
|
@ -20,7 +20,7 @@ DOMImplementation::DOMImplementation(Document& document)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
||||
ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const String& namespace_, const String& qualified_name, RefPtr<DocumentType> doctype) const
|
||||
ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(String const& namespace_, String const& qualified_name, RefPtr<DocumentType> doctype) const
|
||||
{
|
||||
// FIXME: This should specifically be an XML document.
|
||||
auto xml_document = Document::create();
|
||||
|
@ -51,7 +51,7 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
||||
NonnullRefPtr<Document> DOMImplementation::create_html_document(const String& title) const
|
||||
NonnullRefPtr<Document> DOMImplementation::create_html_document(String const& title) const
|
||||
{
|
||||
// FIXME: This should specifically be a HTML document.
|
||||
auto html_document = Document::create();
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
}
|
||||
|
||||
ExceptionOr<NonnullRefPtr<Document>> create_document(String const&, String const&, RefPtr<DocumentType>) const;
|
||||
NonnullRefPtr<Document> create_html_document(const String& title) const;
|
||||
NonnullRefPtr<Document> create_html_document(String const& title) const;
|
||||
ExceptionOr<NonnullRefPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id);
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
|
||||
|
|
|
@ -307,7 +307,7 @@ Origin Document::origin() const
|
|||
return { m_url.protocol(), m_url.host(), m_url.port_or_default() };
|
||||
}
|
||||
|
||||
void Document::set_origin(const Origin& origin)
|
||||
void Document::set_origin(Origin const& origin)
|
||||
{
|
||||
m_url.set_protocol(origin.protocol());
|
||||
m_url.set_host(origin.host());
|
||||
|
@ -328,7 +328,7 @@ void Document::schedule_layout_update()
|
|||
m_layout_update_timer->start();
|
||||
}
|
||||
|
||||
bool Document::is_child_allowed(const Node& node) const
|
||||
bool Document::is_child_allowed(Node const& node) const
|
||||
{
|
||||
switch (node.type()) {
|
||||
case NodeType::DOCUMENT_NODE:
|
||||
|
@ -350,7 +350,7 @@ Element* Document::document_element()
|
|||
return first_child_of_type<Element>();
|
||||
}
|
||||
|
||||
const Element* Document::document_element() const
|
||||
Element const* Document::document_element() const
|
||||
{
|
||||
return first_child_of_type<Element>();
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ String Document::title() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
void Document::set_title(const String& title)
|
||||
void Document::set_title(String const& title)
|
||||
{
|
||||
auto* head_element = const_cast<HTML::HTMLHeadElement*>(head());
|
||||
if (!head_element)
|
||||
|
@ -651,9 +651,9 @@ void Document::set_visited_link_color(Color color)
|
|||
m_visited_link_color = color;
|
||||
}
|
||||
|
||||
const Layout::InitialContainingBlock* Document::layout_node() const
|
||||
Layout::InitialContainingBlock const* Document::layout_node() const
|
||||
{
|
||||
return static_cast<const Layout::InitialContainingBlock*>(Node::layout_node());
|
||||
return static_cast<Layout::InitialContainingBlock const*>(Node::layout_node());
|
||||
}
|
||||
|
||||
Layout::InitialContainingBlock* Document::layout_node()
|
||||
|
@ -935,12 +935,12 @@ NonnullRefPtr<DocumentFragment> Document::create_document_fragment()
|
|||
return adopt_ref(*new DocumentFragment(*this));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Text> Document::create_text_node(const String& data)
|
||||
NonnullRefPtr<Text> Document::create_text_node(String const& data)
|
||||
{
|
||||
return adopt_ref(*new Text(*this, data));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Comment> Document::create_comment(const String& data)
|
||||
NonnullRefPtr<Comment> Document::create_comment(String const& data)
|
||||
{
|
||||
return adopt_ref(*new Comment(*this, data));
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ NonnullRefPtr<Range> Document::create_range()
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createevent
|
||||
NonnullRefPtr<Event> Document::create_event(const String& interface)
|
||||
NonnullRefPtr<Event> Document::create_event(String const& interface)
|
||||
{
|
||||
auto interface_lowercase = interface.to_lowercase();
|
||||
RefPtr<Event> event;
|
||||
|
@ -1101,12 +1101,12 @@ ExceptionOr<NonnullRefPtr<Node>> Document::adopt_node_binding(NonnullRefPtr<Node
|
|||
return node;
|
||||
}
|
||||
|
||||
const DocumentType* Document::doctype() const
|
||||
DocumentType const* Document::doctype() const
|
||||
{
|
||||
return first_child_of_type<DocumentType>();
|
||||
}
|
||||
|
||||
const String& Document::compat_mode() const
|
||||
String const& Document::compat_mode() const
|
||||
{
|
||||
static String back_compat = "BackCompat";
|
||||
static String css1_compat = "CSS1Compat";
|
||||
|
@ -1192,12 +1192,12 @@ Page* Document::page()
|
|||
return m_browsing_context ? m_browsing_context->page() : nullptr;
|
||||
}
|
||||
|
||||
const Page* Document::page() const
|
||||
Page const* Document::page() const
|
||||
{
|
||||
return m_browsing_context ? m_browsing_context->page() : nullptr;
|
||||
}
|
||||
|
||||
EventTarget* Document::get_parent(const Event& event)
|
||||
EventTarget* Document::get_parent(Event const& event)
|
||||
{
|
||||
if (event.type() == HTML::EventNames::load)
|
||||
return nullptr;
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
AK::URL url() const { return m_url; }
|
||||
|
||||
Origin origin() const;
|
||||
void set_origin(const Origin& origin);
|
||||
void set_origin(Origin const& origin);
|
||||
|
||||
AK::URL parse_url(String const&) const;
|
||||
|
||||
|
@ -84,14 +84,14 @@ public:
|
|||
|
||||
void set_hovered_node(Node*);
|
||||
Node* hovered_node() { return m_hovered_node; }
|
||||
const Node* hovered_node() const { return m_hovered_node; }
|
||||
Node const* hovered_node() const { return m_hovered_node; }
|
||||
|
||||
void set_inspected_node(Node*);
|
||||
Node* inspected_node() { return m_inspected_node; }
|
||||
const Node* inspected_node() const { return m_inspected_node; }
|
||||
Node const* inspected_node() const { return m_inspected_node; }
|
||||
|
||||
Element* document_element();
|
||||
const Element* document_element() const;
|
||||
Element const* document_element() const;
|
||||
|
||||
HTML::HTMLHtmlElement* html_element();
|
||||
HTML::HTMLHeadElement* head();
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
ExceptionOr<void> set_body(HTML::HTMLElement* new_body);
|
||||
|
||||
String title() const;
|
||||
void set_title(const String&);
|
||||
void set_title(String const&);
|
||||
|
||||
void attach_to_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&);
|
||||
void detach_from_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&);
|
||||
|
@ -124,9 +124,9 @@ public:
|
|||
HTML::BrowsingContext const* browsing_context() const { return m_browsing_context.ptr(); }
|
||||
|
||||
Page* page();
|
||||
const Page* page() const;
|
||||
Page const* page() const;
|
||||
|
||||
Color background_color(const Gfx::Palette&) const;
|
||||
Color background_color(Gfx::Palette const&) const;
|
||||
Vector<CSS::BackgroundLayerData> const* background_layers() const;
|
||||
|
||||
Color link_color() const;
|
||||
|
@ -148,9 +148,9 @@ public:
|
|||
void invalidate_layout();
|
||||
void invalidate_stacking_context_tree();
|
||||
|
||||
virtual bool is_child_allowed(const Node&) const override;
|
||||
virtual bool is_child_allowed(Node const&) const override;
|
||||
|
||||
const Layout::InitialContainingBlock* layout_node() const;
|
||||
Layout::InitialContainingBlock const* layout_node() const;
|
||||
Layout::InitialContainingBlock* layout_node();
|
||||
|
||||
void schedule_style_update();
|
||||
|
@ -168,8 +168,8 @@ public:
|
|||
NonnullRefPtr<HTMLCollection> forms();
|
||||
NonnullRefPtr<HTMLCollection> scripts();
|
||||
|
||||
const String& source() const { return m_source; }
|
||||
void set_source(const String& source) { m_source = source; }
|
||||
String const& source() const { return m_source; }
|
||||
void set_source(String const& source) { m_source = source; }
|
||||
|
||||
HTML::EnvironmentSettingsObject& relevant_settings_object();
|
||||
JS::Realm& realm();
|
||||
|
@ -177,13 +177,13 @@ public:
|
|||
|
||||
JS::Value run_javascript(StringView source, StringView filename = "(unknown)");
|
||||
|
||||
ExceptionOr<NonnullRefPtr<Element>> create_element(const String& tag_name);
|
||||
ExceptionOr<NonnullRefPtr<Element>> create_element_ns(const String& namespace_, const String& qualified_name);
|
||||
ExceptionOr<NonnullRefPtr<Element>> create_element(String const& tag_name);
|
||||
ExceptionOr<NonnullRefPtr<Element>> create_element_ns(String const& namespace_, String const& qualified_name);
|
||||
NonnullRefPtr<DocumentFragment> create_document_fragment();
|
||||
NonnullRefPtr<Text> create_text_node(const String& data);
|
||||
NonnullRefPtr<Comment> create_comment(const String& data);
|
||||
NonnullRefPtr<Text> create_text_node(String const& data);
|
||||
NonnullRefPtr<Comment> create_comment(String const& data);
|
||||
NonnullRefPtr<Range> create_range();
|
||||
NonnullRefPtr<Event> create_event(const String& interface);
|
||||
NonnullRefPtr<Event> create_event(String const& interface);
|
||||
|
||||
void set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement*);
|
||||
HTML::HTMLScriptElement* pending_parsing_blocking_script() { return m_pending_parsing_blocking_script; }
|
||||
|
@ -205,18 +205,18 @@ public:
|
|||
void adopt_node(Node&);
|
||||
ExceptionOr<NonnullRefPtr<Node>> adopt_node_binding(NonnullRefPtr<Node>);
|
||||
|
||||
const DocumentType* doctype() const;
|
||||
const String& compat_mode() const;
|
||||
DocumentType const* doctype() const;
|
||||
String const& compat_mode() const;
|
||||
|
||||
void set_editable(bool editable) { m_editable = editable; }
|
||||
virtual bool is_editable() const final;
|
||||
|
||||
Element* focused_element() { return m_focused_element; }
|
||||
const Element* focused_element() const { return m_focused_element; }
|
||||
Element const* focused_element() const { return m_focused_element; }
|
||||
|
||||
void set_focused_element(Element*);
|
||||
|
||||
const Element* active_element() const { return m_active_element; }
|
||||
Element const* active_element() const { return m_active_element; }
|
||||
|
||||
void set_active_element(Element*);
|
||||
|
||||
|
@ -224,7 +224,7 @@ public:
|
|||
void set_created_for_appropriate_template_contents(bool value) { m_created_for_appropriate_template_contents = value; }
|
||||
|
||||
Document* associated_inert_template_document() { return m_associated_inert_template_document; }
|
||||
const Document* associated_inert_template_document() const { return m_associated_inert_template_document; }
|
||||
Document const* associated_inert_template_document() const { return m_associated_inert_template_document; }
|
||||
void set_associated_inert_template_document(Document& document) { m_associated_inert_template_document = document; }
|
||||
|
||||
String ready_state() const;
|
||||
|
@ -253,13 +253,13 @@ public:
|
|||
|
||||
HTML::Window* default_view() { return m_window; }
|
||||
|
||||
const String& content_type() const { return m_content_type; }
|
||||
void set_content_type(const String& content_type) { m_content_type = content_type; }
|
||||
String const& content_type() const { return m_content_type; }
|
||||
void set_content_type(String const& content_type) { m_content_type = content_type; }
|
||||
|
||||
bool has_encoding() const { return m_encoding.has_value(); }
|
||||
const Optional<String>& encoding() const { return m_encoding; }
|
||||
Optional<String> const& encoding() const { return m_encoding; }
|
||||
String encoding_or_default() const { return m_encoding.value_or("UTF-8"); }
|
||||
void set_encoding(const Optional<String>& encoding) { m_encoding = encoding; }
|
||||
void set_encoding(Optional<String> const& encoding) { m_encoding = encoding; }
|
||||
|
||||
// NOTE: These are intended for the JS bindings
|
||||
String character_set() const { return encoding_or_default(); }
|
||||
|
@ -280,7 +280,7 @@ public:
|
|||
void increment_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter++; }
|
||||
void decrement_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter--; }
|
||||
|
||||
virtual EventTarget* get_parent(const Event&) override;
|
||||
virtual EventTarget* get_parent(Event const&) override;
|
||||
|
||||
String dump_dom_tree_as_json() const;
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ public:
|
|||
|
||||
virtual FlyString node_name() const override { return "#doctype"; }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
void set_name(const String& name) { m_name = name; }
|
||||
String const& name() const { return m_name; }
|
||||
void set_name(String const& name) { m_name = name; }
|
||||
|
||||
const String& public_id() const { return m_public_id; }
|
||||
void set_public_id(const String& public_id) { m_public_id = public_id; }
|
||||
String const& public_id() const { return m_public_id; }
|
||||
void set_public_id(String const& public_id) { m_public_id = public_id; }
|
||||
|
||||
const String& system_id() const { return m_system_id; }
|
||||
void set_system_id(const String& system_id) { m_system_id = system_id; }
|
||||
String const& system_id() const { return m_system_id; }
|
||||
void set_system_id(String const& system_id) { m_system_id = system_id; }
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
|
|
|
@ -51,7 +51,7 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name)
|
|||
Element::~Element() = default;
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattribute
|
||||
String Element::get_attribute(const FlyString& name) const
|
||||
String Element::get_attribute(FlyString const& name) const
|
||||
{
|
||||
// 1. Let attr be the result of getting an attribute given qualifiedName and this.
|
||||
auto const* attribute = m_attributes->get_attribute(name);
|
||||
|
@ -65,7 +65,7 @@ String Element::get_attribute(const FlyString& name) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-setattribute
|
||||
ExceptionOr<void> Element::set_attribute(const FlyString& name, const String& value)
|
||||
ExceptionOr<void> Element::set_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
// 1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException.
|
||||
// FIXME: Proper name validation
|
||||
|
@ -156,7 +156,7 @@ ExceptionOr<void> Element::set_attribute_ns(FlyString const& namespace_, FlyStri
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-removeattribute
|
||||
void Element::remove_attribute(const FlyString& name)
|
||||
void Element::remove_attribute(FlyString const& name)
|
||||
{
|
||||
m_attributes->remove_attribute(name);
|
||||
|
||||
|
@ -167,7 +167,7 @@ void Element::remove_attribute(const FlyString& name)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-hasattribute
|
||||
bool Element::has_attribute(const FlyString& name) const
|
||||
bool Element::has_attribute(FlyString const& name) const
|
||||
{
|
||||
return m_attributes->get_attribute(name) != nullptr;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ Vector<String> Element::get_attribute_names() const
|
|||
return names;
|
||||
}
|
||||
|
||||
bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensitivity) const
|
||||
bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return any_of(m_classes, [&](auto& it) {
|
||||
return case_sensitivity == CaseSensitivity::CaseSensitive
|
||||
|
@ -291,7 +291,7 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document&
|
|||
TODO();
|
||||
}
|
||||
|
||||
void Element::parse_attribute(const FlyString& name, const String& value)
|
||||
void Element::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
if (name == HTML::AttributeNames::class_) {
|
||||
auto new_classes = value.split_view(is_ascii_space);
|
||||
|
|
|
@ -36,27 +36,27 @@ public:
|
|||
Element(Document&, DOM::QualifiedName);
|
||||
virtual ~Element() override;
|
||||
|
||||
const String& qualified_name() const { return m_qualified_name.as_string(); }
|
||||
const String& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; }
|
||||
String const& qualified_name() const { return m_qualified_name.as_string(); }
|
||||
String const& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; }
|
||||
virtual FlyString node_name() const final { return html_uppercased_qualified_name(); }
|
||||
const FlyString& local_name() const { return m_qualified_name.local_name(); }
|
||||
FlyString const& local_name() const { return m_qualified_name.local_name(); }
|
||||
|
||||
// NOTE: This is for the JS bindings
|
||||
const String& tag_name() const { return html_uppercased_qualified_name(); }
|
||||
String const& tag_name() const { return html_uppercased_qualified_name(); }
|
||||
|
||||
const FlyString& prefix() const { return m_qualified_name.prefix(); }
|
||||
const FlyString& namespace_() const { return m_qualified_name.namespace_(); }
|
||||
FlyString const& prefix() const { return m_qualified_name.prefix(); }
|
||||
FlyString const& namespace_() const { return m_qualified_name.namespace_(); }
|
||||
|
||||
// NOTE: This is for the JS bindings
|
||||
const FlyString& namespace_uri() const { return namespace_(); }
|
||||
FlyString const& namespace_uri() const { return namespace_(); }
|
||||
|
||||
bool has_attribute(const FlyString& name) const;
|
||||
bool has_attribute(FlyString const& name) const;
|
||||
bool has_attributes() const { return !m_attributes->is_empty(); }
|
||||
String attribute(const FlyString& name) const { return get_attribute(name); }
|
||||
String get_attribute(const FlyString& name) const;
|
||||
ExceptionOr<void> set_attribute(const FlyString& name, const String& value);
|
||||
String attribute(FlyString const& name) const { return get_attribute(name); }
|
||||
String get_attribute(FlyString const& name) const;
|
||||
ExceptionOr<void> set_attribute(FlyString const& name, String const& value);
|
||||
ExceptionOr<void> set_attribute_ns(FlyString const& namespace_, FlyString const& qualified_name, String const& value);
|
||||
void remove_attribute(const FlyString& name);
|
||||
void remove_attribute(FlyString const& name);
|
||||
DOM::ExceptionOr<bool> toggle_attribute(FlyString const& name, Optional<bool> force);
|
||||
size_t attribute_list_size() const { return m_attributes->length(); }
|
||||
NonnullRefPtr<NamedNodeMap> const& attributes() const { return m_attributes; }
|
||||
|
@ -81,11 +81,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool has_class(const FlyString&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
const Vector<FlyString>& class_names() const { return m_classes; }
|
||||
bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
Vector<FlyString> const& class_names() const { return m_classes; }
|
||||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
|
||||
virtual void parse_attribute(const FlyString& name, const String& value);
|
||||
virtual void parse_attribute(FlyString const& name, String const& value);
|
||||
virtual void did_remove_attribute(FlyString const&);
|
||||
|
||||
enum class NeedsRelayout {
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
NeedsRelayout recompute_style();
|
||||
|
||||
Layout::NodeWithStyle* layout_node() { return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); }
|
||||
const Layout::NodeWithStyle* layout_node() const { return static_cast<const Layout::NodeWithStyle*>(Node::layout_node()); }
|
||||
Layout::NodeWithStyle const* layout_node() const { return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); }
|
||||
|
||||
String name() const { return attribute(HTML::AttributeNames::name); }
|
||||
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
NonnullRefPtr<HTMLCollection> get_elements_by_class_name(FlyString const&);
|
||||
|
||||
ShadowRoot* shadow_root() { return m_shadow_root; }
|
||||
const ShadowRoot* shadow_root() const { return m_shadow_root; }
|
||||
ShadowRoot const* shadow_root() const { return m_shadow_root; }
|
||||
void set_shadow_root(RefPtr<ShadowRoot>);
|
||||
|
||||
void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); }
|
||||
|
|
|
@ -37,7 +37,7 @@ void Event::set_cancelled_flag()
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-initialize
|
||||
void Event::initialize(const String& type, bool bubbles, bool cancelable)
|
||||
void Event::initialize(String const& type, bool bubbles, bool cancelable)
|
||||
{
|
||||
m_initialized = true;
|
||||
m_stop_propagation = false;
|
||||
|
@ -51,7 +51,7 @@ void Event::initialize(const String& type, bool bubbles, bool cancelable)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-initevent
|
||||
void Event::init_event(const String& type, bool bubbles, bool cancelable)
|
||||
void Event::init_event(String const& type, bool bubbles, bool cancelable)
|
||||
{
|
||||
if (m_dispatch)
|
||||
return;
|
||||
|
|
|
@ -47,11 +47,11 @@ public:
|
|||
|
||||
using Path = Vector<PathEntry>;
|
||||
|
||||
static NonnullRefPtr<Event> create(const FlyString& event_name, EventInit const& event_init = {})
|
||||
static NonnullRefPtr<Event> create(FlyString const& event_name, EventInit const& event_init = {})
|
||||
{
|
||||
return adopt_ref(*new Event(event_name, event_init));
|
||||
}
|
||||
static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, EventInit const& event_init)
|
||||
static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, EventInit const& event_init)
|
||||
{
|
||||
return Event::create(event_name, event_init);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
double time_stamp() const;
|
||||
|
||||
const FlyString& type() const { return m_type; }
|
||||
FlyString const& type() const { return m_type; }
|
||||
void set_type(StringView type) { m_type = type; }
|
||||
|
||||
RefPtr<EventTarget> target() const { return m_target; }
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
void append_to_path(EventTarget&, RefPtr<EventTarget>, RefPtr<EventTarget>, TouchTargetList&, bool);
|
||||
Path& path() { return m_path; }
|
||||
const Path& path() const { return m_path; }
|
||||
Path const& path() const { return m_path; }
|
||||
void clear_path() { m_path.clear(); }
|
||||
|
||||
void set_touch_target_list(TouchTargetList& touch_target_list) { m_touch_target_list = touch_target_list; }
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
m_stop_immediate_propagation = true;
|
||||
}
|
||||
|
||||
void init_event(const String&, bool, bool);
|
||||
void init_event(String const&, bool, bool);
|
||||
|
||||
void set_time_stamp(double time_stamp) { m_time_stamp = time_stamp; }
|
||||
|
||||
|
@ -163,7 +163,7 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
void initialize(const String&, bool, bool);
|
||||
void initialize(String const&, bool, bool);
|
||||
|
||||
private:
|
||||
FlyString m_type;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
virtual JS::Object* create_wrapper(JS::GlobalObject&) = 0;
|
||||
|
||||
virtual EventTarget* get_parent(const Event&) { return nullptr; }
|
||||
virtual EventTarget* get_parent(Event const&) { return nullptr; }
|
||||
|
||||
void add_an_event_listener(NonnullRefPtr<DOMEventListener>);
|
||||
void remove_an_event_listener(DOMEventListener&);
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
auto& event_listener_list() { return m_event_listener_list; }
|
||||
auto const& event_listener_list() const { return m_event_listener_list; }
|
||||
|
||||
Function<void(const Event&)> activation_behavior;
|
||||
Function<void(Event const&)> activation_behavior;
|
||||
|
||||
// NOTE: These only exist for checkbox and radio input elements.
|
||||
virtual void legacy_pre_activation_behavior() { }
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
ExceptionOr(const ValueType& result)
|
||||
ExceptionOr(ValueType const& result)
|
||||
: m_result(result)
|
||||
{
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
}
|
||||
|
||||
ExceptionOr(ExceptionOr&& other) = default;
|
||||
ExceptionOr(const ExceptionOr& other) = default;
|
||||
ExceptionOr(ExceptionOr const& other) = default;
|
||||
~ExceptionOr() = default;
|
||||
|
||||
ValueType& value() requires(!IsSame<ValueType, Empty>)
|
||||
|
|
|
@ -95,7 +95,7 @@ const HTML::HTMLElement* Node::enclosing_html_element() const
|
|||
return first_ancestor_of_type<HTML::HTMLElement>();
|
||||
}
|
||||
|
||||
const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(const FlyString& attribute) const
|
||||
const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(FlyString const& attribute) const
|
||||
{
|
||||
for (auto* node = this; node; node = node->parent()) {
|
||||
if (is<HTML::HTMLElement>(*node) && verify_cast<HTML::HTMLElement>(*node).has_attribute(attribute))
|
||||
|
@ -162,7 +162,7 @@ String Node::node_value() const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-dom-node-nodevalue%E2%91%A0
|
||||
void Node::set_node_value(const String& value)
|
||||
void Node::set_node_value(String const& value)
|
||||
{
|
||||
|
||||
if (is<Attribute>(this)) {
|
||||
|
@ -249,7 +249,7 @@ Element* Node::parent_element()
|
|||
return verify_cast<Element>(parent());
|
||||
}
|
||||
|
||||
const Element* Node::parent_element() const
|
||||
Element const* Node::parent_element() const
|
||||
{
|
||||
if (!parent() || !is<Element>(parent()))
|
||||
return nullptr;
|
||||
|
@ -650,7 +650,7 @@ void Node::set_layout_node(Badge<Layout::Node>, Layout::Node* layout_node) const
|
|||
m_layout_node = nullptr;
|
||||
}
|
||||
|
||||
EventTarget* Node::get_parent(const Event&)
|
||||
EventTarget* Node::get_parent(Event const&)
|
||||
{
|
||||
// FIXME: returns the node’s assigned slot, if node is assigned, and node’s parent otherwise.
|
||||
return parent();
|
||||
|
@ -746,7 +746,7 @@ u16 Node::compare_document_position(RefPtr<Node> other)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor
|
||||
bool Node::is_host_including_inclusive_ancestor_of(const Node& other) const
|
||||
bool Node::is_host_including_inclusive_ancestor_of(Node const& other) const
|
||||
{
|
||||
if (is_inclusive_ancestor_of(other))
|
||||
return true;
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
using TreeNode<Node>::unref;
|
||||
|
||||
ParentNode* parent_or_shadow_host();
|
||||
const ParentNode* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); }
|
||||
ParentNode const* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); }
|
||||
|
||||
// ^EventTarget
|
||||
virtual void ref_event_target() final { ref(); }
|
||||
|
@ -121,24 +121,24 @@ public:
|
|||
void set_node_value(String const&);
|
||||
|
||||
Document& document() { return *m_document; }
|
||||
const Document& document() const { return *m_document; }
|
||||
Document const& document() const { return *m_document; }
|
||||
|
||||
RefPtr<Document> owner_document() const;
|
||||
|
||||
const HTML::HTMLAnchorElement* enclosing_link_element() const;
|
||||
const HTML::HTMLElement* enclosing_html_element() const;
|
||||
const HTML::HTMLElement* enclosing_html_element_with_attribute(const FlyString&) const;
|
||||
const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const;
|
||||
|
||||
String child_text_content() const;
|
||||
|
||||
Node& root();
|
||||
const Node& root() const
|
||||
Node const& root() const
|
||||
{
|
||||
return const_cast<Node*>(this)->root();
|
||||
}
|
||||
|
||||
Node& shadow_including_root();
|
||||
const Node& shadow_including_root() const
|
||||
Node const& shadow_including_root() const
|
||||
{
|
||||
return const_cast<Node*>(this)->shadow_including_root();
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ public:
|
|||
bool is_connected() const;
|
||||
|
||||
Node* parent_node() { return parent(); }
|
||||
const Node* parent_node() const { return parent(); }
|
||||
Node const* parent_node() const { return parent(); }
|
||||
|
||||
Element* parent_element();
|
||||
const Element* parent_element() const;
|
||||
Element const* parent_element() const;
|
||||
|
||||
virtual void inserted();
|
||||
virtual void removed_from(Node*) { }
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
virtual void adopted_from(Document&) { }
|
||||
virtual void cloned(Node&, bool) {};
|
||||
|
||||
const Layout::Node* layout_node() const { return m_layout_node; }
|
||||
Layout::Node const* layout_node() const { return m_layout_node; }
|
||||
Layout::Node* layout_node() { return m_layout_node; }
|
||||
|
||||
Painting::PaintableBox const* paint_box() const;
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
|
||||
void set_layout_node(Badge<Layout::Node>, Layout::Node*) const;
|
||||
|
||||
virtual bool is_child_allowed(const Node&) const { return true; }
|
||||
virtual bool is_child_allowed(Node const&) const { return true; }
|
||||
|
||||
bool needs_style_update() const { return m_needs_style_update; }
|
||||
void set_needs_style_update(bool);
|
||||
|
@ -179,14 +179,14 @@ public:
|
|||
|
||||
void set_document(Badge<Document>, Document&);
|
||||
|
||||
virtual EventTarget* get_parent(const Event&) override;
|
||||
virtual EventTarget* get_parent(Event const&) override;
|
||||
|
||||
template<typename T>
|
||||
bool fast_is() const = delete;
|
||||
|
||||
ExceptionOr<void> ensure_pre_insertion_validity(NonnullRefPtr<Node> node, RefPtr<Node> child) const;
|
||||
|
||||
bool is_host_including_inclusive_ancestor_of(const Node&) const;
|
||||
bool is_host_including_inclusive_ancestor_of(Node const&) const;
|
||||
|
||||
bool is_scripting_enabled() const;
|
||||
bool is_scripting_disabled() const;
|
||||
|
|
|
@ -51,10 +51,10 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Element* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); }
|
||||
const Element* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); }
|
||||
const Element* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); }
|
||||
const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); }
|
||||
Element const* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); }
|
||||
Element const* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); }
|
||||
Element const* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); }
|
||||
Element const* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); }
|
||||
|
||||
protected:
|
||||
NonDocumentTypeChildNode() = default;
|
||||
|
|
|
@ -16,10 +16,10 @@ namespace Web::DOM {
|
|||
template<typename NodeType>
|
||||
class NonElementParentNode {
|
||||
public:
|
||||
RefPtr<Element> get_element_by_id(const FlyString& id) const
|
||||
RefPtr<Element> get_element_by_id(FlyString const& id) const
|
||||
{
|
||||
RefPtr<Element> found_element;
|
||||
static_cast<const NodeType*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.attribute(HTML::AttributeNames::id) == id) {
|
||||
found_element = &element;
|
||||
return IterationDecision::Break;
|
||||
|
@ -28,9 +28,9 @@ public:
|
|||
});
|
||||
return found_element;
|
||||
}
|
||||
RefPtr<Element> get_element_by_id(const FlyString& id)
|
||||
RefPtr<Element> get_element_by_id(FlyString const& id)
|
||||
{
|
||||
return const_cast<const NonElementParentNode*>(this)->get_element_by_id(id);
|
||||
return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
bool is_valid() const { return m_node; }
|
||||
|
||||
Node* node() { return m_node; }
|
||||
const Node* node() const { return m_node; }
|
||||
Node const* node() const { return m_node; }
|
||||
|
||||
unsigned offset() const { return m_offset; }
|
||||
bool offset_is_at_end_of_node() const;
|
||||
|
@ -29,12 +29,12 @@ public:
|
|||
bool increment_offset();
|
||||
bool decrement_offset();
|
||||
|
||||
bool operator==(const Position& other) const
|
||||
bool operator==(Position const& other) const
|
||||
{
|
||||
return m_node == other.m_node && m_offset == other.m_offset;
|
||||
}
|
||||
|
||||
bool operator!=(const Position& other) const
|
||||
bool operator!=(Position const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
ProcessingInstruction::ProcessingInstruction(Document& document, const String& data, const String& target)
|
||||
ProcessingInstruction::ProcessingInstruction(Document& document, String const& data, String const& target)
|
||||
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data)
|
||||
, m_target(target)
|
||||
{
|
||||
|
|
|
@ -15,12 +15,12 @@ class ProcessingInstruction final : public CharacterData {
|
|||
public:
|
||||
using WrapperType = Bindings::ProcessingInstructionWrapper;
|
||||
|
||||
ProcessingInstruction(Document&, const String& data, const String& target);
|
||||
ProcessingInstruction(Document&, String const& data, String const& target);
|
||||
virtual ~ProcessingInstruction() override = default;
|
||||
|
||||
virtual FlyString node_name() const override { return m_target; }
|
||||
|
||||
const String& target() const { return m_target; }
|
||||
String const& target() const { return m_target; }
|
||||
|
||||
private:
|
||||
String m_target;
|
||||
|
|
|
@ -19,7 +19,7 @@ ShadowRoot::ShadowRoot(Document& document, Element& host)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6
|
||||
EventTarget* ShadowRoot::get_parent(const Event& event)
|
||||
EventTarget* ShadowRoot::get_parent(Event const& event)
|
||||
{
|
||||
if (!event.composed()) {
|
||||
auto& events_first_invocation_target = verify_cast<Node>(*event.path().first().invocation_target);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; }
|
||||
|
||||
// ^EventTarget
|
||||
virtual EventTarget* get_parent(const Event&) override;
|
||||
virtual EventTarget* get_parent(Event const&) override;
|
||||
|
||||
// NOTE: This is intended for the JS bindings.
|
||||
String mode() const { return m_closed ? "closed" : "open"; }
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
Text::Text(Document& document, const String& data)
|
||||
Text::Text(Document& document, String const& data)
|
||||
: CharacterData(document, NodeType::TEXT_NODE, data)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class Text final : public CharacterData {
|
|||
public:
|
||||
using WrapperType = Bindings::TextWrapper;
|
||||
|
||||
explicit Text(Document&, const String&);
|
||||
explicit Text(Document&, String const&);
|
||||
virtual ~Text() override = default;
|
||||
|
||||
static NonnullRefPtr<Text> create_with_global_object(Bindings::WindowObject& window, String const& data);
|
||||
|
|
|
@ -36,14 +36,14 @@ public:
|
|||
private:
|
||||
DOMTreeModel(JsonObject, GUI::TreeView&);
|
||||
|
||||
ALWAYS_INLINE JsonObject const* get_parent(const JsonObject& o) const
|
||||
ALWAYS_INLINE JsonObject const* get_parent(JsonObject const& o) const
|
||||
{
|
||||
auto parent_node = m_dom_node_to_parent_map.get(&o);
|
||||
VERIFY(parent_node.has_value());
|
||||
return *parent_node;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static JsonArray const* get_children(const JsonObject& o)
|
||||
ALWAYS_INLINE static JsonArray const* get_children(JsonObject const& o)
|
||||
{
|
||||
if (auto const* maybe_children = o.get_ptr("children"); maybe_children)
|
||||
return &maybe_children->as_array();
|
||||
|
|
|
@ -13,7 +13,7 @@ FontCache& FontCache::the()
|
|||
return cache;
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Font> FontCache::get(const FontSelector& font_selector) const
|
||||
RefPtr<Gfx::Font> FontCache::get(FontSelector const& font_selector) const
|
||||
{
|
||||
auto cached_font = m_fonts.get(font_selector);
|
||||
if (cached_font.has_value())
|
||||
|
@ -21,7 +21,7 @@ RefPtr<Gfx::Font> FontCache::get(const FontSelector& font_selector) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void FontCache::set(const FontSelector& font_selector, NonnullRefPtr<Gfx::Font> font)
|
||||
void FontCache::set(FontSelector const& font_selector, NonnullRefPtr<Gfx::Font> font)
|
||||
{
|
||||
m_fonts.set(font_selector, move(font));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ struct FontSelector {
|
|||
int weight { 0 };
|
||||
int slope { 0 };
|
||||
|
||||
bool operator==(const FontSelector& other) const
|
||||
bool operator==(FontSelector const& other) const
|
||||
{
|
||||
return family == other.family && point_size == other.point_size && weight == other.weight && slope == other.slope;
|
||||
}
|
||||
|
@ -27,15 +27,15 @@ struct FontSelector {
|
|||
namespace AK {
|
||||
template<>
|
||||
struct Traits<FontSelector> : public GenericTraits<FontSelector> {
|
||||
static unsigned hash(const FontSelector& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); }
|
||||
static unsigned hash(FontSelector const& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); }
|
||||
};
|
||||
}
|
||||
|
||||
class FontCache {
|
||||
public:
|
||||
static FontCache& the();
|
||||
RefPtr<Gfx::Font> get(const FontSelector&) const;
|
||||
void set(const FontSelector&, NonnullRefPtr<Gfx::Font>);
|
||||
RefPtr<Gfx::Font> get(FontSelector const&) const;
|
||||
void set(FontSelector const&, NonnullRefPtr<Gfx::Font>);
|
||||
|
||||
private:
|
||||
FontCache() = default;
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
virtual ~BrowsingContextContainer() override;
|
||||
|
||||
BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; }
|
||||
const BrowsingContext* nested_browsing_context() const { return m_nested_browsing_context; }
|
||||
BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; }
|
||||
|
||||
const DOM::Document* content_document() const;
|
||||
DOM::Document const* content_document_without_origin_check() const;
|
||||
|
|
|
@ -207,7 +207,7 @@ void CanvasRenderingContext2D::rotate(float radians)
|
|||
m_drawing_state.transform.rotate_radians(radians);
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::did_draw(const Gfx::FloatRect&)
|
||||
void CanvasRenderingContext2D::did_draw(Gfx::FloatRect const&)
|
||||
{
|
||||
// FIXME: Make use of the rect to reduce the invalidated area when possible.
|
||||
if (!m_element)
|
||||
|
@ -230,7 +230,7 @@ OwnPtr<Gfx::Painter> CanvasRenderingContext2D::painter()
|
|||
return make<Gfx::Painter>(*m_element->bitmap());
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::fill_text(const String& text, float x, float y, Optional<double> max_width)
|
||||
void CanvasRenderingContext2D::fill_text(String const& text, float x, float y, Optional<double> max_width)
|
||||
{
|
||||
if (max_width.has_value() && max_width.value() <= 0)
|
||||
return;
|
||||
|
@ -383,7 +383,7 @@ void CanvasRenderingContext2D::fill(Gfx::Painter::WindingRule winding)
|
|||
did_draw(m_path.bounding_box());
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::fill(const String& fill_rule)
|
||||
void CanvasRenderingContext2D::fill(String const& fill_rule)
|
||||
{
|
||||
if (fill_rule == "evenodd")
|
||||
return fill(Gfx::Painter::WindingRule::EvenOdd);
|
||||
|
@ -439,7 +439,7 @@ DOM::ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int
|
|||
return image_data;
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::put_image_data(const ImageData& image_data, float x, float y)
|
||||
void CanvasRenderingContext2D::put_image_data(ImageData const& image_data, float x, float y)
|
||||
{
|
||||
auto painter = this->painter();
|
||||
if (!painter)
|
||||
|
|
|
@ -72,16 +72,16 @@ public:
|
|||
void rect(float x, float y, float width, float height);
|
||||
void stroke();
|
||||
|
||||
void fill_text(const String&, float x, float y, Optional<double> max_width);
|
||||
void fill_text(String const&, float x, float y, Optional<double> max_width);
|
||||
void stroke_text(String const&, float x, float y, Optional<double> max_width);
|
||||
|
||||
// FIXME: We should only have one fill(), really. Fix the wrapper generator!
|
||||
void fill(Gfx::Painter::WindingRule);
|
||||
void fill(const String& fill_rule);
|
||||
void fill(String const& fill_rule);
|
||||
|
||||
RefPtr<ImageData> create_image_data(int width, int height) const;
|
||||
DOM::ExceptionOr<RefPtr<ImageData>> get_image_data(int x, int y, int width, int height) const;
|
||||
void put_image_data(const ImageData&, float x, float y);
|
||||
void put_image_data(ImageData const&, float x, float y);
|
||||
|
||||
void save();
|
||||
void restore();
|
||||
|
@ -112,7 +112,7 @@ private:
|
|||
Gfx::IntRect bounding_box;
|
||||
};
|
||||
|
||||
void did_draw(const Gfx::FloatRect&);
|
||||
void did_draw(Gfx::FloatRect const&);
|
||||
PreparedText prepare_text(String const& text, float max_width = INFINITY);
|
||||
|
||||
OwnPtr<Gfx::Painter> painter();
|
||||
|
|
|
@ -37,7 +37,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLBodyElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
if (name.equals_ignoring_case("link")) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
HTMLBodyElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLBodyElement() override;
|
||||
|
||||
virtual void parse_attribute(const FlyString&, const String&) override;
|
||||
virtual void parse_attribute(FlyString const&, String const&) override;
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -59,7 +59,7 @@ CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type)
|
|||
return m_context;
|
||||
}
|
||||
|
||||
static Gfx::IntSize bitmap_size_for_canvas(const HTMLCanvasElement& canvas)
|
||||
static Gfx::IntSize bitmap_size_for_canvas(HTMLCanvasElement const& canvas)
|
||||
{
|
||||
auto width = canvas.width();
|
||||
auto height = canvas.height();
|
||||
|
@ -94,7 +94,7 @@ bool HTMLCanvasElement::create_bitmap()
|
|||
return m_bitmap;
|
||||
}
|
||||
|
||||
String HTMLCanvasElement::to_data_url(const String& type, [[maybe_unused]] Optional<double> quality) const
|
||||
String HTMLCanvasElement::to_data_url(String const& type, [[maybe_unused]] Optional<double> quality) const
|
||||
{
|
||||
if (!m_bitmap)
|
||||
return {};
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
HTMLCanvasElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLCanvasElement() override;
|
||||
|
||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||
Gfx::Bitmap const* bitmap() const { return m_bitmap; }
|
||||
Gfx::Bitmap* bitmap() { return m_bitmap; }
|
||||
bool create_bitmap();
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
void set_width(unsigned);
|
||||
void set_height(unsigned);
|
||||
|
||||
String to_data_url(const String& type, Optional<double> quality) const;
|
||||
String to_data_url(String const& type, Optional<double> quality) const;
|
||||
|
||||
private:
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
|
|
@ -78,7 +78,7 @@ String HTMLElement::content_editable() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
|
||||
DOM::ExceptionOr<void> HTMLElement::set_content_editable(const String& content_editable)
|
||||
DOM::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable)
|
||||
{
|
||||
if (content_editable.equals_ignoring_case("inherit")) {
|
||||
remove_attribute(HTML::AttributeNames::contenteditable);
|
||||
|
@ -112,7 +112,7 @@ String HTMLElement::inner_text()
|
|||
if (!layout_node())
|
||||
return text_content();
|
||||
|
||||
Function<void(const Layout::Node&)> recurse = [&](auto& node) {
|
||||
Function<void(Layout::Node const&)> recurse = [&](auto& node) {
|
||||
for (auto* child = node.first_child(); child; child = child->next_sibling()) {
|
||||
if (is<Layout::TextNode>(child))
|
||||
builder.append(verify_cast<Layout::TextNode>(*child).text_for_rendering());
|
||||
|
@ -168,7 +168,7 @@ bool HTMLElement::cannot_navigate() const
|
|||
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
|
||||
}
|
||||
|
||||
void HTMLElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
Element::parse_attribute(name, value);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
virtual bool is_editable() const final;
|
||||
String content_editable() const;
|
||||
DOM::ExceptionOr<void> set_content_editable(const String&);
|
||||
DOM::ExceptionOr<void> set_content_editable(String const&);
|
||||
|
||||
String inner_text();
|
||||
void set_inner_text(StringView);
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
virtual bool is_labelable() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
private:
|
||||
// ^HTML::GlobalEventHandlers
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLFieldSetElement() override;
|
||||
|
||||
const String& type() const
|
||||
String const& type() const
|
||||
{
|
||||
static String fieldset = "fieldset";
|
||||
return fieldset;
|
||||
|
|
|
@ -25,7 +25,7 @@ RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::St
|
|||
return adopt_ref(*new Layout::FrameBox(document(), *this, move(style)));
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLIFrameElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
if (name == HTML::AttributeNames::src)
|
||||
|
@ -56,7 +56,7 @@ void HTMLIFrameElement::removed_from(DOM::Node* node)
|
|||
discard_nested_browsing_context();
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::load_src(const String& value)
|
||||
void HTMLIFrameElement::load_src(String const& value)
|
||||
{
|
||||
if (!m_nested_browsing_context)
|
||||
return;
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
private:
|
||||
virtual void inserted() override;
|
||||
virtual void removed_from(Node*) override;
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
void load_src(const String&);
|
||||
void load_src(String const&);
|
||||
};
|
||||
|
||||
void run_iframe_load_event_steps(HTML::HTMLIFrameElement&);
|
||||
|
|
|
@ -70,7 +70,7 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLImageElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLImageElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
|
||||
|
@ -83,7 +83,7 @@ RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::Sty
|
|||
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* HTMLImageElement::bitmap() const
|
||||
Gfx::Bitmap const* HTMLImageElement::bitmap() const
|
||||
{
|
||||
return m_image_loader.bitmap(m_image_loader.current_frame_index());
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ public:
|
|||
HTMLImageElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLImageElement() override;
|
||||
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
String alt() const { return attribute(HTML::AttributeNames::alt); }
|
||||
String src() const { return attribute(HTML::AttributeNames::src); }
|
||||
|
||||
const Gfx::Bitmap* bitmap() const;
|
||||
Gfx::Bitmap const* bitmap() const;
|
||||
|
||||
unsigned width() const;
|
||||
void set_width(unsigned);
|
||||
|
|
|
@ -53,7 +53,7 @@ void HTMLLinkElement::inserted()
|
|||
}
|
||||
}
|
||||
|
||||
void HTMLLinkElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
if (name == HTML::AttributeNames::rel) {
|
||||
m_relationship = 0;
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
String href() const { return attribute(HTML::AttributeNames::href); }
|
||||
|
||||
private:
|
||||
void parse_attribute(const FlyString&, const String&) override;
|
||||
void parse_attribute(FlyString const&, String const&) override;
|
||||
|
||||
// ^ResourceClient
|
||||
virtual void resource_did_fail() override;
|
||||
|
|
|
@ -23,7 +23,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName
|
|||
|
||||
HTMLObjectElement::~HTMLObjectElement() = default;
|
||||
|
||||
void HTMLObjectElement::parse_attribute(const FlyString& name, const String& value)
|
||||
void HTMLObjectElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
BrowsingContextContainer::parse_attribute(name, value);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
HTMLObjectElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLObjectElement() override;
|
||||
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
String data() const;
|
||||
void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); }
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLOutputElement() override;
|
||||
|
||||
const String& type() const
|
||||
String const& type() const
|
||||
{
|
||||
static String output = "output";
|
||||
return output;
|
||||
|
|
|
@ -99,7 +99,7 @@ void HTMLScriptElement::execute_script()
|
|||
}
|
||||
|
||||
// https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match
|
||||
static bool is_javascript_mime_type_essence_match(const String& string)
|
||||
static bool is_javascript_mime_type_essence_match(String const& string)
|
||||
{
|
||||
auto lowercase_string = string.to_lowercase();
|
||||
return lowercase_string.is_one_of("application/ecmascript", "application/javascript", "application/x-ecmascript", "application/x-javascript", "text/ecmascript", "text/javascript", "text/javascript1.0", "text/javascript1.1", "text/javascript1.2", "text/javascript1.3", "text/javascript1.4", "text/javascript1.5", "text/jscript", "text/livescript", "text/x-ecmascript", "text/x-javascript");
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~HTMLTemplateElement() override;
|
||||
|
||||
NonnullRefPtr<DOM::DocumentFragment> content() { return *m_content; }
|
||||
const NonnullRefPtr<DOM::DocumentFragment> content() const { return *m_content; }
|
||||
NonnullRefPtr<DOM::DocumentFragment> const content() const { return *m_content; }
|
||||
|
||||
virtual void adopted_from(DOM::Document&) override;
|
||||
virtual void cloned(Node& copy, bool clone_children) override;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual ~HTMLTextAreaElement() override;
|
||||
|
||||
const String& type() const
|
||||
String const& type() const
|
||||
{
|
||||
static String textarea = "textarea";
|
||||
return textarea;
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
unsigned height() const;
|
||||
|
||||
Gfx::Bitmap& bitmap() { return m_bitmap; }
|
||||
const Gfx::Bitmap& bitmap() const { return m_bitmap; }
|
||||
Gfx::Bitmap const& bitmap() const { return m_bitmap; }
|
||||
|
||||
JS::Uint8ClampedArray* data();
|
||||
const JS::Uint8ClampedArray* data() const;
|
||||
|
|
|
@ -16,17 +16,17 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
bool prescan_should_abort(const ByteBuffer& input, const size_t& position)
|
||||
bool prescan_should_abort(ByteBuffer const& input, size_t const& position)
|
||||
{
|
||||
return position >= input.size() || position >= 1024;
|
||||
}
|
||||
|
||||
bool prescan_is_whitespace_or_slash(const u8& byte)
|
||||
bool prescan_is_whitespace_or_slash(u8 const& byte)
|
||||
{
|
||||
return byte == '\t' || byte == '\n' || byte == '\f' || byte == '\r' || byte == ' ' || byte == '/';
|
||||
}
|
||||
|
||||
bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position)
|
||||
bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position)
|
||||
{
|
||||
while (!prescan_should_abort(input, position) && (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '/'))
|
||||
++position;
|
||||
|
@ -96,7 +96,7 @@ Optional<StringView> extract_character_encoding_from_meta_element(String const&
|
|||
return TextCodec::get_standardized_encoding(encoding);
|
||||
}
|
||||
|
||||
RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, const ByteBuffer& input, size_t& position)
|
||||
RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position)
|
||||
{
|
||||
if (!prescan_skip_whitespace_and_slashes(input, position))
|
||||
return {};
|
||||
|
@ -160,7 +160,7 @@ value:
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
|
||||
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, const ByteBuffer& input)
|
||||
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input)
|
||||
{
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
|
||||
|
||||
|
@ -249,7 +249,7 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, cons
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding
|
||||
String run_encoding_sniffing_algorithm(DOM::Document& document, const ByteBuffer& input)
|
||||
String run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input)
|
||||
{
|
||||
if (input.size() >= 2) {
|
||||
if (input[0] == 0xFE && input[1] == 0xFF) {
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
bool prescan_should_abort(const ByteBuffer& input, const size_t& position);
|
||||
bool prescan_is_whitespace_or_slash(const u8& byte);
|
||||
bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position);
|
||||
bool prescan_should_abort(ByteBuffer const& input, size_t const& position);
|
||||
bool prescan_is_whitespace_or_slash(u8 const& byte);
|
||||
bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position);
|
||||
Optional<StringView> extract_character_encoding_from_meta_element(String const&);
|
||||
RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, const ByteBuffer& input, size_t& position);
|
||||
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, const ByteBuffer& input);
|
||||
String run_encoding_sniffing_algorithm(DOM::Document&, const ByteBuffer& input);
|
||||
RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position);
|
||||
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input);
|
||||
String run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input);
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
static inline void log_parse_error(const SourceLocation& location = SourceLocation::current())
|
||||
static inline void log_parse_error(SourceLocation const& location = SourceLocation::current())
|
||||
{
|
||||
dbgln("Parse error! {}", location);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ static bool is_html_integration_point(DOM::Element const& element)
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, const String& encoding)
|
||||
RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, String const& encoding)
|
||||
{
|
||||
auto document = DOM::Document::create(url);
|
||||
auto parser = HTMLParser::create(document, data, encoding);
|
||||
|
@ -126,7 +126,7 @@ RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, c
|
|||
return document;
|
||||
}
|
||||
|
||||
HTMLParser::HTMLParser(DOM::Document& document, StringView input, const String& encoding)
|
||||
HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const& encoding)
|
||||
: m_tokenizer(input, encoding)
|
||||
, m_document(document)
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ void HTMLParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& toke
|
|||
}
|
||||
}
|
||||
|
||||
DOM::QuirksMode HTMLParser::which_quirks_mode(const HTMLToken& doctype_token) const
|
||||
DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) const
|
||||
{
|
||||
if (doctype_token.doctype_data().force_quirks)
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
@ -651,7 +651,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::create_element_for(HTMLToken const& toke
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element
|
||||
NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_)
|
||||
NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(HTMLToken const& token, FlyString const& namespace_)
|
||||
{
|
||||
auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
|
||||
|
||||
|
@ -677,7 +677,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken&
|
|||
return element;
|
||||
}
|
||||
|
||||
NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(const HTMLToken& token)
|
||||
NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(HTMLToken const& token)
|
||||
{
|
||||
return insert_foreign_element(token, Namespace::HTML);
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ AnythingElse:
|
|||
process_using_the_rules_for(m_insertion_mode, token);
|
||||
}
|
||||
|
||||
void HTMLParser::generate_implied_end_tags(const FlyString& exception)
|
||||
void HTMLParser::generate_implied_end_tags(FlyString const& exception)
|
||||
{
|
||||
while (current_node().local_name() != exception && current_node().local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc))
|
||||
(void)m_stack_of_open_elements.pop();
|
||||
|
@ -1335,7 +1335,7 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a
|
|||
}
|
||||
}
|
||||
|
||||
bool HTMLParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_)
|
||||
bool HTMLParser::is_special_tag(FlyString const& tag_name, FlyString const& namespace_)
|
||||
{
|
||||
if (namespace_ == Namespace::HTML) {
|
||||
return tag_name.is_one_of(
|
||||
|
@ -3357,7 +3357,7 @@ void HTMLParser::reset_the_insertion_mode_appropriately()
|
|||
m_insertion_mode = InsertionMode::InBody;
|
||||
}
|
||||
|
||||
const char* HTMLParser::insertion_mode_name() const
|
||||
char const* HTMLParser::insertion_mode_name() const
|
||||
{
|
||||
switch (m_insertion_mode) {
|
||||
#define __ENUMERATE_INSERTION_MODE(mode) \
|
||||
|
@ -3430,7 +3430,7 @@ NonnullRefPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& docume
|
|||
return adopt_ref(*new HTMLParser(document));
|
||||
}
|
||||
|
||||
NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, const ByteBuffer& input)
|
||||
NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input)
|
||||
{
|
||||
if (document.has_encoding())
|
||||
return adopt_ref(*new HTMLParser(document, input, document.encoding().value()));
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Web::HTML {
|
|||
__ENUMERATE_INSERTION_MODE(AfterAfterBody) \
|
||||
__ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
|
||||
|
||||
RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, const String& encoding);
|
||||
RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, String const& encoding);
|
||||
|
||||
class HTMLParser : public RefCounted<HTMLParser> {
|
||||
friend class HTMLTokenizer;
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
InsertionMode insertion_mode() const { return m_insertion_mode; }
|
||||
|
||||
static bool is_special_tag(const FlyString& tag_name, const FlyString& namespace_);
|
||||
static bool is_special_tag(FlyString const& tag_name, FlyString const& namespace_);
|
||||
|
||||
HTMLTokenizer& tokenizer() { return m_tokenizer; }
|
||||
|
||||
|
@ -76,12 +76,12 @@ public:
|
|||
size_t script_nesting_level() const { return m_script_nesting_level; }
|
||||
|
||||
private:
|
||||
HTMLParser(DOM::Document&, StringView input, const String& encoding);
|
||||
HTMLParser(DOM::Document&, StringView input, String const& encoding);
|
||||
HTMLParser(DOM::Document&);
|
||||
|
||||
const char* insertion_mode_name() const;
|
||||
char const* insertion_mode_name() const;
|
||||
|
||||
DOM::QuirksMode which_quirks_mode(const HTMLToken&) const;
|
||||
DOM::QuirksMode which_quirks_mode(HTMLToken const&) const;
|
||||
|
||||
void handle_initial(HTMLToken&);
|
||||
void handle_before_html(HTMLToken&);
|
||||
|
@ -111,7 +111,7 @@ private:
|
|||
|
||||
void stop_parsing() { m_stop_parsing = true; }
|
||||
|
||||
void generate_implied_end_tags(const FlyString& exception = {});
|
||||
void generate_implied_end_tags(FlyString const& exception = {});
|
||||
void generate_all_implied_end_tags_thoroughly();
|
||||
NonnullRefPtr<DOM::Element> create_element_for(HTMLToken const&, FlyString const& namespace_, DOM::Node const& intended_parent);
|
||||
|
||||
|
@ -124,8 +124,8 @@ private:
|
|||
|
||||
DOM::Text* find_character_insertion_node();
|
||||
void flush_character_insertions();
|
||||
NonnullRefPtr<DOM::Element> insert_foreign_element(const HTMLToken&, const FlyString&);
|
||||
NonnullRefPtr<DOM::Element> insert_html_element(const HTMLToken&);
|
||||
NonnullRefPtr<DOM::Element> insert_foreign_element(HTMLToken const&, FlyString const&);
|
||||
NonnullRefPtr<DOM::Element> insert_html_element(HTMLToken const&);
|
||||
DOM::Element& current_node();
|
||||
DOM::Element& adjusted_current_node();
|
||||
DOM::Element& node_before_current_node();
|
||||
|
|
|
@ -31,7 +31,7 @@ bool ListOfActiveFormattingElements::contains(const DOM::Element& element) const
|
|||
return false;
|
||||
}
|
||||
|
||||
DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(const FlyString& tag_name)
|
||||
DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(FlyString const& tag_name)
|
||||
{
|
||||
for (ssize_t i = m_entries.size() - 1; i >= 0; --i) {
|
||||
auto& entry = m_entries[i];
|
||||
|
|
|
@ -34,10 +34,10 @@ public:
|
|||
|
||||
void remove(DOM::Element&);
|
||||
|
||||
const Vector<Entry>& entries() const { return m_entries; }
|
||||
Vector<Entry> const& entries() const { return m_entries; }
|
||||
Vector<Entry>& entries() { return m_entries; }
|
||||
|
||||
DOM::Element* last_element_with_tag_name_before_marker(const FlyString& tag_name);
|
||||
DOM::Element* last_element_with_tag_name_before_marker(FlyString const& tag_name);
|
||||
|
||||
void clear_up_to_the_last_marker();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ static Vector<FlyString> s_base_list { "applet", "caption", "html", "table", "td
|
|||
|
||||
StackOfOpenElements::~StackOfOpenElements() = default;
|
||||
|
||||
bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>& list) const
|
||||
bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const& list) const
|
||||
{
|
||||
for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
|
||||
auto& node = m_elements.at(i);
|
||||
|
@ -26,12 +26,12 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_scope(FlyString const& tag_name) const
|
||||
{
|
||||
return has_in_scope_impl(tag_name, s_base_list);
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>& list) const
|
||||
bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const& list) const
|
||||
{
|
||||
for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
|
||||
auto& node = m_elements.at(i);
|
||||
|
@ -48,19 +48,19 @@ bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const
|
|||
return has_in_scope_impl(target_node, s_base_list);
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_button_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_button_scope(FlyString const& tag_name) const
|
||||
{
|
||||
auto list = s_base_list;
|
||||
list.append("button");
|
||||
return has_in_scope_impl(tag_name, list);
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_table_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_table_scope(FlyString const& tag_name) const
|
||||
{
|
||||
return has_in_scope_impl(tag_name, { "html", "table", "template" });
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_list_item_scope(FlyString const& tag_name) const
|
||||
{
|
||||
auto list = s_base_list;
|
||||
list.append("ol");
|
||||
|
@ -74,7 +74,7 @@ bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) cons
|
|||
// - optgroup in the HTML namespace
|
||||
// - option in the HTML namespace
|
||||
// NOTE: In this case it's "all element types _except_"
|
||||
bool StackOfOpenElements::has_in_select_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_select_scope(FlyString const& tag_name) const
|
||||
{
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#has-an-element-in-the-specific-scope
|
||||
for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
|
||||
|
@ -103,7 +103,7 @@ bool StackOfOpenElements::contains(const DOM::Element& element) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::contains(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::contains(FlyString const& tag_name) const
|
||||
{
|
||||
for (auto& element_on_stack : m_elements) {
|
||||
if (element_on_stack.local_name() == tag_name)
|
||||
|
@ -112,7 +112,7 @@ bool StackOfOpenElements::contains(const FlyString& tag_name) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(const FlyString& tag_name)
|
||||
void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(FlyString const& tag_name)
|
||||
{
|
||||
while (m_elements.last().local_name() != tag_name)
|
||||
(void)pop();
|
||||
|
@ -132,7 +132,7 @@ DOM::Element* StackOfOpenElements::topmost_special_node_below(const DOM::Element
|
|||
return found_element;
|
||||
}
|
||||
|
||||
StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(const FlyString& tag_name)
|
||||
StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(FlyString const& tag_name)
|
||||
{
|
||||
for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
|
||||
auto& element = m_elements[i];
|
||||
|
|
|
@ -36,21 +36,21 @@ public:
|
|||
const DOM::Element& current_node() const { return m_elements.last(); }
|
||||
DOM::Element& current_node() { return m_elements.last(); }
|
||||
|
||||
bool has_in_scope(const FlyString& tag_name) const;
|
||||
bool has_in_button_scope(const FlyString& tag_name) const;
|
||||
bool has_in_table_scope(const FlyString& tag_name) const;
|
||||
bool has_in_list_item_scope(const FlyString& tag_name) const;
|
||||
bool has_in_select_scope(const FlyString& tag_name) const;
|
||||
bool has_in_scope(FlyString const& tag_name) const;
|
||||
bool has_in_button_scope(FlyString const& tag_name) const;
|
||||
bool has_in_table_scope(FlyString const& tag_name) const;
|
||||
bool has_in_list_item_scope(FlyString const& tag_name) const;
|
||||
bool has_in_select_scope(FlyString const& tag_name) const;
|
||||
|
||||
bool has_in_scope(const DOM::Element&) const;
|
||||
|
||||
bool contains(const DOM::Element&) const;
|
||||
bool contains(const FlyString& tag_name) const;
|
||||
bool contains(FlyString const& tag_name) const;
|
||||
|
||||
const NonnullRefPtrVector<DOM::Element>& elements() const { return m_elements; }
|
||||
NonnullRefPtrVector<DOM::Element> const& elements() const { return m_elements; }
|
||||
NonnullRefPtrVector<DOM::Element>& elements() { return m_elements; }
|
||||
|
||||
void pop_until_an_element_with_tag_name_has_been_popped(const FlyString&);
|
||||
void pop_until_an_element_with_tag_name_has_been_popped(FlyString const&);
|
||||
|
||||
DOM::Element* topmost_special_node_below(const DOM::Element&);
|
||||
|
||||
|
@ -58,12 +58,12 @@ public:
|
|||
DOM::Element* element;
|
||||
ssize_t index;
|
||||
};
|
||||
LastElementResult last_element_with_tag_name(const FlyString&);
|
||||
LastElementResult last_element_with_tag_name(FlyString const&);
|
||||
DOM::Element* element_immediately_above(DOM::Element const&);
|
||||
|
||||
private:
|
||||
bool has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>&) const;
|
||||
bool has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>&) const;
|
||||
bool has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const&) const;
|
||||
bool has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const&) const;
|
||||
|
||||
NonnullRefPtrVector<DOM::Element> m_elements;
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ void InProcessWebView::page_did_layout()
|
|||
set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_change_title(const String& title)
|
||||
void InProcessWebView::page_did_change_title(String const& title)
|
||||
{
|
||||
if (on_title_change)
|
||||
on_title_change(title);
|
||||
|
@ -101,19 +101,19 @@ void InProcessWebView::page_did_request_cursor_change(Gfx::StandardCursor cursor
|
|||
set_override_cursor(cursor);
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& content_position)
|
||||
void InProcessWebView::page_did_request_context_menu(Gfx::IntPoint const& content_position)
|
||||
{
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
|
||||
void InProcessWebView::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const AK::URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers)
|
||||
{
|
||||
if (on_link_context_menu_request)
|
||||
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap)
|
||||
void InProcessWebView::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const AK::URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers, Gfx::Bitmap const* bitmap)
|
||||
{
|
||||
if (!on_image_context_menu_request)
|
||||
return;
|
||||
|
@ -123,19 +123,19 @@ void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint&
|
|||
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), move(shareable_bitmap));
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_click_link(const AK::URL& url, const String& target, unsigned modifiers)
|
||||
void InProcessWebView::page_did_click_link(const AK::URL& url, String const& target, unsigned modifiers)
|
||||
{
|
||||
if (on_link_click)
|
||||
on_link_click(url, target, modifiers);
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_middle_click_link(const AK::URL& url, const String& target, unsigned modifiers)
|
||||
void InProcessWebView::page_did_middle_click_link(const AK::URL& url, String const& target, unsigned modifiers)
|
||||
{
|
||||
if (on_link_middle_click)
|
||||
on_link_middle_click(url, target, modifiers);
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_enter_tooltip_area([[maybe_unused]] const Gfx::IntPoint& content_position, const String& title)
|
||||
void InProcessWebView::page_did_enter_tooltip_area([[maybe_unused]] Gfx::IntPoint const& content_position, String const& title)
|
||||
{
|
||||
GUI::Application::the()->show_tooltip(title, nullptr);
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ void InProcessWebView::page_did_unhover_link()
|
|||
on_link_hover({});
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_invalidate(const Gfx::IntRect&)
|
||||
void InProcessWebView::page_did_invalidate(Gfx::IntRect const&)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_change_favicon(const Gfx::Bitmap& bitmap)
|
||||
void InProcessWebView::page_did_change_favicon(Gfx::Bitmap const& bitmap)
|
||||
{
|
||||
if (on_favicon_change)
|
||||
on_favicon_change(bitmap);
|
||||
|
@ -306,7 +306,7 @@ bool InProcessWebView::load(const AK::URL& url)
|
|||
return page().top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
|
||||
}
|
||||
|
||||
const Layout::InitialContainingBlock* InProcessWebView::layout_root() const
|
||||
Layout::InitialContainingBlock const* InProcessWebView::layout_root() const
|
||||
{
|
||||
return document() ? document()->layout_node() : nullptr;
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ Layout::InitialContainingBlock* InProcessWebView::layout_root()
|
|||
return const_cast<Layout::InitialContainingBlock*>(document()->layout_node());
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
|
||||
void InProcessWebView::page_did_request_scroll_into_view(Gfx::IntRect const& rect)
|
||||
{
|
||||
scroll_into_view(rect, true, true);
|
||||
set_override_cursor(Gfx::StandardCursor::None);
|
||||
|
@ -360,18 +360,18 @@ void InProcessWebView::drop_event(GUI::DropEvent& event)
|
|||
AbstractScrollableWidget::drop_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_alert(const String& message)
|
||||
void InProcessWebView::page_did_request_alert(String const& message)
|
||||
{
|
||||
GUI::MessageBox::show(window(), message, "Alert", GUI::MessageBox::Type::Information);
|
||||
}
|
||||
|
||||
bool InProcessWebView::page_did_request_confirm(const String& message)
|
||||
bool InProcessWebView::page_did_request_confirm(String const& message)
|
||||
{
|
||||
auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
|
||||
return confirm_result == GUI::Dialog::ExecResult::ExecOK;
|
||||
}
|
||||
|
||||
String InProcessWebView::page_did_request_prompt(const String& message, const String& default_)
|
||||
String InProcessWebView::page_did_request_prompt(String const& message, String const& default_)
|
||||
{
|
||||
String value { default_ };
|
||||
if (GUI::InputBox::show(window(), value, message, "Prompt") == GUI::InputBox::ExecOK)
|
||||
|
@ -386,7 +386,7 @@ String InProcessWebView::page_did_request_cookie(const AK::URL& url, Cookie::Sou
|
|||
return {};
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_set_cookie(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
|
||||
void InProcessWebView::page_did_set_cookie(const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source)
|
||||
{
|
||||
if (on_set_cookie)
|
||||
on_set_cookie(url, cookie, source);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
void set_document(DOM::Document*);
|
||||
|
||||
const Layout::InitialContainingBlock* layout_root() const;
|
||||
Layout::InitialContainingBlock const* layout_root() const;
|
||||
Layout::InitialContainingBlock* layout_root();
|
||||
|
||||
void reload();
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
InProcessWebView();
|
||||
|
||||
Page& page() { return *m_page; }
|
||||
const Page& page() const { return *m_page; }
|
||||
Page const& page() const { return *m_page; }
|
||||
|
||||
virtual void resize_event(GUI::ResizeEvent&) override;
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
@ -67,30 +67,30 @@ private:
|
|||
virtual Gfx::Palette palette() const override { return GUI::AbstractScrollableWidget::palette(); }
|
||||
virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); }
|
||||
virtual CSS::PreferredColorScheme preferred_color_scheme() const override { return m_preferred_color_scheme; }
|
||||
virtual void page_did_change_title(const String&) override;
|
||||
virtual void page_did_change_title(String const&) override;
|
||||
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) override;
|
||||
virtual void page_did_start_loading(const AK::URL&) override;
|
||||
virtual void page_did_finish_loading(const AK::URL&) override;
|
||||
virtual void page_did_change_selection() override;
|
||||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
|
||||
virtual void page_did_request_context_menu(const Gfx::IntPoint&) override;
|
||||
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override;
|
||||
virtual void page_did_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
|
||||
virtual void page_did_middle_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
|
||||
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override;
|
||||
virtual void page_did_request_context_menu(Gfx::IntPoint const&) override;
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::Bitmap const*) override;
|
||||
virtual void page_did_click_link(const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_middle_click_link(const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override;
|
||||
virtual void page_did_leave_tooltip_area() override;
|
||||
virtual void page_did_hover_link(const AK::URL&) override;
|
||||
virtual void page_did_unhover_link() override;
|
||||
virtual void page_did_invalidate(const Gfx::IntRect&) override;
|
||||
virtual void page_did_change_favicon(const Gfx::Bitmap&) override;
|
||||
virtual void page_did_invalidate(Gfx::IntRect const&) override;
|
||||
virtual void page_did_change_favicon(Gfx::Bitmap const&) override;
|
||||
virtual void page_did_layout() override;
|
||||
virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) override;
|
||||
virtual void page_did_request_alert(const String&) override;
|
||||
virtual bool page_did_request_confirm(const String&) override;
|
||||
virtual String page_did_request_prompt(const String&, const String&) override;
|
||||
virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) override;
|
||||
virtual void page_did_request_alert(String const&) override;
|
||||
virtual bool page_did_request_confirm(String const&) override;
|
||||
virtual String page_did_request_prompt(String const&, String const&) override;
|
||||
virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) override;
|
||||
virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) override;
|
||||
virtual void page_did_set_cookie(const AK::URL&, Cookie::ParsedCookie const&, Cookie::Source) override;
|
||||
|
||||
void layout_and_sync_size();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ bool BlockContainer::is_scrollable() const
|
|||
return computed_values().overflow_y() == CSS::Overflow::Scroll;
|
||||
}
|
||||
|
||||
void BlockContainer::set_scroll_offset(const Gfx::FloatPoint& offset)
|
||||
void BlockContainer::set_scroll_offset(Gfx::FloatPoint const& offset)
|
||||
{
|
||||
// FIXME: If there is horizontal and vertical scroll ignore only part of the new offset
|
||||
if (offset.y() < 0 || m_scroll_offset == offset)
|
||||
|
|
|
@ -19,13 +19,13 @@ public:
|
|||
virtual ~BlockContainer() override;
|
||||
|
||||
BlockContainer* previous_sibling() { return verify_cast<BlockContainer>(Node::previous_sibling()); }
|
||||
const BlockContainer* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); }
|
||||
BlockContainer const* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); }
|
||||
BlockContainer* next_sibling() { return verify_cast<BlockContainer>(Node::next_sibling()); }
|
||||
const BlockContainer* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); }
|
||||
BlockContainer const* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); }
|
||||
|
||||
bool is_scrollable() const;
|
||||
const Gfx::FloatPoint& scroll_offset() const { return m_scroll_offset; }
|
||||
void set_scroll_offset(const Gfx::FloatPoint&);
|
||||
Gfx::FloatPoint const& scroll_offset() const { return m_scroll_offset; }
|
||||
void set_scroll_offset(Gfx::FloatPoint const&);
|
||||
|
||||
Painting::PaintableWithLines const* paint_box() const;
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ void BlockFormattingContext::compute_width(Box const& box, LayoutMode layout_mod
|
|||
|
||||
auto margin_left = CSS::Length::make_auto();
|
||||
auto margin_right = CSS::Length::make_auto();
|
||||
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
|
||||
auto try_compute_width = [&](const auto& a_width) {
|
||||
auto try_compute_width = [&](auto const& a_width) {
|
||||
CSS::Length width = a_width;
|
||||
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
|
@ -253,8 +253,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Layo
|
|||
|
||||
auto margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
auto margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||
|
||||
// If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
|
||||
if (margin_left.is_auto())
|
||||
|
|
|
@ -29,7 +29,7 @@ FormattingContext::FormattingContext(Type type, FormattingState& state, Box cons
|
|||
|
||||
FormattingContext::~FormattingContext() = default;
|
||||
|
||||
bool FormattingContext::creates_block_formatting_context(const Box& box)
|
||||
bool FormattingContext::creates_block_formatting_context(Box const& box)
|
||||
{
|
||||
if (box.is_root_element())
|
||||
return true;
|
||||
|
@ -472,12 +472,12 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
|||
|
||||
auto margin_left = CSS::Length::make_auto();
|
||||
auto margin_right = CSS::Length::make_auto();
|
||||
const auto border_left = computed_values.border_left().width;
|
||||
const auto border_right = computed_values.border_right().width;
|
||||
const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box);
|
||||
const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box);
|
||||
auto const border_left = computed_values.border_left().width;
|
||||
auto const border_right = computed_values.border_right().width;
|
||||
auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box);
|
||||
auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box);
|
||||
|
||||
auto try_compute_width = [&](const auto& a_width) {
|
||||
auto try_compute_width = [&](auto const& a_width) {
|
||||
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box);
|
||||
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block).resolved(box);
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ public:
|
|||
Box const& context_box() const { return m_context_box; }
|
||||
|
||||
FormattingContext* parent() { return m_parent; }
|
||||
const FormattingContext* parent() const { return m_parent; }
|
||||
FormattingContext const* parent() const { return m_parent; }
|
||||
|
||||
Type type() const { return m_type; }
|
||||
bool is_block_formatting_context() const { return type() == Type::Block; }
|
||||
|
||||
virtual bool inhibits_floating() const { return false; }
|
||||
|
||||
static bool creates_block_formatting_context(const Box&);
|
||||
static bool creates_block_formatting_context(Box const&);
|
||||
|
||||
static float compute_width_for_replaced_element(FormattingState const&, ReplacedBox const&);
|
||||
static float compute_height_for_replaced_element(FormattingState const&, ReplacedBox const&);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, const ImageLoader& image_loader)
|
||||
ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, ImageLoader const& image_loader)
|
||||
: ReplacedBox(document, element, move(style))
|
||||
, m_image_loader(image_loader)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ class ImageBox
|
|||
: public ReplacedBox
|
||||
, public HTML::BrowsingContext::ViewportClient {
|
||||
public:
|
||||
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&);
|
||||
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, ImageLoader const&);
|
||||
virtual ~ImageBox() override;
|
||||
|
||||
virtual void prepare_for_replaced_layout() override;
|
||||
|
@ -36,7 +36,7 @@ private:
|
|||
int preferred_width() const;
|
||||
int preferred_height() const;
|
||||
|
||||
const ImageLoader& m_image_loader;
|
||||
ImageLoader const& m_image_loader;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -78,13 +78,13 @@ void InitialContainingBlock::recompute_selection_states()
|
|||
});
|
||||
}
|
||||
|
||||
void InitialContainingBlock::set_selection(const LayoutRange& selection)
|
||||
void InitialContainingBlock::set_selection(LayoutRange const& selection)
|
||||
{
|
||||
m_selection = selection;
|
||||
recompute_selection_states();
|
||||
}
|
||||
|
||||
void InitialContainingBlock::set_selection_end(const LayoutPosition& position)
|
||||
void InitialContainingBlock::set_selection_end(LayoutPosition const& position)
|
||||
{
|
||||
m_selection.set_end(position);
|
||||
recompute_selection_states();
|
||||
|
|
|
@ -20,9 +20,9 @@ public:
|
|||
|
||||
void paint_all_phases(PaintContext&);
|
||||
|
||||
const LayoutRange& selection() const { return m_selection; }
|
||||
void set_selection(const LayoutRange&);
|
||||
void set_selection_end(const LayoutPosition&);
|
||||
LayoutRange const& selection() const { return m_selection; }
|
||||
void set_selection(LayoutRange const&);
|
||||
void set_selection_end(LayoutPosition const&);
|
||||
|
||||
void build_stacking_context_tree_if_needed();
|
||||
void recompute_selection_states();
|
||||
|
|
|
@ -65,7 +65,7 @@ void Label::handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPo
|
|||
}
|
||||
}
|
||||
|
||||
bool Label::is_inside_associated_label(LabelableNode const& control, const Gfx::IntPoint& position)
|
||||
bool Label::is_inside_associated_label(LabelableNode const& control, Gfx::IntPoint const& position)
|
||||
{
|
||||
if (auto* label = label_for_control_node(control); label)
|
||||
return enclosing_int_rect(label->paint_box()->absolute_rect()).contains(position);
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
|
||||
HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
|
||||
|
||||
void handle_mousedown_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
|
||||
void handle_mouseup_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
|
||||
void handle_mousemove_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button);
|
||||
void handle_mousedown_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
|
||||
void handle_mouseup_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
|
||||
void handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button);
|
||||
|
||||
LabelableNode* labeled_control();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ struct LayoutPosition {
|
|||
class LayoutRange {
|
||||
public:
|
||||
LayoutRange() = default;
|
||||
LayoutRange(const LayoutPosition& start, const LayoutPosition& end)
|
||||
LayoutRange(LayoutPosition const& start, LayoutPosition const& end)
|
||||
: m_start(start)
|
||||
, m_end(end)
|
||||
{
|
||||
|
@ -32,18 +32,18 @@ public:
|
|||
|
||||
bool is_valid() const { return m_start.layout_node && m_end.layout_node; }
|
||||
|
||||
void set(const LayoutPosition& start, const LayoutPosition& end)
|
||||
void set(LayoutPosition const& start, LayoutPosition const& end)
|
||||
{
|
||||
m_start = start;
|
||||
m_end = end;
|
||||
}
|
||||
|
||||
void set_start(const LayoutPosition& start) { m_start = start; }
|
||||
void set_end(const LayoutPosition& end) { m_end = end; }
|
||||
void set_start(LayoutPosition const& start) { m_start = start; }
|
||||
void set_end(LayoutPosition const& end) { m_end = end; }
|
||||
|
||||
const LayoutPosition& start() const { return m_start; }
|
||||
LayoutPosition const& start() const { return m_start; }
|
||||
LayoutPosition& start() { return m_start; }
|
||||
const LayoutPosition& end() const { return m_end; }
|
||||
LayoutPosition const& end() const { return m_end; }
|
||||
LayoutPosition& end() { return m_end; }
|
||||
|
||||
LayoutRange normalized() const;
|
||||
|
|
|
@ -65,7 +65,7 @@ int LineBoxFragment::text_index_at(float x) const
|
|||
return m_start + m_length;
|
||||
}
|
||||
|
||||
Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const
|
||||
Gfx::FloatRect LineBoxFragment::selection_rect(Gfx::Font const& font) const
|
||||
{
|
||||
if (layout_node().selection_state() == Node::SelectionState::None)
|
||||
return {};
|
||||
|
@ -79,8 +79,8 @@ Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const
|
|||
if (!is<TextNode>(layout_node()))
|
||||
return {};
|
||||
|
||||
const auto start_index = m_start;
|
||||
const auto end_index = m_start + m_length;
|
||||
auto const start_index = m_start;
|
||||
auto const end_index = m_start + m_length;
|
||||
auto text = this->text();
|
||||
|
||||
if (layout_node().selection_state() == Node::SelectionState::StartAndEnd) {
|
||||
|
|
|
@ -40,14 +40,14 @@ public:
|
|||
const Gfx::FloatRect absolute_rect() const;
|
||||
Type type() const { return m_type; }
|
||||
|
||||
const Gfx::FloatPoint& offset() const { return m_offset; }
|
||||
void set_offset(const Gfx::FloatPoint& offset) { m_offset = offset; }
|
||||
Gfx::FloatPoint const& offset() const { return m_offset; }
|
||||
void set_offset(Gfx::FloatPoint const& offset) { m_offset = offset; }
|
||||
|
||||
// The baseline of a fragment is the number of pixels from the top to the text baseline.
|
||||
void set_baseline(float y) { m_baseline = y; }
|
||||
float baseline() const { return m_baseline; }
|
||||
|
||||
const Gfx::FloatSize& size() const { return m_size; }
|
||||
Gfx::FloatSize const& size() const { return m_size; }
|
||||
void set_width(float width) { m_size.set_width(width); }
|
||||
void set_height(float height) { m_size.set_height(height); }
|
||||
float width() const { return m_size.width(); }
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
int text_index_at(float x) const;
|
||||
|
||||
Gfx::FloatRect selection_rect(const Gfx::Font&) const;
|
||||
Gfx::FloatRect selection_rect(Gfx::Font const&) const;
|
||||
|
||||
float height_of_inline_level_box(FormattingState const&) const;
|
||||
float top_of_inline_level_box(FormattingState const&) const;
|
||||
|
|
|
@ -54,7 +54,7 @@ bool Node::can_contain_boxes_with_position_absolute() const
|
|||
return computed_values().position() != CSS::Position::Static || is<InitialContainingBlock>(*this);
|
||||
}
|
||||
|
||||
const BlockContainer* Node::containing_block() const
|
||||
BlockContainer const* Node::containing_block() const
|
||||
{
|
||||
if (is<TextNode>(*this))
|
||||
return first_ancestor_of_type<BlockContainer>();
|
||||
|
@ -67,7 +67,7 @@ const BlockContainer* Node::containing_block() const
|
|||
ancestor = ancestor->parent();
|
||||
while (ancestor && (!is<BlockContainer>(*ancestor) || ancestor->is_anonymous()))
|
||||
ancestor = ancestor->containing_block();
|
||||
return static_cast<const BlockContainer*>(ancestor);
|
||||
return static_cast<BlockContainer const*>(ancestor);
|
||||
}
|
||||
|
||||
if (position == CSS::Position::Fixed)
|
||||
|
@ -102,7 +102,7 @@ HTML::BrowsingContext& Node::browsing_context()
|
|||
return *document().browsing_context();
|
||||
}
|
||||
|
||||
const InitialContainingBlock& Node::root() const
|
||||
InitialContainingBlock const& Node::root() const
|
||||
{
|
||||
VERIFY(document().layout_node());
|
||||
return *document().layout_node();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue