mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
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.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -65,7 +65,7 @@ void AbstractSlider::set_page_step(int page_step)
|
|||
|
||||
void AbstractSlider::set_range(int min, int max)
|
||||
{
|
||||
ASSERT(min <= max);
|
||||
VERIFY(min <= max);
|
||||
if (m_min == min && m_max == max)
|
||||
return;
|
||||
m_min = min;
|
||||
|
|
|
@ -140,8 +140,8 @@ void AbstractView::update_edit_widget_position()
|
|||
|
||||
void AbstractView::begin_editing(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(is_editable());
|
||||
ASSERT(model());
|
||||
VERIFY(is_editable());
|
||||
VERIFY(model());
|
||||
if (m_edit_index == index)
|
||||
return;
|
||||
if (!model()->is_editable(index))
|
||||
|
@ -152,7 +152,7 @@ void AbstractView::begin_editing(const ModelIndex& index)
|
|||
}
|
||||
m_edit_index = index;
|
||||
|
||||
ASSERT(aid_create_editing_delegate);
|
||||
VERIFY(aid_create_editing_delegate);
|
||||
m_editing_delegate = aid_create_editing_delegate(index);
|
||||
m_editing_delegate->bind(*model(), index);
|
||||
m_editing_delegate->set_value(index.data());
|
||||
|
@ -164,12 +164,12 @@ void AbstractView::begin_editing(const ModelIndex& index)
|
|||
m_edit_widget->set_focus(true);
|
||||
m_editing_delegate->will_begin_editing();
|
||||
m_editing_delegate->on_commit = [this] {
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
model()->set_data(m_edit_index, m_editing_delegate->value());
|
||||
stop_editing();
|
||||
};
|
||||
m_editing_delegate->on_rollback = [this] {
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
stop_editing();
|
||||
};
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
|||
if (distance_travelled_squared <= drag_distance_threshold)
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
|
||||
ASSERT(!data_type.is_null());
|
||||
VERIFY(!data_type.is_null());
|
||||
|
||||
if (m_is_dragging)
|
||||
return;
|
||||
|
@ -323,7 +323,7 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
|||
dbgln("Drag was cancelled!");
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
bool is_checked() const
|
||||
{
|
||||
ASSERT(is_checkable());
|
||||
VERIFY(is_checkable());
|
||||
return m_checked;
|
||||
}
|
||||
void set_checked(bool);
|
||||
|
|
|
@ -82,7 +82,7 @@ Application* Application::the()
|
|||
|
||||
Application::Application(int argc, char** argv)
|
||||
{
|
||||
ASSERT(!*s_the);
|
||||
VERIFY(!*s_the);
|
||||
*s_the = *this;
|
||||
m_event_loop = make<Core::EventLoop>();
|
||||
WindowServerConnection::the();
|
||||
|
@ -212,7 +212,7 @@ Gfx::Palette Application::palette() const
|
|||
|
||||
void Application::tooltip_show_timer_did_fire()
|
||||
{
|
||||
ASSERT(m_tooltip_window);
|
||||
VERIFY(m_tooltip_window);
|
||||
Gfx::IntRect desktop_rect = Desktop::the().rect();
|
||||
|
||||
const int margin = 30;
|
||||
|
|
|
@ -196,7 +196,7 @@ void AutocompleteBox::apply_suggestion()
|
|||
auto suggestion = suggestion_index.data().to_string();
|
||||
size_t partial_length = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::PartialInputLength).to_i64();
|
||||
|
||||
ASSERT(suggestion.length() >= partial_length);
|
||||
VERIFY(suggestion.length() >= partial_length);
|
||||
auto completion = suggestion.substring_view(partial_length, suggestion.length() - partial_length);
|
||||
m_editor->insert_at_cursor_or_replace_selection(completion);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
void attach(TextEditor& editor)
|
||||
{
|
||||
ASSERT(!m_editor);
|
||||
VERIFY(!m_editor);
|
||||
m_editor = editor;
|
||||
}
|
||||
void detach() { m_editor.clear(); }
|
||||
|
|
|
@ -136,7 +136,7 @@ void BreadcrumbBar::set_selected_segment(Optional<size_t> index)
|
|||
}
|
||||
|
||||
auto& segment = m_segments[index.value()];
|
||||
ASSERT(segment.button);
|
||||
VERIFY(segment.button);
|
||||
segment.button->set_checked(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ void ColumnsView::select_all()
|
|||
return;
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
});
|
||||
|
||||
for (Column& column : columns_for_selection) {
|
||||
|
@ -102,12 +102,12 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
auto& column = m_columns[i];
|
||||
auto* next_column = i + 1 == m_columns.size() ? nullptr : &m_columns[i + 1];
|
||||
|
||||
ASSERT(column.width > 0);
|
||||
VERIFY(column.width > 0);
|
||||
|
||||
int row_count = model()->row_count(column.parent_index);
|
||||
for (int row = 0; row < row_count; row++) {
|
||||
ModelIndex index = model()->index(row, m_model_column, column.parent_index);
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
|
||||
bool is_selected_row = selection().contains(index);
|
||||
|
||||
|
@ -180,7 +180,7 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
|
||||
void ColumnsView::push_column(const ModelIndex& parent_index)
|
||||
{
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
|
||||
// Drop columns at the end.
|
||||
ModelIndex grandparent = model()->parent_index(parent_index);
|
||||
|
@ -216,7 +216,7 @@ void ColumnsView::update_column_sizes()
|
|||
column.width = 10;
|
||||
for (int row = 0; row < row_count; row++) {
|
||||
ModelIndex index = model()->index(row, m_model_column, column.parent_index);
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
auto text = index.data().to_string();
|
||||
int row_width = icon_spacing() + icon_size() + icon_spacing() + font().width(text) + icon_spacing() + s_arrow_bitmap_width + icon_spacing();
|
||||
if (row_width > column.width)
|
||||
|
|
|
@ -118,7 +118,7 @@ ComboBox::ComboBox()
|
|||
m_list_view->set_frame_thickness(1);
|
||||
m_list_view->set_frame_shadow(Gfx::FrameShadow::Plain);
|
||||
m_list_view->on_selection = [this](auto& index) {
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
m_list_view->set_activates_on_selection(true);
|
||||
if (m_updating_model)
|
||||
selection_updated(index);
|
||||
|
|
|
@ -43,7 +43,7 @@ Dialog::~Dialog()
|
|||
|
||||
int Dialog::exec()
|
||||
{
|
||||
ASSERT(!m_event_loop);
|
||||
VERIFY(!m_event_loop);
|
||||
m_event_loop = make<Core::EventLoop>();
|
||||
if (parent() && is<Window>(parent())) {
|
||||
auto& parent_window = *static_cast<Window*>(parent());
|
||||
|
|
|
@ -73,7 +73,7 @@ i32 DisplayLink::register_callback(Function<void(i32)> callback)
|
|||
|
||||
bool DisplayLink::unregister_callback(i32 callback_id)
|
||||
{
|
||||
ASSERT(callbacks().contains(callback_id));
|
||||
VERIFY(callbacks().contains(callback_id));
|
||||
callbacks().remove(callback_id);
|
||||
|
||||
if (callbacks().is_empty())
|
||||
|
|
|
@ -46,9 +46,9 @@ DragOperation::~DragOperation()
|
|||
|
||||
DragOperation::Outcome DragOperation::exec()
|
||||
{
|
||||
ASSERT(!s_current_drag_operation);
|
||||
ASSERT(!m_event_loop);
|
||||
ASSERT(m_mime_data);
|
||||
VERIFY(!s_current_drag_operation);
|
||||
VERIFY(!m_event_loop);
|
||||
VERIFY(m_mime_data);
|
||||
|
||||
Gfx::ShareableBitmap drag_bitmap;
|
||||
if (m_mime_data->has_format("image/x-raw-bitmap")) {
|
||||
|
@ -79,14 +79,14 @@ DragOperation::Outcome DragOperation::exec()
|
|||
|
||||
void DragOperation::done(Outcome outcome)
|
||||
{
|
||||
ASSERT(m_outcome == Outcome::None);
|
||||
VERIFY(m_outcome == Outcome::None);
|
||||
m_outcome = outcome;
|
||||
m_event_loop->quit(0);
|
||||
}
|
||||
|
||||
void DragOperation::notify_accepted(Badge<WindowServerConnection>)
|
||||
{
|
||||
ASSERT(s_current_drag_operation);
|
||||
VERIFY(s_current_drag_operation);
|
||||
s_current_drag_operation->done(Outcome::Accepted);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ EditingEngine::~EditingEngine()
|
|||
|
||||
void EditingEngine::attach(TextEditor& editor)
|
||||
{
|
||||
ASSERT(!m_editor);
|
||||
VERIFY(!m_editor);
|
||||
m_editor = editor;
|
||||
}
|
||||
|
||||
void EditingEngine::detach()
|
||||
{
|
||||
ASSERT(m_editor);
|
||||
VERIFY(m_editor);
|
||||
m_editor = nullptr;
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ TextPosition EditingEngine::find_beginning_of_next_word()
|
|||
has_seen_whitespace = true;
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void EditingEngine::move_to_beginning_of_next_word()
|
||||
|
@ -516,7 +516,7 @@ TextPosition EditingEngine::find_end_of_next_word()
|
|||
is_first_iteration = false;
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void EditingEngine::move_to_end_of_next_word()
|
||||
|
@ -584,7 +584,7 @@ TextPosition EditingEngine::find_end_of_previous_word()
|
|||
has_seen_whitespace = true;
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void EditingEngine::move_to_end_of_previous_word()
|
||||
|
@ -648,7 +648,7 @@ TextPosition EditingEngine::find_beginning_of_previous_word()
|
|||
is_first_iteration = false;
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void EditingEngine::move_to_beginning_of_previous_word()
|
||||
|
@ -689,7 +689,7 @@ void EditingEngine::move_selected_lines_down()
|
|||
get_selection_line_boundaries(first_line, last_line);
|
||||
|
||||
auto& lines = m_editor->document().lines();
|
||||
ASSERT(lines.size() != 0);
|
||||
VERIFY(lines.size() != 0);
|
||||
if (last_line >= lines.size() - 1)
|
||||
return;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode)
|
|||
for (auto size : target_icon.sizes()) {
|
||||
auto& emblem = size < 32 ? *s_symlink_emblem_small : *s_symlink_emblem;
|
||||
auto original_bitmap = target_icon.bitmap_for_size(size);
|
||||
ASSERT(original_bitmap);
|
||||
VERIFY(original_bitmap);
|
||||
auto generated_bitmap = original_bitmap->clone();
|
||||
if (!generated_bitmap) {
|
||||
dbgln("Failed to clone {}x{} icon for symlink variant", size, size);
|
||||
|
|
|
@ -99,7 +99,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_
|
|||
|
||||
auto& widget = set_main_widget<GUI::Widget>();
|
||||
if (!widget.load_from_gml(file_picker_dialog_gml))
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
auto& toolbar = *widget.find_descendant_of_type_named<GUI::ToolBar>("toolbar");
|
||||
toolbar.set_has_frame(false);
|
||||
|
|
|
@ -53,7 +53,7 @@ ModelIndex FileSystemModel::Node::index(int column) const
|
|||
if (&parent->children[row] == this)
|
||||
return m_model.create_index(row, column, const_cast<Node*>(this));
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool FileSystemModel::Node::fetch_data(const String& full_path, bool is_root)
|
||||
|
@ -340,7 +340,7 @@ const FileSystemModel::Node& FileSystemModel::node(const ModelIndex& index) cons
|
|||
{
|
||||
if (!index.is_valid())
|
||||
return *m_root;
|
||||
ASSERT(index.internal_data());
|
||||
VERIFY(index.internal_data());
|
||||
return *(Node*)index.internal_data();
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const
|
|||
return {};
|
||||
auto& node = this->node(index);
|
||||
if (!node.parent) {
|
||||
ASSERT(&node == m_root);
|
||||
VERIFY(&node == m_root);
|
||||
return {};
|
||||
}
|
||||
return node.parent->index(index.column());
|
||||
|
@ -369,7 +369,7 @@ ModelIndex FileSystemModel::parent_index(const ModelIndex& index) const
|
|||
|
||||
Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
|
||||
if (role == ModelRole::TextAlignment) {
|
||||
switch (index.column()) {
|
||||
|
@ -386,7 +386,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
|
|||
case Column::SymlinkTarget:
|
||||
return Gfx::TextAlignment::CenterLeft;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
|
|||
|
||||
if (role == ModelRole::Custom) {
|
||||
// For GUI::FileSystemModel, custom role means the full path.
|
||||
ASSERT(index.column() == Column::Name);
|
||||
VERIFY(index.column() == Column::Name);
|
||||
return node.full_path();
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
|
|||
case Column::SymlinkTarget:
|
||||
return node.symlink_target;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (role == ModelRole::Display) {
|
||||
|
@ -581,7 +581,7 @@ String FileSystemModel::column_name(int column) const
|
|||
case Column::SymlinkTarget:
|
||||
return "Symlink target";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool FileSystemModel::accepts_drag(const ModelIndex& index, const Vector<String>& mime_types) const
|
||||
|
@ -611,7 +611,7 @@ bool FileSystemModel::is_editable(const ModelIndex& index) const
|
|||
|
||||
void FileSystemModel::set_data(const ModelIndex& index, const Variant& data)
|
||||
{
|
||||
ASSERT(is_editable(index));
|
||||
VERIFY(is_editable(index));
|
||||
Node& node = const_cast<Node&>(this->node(index));
|
||||
auto dirname = LexicalPath(node.full_path()).dirname();
|
||||
auto new_full_path = String::formatted("{}/{}", dirname, data.to_string());
|
||||
|
|
|
@ -96,7 +96,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
|
|||
|
||||
auto& widget = set_main_widget<GUI::Widget>();
|
||||
if (!widget.load_from_gml(font_picker_dialog_gml))
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
m_family_list_view = *widget.find_descendant_of_type_named<ListView>("family_list_view");
|
||||
m_family_list_view->set_model(ItemListModel<String>::create(m_families));
|
||||
|
|
|
@ -113,7 +113,7 @@ String format_gml(const StringView& string)
|
|||
auto ast = parse_gml(string);
|
||||
if (ast.is_null())
|
||||
return {};
|
||||
ASSERT(ast.is_object());
|
||||
VERIFY(ast.is_object());
|
||||
return format_gml_object(ast.as_object());
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ char GMLLexer::peek(size_t offset) const
|
|||
|
||||
char GMLLexer::consume()
|
||||
{
|
||||
ASSERT(m_index < m_input.length());
|
||||
VERIFY(m_index < m_input.length());
|
||||
char ch = m_input[m_index++];
|
||||
m_previous_position = m_position;
|
||||
if (ch == '\n') {
|
||||
|
|
|
@ -62,7 +62,7 @@ struct GMLToken {
|
|||
FOR_EACH_TOKEN_TYPE
|
||||
#undef __TOKEN
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Type m_type { Type::Unknown };
|
||||
|
|
|
@ -153,7 +153,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
|
|||
int new_size = m_section_resize_original_width + delta.primary_offset_for_orientation(m_orientation);
|
||||
if (new_size <= minimum_column_size)
|
||||
new_size = minimum_column_size;
|
||||
ASSERT(m_resizing_section >= 0 && m_resizing_section < model()->column_count());
|
||||
VERIFY(m_resizing_section >= 0 && m_resizing_section < model()->column_count());
|
||||
set_section_size(m_resizing_section, new_size);
|
||||
return;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ Menu& HeaderView::ensure_context_menu()
|
|||
// FIXME: This menu needs to be rebuilt if the model is swapped out,
|
||||
// or if the column count/names change.
|
||||
if (!m_context_menu) {
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
m_context_menu = Menu::construct();
|
||||
|
||||
if (m_orientation == Gfx::Orientation::Vertical) {
|
||||
|
|
|
@ -44,7 +44,7 @@ char IniLexer::peek(size_t offset) const
|
|||
|
||||
char IniLexer::consume()
|
||||
{
|
||||
ASSERT(m_index < m_input.length());
|
||||
VERIFY(m_index < m_input.length());
|
||||
char ch = m_input[m_index++];
|
||||
m_previous_position = m_position;
|
||||
if (ch == '\n') {
|
||||
|
|
|
@ -62,7 +62,7 @@ struct IniToken {
|
|||
FOR_EACH_TOKEN_TYPE
|
||||
#undef __TOKEN
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Type m_type { Type::Unknown };
|
||||
|
|
|
@ -49,7 +49,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap)
|
|||
: Icon()
|
||||
{
|
||||
if (bitmap) {
|
||||
ASSERT(bitmap->width() == bitmap->height());
|
||||
VERIFY(bitmap->width() == bitmap->height());
|
||||
int size = bitmap->width();
|
||||
set_bitmap_for_size(size, move(bitmap));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2)
|
|||
: Icon(move(bitmap1))
|
||||
{
|
||||
if (bitmap2) {
|
||||
ASSERT(bitmap2->width() == bitmap2->height());
|
||||
VERIFY(bitmap2->width() == bitmap2->height());
|
||||
int size = bitmap2->width();
|
||||
set_bitmap_for_size(size, move(bitmap2));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void IconView::reinit_item_cache() const
|
|||
for (size_t i = new_item_count; i < m_item_data_cache.size(); i++) {
|
||||
auto& item_data = m_item_data_cache[i];
|
||||
if (item_data.selected) {
|
||||
ASSERT(m_selected_count_cache > 0);
|
||||
VERIFY(m_selected_count_cache > 0);
|
||||
m_selected_count_cache--;
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const
|
|||
|
||||
ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
auto adjusted_position = to_content_position(position);
|
||||
if (auto item_data = item_data_from_content_position(adjusted_position)) {
|
||||
if (item_data->is_containing(adjusted_position))
|
||||
|
@ -603,7 +603,7 @@ void IconView::do_clear_selection()
|
|||
m_selected_count_cache--;
|
||||
}
|
||||
m_first_selected_hint = 0;
|
||||
ASSERT(m_selected_count_cache == 0);
|
||||
VERIFY(m_selected_count_cache == 0);
|
||||
}
|
||||
|
||||
void IconView::clear_selection()
|
||||
|
@ -661,7 +661,7 @@ void IconView::remove_selection(ItemData& item_data)
|
|||
|
||||
TemporaryChange change(m_changing_selection, true);
|
||||
item_data.selected = false;
|
||||
ASSERT(m_selected_count_cache > 0);
|
||||
VERIFY(m_selected_count_cache > 0);
|
||||
m_selected_count_cache--;
|
||||
int item_index = &item_data - &m_item_data_cache[0];
|
||||
if (m_first_selected_hint == item_index) {
|
||||
|
@ -770,7 +770,7 @@ void IconView::set_flow_direction(FlowDirection flow_direction)
|
|||
template<typename Function>
|
||||
inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const
|
||||
{
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
if (rect.is_empty())
|
||||
return IterationDecision::Continue;
|
||||
int begin_row, begin_column;
|
||||
|
|
|
@ -100,13 +100,13 @@ private:
|
|||
|
||||
bool is_intersecting(const Gfx::IntRect& rect) const
|
||||
{
|
||||
ASSERT(valid);
|
||||
VERIFY(valid);
|
||||
return icon_rect.intersects(rect) || text_rect.intersects(rect);
|
||||
}
|
||||
|
||||
bool is_containing(const Gfx::IntPoint& point) const
|
||||
{
|
||||
ASSERT(valid);
|
||||
VERIFY(valid);
|
||||
return icon_rect.contains(point) || text_rect.contains(point);
|
||||
}
|
||||
};
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
void reinit_item_cache() const;
|
||||
int model_index_to_item_index(const ModelIndex& model_index) const
|
||||
{
|
||||
ASSERT(model_index.row() < item_count());
|
||||
VERIFY(model_index.row() < item_count());
|
||||
return model_index.row();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ void ImageWidget::load_from_file(const StringView& path)
|
|||
auto& mapped_file = *file_or_error.value();
|
||||
m_image_decoder = Gfx::ImageDecoder::create((const u8*)mapped_file.data(), mapped_file.size());
|
||||
auto bitmap = m_image_decoder->bitmap();
|
||||
ASSERT(bitmap);
|
||||
VERIFY(bitmap);
|
||||
|
||||
set_bitmap(bitmap);
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ void JsonArrayModel::update()
|
|||
|
||||
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());
|
||||
m_array = json.value().as_array();
|
||||
|
||||
did_update();
|
||||
|
@ -65,7 +65,7 @@ bool JsonArrayModel::store()
|
|||
|
||||
bool JsonArrayModel::add(const Vector<JsonValue>&& values)
|
||||
{
|
||||
ASSERT(values.size() == m_fields.size());
|
||||
VERIFY(values.size() == m_fields.size());
|
||||
JsonObject obj;
|
||||
for (size_t i = 0; i < m_fields.size(); ++i) {
|
||||
auto& field_spec = m_fields[i];
|
||||
|
|
|
@ -66,7 +66,7 @@ Layout::Layout()
|
|||
} else if (entry.type == Entry::Type::Spacer) {
|
||||
entry_object.set("type", "Spacer");
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
entries_array.append(move(entry_object));
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ void Layout::notify_adopted(Badge<Widget>, Widget& widget)
|
|||
|
||||
void Layout::notify_disowned(Badge<Widget>, Widget& widget)
|
||||
{
|
||||
ASSERT(m_owner == &widget);
|
||||
VERIFY(m_owner == &widget);
|
||||
m_owner.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void LazyWidget::show_event(ShowEvent&)
|
|||
return;
|
||||
m_has_been_shown = true;
|
||||
|
||||
ASSERT(on_first_show);
|
||||
VERIFY(on_first_show);
|
||||
on_first_show(*this);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ Gfx::IntRect ListView::content_rect(const ModelIndex& index) const
|
|||
|
||||
ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const
|
||||
{
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
|
||||
auto adjusted_position = this->adjusted_position(point);
|
||||
for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) {
|
||||
|
|
|
@ -113,7 +113,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
|
|||
#if MENU_DEBUG
|
||||
dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
|
||||
#endif
|
||||
ASSERT(m_menu_id > 0);
|
||||
VERIFY(m_menu_id > 0);
|
||||
for (size_t i = 0; i < m_items.size(); ++i) {
|
||||
auto& item = m_items[i];
|
||||
item.set_menu_id({}, m_menu_id);
|
||||
|
|
|
@ -63,12 +63,12 @@ void MenuBar::unrealize_menubar()
|
|||
|
||||
void MenuBar::notify_added_to_application(Badge<Application>)
|
||||
{
|
||||
ASSERT(m_menubar_id == -1);
|
||||
VERIFY(m_menubar_id == -1);
|
||||
m_menubar_id = realize_menubar();
|
||||
ASSERT(m_menubar_id != -1);
|
||||
VERIFY(m_menubar_id != -1);
|
||||
for (auto& menu : m_menus) {
|
||||
int menu_id = menu.realize_menu();
|
||||
ASSERT(menu_id != -1);
|
||||
VERIFY(menu_id != -1);
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::AddMenuToMenubar>(m_menubar_id, menu_id);
|
||||
}
|
||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetApplicationMenubar>(m_menubar_id);
|
||||
|
|
|
@ -72,7 +72,7 @@ void MenuItem::set_enabled(bool enabled)
|
|||
|
||||
void MenuItem::set_checked(bool checked)
|
||||
{
|
||||
ASSERT(is_checkable());
|
||||
VERIFY(is_checkable());
|
||||
if (m_checked == checked)
|
||||
return;
|
||||
m_checked = checked;
|
||||
|
@ -81,7 +81,7 @@ void MenuItem::set_checked(bool checked)
|
|||
|
||||
void MenuItem::set_default(bool is_default)
|
||||
{
|
||||
ASSERT(is_checkable());
|
||||
VERIFY(is_checkable());
|
||||
if (m_default == is_default)
|
||||
return;
|
||||
m_default = is_default;
|
||||
|
|
|
@ -35,7 +35,7 @@ Variant ModelIndex::data(ModelRole role) const
|
|||
if (!is_valid())
|
||||
return {};
|
||||
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
return model()->data(*this, role);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter)
|
|||
|
||||
void ModelSelection::set(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indexes.size() == 1 && m_indexes.contains(index))
|
||||
return;
|
||||
m_indexes.clear();
|
||||
|
@ -57,7 +57,7 @@ void ModelSelection::set(const ModelIndex& index)
|
|||
|
||||
void ModelSelection::add(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indexes.contains(index))
|
||||
return;
|
||||
m_indexes.set(index);
|
||||
|
@ -78,7 +78,7 @@ void ModelSelection::add_all(const Vector<ModelIndex>& indices)
|
|||
|
||||
void ModelSelection::toggle(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indexes.contains(index))
|
||||
m_indexes.remove(index);
|
||||
else
|
||||
|
@ -88,7 +88,7 @@ void ModelSelection::toggle(const ModelIndex& index)
|
|||
|
||||
bool ModelSelection::remove(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
if (!m_indexes.contains(index))
|
||||
return false;
|
||||
m_indexes.remove(index);
|
||||
|
|
|
@ -94,7 +94,7 @@ void MultiView::set_view_mode(ViewMode mode)
|
|||
m_view_as_icons_action->set_checked(true);
|
||||
return;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void MultiView::set_model(RefPtr<Model> model)
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
case ViewMode::Icon:
|
||||
return *m_icon_view;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ OpacitySlider::OpacitySlider(Gfx::Orientation orientation)
|
|||
: AbstractSlider(orientation)
|
||||
{
|
||||
// FIXME: Implement vertical mode.
|
||||
ASSERT(orientation == Gfx::Orientation::Horizontal);
|
||||
VERIFY(orientation == Gfx::Orientation::Horizontal);
|
||||
|
||||
set_min(0);
|
||||
set_max(100);
|
||||
|
|
|
@ -59,7 +59,7 @@ void ProgressBar::set_value(int value)
|
|||
|
||||
void ProgressBar::set_range(int min, int max)
|
||||
{
|
||||
ASSERT(min < max);
|
||||
VERIFY(min < max);
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_value = clamp(m_value, m_min, m_max);
|
||||
|
|
|
@ -85,7 +85,7 @@ String RunningProcessesModel::column_name(int column_index) const
|
|||
case Column::Name:
|
||||
return "Name";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
|
@ -109,7 +109,7 @@ GUI::Variant RunningProcessesModel::data(const GUI::ModelIndex& index, GUI::Mode
|
|||
case Column::Name:
|
||||
return process.name;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ void ScrollBar::mousedown_event(MouseEvent& event)
|
|||
if (event.shift()) {
|
||||
scroll_to_position(event.position());
|
||||
m_pressed_component = component_at_position(event.position());
|
||||
ASSERT(m_pressed_component == Component::Scrubber);
|
||||
VERIFY(m_pressed_component == Component::Scrubber);
|
||||
}
|
||||
if (m_pressed_component == Component::Scrubber) {
|
||||
m_scrub_start_value = value();
|
||||
|
@ -287,9 +287,9 @@ void ScrollBar::mousedown_event(MouseEvent& event)
|
|||
update();
|
||||
return;
|
||||
}
|
||||
ASSERT(!event.shift());
|
||||
VERIFY(!event.shift());
|
||||
|
||||
ASSERT(m_pressed_component == Component::Gutter);
|
||||
VERIFY(m_pressed_component == Component::Gutter);
|
||||
set_automatic_scrolling_active(true, Component::Gutter);
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -83,12 +83,12 @@ ModelIndex SortingProxyModel::map_to_source(const ModelIndex& proxy_index) const
|
|||
if (!proxy_index.is_valid())
|
||||
return {};
|
||||
|
||||
ASSERT(proxy_index.model() == this);
|
||||
ASSERT(proxy_index.internal_data());
|
||||
VERIFY(proxy_index.model() == this);
|
||||
VERIFY(proxy_index.internal_data());
|
||||
|
||||
auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data());
|
||||
auto it = m_mappings.find(index_mapping.source_parent);
|
||||
ASSERT(it != m_mappings.end());
|
||||
VERIFY(it != m_mappings.end());
|
||||
|
||||
auto& mapping = *it->value;
|
||||
if (static_cast<size_t>(proxy_index.row()) >= mapping.source_rows.size() || proxy_index.column() >= column_count())
|
||||
|
@ -103,7 +103,7 @@ ModelIndex SortingProxyModel::map_to_proxy(const ModelIndex& source_index) const
|
|||
if (!source_index.is_valid())
|
||||
return {};
|
||||
|
||||
ASSERT(source_index.model() == m_source);
|
||||
VERIFY(source_index.model() == m_source);
|
||||
|
||||
auto source_parent = source_index.parent();
|
||||
auto it = const_cast<SortingProxyModel*>(this)->build_mapping(source_parent);
|
||||
|
@ -158,7 +158,7 @@ ModelIndex SortingProxyModel::index(int row, int column, const ModelIndex& paren
|
|||
const_cast<SortingProxyModel*>(this)->build_mapping(source_parent);
|
||||
|
||||
auto it = m_mappings.find(source_parent);
|
||||
ASSERT(it != m_mappings.end());
|
||||
VERIFY(it != m_mappings.end());
|
||||
auto& mapping = *it->value;
|
||||
if (row >= static_cast<int>(mapping.source_rows.size()) || column >= column_count())
|
||||
return {};
|
||||
|
@ -170,12 +170,12 @@ ModelIndex SortingProxyModel::parent_index(const ModelIndex& proxy_index) const
|
|||
if (!proxy_index.is_valid())
|
||||
return {};
|
||||
|
||||
ASSERT(proxy_index.model() == this);
|
||||
ASSERT(proxy_index.internal_data());
|
||||
VERIFY(proxy_index.model() == this);
|
||||
VERIFY(proxy_index.internal_data());
|
||||
|
||||
auto& index_mapping = *static_cast<Mapping*>(proxy_index.internal_data());
|
||||
auto it = m_mappings.find(index_mapping.source_parent);
|
||||
ASSERT(it != m_mappings.end());
|
||||
VERIFY(it != m_mappings.end());
|
||||
|
||||
return map_to_proxy(it->value->source_parent);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void SpinBox::set_value(int value)
|
|||
|
||||
void SpinBox::set_range(int min, int max)
|
||||
{
|
||||
ASSERT(min <= max);
|
||||
VERIFY(min <= max);
|
||||
if (m_min == min && m_max == max)
|
||||
return;
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ Gfx::IntRect TabWidget::bar_rect() const
|
|||
case TabPosition::Bottom:
|
||||
return { 0, height() - bar_height(), width(), bar_height() };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Gfx::IntRect TabWidget::container_rect() const
|
||||
|
@ -187,7 +187,7 @@ Gfx::IntRect TabWidget::container_rect() const
|
|||
case TabPosition::Bottom:
|
||||
return { 0, 0, width(), height() - bar_height() };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void TabWidget::paint_event(PaintEvent& event)
|
||||
|
|
|
@ -210,7 +210,7 @@ void TextDocumentLine::remove(TextDocument& document, size_t index)
|
|||
|
||||
void TextDocumentLine::remove_range(TextDocument& document, size_t start, size_t length)
|
||||
{
|
||||
ASSERT(length <= m_text.size());
|
||||
VERIFY(length <= m_text.size());
|
||||
|
||||
Vector<u32> new_data;
|
||||
new_data.ensure_capacity(m_text.size() - length);
|
||||
|
@ -332,7 +332,7 @@ String TextDocument::text_in_range(const TextRange& a_range) const
|
|||
|
||||
u32 TextDocument::code_point_at(const TextPosition& position) const
|
||||
{
|
||||
ASSERT(position.line() < line_count());
|
||||
VERIFY(position.line() < line_count());
|
||||
auto& line = this->line(position.line());
|
||||
if (position.column() == line.length())
|
||||
return '\n';
|
||||
|
@ -814,7 +814,7 @@ void TextDocument::remove(const TextRange& unnormalized_range)
|
|||
}
|
||||
} else {
|
||||
// Delete across a newline, merging lines.
|
||||
ASSERT(range.start().line() == range.end().line() - 1);
|
||||
VERIFY(range.start().line() == range.end().line() - 1);
|
||||
auto& first_line = line(range.start().line());
|
||||
auto& second_line = line(range.end().line());
|
||||
Vector<u32> code_points;
|
||||
|
|
|
@ -199,11 +199,11 @@ TextPosition TextEditor::text_position_at_content_position(const Gfx::IntPoint&
|
|||
break;
|
||||
case Gfx::TextAlignment::CenterRight:
|
||||
// FIXME: Support right-aligned line wrapping, I guess.
|
||||
ASSERT(!is_wrapping_enabled());
|
||||
VERIFY(!is_wrapping_enabled());
|
||||
column_index = (position.x() - content_x_for_position({ line_index, 0 }) + fixed_glyph_width() / 2) / fixed_glyph_width();
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
column_index = max((size_t)0, min(column_index, line(line_index).length()));
|
||||
|
@ -688,7 +688,7 @@ void TextEditor::keydown_event(KeyEvent& event)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (m_editing_engine->on_key(event))
|
||||
|
@ -873,10 +873,10 @@ int TextEditor::content_x_for_position(const TextPosition& position) const
|
|||
return m_horizontal_content_padding + ((is_single_line() && icon()) ? (icon_size() + icon_padding()) : 0) + x_offset;
|
||||
case Gfx::TextAlignment::CenterRight:
|
||||
// FIXME
|
||||
ASSERT(!is_wrapping_enabled());
|
||||
VERIFY(!is_wrapping_enabled());
|
||||
return content_width() - m_horizontal_content_padding - (line.length() * fixed_glyph_width()) + (position.column() * fixed_glyph_width());
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -884,8 +884,8 @@ Gfx::IntRect TextEditor::content_rect_for_position(const TextPosition& position)
|
|||
{
|
||||
if (!position.is_valid())
|
||||
return {};
|
||||
ASSERT(!lines().is_empty());
|
||||
ASSERT(position.column() <= (current_line().length() + 1));
|
||||
VERIFY(!lines().is_empty());
|
||||
VERIFY(position.column() <= (current_line().length() + 1));
|
||||
|
||||
int x = content_x_for_position(position);
|
||||
|
||||
|
@ -993,7 +993,7 @@ void TextEditor::set_cursor(size_t line, size_t column)
|
|||
|
||||
void TextEditor::set_cursor(const TextPosition& a_position)
|
||||
{
|
||||
ASSERT(!lines().is_empty());
|
||||
VERIFY(!lines().is_empty());
|
||||
|
||||
TextPosition position = a_position;
|
||||
|
||||
|
@ -1146,7 +1146,7 @@ void TextEditor::delete_text_range(TextRange range)
|
|||
void TextEditor::insert_at_cursor_or_replace_selection(const StringView& text)
|
||||
{
|
||||
ReflowDeferrer defer(*this);
|
||||
ASSERT(is_editable());
|
||||
VERIFY(is_editable());
|
||||
if (has_selection())
|
||||
delete_selection();
|
||||
execute<InsertTextCommand>(text, m_cursor);
|
||||
|
@ -1188,7 +1188,7 @@ void TextEditor::defer_reflow()
|
|||
|
||||
void TextEditor::undefer_reflow()
|
||||
{
|
||||
ASSERT(m_reflow_deferred);
|
||||
VERIFY(m_reflow_deferred);
|
||||
if (!--m_reflow_deferred) {
|
||||
if (m_reflow_requested) {
|
||||
recompute_all_visual_lines();
|
||||
|
@ -1268,7 +1268,7 @@ void TextEditor::set_mode(const Mode mode)
|
|||
set_accepts_emoji_input(false);
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (!is_displayonly())
|
||||
|
@ -1637,7 +1637,7 @@ void TextEditor::set_editing_engine(OwnPtr<EditingEngine> editing_engine)
|
|||
m_editing_engine->detach();
|
||||
m_editing_engine = move(editing_engine);
|
||||
|
||||
ASSERT(m_editing_engine);
|
||||
VERIFY(m_editing_engine);
|
||||
m_editing_engine->attach(*this);
|
||||
|
||||
m_cursor_state = true;
|
||||
|
@ -1653,7 +1653,7 @@ int TextEditor::line_height() const
|
|||
|
||||
int TextEditor::fixed_glyph_width() const
|
||||
{
|
||||
ASSERT(font().is_fixed_width());
|
||||
VERIFY(font().is_fixed_width());
|
||||
return font().glyph_width(' ');
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ void TextEditor::set_should_autocomplete_automatically(bool value)
|
|||
return;
|
||||
|
||||
if (value) {
|
||||
ASSERT(m_autocomplete_provider);
|
||||
VERIFY(m_autocomplete_provider);
|
||||
m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] { try_show_autocomplete(); });
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ struct TreeView::MetadataForIndex {
|
|||
|
||||
TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex& index) const
|
||||
{
|
||||
ASSERT(index.is_valid());
|
||||
VERIFY(index.is_valid());
|
||||
auto it = m_view_metadata.find(index.internal_data());
|
||||
if (it != m_view_metadata.end())
|
||||
return *it->value;
|
||||
|
@ -165,7 +165,7 @@ void TreeView::collapse_tree(const ModelIndex& root)
|
|||
|
||||
void TreeView::toggle_index(const ModelIndex& index)
|
||||
{
|
||||
ASSERT(model()->row_count(index));
|
||||
VERIFY(model()->row_count(index));
|
||||
auto& metadata = ensure_metadata_for_index(index);
|
||||
metadata.open = !metadata.open;
|
||||
if (on_toggle)
|
||||
|
@ -178,7 +178,7 @@ void TreeView::toggle_index(const ModelIndex& index)
|
|||
template<typename Callback>
|
||||
void TreeView::traverse_in_paint_order(Callback callback) const
|
||||
{
|
||||
ASSERT(model());
|
||||
VERIFY(model());
|
||||
auto& model = *this->model();
|
||||
int indent_level = 1;
|
||||
int y_offset = 0;
|
||||
|
|
|
@ -65,7 +65,7 @@ const char* to_string(Variant::Type type)
|
|||
case Variant::Type::TextAlignment:
|
||||
return "TextAlignment";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Variant::Variant()
|
||||
|
@ -195,7 +195,7 @@ Variant::Variant(const JsonValue& value)
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Bitmap& value)
|
||||
|
@ -276,7 +276,7 @@ void Variant::move_from(Variant&& other)
|
|||
|
||||
void Variant::copy_from(const Variant& other)
|
||||
{
|
||||
ASSERT(!is_valid());
|
||||
VERIFY(!is_valid());
|
||||
m_type = other.m_type;
|
||||
switch (m_type) {
|
||||
case Type::Bool:
|
||||
|
@ -366,7 +366,7 @@ bool Variant::operator==(const Variant& other) const
|
|||
case Type::Invalid:
|
||||
return true;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool Variant::operator<(const Variant& other) const
|
||||
|
@ -400,11 +400,11 @@ bool Variant::operator<(const Variant& other) const
|
|||
case Type::Font:
|
||||
case Type::TextAlignment:
|
||||
// FIXME: Figure out how to compare these.
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
String Variant::to_string() const
|
||||
|
@ -449,14 +449,14 @@ String Variant::to_string() const
|
|||
case Gfx::TextAlignment::TopRight:
|
||||
return "Gfx::TextAlignment::TopRight";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
case Type::Invalid:
|
||||
return "[null]";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
bool as_bool() const
|
||||
{
|
||||
ASSERT(type() == Type::Bool);
|
||||
VERIFY(type() == Type::Bool);
|
||||
return m_value.as_bool;
|
||||
}
|
||||
|
||||
|
@ -127,19 +127,19 @@ public:
|
|||
|
||||
int as_i32() const
|
||||
{
|
||||
ASSERT(type() == Type::Int32);
|
||||
VERIFY(type() == Type::Int32);
|
||||
return m_value.as_i32;
|
||||
}
|
||||
|
||||
int as_i64() const
|
||||
{
|
||||
ASSERT(type() == Type::Int64);
|
||||
VERIFY(type() == Type::Int64);
|
||||
return m_value.as_i64;
|
||||
}
|
||||
|
||||
unsigned as_uint() const
|
||||
{
|
||||
ASSERT(type() == Type::UnsignedInt);
|
||||
VERIFY(type() == Type::UnsignedInt);
|
||||
return m_value.as_uint;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
if (is_float())
|
||||
return (int)as_float();
|
||||
if (is_uint()) {
|
||||
ASSERT(as_uint() <= INT32_MAX);
|
||||
VERIFY(as_uint() <= INT32_MAX);
|
||||
return (int)as_uint();
|
||||
}
|
||||
if (is_string())
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
|
||||
float as_float() const
|
||||
{
|
||||
ASSERT(type() == Type::Float);
|
||||
VERIFY(type() == Type::Float);
|
||||
return m_value.as_float;
|
||||
}
|
||||
|
||||
|
@ -196,31 +196,31 @@ public:
|
|||
|
||||
String as_string() const
|
||||
{
|
||||
ASSERT(type() == Type::String);
|
||||
VERIFY(type() == Type::String);
|
||||
return m_value.as_string;
|
||||
}
|
||||
|
||||
const Gfx::Bitmap& as_bitmap() const
|
||||
{
|
||||
ASSERT(type() == Type::Bitmap);
|
||||
VERIFY(type() == Type::Bitmap);
|
||||
return *m_value.as_bitmap;
|
||||
}
|
||||
|
||||
GUI::Icon as_icon() const
|
||||
{
|
||||
ASSERT(type() == Type::Icon);
|
||||
VERIFY(type() == Type::Icon);
|
||||
return GUI::Icon(*m_value.as_icon);
|
||||
}
|
||||
|
||||
Color as_color() const
|
||||
{
|
||||
ASSERT(type() == Type::Color);
|
||||
VERIFY(type() == Type::Color);
|
||||
return Color::from_rgba(m_value.as_color);
|
||||
}
|
||||
|
||||
const Gfx::Font& as_font() const
|
||||
{
|
||||
ASSERT(type() == Type::Font);
|
||||
VERIFY(type() == Type::Font);
|
||||
return *m_value.as_font;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ bool VimEditingEngine::on_key(const KeyEvent& event)
|
|||
case (VimMode::Normal):
|
||||
return on_key_in_normal_mode(event);
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -305,7 +305,7 @@ void Widget::handle_keydown_event(KeyEvent& event)
|
|||
|
||||
void Widget::handle_paint_event(PaintEvent& event)
|
||||
{
|
||||
ASSERT(is_visible());
|
||||
VERIFY(is_visible());
|
||||
if (fill_with_background_color()) {
|
||||
Painter painter(*this);
|
||||
painter.fill_rect(event.rect(), palette().color(background_role()));
|
||||
|
|
|
@ -228,7 +228,7 @@ String Window::title() const
|
|||
|
||||
Gfx::IntRect Window::rect_in_menubar() const
|
||||
{
|
||||
ASSERT(m_window_type == WindowType::MenuApplet);
|
||||
VERIFY(m_window_type == WindowType::MenuApplet);
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRectInMenubar>(m_window_id)->rect();
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ void Window::handle_drop_event(DropEvent& event)
|
|||
return;
|
||||
auto result = m_main_widget->hit_test(event.position());
|
||||
auto local_event = make<DropEvent>(result.local_position, event.text(), event.mime_data());
|
||||
ASSERT(result.widget);
|
||||
VERIFY(result.widget);
|
||||
result.widget->dispatch_event(*local_event, this);
|
||||
|
||||
Application::the()->set_drag_hovered_widget({}, nullptr);
|
||||
|
@ -358,7 +358,7 @@ void Window::handle_mouse_event(MouseEvent& event)
|
|||
return;
|
||||
auto result = m_main_widget->hit_test(event.position());
|
||||
auto local_event = make<MouseEvent>((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
|
||||
ASSERT(result.widget);
|
||||
VERIFY(result.widget);
|
||||
set_hovered_widget(result.widget);
|
||||
if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget)
|
||||
m_automatic_cursor_tracking_widget = *result.widget;
|
||||
|
@ -374,7 +374,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
|
|||
if (!m_main_widget)
|
||||
return;
|
||||
auto rects = event.rects();
|
||||
ASSERT(!rects.is_empty());
|
||||
VERIFY(!rects.is_empty());
|
||||
if (m_back_store && m_back_store->size() != event.window_size()) {
|
||||
// Eagerly discard the backing store if we learn from this paint event that it needs to be bigger.
|
||||
// Otherwise we would have to wait for a resize event to tell us. This way we don't waste the
|
||||
|
@ -384,12 +384,12 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
|
|||
bool created_new_backing_store = !m_back_store;
|
||||
if (!m_back_store) {
|
||||
m_back_store = create_backing_store(event.window_size());
|
||||
ASSERT(m_back_store);
|
||||
VERIFY(m_back_store);
|
||||
} else if (m_double_buffering_enabled) {
|
||||
bool still_has_pixels = m_back_store->bitmap().set_nonvolatile();
|
||||
if (!still_has_pixels) {
|
||||
m_back_store = create_backing_store(event.window_size());
|
||||
ASSERT(m_back_store);
|
||||
VERIFY(m_back_store);
|
||||
created_new_backing_store = true;
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ void Window::handle_drag_move_event(DragEvent& event)
|
|||
if (!m_main_widget)
|
||||
return;
|
||||
auto result = m_main_widget->hit_test(event.position());
|
||||
ASSERT(result.widget);
|
||||
VERIFY(result.widget);
|
||||
|
||||
Application::the()->set_drag_hovered_widget({}, result.widget, result.local_position, event.mime_types());
|
||||
|
||||
|
@ -688,7 +688,7 @@ void Window::set_has_alpha_channel(bool value)
|
|||
|
||||
void Window::set_double_buffering_enabled(bool value)
|
||||
{
|
||||
ASSERT(!is_visible());
|
||||
VERIFY(!is_visible());
|
||||
m_double_buffering_enabled = value;
|
||||
}
|
||||
|
||||
|
@ -742,7 +742,7 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
|
|||
|
||||
if (!m_back_store || m_back_store->size() != m_front_store->size()) {
|
||||
m_back_store = create_backing_store(m_front_store->size());
|
||||
ASSERT(m_back_store);
|
||||
VERIFY(m_back_store);
|
||||
memcpy(m_back_store->bitmap().scanline(0), m_front_store->bitmap().scanline(0), m_front_store->bitmap().size_in_bytes());
|
||||
m_back_store->bitmap().set_volatile();
|
||||
return;
|
||||
|
@ -760,7 +760,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size
|
|||
{
|
||||
auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32;
|
||||
|
||||
ASSERT(!size.is_empty());
|
||||
VERIFY(!size.is_empty());
|
||||
size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format);
|
||||
size_t size_in_bytes = size.height() * pitch;
|
||||
|
||||
|
@ -779,7 +779,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size
|
|||
|
||||
void Window::set_modal(bool modal)
|
||||
{
|
||||
ASSERT(!is_visible());
|
||||
VERIFY(!is_visible());
|
||||
m_modal = modal;
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ void Window::set_icon(const Gfx::Bitmap* icon)
|
|||
Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16);
|
||||
|
||||
m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, icon_size);
|
||||
ASSERT(m_icon);
|
||||
VERIFY(m_icon);
|
||||
if (icon) {
|
||||
Painter painter(*m_icon);
|
||||
painter.blit({ 0, 0 }, *icon, icon->rect());
|
||||
|
@ -910,7 +910,7 @@ void Window::refresh_system_theme()
|
|||
void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback)
|
||||
{
|
||||
for (auto& e : *reified_windows) {
|
||||
ASSERT(e.value);
|
||||
VERIFY(e.value);
|
||||
callback(*e.value);
|
||||
}
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget)
|
|||
|
||||
void Window::set_progress(int progress)
|
||||
{
|
||||
ASSERT(m_window_id);
|
||||
VERIFY(m_window_id);
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress));
|
||||
}
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ void Window::did_disable_focused_widget(Badge<Widget>)
|
|||
|
||||
bool Window::is_active() const
|
||||
{
|
||||
ASSERT(Application::the());
|
||||
VERIFY(Application::the());
|
||||
return this == Application::the()->active_window();
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ static MouseButton to_gmousebutton(u32 button)
|
|||
case 16:
|
||||
return MouseButton::Forward;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue