1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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();

View file

@ -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")) {

View file

@ -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:

View file

@ -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 {};

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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&);

View file

@ -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());
}

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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); }

View file

@ -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;

View file

@ -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");

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}

View file

@ -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()));

View file

@ -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();

View file

@ -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];

View file

@ -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();

View file

@ -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];

View file

@ -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;
};