diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:42:32 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:56:54 +0100 |
commit | 5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch) | |
tree | e881854dac5d749518562970d6194a0ef65736ec /Userland/Libraries/LibWeb | |
parent | b33a6a443e700cd80325d312f21c985b0687bb97 (diff) | |
download | serenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip |
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)
Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.
We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
Diffstat (limited to 'Userland/Libraries/LibWeb')
55 files changed, 168 insertions, 168 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index 2abd1f54f2..1a7bfb2719 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -110,7 +110,7 @@ static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object) { auto* this_object = vm.this_value(global_object).to_object(global_object); if (!this_object) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } if (StringView("WindowObject") != this_object->class_name()) { @@ -317,7 +317,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob) // decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8. auto decoder = TextCodec::decoder_for("windows-1252"); - ASSERT(decoder); + VERIFY(decoder); return JS::js_string(vm, decoder->to_utf8(decoded)); } diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp index b257a378a6..13d3f662fd 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp @@ -36,7 +36,7 @@ Wrappable::~Wrappable() void Wrappable::set_wrapper(Wrapper& wrapper) { - ASSERT(!m_wrapper); + VERIFY(!m_wrapper); m_wrapper = wrapper.make_weak_ptr(); } diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 08b2ca500f..a2a55c81ba 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -55,7 +55,7 @@ float Length::relative_length_to_px(const Layout::Node& layout_node) const return max(viewport.width(), viewport.height()) * (m_value / 100); } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -97,7 +97,7 @@ const char* Length::unit_name() const case Type::Vmin: return "vmin"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index bce76a059c..78ee24f5de 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -143,7 +143,7 @@ public: case Type::Undefined: case Type::Percentage: default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp index ad5ab28745..87fcde8d6e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp @@ -33,11 +33,11 @@ #include <stdlib.h> #include <string.h> -#define PARSE_ASSERT(x) \ +#define PARSE_VERIFY(x) \ if (!(x)) { \ dbgln("CSS PARSER ASSERTION FAILED: {}", #x); \ dbgln("At character# {} in CSS: _{}_", index, css); \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ } #define PARSE_ERROR() \ @@ -344,7 +344,7 @@ public: char consume_one() { - PARSE_ASSERT(index < css.length()); + PARSE_VERIFY(index < css.length()); return css[index++]; }; @@ -424,7 +424,7 @@ public: if (type != CSS::Selector::SimpleSelector::Type::Universal) { while (is_valid_selector_char(peek())) buffer.append(consume_one()); - PARSE_ASSERT(!buffer.is_null()); + PARSE_VERIFY(!buffer.is_null()); } auto value = String::copy(buffer); @@ -593,7 +593,7 @@ public: break; simple_selectors.append(component.value()); // If this assert triggers, we're most likely up to no good. - PARSE_ASSERT(simple_selectors.size() < 100); + PARSE_VERIFY(simple_selectors.size() < 100); } if (simple_selectors.is_empty()) @@ -682,7 +682,7 @@ public: continue; } if (ch == ')') { - PARSE_ASSERT(paren_nesting_level > 0); + PARSE_VERIFY(paren_nesting_level > 0); --paren_nesting_level; buffer.append(consume_one()); continue; diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 5f553e2be0..a1db87f78f 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -119,7 +119,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E case CSS::Selector::SimpleSelector::Type::TagName: return component.value == element.local_name(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -134,7 +134,7 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con case CSS::Selector::ComplexSelector::Relation::None: return true; case CSS::Selector::ComplexSelector::Relation::Descendant: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* ancestor = element.parent(); ancestor; ancestor = ancestor->parent()) { if (!is<DOM::Element>(*ancestor)) continue; @@ -143,29 +143,29 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con } return false; case CSS::Selector::ComplexSelector::Relation::ImmediateChild: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (!element.parent() || !is<DOM::Element>(*element.parent())) return false; return matches(selector, component_list_index - 1, downcast<DOM::Element>(*element.parent())); case CSS::Selector::ComplexSelector::Relation::AdjacentSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); if (auto* sibling = element.previous_element_sibling()) return matches(selector, component_list_index - 1, *sibling); return false; case CSS::Selector::ComplexSelector::Relation::GeneralSibling: - ASSERT(component_list_index != 0); + VERIFY(component_list_index != 0); for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) { if (matches(selector, component_list_index - 1, *sibling)) return true; } return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool matches(const CSS::Selector& selector, const DOM::Element& element) { - ASSERT(!selector.complex_selectors().is_empty()); + VERIFY(!selector.complex_selectors().is_empty()); return matches(selector, selector.complex_selectors().size() - 1, element); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index da6f2a6fd9..2ced865baa 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -188,7 +188,7 @@ static bool contains(Edge a, Edge b) static inline void set_property_border_width(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_length()); + VERIFY(value.is_length()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopWidth, value); if (contains(Edge::Right, edge)) @@ -201,7 +201,7 @@ static inline void set_property_border_width(StyleProperties& style, const Style static inline void set_property_border_color(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_color()); + VERIFY(value.is_color()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopColor, value); if (contains(Edge::Right, edge)) @@ -214,7 +214,7 @@ static inline void set_property_border_color(StyleProperties& style, const Style static inline void set_property_border_style(StyleProperties& style, const StyleValue& value, Edge edge) { - ASSERT(value.is_string()); + VERIFY(value.is_string()); if (contains(Edge::Top, edge)) style.set_property(CSS::PropertyID::BorderTopStyle, value); if (contains(Edge::Right, edge)) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index c6d6b503bf..65905b54d5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -54,7 +54,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const if (id() == CSS::ValueID::LibwebLink) return document.link_color(); - ASSERT(document.page()); + VERIFY(document.page()); auto palette = document.page()->palette(); switch (id()) { case CSS::ValueID::LibwebPaletteDesktopBackground: diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp index 2b7b2218c7..1fde66eee3 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -75,7 +75,7 @@ PropertyID property_id_from_string(const StringView& string) )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); @@ -95,7 +95,7 @@ const char* string_from_property_id(PropertyID property_id) { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name", name); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp index e2f235db62..6391df70f4 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_object()); + VERIFY(json.has_value()); + VERIFY(json.value().is_object()); StringBuilder builder; SourceGenerator generator { builder }; @@ -76,7 +76,7 @@ enum class PropertyID { )~~~"); json.value().as_object().for_each_member([&](auto& name, auto& value) { - ASSERT(value.is_object()); + VERIFY(value.is_object()); auto member_generator = generator.fork(); member_generator.set("name:titlecase", title_casify(name)); diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp index 4991a4040a..0fb443bcc6 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_cpp.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp index 7c85ade83f..03b474908c 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/Generate_CSS_ValueID_h.cpp @@ -58,8 +58,8 @@ int main(int argc, char** argv) return 1; auto json = JsonValue::from_string(file->read_all()); - ASSERT(json.has_value()); - ASSERT(json.value().is_array()); + VERIFY(json.has_value()); + VERIFY(json.value().is_array()); StringBuilder builder; SourceGenerator generator { builder }; diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 5b257c1b0d..7a7449ed0b 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -585,7 +585,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); } else { dbgln("Unimplemented JS-to-C++ conversion: {}", parameter.type.name); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index d4f2170f1b..242b2924b8 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -89,8 +89,8 @@ Document::~Document() void Document::removed_last_ref() { - ASSERT(!ref_count()); - ASSERT(!m_deletion_has_begun); + VERIFY(!ref_count()); + VERIFY(!m_deletion_has_begun); if (m_referencing_node_count) { // The document has reached ref_count==0 but still has nodes keeping it alive. @@ -121,8 +121,8 @@ void Document::removed_last_ref() }); for (auto& node : descendants) { - ASSERT(&node.document() == this); - ASSERT(!node.is_document()); + VERIFY(&node.document() == this); + VERIFY(!node.is_document()); if (node.parent()) node.parent()->remove_child(node); } @@ -299,7 +299,7 @@ void Document::attach_to_frame(Badge<Frame>, Frame& frame) void Document::detach_from_frame(Badge<Frame>, Frame& frame) { - ASSERT(&frame == m_frame); + VERIFY(&frame == m_frame); tear_down_layout_tree(); m_frame = nullptr; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index e789df05a3..30c4c17b32 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -259,14 +259,14 @@ private: void increment_referencing_node_count() { - ASSERT(!m_deletion_has_begun); + VERIFY(!m_deletion_has_begun); ++m_referencing_node_count; } void decrement_referencing_node_count() { - ASSERT(!m_deletion_has_begun); - ASSERT(m_referencing_node_count); + VERIFY(!m_deletion_has_begun); + VERIFY(m_referencing_node_count); --m_referencing_node_count; if (!m_referencing_node_count && !ref_count()) { m_deletion_has_begun = true; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 10e2bda733..24b063d5cd 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -131,7 +131,7 @@ RefPtr<Layout::Node> Element::create_layout_node() switch (display) { case CSS::Display::None: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); break; case CSS::Display::Block: return adopt(*new Layout::BlockBox(document(), this, move(style))); @@ -164,7 +164,7 @@ RefPtr<Layout::Node> Element::create_layout_node() // FIXME: This is just an incorrect placeholder until we improve table layout support. return adopt(*new Layout::BlockBox(document(), this, move(style))); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void Element::parse_attribute(const FlyString& name, const String& value) @@ -214,7 +214,7 @@ static StyleDifference compute_style_difference(const CSS::StyleProperties& old_ void Element::recompute_style() { set_needs_style_update(false); - ASSERT(parent()); + VERIFY(parent()); auto old_specified_css_values = m_specified_css_values; auto new_specified_css_values = document().style_resolver().resolve_style(*this); m_specified_css_values = new_specified_css_values; diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index e45b42c23e..1ec7f8b96b 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -136,7 +136,7 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha return entry.index <= struct_.index && !entry.shadow_adjusted_target.is_null(); }); - ASSERT(last_valid_shadow_adjusted_target.has_value()); + VERIFY(last_valid_shadow_adjusted_target.has_value()); event.set_target(last_valid_shadow_adjusted_target.value().shadow_adjusted_target); event.set_related_target(struct_.related_target); @@ -249,7 +249,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr< return !entry.shadow_adjusted_target.is_null(); }); - ASSERT(clear_targets_struct.has_value()); + VERIFY(clear_targets_struct.has_value()); if (is<Node>(clear_targets_struct.value().shadow_adjusted_target.ptr())) { auto& shadow_adjusted_target_node = downcast<Node>(*clear_targets_struct.value().shadow_adjusted_target); diff --git a/Userland/Libraries/LibWeb/DOM/EventListener.cpp b/Userland/Libraries/LibWeb/DOM/EventListener.cpp index eb64bfa503..ad9f0cd3e7 100644 --- a/Userland/Libraries/LibWeb/DOM/EventListener.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventListener.cpp @@ -31,7 +31,7 @@ namespace Web::DOM { JS::Function& EventListener::function() { - ASSERT(m_function.cell()); + VERIFY(m_function.cell()); return *m_function.cell(); } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 26204538bc..d66c33e138 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -54,7 +54,7 @@ Node::Node(Document& document, NodeType type) Node::~Node() { - ASSERT(m_deletion_has_begun); + VERIFY(m_deletion_has_begun); if (layout_node() && layout_node()->parent()) layout_node()->parent()->remove_child(*layout_node()); diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp index b6fae82ebf..0b7f66afc4 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.cpp +++ b/Userland/Libraries/LibWeb/DOM/Window.cpp @@ -95,7 +95,7 @@ i32 Window::set_timeout(JS::Function& callback, i32 interval) void Window::timer_did_fire(Badge<Timer>, Timer& timer) { // We should not be here if there's no JS wrapper for the Window object. - ASSERT(wrapper()); + VERIFY(wrapper()); auto& vm = wrapper()->vm(); // NOTE: This protector pointer keeps the timer alive until the end of this function no matter what. diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp index 76c0e39769..ad732548d5 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp @@ -79,7 +79,7 @@ GUI::ModelIndex DOMTreeModel::parent_index(const GUI::ModelIndex& index) const ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp index 46585e80d9..c41be830a8 100644 --- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp +++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp @@ -70,7 +70,7 @@ void GlobalEventHandlers::set_event_handler_attribute(const FlyString& name, HTM return; } auto* function = JS::ScriptFunction::create(self.script_execution_context()->interpreter().global_object(), name, program->body(), program->parameters(), program->function_length(), nullptr, false, false); - ASSERT(function); + VERIFY(function); listener = adopt(*new DOM::EventListener(JS::make_handle(static_cast<JS::Function*>(function)))); } if (listener) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index d2f071314d..4b6462417e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -53,7 +53,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co if (color.has_value()) style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } else if (name.equals_ignoring_case("background")) { - ASSERT(m_background_style_value); + VERIFY(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value); } }); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 9144211b07..259f88083d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -65,7 +65,7 @@ RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node() CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) { - ASSERT(type == "2d"); + VERIFY(type == "2d"); if (!m_context) m_context = CanvasRenderingContext2D::create(*this); return m_context; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 36fff8b52c..73113dd242 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -73,7 +73,7 @@ bool HTMLElement::is_editable() const case ContentEditableState::Inherit: return parent() && parent()->is_editable(); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -87,7 +87,7 @@ String HTMLElement::content_editable() const case ContentEditableState::Inherit: return "inherit"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index d4fe2cb37f..06b942e076 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -44,7 +44,7 @@ namespace Web::HTML { HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - ASSERT(document.frame()); + VERIFY(document.frame()); m_content_frame = Frame::create_subframe(*this, document.frame()->main_frame()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index d2005bb4b0..8fcf9edaff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -56,7 +56,7 @@ void HTMLLinkElement::resource_did_fail() void HTMLLinkElement::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->has_encoded_data()) return; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 9eeaa8b9ec..e3a64bcbb9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -93,7 +93,7 @@ void HTMLScriptElement::execute_script() document().set_current_script({}, old_current_script); } else { - ASSERT(!document().current_script()); + VERIFY(!document().current_script()); TODO(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 8320416d20..fd7a1655a3 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -267,7 +267,7 @@ void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLTok handle_after_after_frameset(token); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -429,7 +429,7 @@ HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropria return { downcast<HTMLTemplateElement>(last_template.element)->content(), nullptr }; } if (!last_table.element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); // Guaranteed not to be a template element (it will be the html element), // so no need to check the parent is a template. return { m_stack_of_open_elements.elements().first(), nullptr }; @@ -903,7 +903,7 @@ void HTMLDocumentParser::reconstruct_the_active_formatting_elements() ssize_t index = m_list_of_active_formatting_elements.entries().size() - 1; RefPtr<DOM::Element> entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Rewind: if (index == 0) { @@ -912,7 +912,7 @@ Rewind: --index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); if (!m_stack_of_open_elements.contains(*entry)) goto Rewind; @@ -920,7 +920,7 @@ Rewind: Advance: ++index; entry = m_list_of_active_formatting_elements.entries().at(index).element; - ASSERT(entry); + VERIFY(entry); Create: // FIXME: Hold on to the real token! @@ -1140,7 +1140,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body || m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } m_frameset_ok = false; @@ -1158,7 +1158,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) if (m_stack_of_open_elements.elements().size() == 1 || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -1863,7 +1863,7 @@ void HTMLDocumentParser::increment_script_nesting_level() void HTMLDocumentParser::decrement_script_nesting_level() { - ASSERT(m_script_nesting_level); + VERIFY(m_script_nesting_level); --m_script_nesting_level; } @@ -1917,7 +1917,7 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) if (the_script->failed_to_load()) return; - ASSERT(the_script->is_ready_to_be_parser_executed()); + VERIFY(the_script->is_ready_to_be_parser_executed()); if (m_aborted) return; @@ -1926,13 +1926,13 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) // FIXME: Handle tokenizer insertion point stuff here too. - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); increment_script_nesting_level(); the_script->execute_script(); decrement_script_nesting_level(); - ASSERT(script_nesting_level() == 0); + VERIFY(script_nesting_level() == 0); m_parser_pause_flag = false; // FIXME: Handle tokenizer insertion point stuff here too. @@ -1955,7 +1955,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() @@ -1964,7 +1964,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() @@ -1973,7 +1973,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() m_stack_of_open_elements.pop(); if (current_node().local_name() == HTML::TagNames::html) - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); } void HTMLDocumentParser::handle_in_row(HTMLToken& token) @@ -2068,7 +2068,7 @@ void HTMLDocumentParser::handle_in_cell(HTMLToken& token) } if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::td) && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::th)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2109,7 +2109,7 @@ void HTMLDocumentParser::handle_in_table_text(HTMLToken& token) } for (auto& pending_token : m_pending_table_character_tokens) { - ASSERT(pending_token.is_character()); + VERIFY(pending_token.is_character()); if (!pending_token.is_parser_whitespace()) { // If any of the tokens in the pending table character tokens list // are character tokens that are not ASCII whitespace, then this is a parse error: @@ -2401,7 +2401,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) if (token.is_end_tag() && token.tag_name() == HTML::TagNames::select) { if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2414,7 +2414,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2427,7 +2427,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) PARSE_ERROR(); if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } @@ -2459,7 +2459,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) { if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2479,7 +2479,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) { if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); PARSE_ERROR(); return; } @@ -2634,7 +2634,7 @@ void HTMLDocumentParser::handle_in_template(HTMLToken& token) if (token.is_end_of_file()) { if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); stop_parsing(); return; } @@ -2849,7 +2849,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& PARSE_ERROR(); for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) { if (node == m_stack_of_open_elements.first()) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); return; } // FIXME: See the above FIXME @@ -2870,7 +2870,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void HTMLDocumentParser::reset_the_insertion_mode_appropriately() @@ -2935,14 +2935,14 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } if (node->local_name() == HTML::TagNames::frameset) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InFrameset; return; } if (node->local_name() == HTML::TagNames::html) { if (!m_head_element) { - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::BeforeHead; return; } @@ -2952,7 +2952,7 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() } } - ASSERT(m_parsing_fragment); + VERIFY(m_parsing_fragment); m_insertion_mode = InsertionMode::InBody; } @@ -2965,7 +2965,7 @@ const char* HTMLDocumentParser::insertion_mode_name() const ENUMERATE_INSERTION_MODES #undef __ENUMERATE_INSERTION_MODE } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } DOM::Document& HTMLDocumentParser::document() diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp index 53a2357be5..38652bdb4e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp @@ -55,7 +55,7 @@ String HTMLToken::to_string() const builder.append("EndOfFile"); break; case HTMLToken::Type::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h index c2246229c6..fcfad6e34b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h @@ -75,9 +75,9 @@ public: u32 code_point() const { - ASSERT(is_character()); + VERIFY(is_character()); Utf8View view(m_comment_or_character.data.string_view()); - ASSERT(view.length() == 1); + VERIFY(view.length() == 1); return *view.begin(); } @@ -100,19 +100,19 @@ public: String tag_name() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.tag_name.to_string(); } bool is_self_closing() const { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); return m_tag.self_closing; } bool has_acknowledged_self_closing_flag() const { - ASSERT(is_self_closing()); + VERIFY(is_self_closing()); return m_tag.self_closing_acknowledged; } @@ -124,7 +124,7 @@ public: StringView attribute(const FlyString& attribute_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (attribute_name == attribute.local_name_builder.string_view()) return attribute.value_builder.string_view(); @@ -139,7 +139,7 @@ public: void adjust_tag_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); if (old_name == m_tag.tag_name.string_view()) { m_tag.tag_name.clear(); m_tag.tag_name.append(new_name); @@ -148,7 +148,7 @@ public: void adjust_attribute_name(const FlyString& old_name, const FlyString& new_name) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.local_name_builder.clear(); @@ -159,7 +159,7 @@ public: void adjust_foreign_attribute(const FlyString& old_name, const FlyString& prefix, const FlyString& local_name, const FlyString& namespace_) { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); for (auto& attribute : m_tag.attributes) { if (old_name == attribute.local_name_builder.string_view()) { attribute.prefix_builder.clear(); @@ -176,7 +176,7 @@ public: void drop_attributes() { - ASSERT(is_start_tag() || is_end_tag()); + VERIFY(is_start_tag() || is_end_tag()); m_tag.attributes.clear(); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 6aa94b1163..2b35432a19 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -189,7 +189,7 @@ namespace Web::HTML { { #define END_STATE \ - ASSERT_NOT_REACHED(); \ + VERIFY_NOT_REACHED(); \ break; \ } \ } \ @@ -2610,7 +2610,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type) HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding) { auto* decoder = TextCodec::decoder_for(encoding); - ASSERT(decoder); + VERIFY(decoder); m_decoded_input = decoder->to_utf8(input); m_utf8_view = Utf8View(m_decoded_input); m_utf8_iterator = m_utf8_view.begin(); @@ -2640,7 +2640,7 @@ void HTMLTokenizer::will_emit(HTMLToken& token) bool HTMLTokenizer::current_end_tag_token_is_appropriate() const { - ASSERT(m_current_token.is_end_tag()); + VERIFY(m_current_token.is_end_tag()); if (!m_last_emitted_start_tag.is_start_tag()) return false; return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h index 787bc12b46..e0c84271c4 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h @@ -152,7 +152,7 @@ private: ENUMERATE_TOKENIZER_STATES #undef __ENUMERATE_TOKENIZER_STATE }; - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } void will_emit(HTMLToken&); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index 2406711bff..502e8e0c6b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -45,7 +45,7 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const @@ -62,7 +62,7 @@ bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, con if (list.contains_slow(node.local_name())) return false; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index b74cc8828c..7f664b3920 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -96,8 +96,8 @@ void InProcessWebView::select_all() last_layout_node = layout_node; } - ASSERT(first_layout_node); - ASSERT(last_layout_node); + VERIFY(first_layout_node); + VERIFY(last_layout_node); int last_layout_node_index_in_node = 0; if (is<Layout::TextNode>(*last_layout_node)) @@ -114,7 +114,7 @@ String InProcessWebView::selected_text() const void InProcessWebView::page_did_layout() { - ASSERT(layout_root()); + VERIFY(layout_root()); set_content_size(layout_root()->size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index bb7def7bb5..2f1c1e96b4 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -359,7 +359,7 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(Box& child_box, Box& containing_block) { - ASSERT(!containing_block.is_absolutely_positioned()); + VERIFY(!containing_block.is_absolutely_positioned()); auto& replaced_element_box_model = child_box.box_model(); replaced_element_box_model.margin.top = child_box.computed_values().margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); @@ -472,7 +472,7 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m layout_block_level_children(context_box(), layout_mode); - ASSERT(!icb.children_are_inline()); + VERIFY(!icb.children_are_inline()); // FIXME: The ICB should have the height of the viewport. // Instead of auto-sizing the ICB, we should spill into overflow. @@ -501,7 +501,7 @@ static Gfx::FloatRect rect_in_coordinate_space(const Box& box, const Box& contex void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_block) { - ASSERT(box.is_floating()); + VERIFY(box.is_floating()); compute_width(box); layout_inside(box, LayoutMode::Default); diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 190340f13c..0cea9f0b3f 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -156,11 +156,11 @@ StackingContext* Box::enclosing_stacking_context() auto& ancestor_box = downcast<Box>(*ancestor); if (!ancestor_box.establishes_stacking_context()) continue; - ASSERT(ancestor_box.stacking_context()); + VERIFY(ancestor_box.stacking_context()); return ancestor_box.stacking_context(); } // We should always reach the Layout::InitialContainingBlockBox stacking context. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } bool Box::establishes_stacking_context() const @@ -196,7 +196,7 @@ LineBox& Box::add_line_box() float Box::width_of_logical_containing_block() const { auto* containing_block = this->containing_block(); - ASSERT(containing_block); + VERIFY(containing_block); return containing_block->width(); } diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 11d0c6b7b0..b96fa7d039 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -99,7 +99,7 @@ void FormattingContext::layout_inside(Box& box, LayoutMode layout_mode) context.run(box, layout_mode); } else { // FIXME: This needs refactoring! - ASSERT(is_block_formatting_context()); + VERIFY(is_block_formatting_context()); run(box, layout_mode); } } diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp index f3210ad941..d0c8b432c6 100644 --- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp @@ -45,7 +45,7 @@ FrameBox::~FrameBox() void FrameBox::prepare_for_replaced_layout() { - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); set_has_intrinsic_width(true); set_has_intrinsic_height(true); @@ -90,7 +90,7 @@ void FrameBox::did_set_rect() { ReplacedBox::did_set_rect(); - ASSERT(dom_node().content_frame()); + VERIFY(dom_node().content_frame()); dom_node().content_frame()->set_size(size().to_type<int>()); } diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp index 587c9198c8..fa74a76dda 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp @@ -51,11 +51,11 @@ void InitialContainingBlockBox::build_stacking_context_tree() if (&box == this) return IterationDecision::Continue; if (!box.establishes_stacking_context()) { - ASSERT(!box.stacking_context()); + VERIFY(!box.stacking_context()); return IterationDecision::Continue; } auto* parent_context = box.enclosing_stacking_context(); - ASSERT(parent_context); + VERIFY(parent_context); box.set_stacking_context(make<StackingContext>(box, parent_context)); return IterationDecision::Continue; }); diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 50430ce843..0e57f6a184 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -90,10 +90,10 @@ float InlineFormattingContext::available_width_at_line(size_t line_index) const void InlineFormattingContext::run(Box&, LayoutMode layout_mode) { - ASSERT(containing_block().children_are_inline()); + VERIFY(containing_block().children_are_inline()); containing_block().line_boxes().clear(); containing_block().for_each_child([&](auto& child) { - ASSERT(child.is_inline()); + VERIFY(child.is_inline()); if (is<Box>(child) && child.is_absolutely_positioned()) { layout_absolutely_positioned_element(downcast<Box>(child)); return; diff --git a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp index c1f6aa1db9..c7c1d3995b 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutPosition.cpp @@ -55,7 +55,7 @@ LayoutRange LayoutRange::normalized() const NonnullRefPtr<DOM::Range> LayoutRange::to_dom_range() const { - ASSERT(is_valid()); + VERIFY(is_valid()); auto start = m_start.to_dom_position(); auto end = m_end.to_dom_position(); diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index e62a688513..5c708f42eb 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -114,25 +114,25 @@ HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) co const Frame& Node::frame() const { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } Frame& Node::frame() { - ASSERT(document().frame()); + VERIFY(document().frame()); return *document().frame(); } const InitialContainingBlockBox& Node::root() const { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } InitialContainingBlockBox& Node::root() { - ASSERT(document().layout_node()); + VERIFY(document().layout_node()); return *document().layout_node(); } @@ -159,7 +159,7 @@ Gfx::FloatPoint Node::box_type_agnostic_position() const { if (is<Box>(*this)) return downcast<Box>(*this).absolute_position(); - ASSERT(is_inline()); + VERIFY(is_inline()); Gfx::FloatPoint position; if (auto* block = containing_block()) { block->for_each_fragment([&](auto& fragment) { diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 23fa3eaf6e..79c5e58784 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -115,7 +115,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node) if (!m_parent_stack[i]->is_inline() || m_parent_stack[i]->is_inline_block()) return *m_parent_stack[i]; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); auto& insertion_point = insertion_parent_for_block_node(nearest_non_inline_ancestor, *layout_node); insertion_point.append_child(*layout_node); @@ -260,7 +260,7 @@ static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& pa template<typename WrapperBoxType> static void wrap_in_anonymous(NonnullRefPtrVector<Node>& sequence, Node* nearest_sibling) { - ASSERT(!sequence.is_empty()); + VERIFY(!sequence.is_empty()); auto& parent = *sequence.first().parent(); auto computed_values = parent.computed_values().clone_inherited_values(); static_cast<CSS::MutableComputedValues&>(computed_values).set_display(WrapperBoxType::static_display()); diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp index 440b2fce52..b2caa2d6ca 100644 --- a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp +++ b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp @@ -78,7 +78,7 @@ GUI::ModelIndex LayoutTreeModel::parent_index(const GUI::ModelIndex& index) cons ++grandparent_child_index; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return {}; } diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 6dcbaa5434..956fa31295 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -227,7 +227,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) ResourceLoader::the().load( error_page_url, [this, failed_url, error](auto data, auto&) { - ASSERT(!data.is_null()); + VERIFY(!data.is_null()); #pragma GCC diagnostic ignored "-Wformat-nonliteral" auto html = String::format( String::copy(data).characters(), @@ -235,12 +235,12 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error) escape_html_entities(error).characters()); #pragma GCC diagnostic pop auto document = HTML::parse_html_document(html, failed_url, "utf-8"); - ASSERT(document); + VERIFY(document); frame().set_document(document); }, [](auto error) { dbgln("Failed to load error page: {}", error); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }); } @@ -279,7 +279,7 @@ void FrameLoader::resource_did_load() if (auto* host_element = frame().host_element()) { // FIXME: Perhaps in the future we'll have a better common base class for <frame> and <iframe> - ASSERT(is<HTML::HTMLIFrameElement>(*host_element)); + VERIFY(is<HTML::HTMLIFrameElement>(*host_element)); downcast<HTML::HTMLIFrameElement>(*host_element).content_frame_did_load({}); } diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp index 30bfa5ab81..4d049c8d5f 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -60,7 +60,7 @@ void ImageLoader::set_visible_in_viewport(bool visible_in_viewport) const void ImageLoader::resource_did_load() { - ASSERT(resource()); + VERIFY(resource()); if (!resource()->mime_type().starts_with("image/")) { m_loading_state = LoadingState::Failed; diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 03f17b34d1..048d500aec 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -87,7 +87,7 @@ static String mime_type_from_content_type(const String& content_type) void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers) { - ASSERT(!m_loaded); + VERIFY(!m_loaded); m_encoded_data = ByteBuffer::copy(data); m_response_headers = headers; m_loaded = true; @@ -128,13 +128,13 @@ void Resource::did_fail(Badge<ResourceLoader>, const String& error) void Resource::register_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(!m_clients.contains(&client)); + VERIFY(!m_clients.contains(&client)); m_clients.set(&client); } void Resource::unregister_client(Badge<ResourceClient>, ResourceClient& client) { - ASSERT(m_clients.contains(&client)); + VERIFY(m_clients.contains(&client)); m_clients.remove(&client); } @@ -144,7 +144,7 @@ void ResourceClient::set_resource(Resource* resource) m_resource->unregister_client({}, *this); m_resource = resource; if (m_resource) { - ASSERT(resource->type() == client_type()); + VERIFY(resource->type() == client_type()); m_resource->register_client({}, *this); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 29e3467ceb..df60760b4b 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -55,7 +55,7 @@ OutOfProcessWebView::~OutOfProcessWebView() void OutOfProcessWebView::handle_web_content_process_crash() { create_client(); - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); // Don't keep a stale backup bitmap around. m_backup_bitmap = nullptr; @@ -337,7 +337,7 @@ void OutOfProcessWebView::request_repaint() WebContentClient& OutOfProcessWebView::client() { - ASSERT(m_client_state.client); + VERIFY(m_client_state.client); return *m_client_state.client; } diff --git a/Userland/Libraries/LibWeb/Page/Frame.cpp b/Userland/Libraries/LibWeb/Page/Frame.cpp index 2dab2252c3..4c90e16fa1 100644 --- a/Userland/Libraries/LibWeb/Page/Frame.cpp +++ b/Userland/Libraries/LibWeb/Page/Frame.cpp @@ -277,7 +277,7 @@ String Frame::selected_text() const } // End node - ASSERT(layout_node == selection.end().layout_node); + VERIFY(layout_node == selection.end().layout_node); if (is<Layout::TextNode>(*layout_node)) { auto& text = downcast<Layout::TextNode>(*layout_node).text_for_rendering(); builder.append(text.substring(0, selection.end().index_in_node)); @@ -289,13 +289,13 @@ String Frame::selected_text() const void Frame::register_viewport_client(ViewportClient& client) { auto result = m_viewport_clients.set(&client); - ASSERT(result == AK::HashSetResult::InsertedNewEntry); + VERIFY(result == AK::HashSetResult::InsertedNewEntry); } void Frame::unregister_viewport_client(ViewportClient& client) { bool was_removed = m_viewport_clients.remove(&client); - ASSERT(was_removed); + VERIFY(was_removed); } } diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 7524f4fff9..fc9dbc8d02 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -37,7 +37,7 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) : m_box(box) , m_parent(parent) { - ASSERT(m_parent != this); + VERIFY(m_parent != this); if (m_parent) { m_parent->m_children.append(this); diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index f812d42dfc..07773c0f72 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -38,7 +38,7 @@ namespace Web::SVG { static void print_instruction(const PathInstruction& instruction) { - ASSERT(PATH_DEBUG); + VERIFY(PATH_DEBUG); auto& data = instruction.data; @@ -115,7 +115,7 @@ Vector<PathInstruction> PathDataParser::parse() while (!done()) parse_drawto(); if (!m_instructions.is_empty() && m_instructions[0].type != PathInstructionType::Move) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return m_instructions; } @@ -348,7 +348,7 @@ void PathDataParser::parse_whitespace(bool must_match_once) matched = true; } - ASSERT(!must_match_once || matched); + VERIFY(!must_match_once || matched); } void PathDataParser::parse_comma_whitespace() @@ -379,7 +379,7 @@ float PathDataParser::parse_fractional_constant() while (!done() && isdigit(ch())) builder.append(consume()); } else { - ASSERT(builder.length() > 0); + VERIFY(builder.length() > 0); } if (floating_point) @@ -398,7 +398,7 @@ float PathDataParser::parse_number() float PathDataParser::parse_flag() { if (!match('0') && !match('1')) - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return consume() - '0'; } @@ -475,7 +475,7 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.move_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.move_to(point + path.segments().last().point()); } break; @@ -488,13 +488,13 @@ Gfx::Path& SVGPathElement::get_path() if (absolute) { path.line_to(point); } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); path.line_to(point + path.segments().last().point()); } break; } case PathInstructionType::HorizontalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { data[0], last_point.y() }); @@ -504,7 +504,7 @@ Gfx::Path& SVGPathElement::get_path() break; } case PathInstructionType::VerticalLine: { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (absolute) { path.line_to(Gfx::FloatPoint { last_point.x(), data[0] }); @@ -610,7 +610,7 @@ Gfx::Path& SVGPathElement::get_path() path.quadratic_bezier_curve_to(through, point); m_previous_control_point = through; } else { - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); auto control_point = through + last_point; path.quadratic_bezier_curve_to(control_point, point + last_point); @@ -621,7 +621,7 @@ Gfx::Path& SVGPathElement::get_path() case PathInstructionType::SmoothQuadraticBezierCurve: { clear_last_control_point = false; - ASSERT(!path.segments().is_empty()); + VERIFY(!path.segments().is_empty()); auto last_point = path.segments().last().point(); if (m_previous_control_point.is_null()) { @@ -650,7 +650,7 @@ Gfx::Path& SVGPathElement::get_path() // with these path instructions, let's just skip them continue; case PathInstructionType::Invalid: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (clear_last_control_point) { diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp index 123337db8e..fde0a4898a 100644 --- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp +++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp @@ -58,7 +58,7 @@ String StylePropertiesModel::column_name(int column_index) const case Column::PropertyValue: return "Value"; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } GUI::Variant StylePropertiesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/Libraries/LibWeb/TreeNode.h b/Userland/Libraries/LibWeb/TreeNode.h index 1673a52dc5..c304230e7b 100644 --- a/Userland/Libraries/LibWeb/TreeNode.h +++ b/Userland/Libraries/LibWeb/TreeNode.h @@ -39,15 +39,15 @@ class TreeNode : public Weakable<T> { public: void ref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); ++m_ref_count; } void unref() { - ASSERT(!m_in_removed_last_ref); - ASSERT(m_ref_count); + VERIFY(!m_in_removed_last_ref); + VERIFY(m_ref_count); if (!--m_ref_count) { if constexpr (IsBaseOf<DOM::Node, T>::value) { m_in_removed_last_ref = true; @@ -324,7 +324,7 @@ inline void TreeNode<T>::remove_all_children() template<typename T> inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) { - ASSERT(node->m_parent == this); + VERIFY(node->m_parent == this); if (m_first_child == node) m_first_child = node->m_next_sibling; @@ -354,7 +354,7 @@ inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node) template<typename T> inline void TreeNode<T>::append_child(NonnullRefPtr<T> node, bool notify) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -380,8 +380,8 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b if (!child) return append_child(move(node), notify); - ASSERT(!node->m_parent); - ASSERT(child->parent() == this); + VERIFY(!node->m_parent); + VERIFY(child->parent() == this); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; @@ -412,7 +412,7 @@ inline void TreeNode<T>::insert_before(NonnullRefPtr<T> node, RefPtr<T> child, b template<typename T> inline void TreeNode<T>::prepend_child(NonnullRefPtr<T> node) { - ASSERT(!node->m_parent); + VERIFY(!node->m_parent); if (!static_cast<T*>(this)->is_child_allowed(*node)) return; diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 56a25cf7f6..ed947be896 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -39,7 +39,7 @@ WebContentClient::WebContentClient(OutOfProcessWebView& view) void WebContentClient::die() { - ASSERT(on_web_content_process_crash); + VERIFY(on_web_content_process_crash); on_web_content_process_crash(); } |