mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
This commit is contained in:
parent
689ca370d4
commit
359d6e7b0b
111 changed files with 517 additions and 503 deletions
|
@ -73,7 +73,7 @@ void Inspector::set_registers(PtraceRegisters const&) {};
|
|||
void Inspector::for_each_loaded_library(Function<IterationDecision(Debug::LoadedLibrary const&)> func) const
|
||||
{
|
||||
for (auto& library : m_loaded_libraries) {
|
||||
if (func(library) == IterationDecision::Break)
|
||||
if (func(*library) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
|
||||
NonnullOwnPtr<Reader> m_reader;
|
||||
|
||||
NonnullOwnPtrVector<Debug::LoadedLibrary> m_loaded_libraries;
|
||||
Vector<NonnullOwnPtr<Debug::LoadedLibrary>> m_loaded_libraries;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -160,9 +160,9 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source
|
|||
return result;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtrVector<DebugInfo::VariableInfo>> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const
|
||||
ErrorOr<Vector<NonnullOwnPtr<DebugInfo::VariableInfo>>> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const
|
||||
{
|
||||
NonnullOwnPtrVector<DebugInfo::VariableInfo> variables;
|
||||
Vector<NonnullOwnPtr<DebugInfo::VariableInfo>> variables;
|
||||
|
||||
// TODO: We can store the scopes in a better data structure
|
||||
for (auto const& scope : m_scopes) {
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
Dwarf::EntryTag type_tag;
|
||||
OwnPtr<VariableInfo> type;
|
||||
NonnullOwnPtrVector<VariableInfo> members;
|
||||
Vector<NonnullOwnPtr<VariableInfo>> members;
|
||||
VariableInfo* parent { nullptr };
|
||||
Vector<u32> dimension_sizes;
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
Vector<Dwarf::DIE> dies_of_variables;
|
||||
};
|
||||
|
||||
ErrorOr<NonnullOwnPtrVector<VariableInfo>> get_variables_in_current_scope(PtraceRegisters const&) const;
|
||||
ErrorOr<Vector<NonnullOwnPtr<VariableInfo>>> get_variables_in_current_scope(PtraceRegisters const&) const;
|
||||
|
||||
Optional<SourcePosition> get_source_position(FlatPtr address) const;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
ReadonlyBytes m_debug_addr_data;
|
||||
ReadonlyBytes m_debug_ranges_data;
|
||||
|
||||
NonnullOwnPtrVector<Dwarf::CompilationUnit> m_compilation_units;
|
||||
Vector<NonnullOwnPtr<Dwarf::CompilationUnit>> m_compilation_units;
|
||||
|
||||
struct DIERange {
|
||||
FlatPtr start_address { 0 };
|
||||
|
@ -93,7 +93,7 @@ template<typename Callback>
|
|||
ErrorOr<void> DwarfInfo::for_each_compilation_unit(Callback callback) const
|
||||
{
|
||||
for (auto const& unit : m_compilation_units) {
|
||||
TRY(callback(unit));
|
||||
TRY(callback(*unit));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -243,11 +243,11 @@ void CommandPalette::collect_actions(GUI::Window& parent_window)
|
|||
};
|
||||
|
||||
Function<void(Menu&)> collect_actions_from_menu = [&](Menu& menu) {
|
||||
for (auto menu_item : menu.items()) {
|
||||
if (menu_item.submenu())
|
||||
collect_actions_from_menu(*menu_item.submenu());
|
||||
for (auto& menu_item : menu.items()) {
|
||||
if (menu_item->submenu())
|
||||
collect_actions_from_menu(*menu_item->submenu());
|
||||
|
||||
auto* action = menu_item.action();
|
||||
auto* action = menu_item->action();
|
||||
if (should_show_action(action))
|
||||
actions.set(*action);
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ void EditingEngine::move_one_left()
|
|||
m_editor->set_cursor(m_editor->cursor().line(), new_column);
|
||||
} else if (m_editor->cursor().line() > 0) {
|
||||
auto new_line = m_editor->cursor().line() - 1;
|
||||
auto new_column = m_editor->lines()[new_line].length();
|
||||
auto new_column = m_editor->lines()[new_line]->length();
|
||||
m_editor->set_cursor(new_line, new_column);
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ void EditingEngine::move_to_first_line()
|
|||
|
||||
void EditingEngine::move_to_last_line()
|
||||
{
|
||||
m_editor->set_cursor(m_editor->line_count() - 1, m_editor->lines()[m_editor->line_count() - 1].length());
|
||||
m_editor->set_cursor(m_editor->line_count() - 1, m_editor->lines()[m_editor->line_count() - 1]->length());
|
||||
};
|
||||
|
||||
void EditingEngine::get_selection_line_boundaries(Badge<MoveLineUpOrDownCommand>, size_t& first_line, size_t& last_line)
|
||||
|
|
|
@ -33,7 +33,7 @@ ModelIndex FileSystemModel::Node::index(int column) const
|
|||
if (!m_parent)
|
||||
return {};
|
||||
for (size_t row = 0; row < m_parent->m_children.size(); ++row) {
|
||||
if (&m_parent->m_children[row] == this)
|
||||
if (m_parent->m_children[row] == this)
|
||||
return m_model.create_index(row, column, const_cast<Node*>(this));
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -111,8 +111,8 @@ void FileSystemModel::Node::traverse_if_needed()
|
|||
}
|
||||
quick_sort(child_names);
|
||||
|
||||
NonnullOwnPtrVector<Node> directory_children;
|
||||
NonnullOwnPtrVector<Node> file_children;
|
||||
Vector<NonnullOwnPtr<Node>> directory_children;
|
||||
Vector<NonnullOwnPtr<Node>> file_children;
|
||||
|
||||
for (auto& child_name : child_names) {
|
||||
auto maybe_child = create_child(child_name);
|
||||
|
@ -229,7 +229,7 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated
|
|||
resolved_path = path;
|
||||
LexicalPath lexical_path(resolved_path);
|
||||
|
||||
Node const* node = m_root->m_parent_of_root ? &m_root->m_children.first() : m_root;
|
||||
Node const* node = m_root->m_parent_of_root ? m_root->m_children.first() : m_root.ptr();
|
||||
if (lexical_path.string() == "/")
|
||||
return *node;
|
||||
|
||||
|
@ -238,9 +238,9 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated
|
|||
auto& part = parts[i];
|
||||
bool found = false;
|
||||
for (auto& child : node->m_children) {
|
||||
if (child.name == part) {
|
||||
const_cast<Node&>(child).reify_if_needed();
|
||||
node = &child;
|
||||
if (child->name == part) {
|
||||
const_cast<Node&>(*child).reify_if_needed();
|
||||
node = child;
|
||||
found = true;
|
||||
if (i == parts.size() - 1)
|
||||
return *node;
|
||||
|
@ -494,7 +494,7 @@ ModelIndex FileSystemModel::index(int row, int column, ModelIndex const& parent)
|
|||
const_cast<Node&>(node).reify_if_needed();
|
||||
if (static_cast<size_t>(row) >= node.m_children.size())
|
||||
return {};
|
||||
return create_index(row, column, &node.m_children[row]);
|
||||
return create_index(row, column, node.m_children[row].ptr());
|
||||
}
|
||||
|
||||
ModelIndex FileSystemModel::parent_index(ModelIndex const& index) const
|
||||
|
@ -801,9 +801,9 @@ Vector<ModelIndex> FileSystemModel::matches(StringView searching, unsigned flags
|
|||
node.reify_if_needed();
|
||||
Vector<ModelIndex> found_indices;
|
||||
for (auto& child : node.m_children) {
|
||||
if (string_matches(child.name, searching, flags)) {
|
||||
const_cast<Node&>(child).reify_if_needed();
|
||||
found_indices.append(child.index(Column::Name));
|
||||
if (string_matches(child->name, searching, flags)) {
|
||||
const_cast<Node&>(*child).reify_if_needed();
|
||||
found_indices.append(child->index(Column::Name));
|
||||
if (flags & FirstMatchOnly)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
FileSystemModel& m_model;
|
||||
|
||||
Node* m_parent { nullptr };
|
||||
NonnullOwnPtrVector<Node> m_children;
|
||||
Vector<NonnullOwnPtr<Node>> m_children;
|
||||
bool m_has_traversed { false };
|
||||
|
||||
bool m_selected { false };
|
||||
|
|
|
@ -68,7 +68,7 @@ void Menu::add_action(NonnullRefPtr<Action> action)
|
|||
void Menu::remove_all_actions()
|
||||
{
|
||||
for (auto& item : m_items) {
|
||||
ConnectionToWindowServer::the().async_remove_menu_item(m_menu_id, item.identifier());
|
||||
ConnectionToWindowServer::the().async_remove_menu_item(m_menu_id, item->identifier());
|
||||
}
|
||||
m_items.clear();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
|
|||
m_current_default_action = default_action;
|
||||
|
||||
for (size_t i = 0; i < m_items.size(); ++i) {
|
||||
realize_menu_item(m_items[i], i);
|
||||
realize_menu_item(*m_items[i], i);
|
||||
}
|
||||
|
||||
all_menus().set(m_menu_id, this);
|
||||
|
@ -168,14 +168,14 @@ Action* Menu::action_at(size_t index)
|
|||
{
|
||||
if (index >= m_items.size())
|
||||
return nullptr;
|
||||
return m_items[index].action();
|
||||
return m_items[index]->action();
|
||||
}
|
||||
|
||||
void Menu::set_children_actions_enabled(bool enabled)
|
||||
{
|
||||
for (auto& item : m_items) {
|
||||
if (item.action())
|
||||
item.action()->set_enabled(enabled);
|
||||
if (item->action())
|
||||
item->action()->set_enabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
bool is_visible() const { return m_visible; }
|
||||
|
||||
NonnullOwnPtrVector<MenuItem> const& items() const { return m_items; }
|
||||
Vector<NonnullOwnPtr<MenuItem>> const& items() const { return m_items; }
|
||||
|
||||
private:
|
||||
friend class Menubar;
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
int m_menu_id { -1 };
|
||||
DeprecatedString m_name;
|
||||
RefPtr<Gfx::Bitmap const> m_icon;
|
||||
NonnullOwnPtrVector<MenuItem> m_items;
|
||||
Vector<NonnullOwnPtr<MenuItem>> m_items;
|
||||
WeakPtr<Action> m_current_default_action;
|
||||
bool m_visible { false };
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void RegularEditingEngine::sort_selected_lines()
|
|||
auto end = lines.begin() + (int)last_line + 1;
|
||||
|
||||
quick_sort(start, end, [](auto& a, auto& b) {
|
||||
return strcmp_utf32(a.code_points(), b.code_points(), min(a.length(), b.length())) < 0;
|
||||
return strcmp_utf32(a->code_points(), b->code_points(), min(a->length(), b->length())) < 0;
|
||||
});
|
||||
|
||||
m_editor->did_change();
|
||||
|
|
|
@ -462,7 +462,7 @@ void TextDocument::update_regex_matches(StringView needle)
|
|||
Vector<RegexStringView> views;
|
||||
|
||||
for (size_t line = 0; line < m_lines.size(); ++line) {
|
||||
views.append(m_lines.at(line).view());
|
||||
views.append(m_lines[line]->view());
|
||||
}
|
||||
re.search(views, m_regex_result);
|
||||
m_regex_needs_update = false;
|
||||
|
|
|
@ -70,15 +70,15 @@ public:
|
|||
virtual ~TextDocument() = default;
|
||||
|
||||
size_t line_count() const { return m_lines.size(); }
|
||||
TextDocumentLine const& line(size_t line_index) const { return m_lines[line_index]; }
|
||||
TextDocumentLine& line(size_t line_index) { return m_lines[line_index]; }
|
||||
TextDocumentLine const& line(size_t line_index) const { return *m_lines[line_index]; }
|
||||
TextDocumentLine& line(size_t line_index) { return *m_lines[line_index]; }
|
||||
|
||||
void set_spans(u32 span_collection_index, Vector<TextDocumentSpan> spans);
|
||||
|
||||
bool set_text(StringView, AllowCallback = AllowCallback::Yes);
|
||||
|
||||
NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return m_lines; }
|
||||
NonnullOwnPtrVector<TextDocumentLine>& lines() { return m_lines; }
|
||||
Vector<NonnullOwnPtr<TextDocumentLine>> const& lines() const { return m_lines; }
|
||||
Vector<NonnullOwnPtr<TextDocumentLine>>& lines() { return m_lines; }
|
||||
|
||||
bool has_spans() const { return !m_spans.is_empty(); }
|
||||
Vector<TextDocumentSpan>& spans() { return m_spans; }
|
||||
|
@ -163,7 +163,7 @@ protected:
|
|||
private:
|
||||
void merge_span_collections();
|
||||
|
||||
NonnullOwnPtrVector<TextDocumentLine> m_lines;
|
||||
Vector<NonnullOwnPtr<TextDocumentLine>> m_lines;
|
||||
HashMap<u32, Vector<TextDocumentSpan>> m_span_collections;
|
||||
Vector<TextDocumentSpan> m_spans;
|
||||
Vector<TextDocumentFoldingRegion> m_folding_regions;
|
||||
|
|
|
@ -133,8 +133,8 @@ void TextEditor::update_content_size()
|
|||
int content_width = 0;
|
||||
int content_height = 0;
|
||||
for (auto& line : m_line_visual_data) {
|
||||
content_width = max(line.visual_rect.width(), content_width);
|
||||
content_height += line.visual_rect.height();
|
||||
content_width = max(line->visual_rect.width(), content_width);
|
||||
content_height += line->visual_rect.height();
|
||||
}
|
||||
content_width += m_horizontal_content_padding * 2;
|
||||
if (is_right_text_alignment(m_text_alignment))
|
||||
|
@ -167,7 +167,7 @@ TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint content
|
|||
if (!document().line_is_visible(i))
|
||||
continue;
|
||||
|
||||
auto& rect = m_line_visual_data[i].visual_rect;
|
||||
auto& rect = m_line_visual_data[i]->visual_rect;
|
||||
if (position.y() >= rect.top() && position.y() <= rect.bottom()) {
|
||||
line_index = i;
|
||||
break;
|
||||
|
@ -634,7 +634,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
first_visual_line_with_selection = visual_line_containing(line_index, selection.start().column());
|
||||
|
||||
if (selection.end().line() > line_index)
|
||||
last_visual_line_with_selection = m_line_visual_data[line_index].visual_lines.size();
|
||||
last_visual_line_with_selection = m_line_visual_data[line_index]->visual_lines.size();
|
||||
else
|
||||
last_visual_line_with_selection = visual_line_containing(line_index, selection.end().column());
|
||||
}
|
||||
|
@ -1441,7 +1441,7 @@ Gfx::IntRect TextEditor::line_content_rect(size_t line_index) const
|
|||
line_rect.center_vertically_within({ {}, frame_inner_rect().size() });
|
||||
return line_rect;
|
||||
}
|
||||
return m_line_visual_data[line_index].visual_rect;
|
||||
return m_line_visual_data[line_index]->visual_rect;
|
||||
}
|
||||
|
||||
void TextEditor::set_cursor_and_focus_line(size_t line, size_t column)
|
||||
|
@ -1451,8 +1451,8 @@ void TextEditor::set_cursor_and_focus_line(size_t line, size_t column)
|
|||
if (line > 1 && line < index_max) {
|
||||
int headroom = frame_inner_rect().height() / 3;
|
||||
do {
|
||||
auto line_data = m_line_visual_data[line];
|
||||
headroom -= line_data.visual_rect.height();
|
||||
auto const& line_data = m_line_visual_data[line];
|
||||
headroom -= line_data->visual_rect.height();
|
||||
line--;
|
||||
} while (line > 0 && headroom > 0);
|
||||
|
||||
|
@ -1481,8 +1481,8 @@ void TextEditor::set_cursor(TextPosition const& a_position)
|
|||
if (position.line() >= line_count())
|
||||
position.set_line(line_count() - 1);
|
||||
|
||||
if (position.column() > lines()[position.line()].length())
|
||||
position.set_column(lines()[position.line()].length());
|
||||
if (position.column() > lines()[position.line()]->length())
|
||||
position.set_column(lines()[position.line()]->length());
|
||||
|
||||
if (m_cursor != position && is_visual_data_up_to_date()) {
|
||||
// NOTE: If the old cursor is no longer valid, repaint everything just in case.
|
||||
|
@ -1972,8 +1972,8 @@ void TextEditor::recompute_all_visual_lines()
|
|||
auto folded_region_iterator = folded_regions.begin();
|
||||
for (size_t line_index = 0; line_index < line_count(); ++line_index) {
|
||||
recompute_visual_lines(line_index, folded_region_iterator);
|
||||
m_line_visual_data[line_index].visual_rect.set_y(y_offset);
|
||||
y_offset += m_line_visual_data[line_index].visual_rect.height();
|
||||
m_line_visual_data[line_index]->visual_rect.set_y(y_offset);
|
||||
y_offset += m_line_visual_data[line_index]->visual_rect.height();
|
||||
}
|
||||
|
||||
update_content_size();
|
||||
|
@ -2008,7 +2008,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
size_t line_width_so_far = 0;
|
||||
|
||||
auto& visual_data = m_line_visual_data[line_index];
|
||||
visual_data.visual_lines.clear_with_capacity();
|
||||
visual_data->visual_lines.clear_with_capacity();
|
||||
|
||||
auto available_width = visible_text_rect_in_inner_coordinates().width();
|
||||
auto glyph_spacing = font().glyph_spacing();
|
||||
|
@ -2034,7 +2034,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
|
||||
if (line_width_so_far + glyph_width + glyph_spacing > available_width) {
|
||||
auto start_of_next_visual_line = line.view().iterator_offset(it_before_computing_glyph_width);
|
||||
visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, start_of_next_visual_line - start_of_visual_line));
|
||||
visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, start_of_next_visual_line - start_of_visual_line));
|
||||
line_width_so_far = 0;
|
||||
start_of_visual_line = start_of_next_visual_line;
|
||||
}
|
||||
|
@ -2042,7 +2042,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
line_width_so_far += glyph_width + glyph_spacing;
|
||||
}
|
||||
|
||||
visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
|
||||
visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
|
||||
};
|
||||
|
||||
auto wrap_visual_lines_at_words = [&]() {
|
||||
|
@ -2057,7 +2057,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
auto word_width = font().width(word);
|
||||
|
||||
if (line_width_so_far + word_width + glyph_spacing > available_width) {
|
||||
visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, last_boundary - start_of_visual_line));
|
||||
visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, last_boundary - start_of_visual_line));
|
||||
line_width_so_far = 0;
|
||||
start_of_visual_line = last_boundary;
|
||||
}
|
||||
|
@ -2068,13 +2068,13 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
|
||||
visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
|
||||
};
|
||||
|
||||
if (line_is_visible) {
|
||||
switch (wrapping_mode()) {
|
||||
case WrappingMode::NoWrap:
|
||||
visual_data.visual_lines.append(line.view());
|
||||
visual_data->visual_lines.append(line.view());
|
||||
break;
|
||||
case WrappingMode::WrapAnywhere:
|
||||
wrap_visual_lines_anywhere();
|
||||
|
@ -2086,9 +2086,9 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
|
|||
}
|
||||
|
||||
if (is_wrapping_enabled())
|
||||
visual_data.visual_rect = { m_horizontal_content_padding, 0, available_width, static_cast<int>(visual_data.visual_lines.size()) * line_height() };
|
||||
visual_data->visual_rect = { m_horizontal_content_padding, 0, available_width, static_cast<int>(visual_data->visual_lines.size()) * line_height() };
|
||||
else
|
||||
visual_data.visual_rect = { m_horizontal_content_padding, 0, text_width_for_font(line.view(), font()), line_height() };
|
||||
visual_data->visual_rect = { m_horizontal_content_padding, 0, text_width_for_font(line.view(), font()), line_height() };
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
|
@ -2100,10 +2100,10 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
|
|||
auto& line = document().line(line_index);
|
||||
auto& visual_data = m_line_visual_data[line_index];
|
||||
|
||||
for (auto visual_line_view : visual_data.visual_lines) {
|
||||
for (auto visual_line_view : visual_data->visual_lines) {
|
||||
Gfx::IntRect visual_line_rect {
|
||||
visual_data.visual_rect.x(),
|
||||
visual_data.visual_rect.y() + ((int)visual_line_index * line_height()),
|
||||
visual_data->visual_rect.x(),
|
||||
visual_data->visual_rect.y() + ((int)visual_line_index * line_height()),
|
||||
text_width_for_font(visual_line_view, font()) + font().glyph_spacing(),
|
||||
line_height()
|
||||
};
|
||||
|
@ -2115,7 +2115,7 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
|
|||
visual_line_rect.translate_by(icon_size() + icon_padding(), 0);
|
||||
}
|
||||
size_t start_of_line = visual_line_view.code_points() - line.code_points();
|
||||
if (callback(visual_line_rect, visual_line_view, start_of_line, visual_line_index == visual_data.visual_lines.size() - 1) == IterationDecision::Break)
|
||||
if (callback(visual_line_rect, visual_line_view, start_of_line, visual_line_index == visual_data->visual_lines.size() - 1) == IterationDecision::Break)
|
||||
break;
|
||||
++visual_line_index;
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ public:
|
|||
size_t line_count() const { return document().line_count(); }
|
||||
TextDocumentLine& line(size_t index) { return document().line(index); }
|
||||
TextDocumentLine const& line(size_t index) const { return document().line(index); }
|
||||
NonnullOwnPtrVector<TextDocumentLine>& lines() { return document().lines(); }
|
||||
NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return document().lines(); }
|
||||
Vector<NonnullOwnPtr<TextDocumentLine>>& lines() { return document().lines(); }
|
||||
Vector<NonnullOwnPtr<TextDocumentLine>> const& lines() const { return document().lines(); }
|
||||
int line_height() const;
|
||||
TextPosition cursor() const { return m_cursor; }
|
||||
TextRange normalized_selection() const { return m_selection.normalized(); }
|
||||
|
@ -432,7 +432,7 @@ private:
|
|||
Gfx::IntRect visual_rect;
|
||||
};
|
||||
|
||||
NonnullOwnPtrVector<LineVisualData> m_line_visual_data;
|
||||
Vector<NonnullOwnPtr<LineVisualData>> m_line_visual_data;
|
||||
|
||||
OwnPtr<Syntax::Highlighter> m_highlighter;
|
||||
OwnPtr<AutocompleteProvider> m_autocomplete_provider;
|
||||
|
|
|
@ -111,7 +111,7 @@ ErrorOr<NonnullRefPtr<GUI::Button>> Toolbar::try_add_action(Action& action)
|
|||
item->widget->set_fixed_size(m_button_size, m_button_size);
|
||||
|
||||
m_items.unchecked_append(move(item));
|
||||
return *static_cast<Button*>(m_items.last().widget.ptr());
|
||||
return *static_cast<Button*>(m_items.last()->widget.ptr());
|
||||
}
|
||||
|
||||
GUI::Button& Toolbar::add_action(Action& action)
|
||||
|
@ -196,12 +196,12 @@ ErrorOr<void> Toolbar::update_overflow_menu()
|
|||
|
||||
for (size_t i = 0; i < m_items.size() - 1; ++i) {
|
||||
auto& item = m_items.at(i);
|
||||
auto item_size = is_horizontal ? item.widget->width() : item.widget->height();
|
||||
auto item_size = is_horizontal ? item->widget->width() : item->widget->height();
|
||||
if (position + item_size + margin > toolbar_size) {
|
||||
marginal_index = i;
|
||||
break;
|
||||
}
|
||||
item.widget->set_visible(true);
|
||||
item->widget->set_visible(true);
|
||||
position += item_size + spacing;
|
||||
}
|
||||
|
||||
|
@ -216,10 +216,10 @@ ErrorOr<void> Toolbar::update_overflow_menu()
|
|||
if (marginal_index.value() > 0) {
|
||||
for (size_t i = marginal_index.value() - 1; i > 0; --i) {
|
||||
auto& item = m_items.at(i);
|
||||
auto item_size = is_horizontal ? item.widget->width() : item.widget->height();
|
||||
auto item_size = is_horizontal ? item->widget->width() : item->widget->height();
|
||||
if (position + m_button_size + spacing + margin <= toolbar_size)
|
||||
break;
|
||||
item.widget->set_visible(false);
|
||||
item->widget->set_visible(false);
|
||||
position -= item_size + spacing;
|
||||
marginal_index = i;
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ ErrorOr<void> Toolbar::update_overflow_menu()
|
|||
if (m_grouped) {
|
||||
for (size_t i = marginal_index.value(); i > 0; --i) {
|
||||
auto& item = m_items.at(i);
|
||||
if (item.type == Item::Type::Separator)
|
||||
if (item->type == Item::Type::Separator)
|
||||
break;
|
||||
item.widget->set_visible(false);
|
||||
item->widget->set_visible(false);
|
||||
marginal_index = i;
|
||||
}
|
||||
}
|
||||
|
@ -247,17 +247,17 @@ ErrorOr<void> Toolbar::update_overflow_menu()
|
|||
auto& item = m_items.at(i);
|
||||
Item* peek_item;
|
||||
if (i > 0) {
|
||||
peek_item = &m_items.at(i - 1);
|
||||
peek_item = m_items[i - 1];
|
||||
if (peek_item->type == Item::Type::Separator)
|
||||
peek_item->widget->set_visible(false);
|
||||
}
|
||||
if (i < m_items.size() - 1) {
|
||||
item.widget->set_visible(false);
|
||||
peek_item = &m_items.at(i + 1);
|
||||
if (item.action)
|
||||
TRY(m_overflow_menu->try_add_action(*item.action));
|
||||
item->widget->set_visible(false);
|
||||
peek_item = m_items[i + 1];
|
||||
if (item->action)
|
||||
TRY(m_overflow_menu->try_add_action(*item->action));
|
||||
}
|
||||
if (item.action && peek_item->type == Item::Type::Separator)
|
||||
if (item->action && peek_item->type == Item::Type::Separator)
|
||||
TRY(m_overflow_menu->try_add_separator());
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
RefPtr<Action> action;
|
||||
RefPtr<Widget> widget;
|
||||
};
|
||||
NonnullOwnPtrVector<Item> m_items;
|
||||
Vector<NonnullOwnPtr<Item>> m_items;
|
||||
RefPtr<Menu> m_overflow_menu;
|
||||
RefPtr<Action> m_overflow_action;
|
||||
RefPtr<Button> m_overflow_button;
|
||||
|
|
|
@ -28,7 +28,7 @@ void UndoStack::undo()
|
|||
return;
|
||||
|
||||
auto& command = m_stack[--m_stack_index];
|
||||
command.undo();
|
||||
command->undo();
|
||||
|
||||
if (on_state_change)
|
||||
on_state_change();
|
||||
|
@ -40,7 +40,7 @@ void UndoStack::redo()
|
|||
return;
|
||||
|
||||
auto& command = m_stack[m_stack_index++];
|
||||
command.redo();
|
||||
command->redo();
|
||||
|
||||
if (on_state_change)
|
||||
on_state_change();
|
||||
|
@ -56,7 +56,7 @@ ErrorOr<void> UndoStack::try_push(NonnullOwnPtr<Command> command)
|
|||
m_clean_index = {};
|
||||
|
||||
if (!m_stack.is_empty() && is_current_modified()) {
|
||||
if (m_stack.last().merge_with(*command))
|
||||
if (m_stack.last()->merge_with(*command))
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -114,14 +114,14 @@ Optional<DeprecatedString> UndoStack::undo_action_text() const
|
|||
{
|
||||
if (!can_undo())
|
||||
return {};
|
||||
return m_stack[m_stack_index - 1].action_text();
|
||||
return m_stack[m_stack_index - 1]->action_text();
|
||||
}
|
||||
|
||||
Optional<DeprecatedString> UndoStack::redo_action_text() const
|
||||
{
|
||||
if (!can_redo())
|
||||
return {};
|
||||
return m_stack[m_stack_index].action_text();
|
||||
return m_stack[m_stack_index]->action_text();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
Function<void()> on_state_change;
|
||||
|
||||
private:
|
||||
NonnullOwnPtrVector<Command> m_stack;
|
||||
Vector<NonnullOwnPtr<Command>> m_stack;
|
||||
size_t m_stack_index { 0 };
|
||||
Optional<size_t> m_clean_index;
|
||||
Optional<Time> m_last_unmodified_timestamp;
|
||||
|
|
|
@ -21,7 +21,7 @@ DeprecatedString Document::render_to_html() const
|
|||
html_builder.append("</title>\n</head>\n"sv);
|
||||
html_builder.append("<body>\n"sv);
|
||||
for (auto& line : m_lines) {
|
||||
html_builder.append(line.render_to_html());
|
||||
html_builder.append(line->render_to_html());
|
||||
}
|
||||
html_builder.append("</body>"sv);
|
||||
html_builder.append("</html>"sv);
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
|
||||
void read_lines(StringView);
|
||||
|
||||
NonnullOwnPtrVector<Line> m_lines;
|
||||
Vector<NonnullOwnPtr<Line>> m_lines;
|
||||
URL m_url;
|
||||
bool m_inside_preformatted_block { false };
|
||||
bool m_inside_unordered_list { false };
|
||||
|
|
|
@ -77,7 +77,7 @@ struct GIFLoadingContext {
|
|||
size_t data_size { 0 };
|
||||
LogicalScreen logical_screen {};
|
||||
u8 background_color_index { 0 };
|
||||
NonnullOwnPtrVector<GIFImageDescriptor> images {};
|
||||
Vector<NonnullOwnPtr<GIFImageDescriptor>> images {};
|
||||
size_t loops { 1 };
|
||||
RefPtr<Gfx::Bitmap> frame_buffer;
|
||||
size_t current_frame { 0 };
|
||||
|
@ -284,11 +284,11 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
|
|||
for (size_t i = start_frame; i <= frame_index; ++i) {
|
||||
auto& image = context.images.at(i);
|
||||
|
||||
auto const previous_image_disposal_method = i > 0 ? context.images.at(i - 1).disposal_method : GIFImageDescriptor::DisposalMethod::None;
|
||||
auto const previous_image_disposal_method = i > 0 ? context.images.at(i - 1)->disposal_method : GIFImageDescriptor::DisposalMethod::None;
|
||||
|
||||
if (i == 0) {
|
||||
context.frame_buffer->fill(Color::Transparent);
|
||||
} else if (i > 0 && image.disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious
|
||||
} else if (i > 0 && image->disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious
|
||||
&& previous_image_disposal_method != GIFImageDescriptor::DisposalMethod::RestorePrevious) {
|
||||
// This marks the start of a run of frames that once disposed should be restored to the
|
||||
// previous underlying image contents. Therefore we make a copy of the current frame
|
||||
|
@ -302,23 +302,23 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
|
|||
// background color of the GIF itself. It appears that all major browsers and most other
|
||||
// GIF decoders adhere to the former interpretation, therefore we will do the same by
|
||||
// clearing the entire frame buffer to transparent.
|
||||
clear_rect(*context.frame_buffer, context.images.at(i - 1).rect(), Color::Transparent);
|
||||
clear_rect(*context.frame_buffer, context.images[i - 1]->rect(), Color::Transparent);
|
||||
} else if (i > 0 && previous_image_disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious) {
|
||||
// Previous frame indicated that once disposed, it should be restored to *its* previous
|
||||
// underlying image contents, therefore we restore the saved previous frame buffer.
|
||||
copy_frame_buffer(*context.frame_buffer, *context.prev_frame_buffer);
|
||||
}
|
||||
|
||||
if (image.lzw_min_code_size > 8)
|
||||
if (image->lzw_min_code_size > 8)
|
||||
return Error::from_string_literal("LZW minimum code size is greater than 8");
|
||||
|
||||
LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size);
|
||||
LZWDecoder decoder(image->lzw_encoded_bytes, image->lzw_min_code_size);
|
||||
|
||||
// Add GIF-specific control codes
|
||||
int const clear_code = decoder.add_control_code();
|
||||
int const end_of_information_code = decoder.add_control_code();
|
||||
|
||||
auto const& color_map = image.use_global_color_map ? context.logical_screen.color_map : image.color_map;
|
||||
auto const& color_map = image->use_global_color_map ? context.logical_screen.color_map : image->color_map;
|
||||
|
||||
int pixel_index = 0;
|
||||
int row = 0;
|
||||
|
@ -336,25 +336,25 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
|
|||
}
|
||||
if (code.value() == end_of_information_code)
|
||||
break;
|
||||
if (!image.width)
|
||||
if (!image->width)
|
||||
continue;
|
||||
|
||||
auto colors = decoder.get_output();
|
||||
for (auto const& color : colors) {
|
||||
auto c = color_map[color];
|
||||
|
||||
int x = pixel_index % image.width + image.x;
|
||||
int y = row + image.y;
|
||||
int x = pixel_index % image->width + image->x;
|
||||
int y = row + image->y;
|
||||
|
||||
if (context.frame_buffer->rect().contains(x, y) && (!image.transparent || color != image.transparency_index)) {
|
||||
if (context.frame_buffer->rect().contains(x, y) && (!image->transparent || color != image->transparency_index)) {
|
||||
context.frame_buffer->set_pixel(x, y, c);
|
||||
}
|
||||
|
||||
++pixel_index;
|
||||
if (pixel_index % image.width == 0) {
|
||||
if (image.interlaced) {
|
||||
if (pixel_index % image->width == 0) {
|
||||
if (image->interlaced) {
|
||||
if (interlace_pass < 4) {
|
||||
if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image.height) {
|
||||
if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image->height) {
|
||||
++interlace_pass;
|
||||
if (interlace_pass < 4)
|
||||
row = INTERLACE_ROW_OFFSETS[interlace_pass];
|
||||
|
@ -471,28 +471,28 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
|
|||
context.images.append(move(current_image));
|
||||
auto& image = context.images.last();
|
||||
|
||||
image.x = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image.y = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image.width = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image.height = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image->x = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image->y = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image->width = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
image->height = TRY(stream.read_value<LittleEndian<u16>>());
|
||||
|
||||
auto packed_fields = TRY(stream.read_value<u8>());
|
||||
|
||||
image.use_global_color_map = !(packed_fields & 0x80);
|
||||
image.interlaced = (packed_fields & 0x40) != 0;
|
||||
image->use_global_color_map = !(packed_fields & 0x80);
|
||||
image->interlaced = (packed_fields & 0x40) != 0;
|
||||
|
||||
if (!image.use_global_color_map) {
|
||||
if (!image->use_global_color_map) {
|
||||
size_t local_color_table_size = AK::exp2<size_t>((packed_fields & 7) + 1);
|
||||
|
||||
for (size_t i = 0; i < local_color_table_size; ++i) {
|
||||
u8 r = TRY(stream.read_value<u8>());
|
||||
u8 g = TRY(stream.read_value<u8>());
|
||||
u8 b = TRY(stream.read_value<u8>());
|
||||
image.color_map[i] = { r, g, b };
|
||||
image->color_map[i] = { r, g, b };
|
||||
}
|
||||
}
|
||||
|
||||
image.lzw_min_code_size = TRY(stream.read_value<u8>());
|
||||
image->lzw_min_code_size = TRY(stream.read_value<u8>());
|
||||
|
||||
u8 lzw_encoded_bytes_expected = 0;
|
||||
|
||||
|
@ -505,7 +505,7 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
|
|||
TRY(stream.read_entire_buffer(buffer.span().trim(lzw_encoded_bytes_expected)));
|
||||
|
||||
for (int i = 0; i < lzw_encoded_bytes_expected; ++i) {
|
||||
image.lzw_encoded_bytes.append(buffer[i]);
|
||||
image->lzw_encoded_bytes.append(buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ ErrorOr<ImageFrameDescriptor> GIFImageDecoderPlugin::frame(size_t index)
|
|||
|
||||
ImageFrameDescriptor frame {};
|
||||
frame.image = TRY(m_context->frame_buffer->clone());
|
||||
frame.duration = m_context->images.at(index).duration * 10;
|
||||
frame.duration = m_context->images[index]->duration * 10;
|
||||
|
||||
if (frame.duration <= 10) {
|
||||
frame.duration = 100;
|
||||
|
|
|
@ -122,7 +122,7 @@ void Job::flush_received_buffers()
|
|||
return;
|
||||
dbgln_if(JOB_DEBUG, "Job: Flushing received buffers: have {} bytes in {} buffers for {}", m_buffered_size, m_received_buffers.size(), m_request.url());
|
||||
for (size_t i = 0; i < m_received_buffers.size(); ++i) {
|
||||
auto& payload = m_received_buffers[i].pending_flush;
|
||||
auto& payload = m_received_buffers[i]->pending_flush;
|
||||
auto result = do_write(payload);
|
||||
if (result.is_error()) {
|
||||
if (!result.error().is_errno()) {
|
||||
|
@ -591,8 +591,8 @@ void Job::finish_up()
|
|||
|
||||
u8* flat_ptr = flattened_buffer.data();
|
||||
for (auto& received_buffer : m_received_buffers) {
|
||||
memcpy(flat_ptr, received_buffer.pending_flush.data(), received_buffer.pending_flush.size());
|
||||
flat_ptr += received_buffer.pending_flush.size();
|
||||
memcpy(flat_ptr, received_buffer->pending_flush.data(), received_buffer->pending_flush.size());
|
||||
flat_ptr += received_buffer->pending_flush.size();
|
||||
}
|
||||
m_received_buffers.clear();
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
ReadonlyBytes pending_flush;
|
||||
};
|
||||
|
||||
NonnullOwnPtrVector<ReceivedBuffer> m_received_buffers;
|
||||
Vector<NonnullOwnPtr<ReceivedBuffer>> m_received_buffers;
|
||||
|
||||
size_t m_buffered_size { 0 };
|
||||
size_t m_received_size { 0 };
|
||||
|
|
|
@ -128,8 +128,8 @@ void ConnectionBase::handle_messages()
|
|||
{
|
||||
auto messages = move(m_unprocessed_messages);
|
||||
for (auto& message : messages) {
|
||||
if (message.endpoint_magic() == m_local_endpoint_magic) {
|
||||
auto handler_result = m_local_stub.handle(message);
|
||||
if (message->endpoint_magic() == m_local_endpoint_magic) {
|
||||
auto handler_result = m_local_stub.handle(*message);
|
||||
if (handler_result.is_error()) {
|
||||
dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error());
|
||||
continue;
|
||||
|
@ -246,9 +246,9 @@ OwnPtr<IPC::Message> ConnectionBase::wait_for_specific_endpoint_message_impl(u32
|
|||
// Otherwise we might end up blocked for a while for no reason.
|
||||
for (size_t i = 0; i < m_unprocessed_messages.size(); ++i) {
|
||||
auto& message = m_unprocessed_messages[i];
|
||||
if (message.endpoint_magic() != endpoint_magic)
|
||||
if (message->endpoint_magic() != endpoint_magic)
|
||||
continue;
|
||||
if (message.message_id() == message_id)
|
||||
if (message->message_id() == message_id)
|
||||
return m_unprocessed_messages.take(i);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
|
||||
RefPtr<Core::Timer> m_responsiveness_timer;
|
||||
|
||||
NonnullOwnPtrVector<Message> m_unprocessed_messages;
|
||||
Vector<NonnullOwnPtr<Message>> m_unprocessed_messages;
|
||||
ByteBuffer m_unprocessed_bytes;
|
||||
|
||||
u32 m_local_endpoint_magic { 0 };
|
||||
|
|
|
@ -12,7 +12,7 @@ void Executable::dump() const
|
|||
{
|
||||
dbgln("\033[33;1mJS::Bytecode::Executable\033[0m ({})", name);
|
||||
for (auto& block : basic_blocks)
|
||||
block.dump(*this);
|
||||
block->dump(*this);
|
||||
if (!string_table->is_empty()) {
|
||||
outln();
|
||||
string_table->dump();
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace JS::Bytecode {
|
|||
|
||||
struct Executable {
|
||||
DeprecatedFlyString name;
|
||||
NonnullOwnPtrVector<BasicBlock> basic_blocks;
|
||||
Vector<NonnullOwnPtr<BasicBlock>> basic_blocks;
|
||||
NonnullOwnPtr<StringTable> string_table;
|
||||
NonnullOwnPtr<IdentifierTable> identifier_table;
|
||||
size_t number_of_registers { 0 };
|
||||
|
|
|
@ -36,9 +36,9 @@ CodeGenerationErrorOr<NonnullOwnPtr<Executable>> Generator::generate(ASTNode con
|
|||
if (generator.is_in_generator_or_async_function()) {
|
||||
// Terminate all unterminated blocks with yield return
|
||||
for (auto& block : generator.m_root_basic_blocks) {
|
||||
if (block.is_terminated())
|
||||
if (block->is_terminated())
|
||||
continue;
|
||||
generator.switch_to_basic_block(block);
|
||||
generator.switch_to_basic_block(*block);
|
||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||
generator.emit<Bytecode::Op::Yield>(nullptr);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
if (name.is_empty())
|
||||
name = DeprecatedString::number(m_next_block++);
|
||||
m_root_basic_blocks.append(BasicBlock::create(name));
|
||||
return m_root_basic_blocks.last();
|
||||
return *m_root_basic_blocks.last();
|
||||
}
|
||||
|
||||
bool is_current_block_terminated() const
|
||||
|
@ -227,7 +227,7 @@ private:
|
|||
};
|
||||
|
||||
BasicBlock* m_current_basic_block { nullptr };
|
||||
NonnullOwnPtrVector<BasicBlock> m_root_basic_blocks;
|
||||
Vector<NonnullOwnPtr<BasicBlock>> m_root_basic_blocks;
|
||||
NonnullOwnPtr<StringTable> m_string_table;
|
||||
NonnullOwnPtr<IdentifierTable> m_identifier_table;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
|||
pushed_execution_context = true;
|
||||
}
|
||||
|
||||
TemporaryChange restore_current_block { m_current_block, entry_point ?: &executable.basic_blocks.first() };
|
||||
TemporaryChange restore_current_block { m_current_block, entry_point ?: executable.basic_blocks.first() };
|
||||
|
||||
if (in_frame)
|
||||
m_register_windows.append(in_frame);
|
||||
|
|
|
@ -164,7 +164,7 @@ void GenerateCFG::perform(PassPipelineExecutable& executable)
|
|||
|
||||
unwind_frames.append(&top_level_frame);
|
||||
|
||||
generate_cfg_for_block(executable.executable.basic_blocks.first(), executable);
|
||||
generate_cfg_for_block(*executable.executable.basic_blocks.first(), executable);
|
||||
|
||||
finished();
|
||||
}
|
||||
|
|
|
@ -175,20 +175,20 @@ void EliminateLoads::perform(PassPipelineExecutable& executable)
|
|||
// save some work between blocks
|
||||
for (auto it = executable.executable.basic_blocks.begin(); it != executable.executable.basic_blocks.end(); ++it) {
|
||||
auto const& old_block = *it;
|
||||
auto new_block = eliminate_loads(old_block, executable.executable.number_of_registers);
|
||||
auto new_block = eliminate_loads(*old_block, executable.executable.number_of_registers);
|
||||
|
||||
// We will replace the old block, with a new one, so we need to replace all references,
|
||||
// to the old one with the new one
|
||||
for (auto& block : executable.executable.basic_blocks) {
|
||||
InstructionStreamIterator it { block.instruction_stream() };
|
||||
InstructionStreamIterator it { block->instruction_stream() };
|
||||
while (!it.at_end()) {
|
||||
auto& instruction = *it;
|
||||
++it;
|
||||
const_cast<Instruction&>(instruction).replace_references(old_block, *new_block);
|
||||
const_cast<Instruction&>(instruction).replace_references(*old_block, *new_block);
|
||||
}
|
||||
}
|
||||
|
||||
executable.executable.basic_blocks.ptr_at(it.index()) = move(new_block);
|
||||
executable.executable.basic_blocks[it.index()] = move(new_block);
|
||||
}
|
||||
|
||||
finished();
|
||||
|
|
|
@ -81,7 +81,7 @@ void MergeBlocks::perform(PassPipelineExecutable& executable)
|
|||
first_successor_position = it.index();
|
||||
}
|
||||
for (auto& block : executable.executable.basic_blocks) {
|
||||
InstructionStreamIterator it { block.instruction_stream() };
|
||||
InstructionStreamIterator it { block->instruction_stream() };
|
||||
while (!it.at_end()) {
|
||||
auto& instruction = *it;
|
||||
++it;
|
||||
|
|
|
@ -35,7 +35,7 @@ void PlaceBlocks::perform(PassPipelineExecutable& executable)
|
|||
};
|
||||
|
||||
// Make sure to visit the entry block first
|
||||
visit(&executable.executable.basic_blocks.first());
|
||||
visit(executable.executable.basic_blocks.first());
|
||||
|
||||
for (auto& entry : cfg)
|
||||
visit(entry.key);
|
||||
|
|
|
@ -22,19 +22,19 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
|
|||
|
||||
for (size_t i = 0; i < executable.executable.basic_blocks.size(); ++i) {
|
||||
auto& block = executable.executable.basic_blocks[i];
|
||||
auto block_bytes = block.instruction_stream();
|
||||
auto block_bytes = block->instruction_stream();
|
||||
for (auto& candidate_block : executable.executable.basic_blocks.span().slice(i + 1)) {
|
||||
if (equal_blocks.contains(&*candidate_block))
|
||||
continue;
|
||||
// FIXME: This can probably be relaxed a bit...
|
||||
if (candidate_block->size() != block.size())
|
||||
if (candidate_block->size() != block->size())
|
||||
continue;
|
||||
|
||||
auto candidate_bytes = candidate_block->instruction_stream();
|
||||
// FIXME: NewBigInt's value is not correctly reflected by its encoding in memory,
|
||||
// this will yield false negatives for blocks containing that
|
||||
if (memcmp(candidate_bytes.data(), block_bytes.data(), candidate_block->size()) == 0)
|
||||
equal_blocks.set(&*candidate_block, &block);
|
||||
equal_blocks.set(candidate_block.ptr(), block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
|
|||
first_successor_position = it.index();
|
||||
|
||||
for (auto& block : executable.executable.basic_blocks) {
|
||||
InstructionStreamIterator it { block.instruction_stream() };
|
||||
InstructionStreamIterator it { block->instruction_stream() };
|
||||
while (!it.at_end()) {
|
||||
auto& instruction = *it;
|
||||
++it;
|
||||
|
|
|
@ -61,12 +61,12 @@ public:
|
|||
{
|
||||
started();
|
||||
for (auto& pass : m_passes)
|
||||
pass.perform(executable);
|
||||
pass->perform(executable);
|
||||
finished();
|
||||
}
|
||||
|
||||
private:
|
||||
NonnullOwnPtrVector<Pass> m_passes;
|
||||
Vector<NonnullOwnPtr<Pass>> m_passes;
|
||||
};
|
||||
|
||||
namespace Passes {
|
||||
|
|
|
@ -22,15 +22,15 @@ DeprecatedString ContainerBlock::render_to_html(bool tight) const
|
|||
StringBuilder builder;
|
||||
|
||||
for (size_t i = 0; i + 1 < m_blocks.size(); ++i) {
|
||||
auto s = m_blocks[i].render_to_html(tight);
|
||||
auto s = m_blocks[i]->render_to_html(tight);
|
||||
builder.append(s);
|
||||
}
|
||||
|
||||
// I don't like this edge case.
|
||||
if (m_blocks.size() != 0) {
|
||||
auto& block = m_blocks[m_blocks.size() - 1];
|
||||
auto s = block.render_to_html(tight);
|
||||
if (tight && dynamic_cast<Paragraph const*>(&block)) {
|
||||
auto s = block->render_to_html(tight);
|
||||
if (tight && dynamic_cast<Paragraph const*>(block.ptr())) {
|
||||
builder.append(s.substring_view(0, s.length() - 1));
|
||||
} else {
|
||||
builder.append(s);
|
||||
|
@ -45,7 +45,7 @@ Vector<DeprecatedString> ContainerBlock::render_lines_for_terminal(size_t view_w
|
|||
Vector<DeprecatedString> lines;
|
||||
|
||||
for (auto& block : m_blocks) {
|
||||
for (auto& line : block.render_lines_for_terminal(view_width))
|
||||
for (auto& line : block->render_lines_for_terminal(view_width))
|
||||
lines.append(move(line));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ RecursionDecision ContainerBlock::walk(Visitor& visitor) const
|
|||
return rd;
|
||||
|
||||
for (auto const& block : m_blocks) {
|
||||
rd = block.walk(visitor);
|
||||
rd = block->walk(visitor);
|
||||
if (rd == RecursionDecision::Break)
|
||||
return rd;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ RecursionDecision ContainerBlock::walk(Visitor& visitor) const
|
|||
}
|
||||
|
||||
template<class CodeBlock>
|
||||
static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blocks, Heading* current_section)
|
||||
static bool try_parse_block(LineIterator& lines, Vector<NonnullOwnPtr<Block>>& blocks, Heading* current_section)
|
||||
{
|
||||
OwnPtr<CodeBlock> block = CodeBlock::parse(lines, current_section);
|
||||
if (!block)
|
||||
|
@ -78,7 +78,7 @@ static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blo
|
|||
}
|
||||
|
||||
template<typename BlockType>
|
||||
static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blocks)
|
||||
static bool try_parse_block(LineIterator& lines, Vector<NonnullOwnPtr<Block>>& blocks)
|
||||
{
|
||||
OwnPtr<BlockType> block = BlockType::parse(lines);
|
||||
if (!block)
|
||||
|
@ -89,7 +89,7 @@ static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blo
|
|||
|
||||
OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
|
||||
{
|
||||
NonnullOwnPtrVector<Block> blocks;
|
||||
Vector<NonnullOwnPtr<Block>> blocks;
|
||||
|
||||
StringBuilder paragraph_text;
|
||||
Heading* current_section = nullptr;
|
||||
|
@ -121,7 +121,7 @@ OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
|
|||
|
||||
bool heading = false;
|
||||
if ((heading = try_parse_block<Heading>(lines, blocks)))
|
||||
current_section = dynamic_cast<Heading*>(&blocks.last());
|
||||
current_section = dynamic_cast<Heading*>(blocks.last().ptr());
|
||||
|
||||
bool any = heading
|
||||
|| try_parse_block<Table>(lines, blocks)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Markdown {
|
|||
|
||||
class ContainerBlock final : public Block {
|
||||
public:
|
||||
ContainerBlock(NonnullOwnPtrVector<Block> blocks, bool has_blank_lines, bool has_trailing_blank_lines)
|
||||
ContainerBlock(Vector<NonnullOwnPtr<Block>> blocks, bool has_blank_lines, bool has_trailing_blank_lines)
|
||||
: m_blocks(move(blocks))
|
||||
, m_has_blank_lines(has_blank_lines)
|
||||
, m_has_trailing_blank_lines(has_trailing_blank_lines)
|
||||
|
@ -35,10 +35,10 @@ public:
|
|||
bool has_blank_lines() const { return m_has_blank_lines; }
|
||||
bool has_trailing_blank_lines() const { return m_has_trailing_blank_lines; }
|
||||
|
||||
NonnullOwnPtrVector<Block> const& blocks() const { return m_blocks; }
|
||||
Vector<NonnullOwnPtr<Block>> const& blocks() const { return m_blocks; }
|
||||
|
||||
private:
|
||||
NonnullOwnPtrVector<Block> m_blocks;
|
||||
Vector<NonnullOwnPtr<Block>> m_blocks;
|
||||
bool m_has_blank_lines;
|
||||
bool m_has_trailing_blank_lines;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ DeprecatedString List::render_to_html(bool) const
|
|||
|
||||
for (auto& item : m_items) {
|
||||
builder.append("<li>"sv);
|
||||
if (!m_is_tight || (item->blocks().size() != 0 && !dynamic_cast<Paragraph const*>(&(item->blocks()[0]))))
|
||||
if (!m_is_tight || (item->blocks().size() != 0 && !dynamic_cast<Paragraph const*>(item->blocks()[0].ptr())))
|
||||
builder.append('\n');
|
||||
builder.append(item->render_to_html(m_is_tight));
|
||||
builder.append("</li>\n"sv);
|
||||
|
|
|
@ -194,14 +194,14 @@ RecursionDecision Text::LinkNode::walk(Visitor& visitor) const
|
|||
void Text::MultiNode::render_to_html(StringBuilder& builder) const
|
||||
{
|
||||
for (auto& child : children) {
|
||||
child.render_to_html(builder);
|
||||
child->render_to_html(builder);
|
||||
}
|
||||
}
|
||||
|
||||
void Text::MultiNode::render_for_terminal(StringBuilder& builder) const
|
||||
{
|
||||
for (auto& child : children) {
|
||||
child.render_for_terminal(builder);
|
||||
child->render_for_terminal(builder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ size_t Text::MultiNode::terminal_length() const
|
|||
{
|
||||
size_t length = 0;
|
||||
for (auto& child : children) {
|
||||
length += child.terminal_length();
|
||||
length += child->terminal_length();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ RecursionDecision Text::MultiNode::walk(Visitor& visitor) const
|
|||
return rd;
|
||||
|
||||
for (auto const& child : children) {
|
||||
rd = child.walk(visitor);
|
||||
rd = child->walk(visitor);
|
||||
if (rd == RecursionDecision::Break)
|
||||
return rd;
|
||||
}
|
||||
|
@ -550,8 +550,8 @@ NonnullOwnPtr<Text::Node> Text::parse_code(Vector<Token>::ConstIterator& tokens)
|
|||
|
||||
// Strip first and last space, when appropriate.
|
||||
if (!is_all_whitespace) {
|
||||
auto& first = dynamic_cast<TextNode&>(code->children.first());
|
||||
auto& last = dynamic_cast<TextNode&>(code->children.last());
|
||||
auto& first = dynamic_cast<TextNode&>(*code->children.first());
|
||||
auto& last = dynamic_cast<TextNode&>(*code->children.last());
|
||||
if (first.text.starts_with(' ') && last.text.ends_with(' ')) {
|
||||
first.text = first.text.substring(1);
|
||||
last.text = last.text.substring(0, last.text.length() - 1);
|
||||
|
@ -653,8 +653,8 @@ NonnullOwnPtr<Text::Node> Text::parse_strike_through(Vector<Token>::ConstIterato
|
|||
tokens = iterator;
|
||||
|
||||
if (!is_all_whitespace) {
|
||||
auto& first = dynamic_cast<TextNode&>(striked_text->children.first());
|
||||
auto& last = dynamic_cast<TextNode&>(striked_text->children.last());
|
||||
auto& first = dynamic_cast<TextNode&>(*striked_text->children.first());
|
||||
auto& last = dynamic_cast<TextNode&>(*striked_text->children.last());
|
||||
if (first.text.starts_with(' ') && last.text.ends_with(' ')) {
|
||||
first.text = first.text.substring(1);
|
||||
last.text = last.text.substring(0, last.text.length() - 1);
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
|
||||
class MultiNode : public Node {
|
||||
public:
|
||||
NonnullOwnPtrVector<Node> children;
|
||||
Vector<NonnullOwnPtr<Node>> children;
|
||||
|
||||
virtual void render_to_html(StringBuilder& builder) const override;
|
||||
virtual void render_for_terminal(StringBuilder& builder) const override;
|
||||
|
|
|
@ -33,7 +33,7 @@ void Terminal::clear()
|
|||
{
|
||||
dbgln_if(TERMINAL_DEBUG, "Clear the entire screen");
|
||||
for (size_t i = 0; i < rows(); ++i)
|
||||
active_buffer()[i].clear();
|
||||
active_buffer()[i]->clear();
|
||||
set_cursor(0, 0);
|
||||
}
|
||||
|
||||
|
@ -715,7 +715,7 @@ void Terminal::linefeed()
|
|||
u16 new_row = cursor_row();
|
||||
#ifndef KERNEL
|
||||
if (!m_controls_are_logically_generated)
|
||||
active_buffer()[new_row].set_terminated(m_column_before_carriage_return.value_or(cursor_column()));
|
||||
active_buffer()[new_row]->set_terminated(m_column_before_carriage_return.value_or(cursor_column()));
|
||||
#endif
|
||||
if (cursor_row() == m_scroll_region_bottom) {
|
||||
scroll_up();
|
||||
|
@ -763,26 +763,26 @@ void Terminal::scroll_up(u16 region_top, u16 region_bottom, size_t count)
|
|||
auto remaining_lines = max_history_size() - history_size();
|
||||
history_delta = (count > remaining_lines) ? remaining_lines - count : 0;
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
add_line_to_history(move(active_buffer().ptr_at(region_top + i)));
|
||||
add_line_to_history(move(active_buffer().at(region_top + i)));
|
||||
}
|
||||
|
||||
// Move lines into their new place.
|
||||
for (u16 row = region_top; row + count <= region_bottom; ++row)
|
||||
swap(active_buffer().ptr_at(row), active_buffer().ptr_at(row + count));
|
||||
swap(active_buffer().at(row), active_buffer().at(row + count));
|
||||
// Clear 'new' lines at the bottom.
|
||||
if (should_move_to_scrollback) {
|
||||
// Since we moved the previous lines into history, we can't just clear them.
|
||||
for (u16 row = region_bottom + 1 - count; row <= region_bottom; ++row)
|
||||
active_buffer().ptr_at(row) = make<Line>(columns());
|
||||
active_buffer().at(row) = make<Line>(columns());
|
||||
} else {
|
||||
// The new lines haven't been moved and we don't want to leak memory.
|
||||
for (u16 row = region_bottom + 1 - count; row <= region_bottom; ++row)
|
||||
active_buffer()[row].clear();
|
||||
active_buffer()[row]->clear();
|
||||
}
|
||||
// Set dirty flag on swapped lines.
|
||||
// The other lines have implicitly been set dirty by being cleared.
|
||||
for (u16 row = region_top; row + count <= region_bottom; ++row)
|
||||
active_buffer()[row].set_dirty(true);
|
||||
active_buffer()[row]->set_dirty(true);
|
||||
m_client.terminal_history_changed(history_delta);
|
||||
}
|
||||
|
||||
|
@ -800,14 +800,14 @@ void Terminal::scroll_down(u16 region_top, u16 region_bottom, size_t count)
|
|||
|
||||
// Move lines into their new place.
|
||||
for (int row = region_bottom; row >= static_cast<int>(region_top + count); --row)
|
||||
swap(active_buffer().ptr_at(row), active_buffer().ptr_at(row - count));
|
||||
swap(active_buffer().at(row), active_buffer().at(row - count));
|
||||
// Clear the 'new' lines at the top.
|
||||
for (u16 row = region_top; row < region_top + count; ++row)
|
||||
active_buffer()[row].clear();
|
||||
active_buffer()[row]->clear();
|
||||
// Set dirty flag on swapped lines.
|
||||
// The other lines have implicitly been set dirty by being cleared.
|
||||
for (u16 row = region_top + count; row <= region_bottom; ++row)
|
||||
active_buffer()[row].set_dirty(true);
|
||||
active_buffer()[row]->set_dirty(true);
|
||||
}
|
||||
|
||||
// Insert `count` blank cells at the end of the line. Text moves left.
|
||||
|
@ -820,9 +820,9 @@ void Terminal::scroll_left(u16 row, u16 column, size_t count)
|
|||
|
||||
auto& line = active_buffer()[row];
|
||||
for (size_t i = column; i < columns() - count; ++i)
|
||||
swap(line.cell_at(i), line.cell_at(i + count));
|
||||
swap(line->cell_at(i), line->cell_at(i + count));
|
||||
clear_in_line(row, columns() - count, columns() - 1);
|
||||
line.set_dirty(true);
|
||||
line->set_dirty(true);
|
||||
}
|
||||
|
||||
// Insert `count` blank cells after `row`. Text moves right.
|
||||
|
@ -835,9 +835,9 @@ void Terminal::scroll_right(u16 row, u16 column, size_t count)
|
|||
|
||||
auto& line = active_buffer()[row];
|
||||
for (int i = columns() - 1; i >= static_cast<int>(column + count); --i)
|
||||
swap(line.cell_at(i), line.cell_at(i - count));
|
||||
swap(line->cell_at(i), line->cell_at(i - count));
|
||||
clear_in_line(row, column, column + count - 1);
|
||||
line.set_dirty(true);
|
||||
line->set_dirty(true);
|
||||
}
|
||||
|
||||
void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
|
||||
|
@ -845,10 +845,10 @@ void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
|
|||
VERIFY(row < rows());
|
||||
VERIFY(column < columns());
|
||||
auto& line = active_buffer()[row];
|
||||
line.set_code_point(column, code_point);
|
||||
line.attribute_at(column) = m_current_state.attribute;
|
||||
line.attribute_at(column).flags |= Attribute::Flags::Touched;
|
||||
line.set_dirty(true);
|
||||
line->set_code_point(column, code_point);
|
||||
line->attribute_at(column) = m_current_state.attribute;
|
||||
line->attribute_at(column).flags |= Attribute::Flags::Touched;
|
||||
line->set_dirty(true);
|
||||
|
||||
m_last_code_point = code_point;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
|
|||
void Terminal::clear_in_line(u16 row, u16 first_column, u16 last_column)
|
||||
{
|
||||
VERIFY(row < rows());
|
||||
active_buffer()[row].clear_range(first_column, last_column, m_current_state.attribute);
|
||||
active_buffer()[row]->clear_range(first_column, last_column, m_current_state.attribute);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1504,44 +1504,44 @@ void Terminal::set_size(u16 columns, u16 rows)
|
|||
if (forwards) {
|
||||
for (size_t i = 1; i <= buffer.size(); ++i) {
|
||||
auto is_at_seam = i == 1;
|
||||
auto next_line = is_at_seam ? nullptr : &buffer[buffer.size() - i + 1];
|
||||
auto& line = buffer[buffer.size() - i];
|
||||
Line* next_line = is_at_seam ? nullptr : buffer[buffer.size() - i + 1].ptr();
|
||||
Line* line = buffer[buffer.size() - i].ptr();
|
||||
auto next_cursor = cursor_on_line(buffer.size() - i + 1);
|
||||
line.rewrap(columns, next_line, next_cursor ?: cursor_on_line(buffer.size() - i), !!next_cursor);
|
||||
line->rewrap(columns, next_line, next_cursor ?: cursor_on_line(buffer.size() - i), !!next_cursor);
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < buffer.size(); ++i) {
|
||||
auto is_at_seam = i + 1 == buffer.size();
|
||||
auto next_line = is_at_seam ? nullptr : &buffer[i + 1];
|
||||
Line* next_line = is_at_seam ? nullptr : buffer[i + 1].ptr();
|
||||
auto next_cursor = cursor_on_line(i + 1);
|
||||
buffer[i].rewrap(columns, next_line, next_cursor ?: cursor_on_line(i), !!next_cursor);
|
||||
buffer[i]->rewrap(columns, next_line, next_cursor ?: cursor_on_line(i), !!next_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
Queue<size_t> lines_to_reevaluate;
|
||||
for (size_t i = 0; i < buffer.size(); ++i) {
|
||||
if (buffer[i].length() != columns)
|
||||
if (buffer[i]->length() != columns)
|
||||
lines_to_reevaluate.enqueue(i);
|
||||
}
|
||||
while (!lines_to_reevaluate.is_empty()) {
|
||||
auto index = lines_to_reevaluate.dequeue();
|
||||
auto is_at_seam = index + 1 == buffer.size();
|
||||
auto next_line = is_at_seam ? nullptr : &buffer[index + 1];
|
||||
auto& line = buffer[index];
|
||||
Line* const next_line = is_at_seam ? nullptr : buffer[index + 1].ptr();
|
||||
Line* const line = buffer[index].ptr();
|
||||
auto next_cursor = cursor_on_line(index + 1);
|
||||
line.rewrap(columns, next_line, next_cursor ?: cursor_on_line(index), !!next_cursor);
|
||||
if (line.length() > columns) {
|
||||
line->rewrap(columns, next_line, next_cursor ?: cursor_on_line(index), !!next_cursor);
|
||||
if (line->length() > columns) {
|
||||
auto current_cursor = cursor_on_line(index);
|
||||
// Split the line into two (or more)
|
||||
++index;
|
||||
buffer.insert(index, make<Line>(0));
|
||||
VERIFY(buffer[index].length() == 0);
|
||||
line.rewrap(columns, &buffer[index], current_cursor, false);
|
||||
VERIFY(buffer[index]->length() == 0);
|
||||
line->rewrap(columns, buffer[index].ptr(), current_cursor, false);
|
||||
// If we inserted a line and the old cursor was after that line, increment its row
|
||||
if (!current_cursor && old_cursor.row >= index)
|
||||
++old_cursor.row;
|
||||
|
||||
if (buffer[index].length() != columns)
|
||||
if (buffer[index]->length() != columns)
|
||||
lines_to_reevaluate.enqueue(index);
|
||||
}
|
||||
if (next_line && next_line->length() != columns)
|
||||
|
@ -1550,7 +1550,7 @@ void Terminal::set_size(u16 columns, u16 rows)
|
|||
}
|
||||
|
||||
for (auto& line : buffer)
|
||||
line.set_length(columns);
|
||||
line->set_length(columns);
|
||||
|
||||
return old_cursor;
|
||||
};
|
||||
|
@ -1563,8 +1563,8 @@ void Terminal::set_size(u16 columns, u16 rows)
|
|||
while (extra_lines > 0) {
|
||||
if (m_history.size() <= cursor_tracker.row)
|
||||
break;
|
||||
if (m_history.last().is_empty()) {
|
||||
if (m_history.size() >= 2 && m_history[m_history.size() - 2].termination_column().has_value())
|
||||
if (m_history.last()->is_empty()) {
|
||||
if (m_history.size() >= 2 && m_history[m_history.size() - 2]->termination_column().has_value())
|
||||
break;
|
||||
--extra_lines;
|
||||
(void)m_history.take_last();
|
||||
|
@ -1635,7 +1635,7 @@ void Terminal::set_size(u16 columns, u16 rows)
|
|||
void Terminal::invalidate_cursor()
|
||||
{
|
||||
if (cursor_row() < active_buffer().size())
|
||||
active_buffer()[cursor_row()].set_dirty(true);
|
||||
active_buffer()[cursor_row()]->set_dirty(true);
|
||||
}
|
||||
|
||||
Attribute Terminal::attribute_at(Position const& position) const
|
||||
|
|
|
@ -120,11 +120,11 @@ public:
|
|||
Line& line(size_t index)
|
||||
{
|
||||
if (m_use_alternate_screen_buffer) {
|
||||
return m_alternate_screen_buffer[index];
|
||||
return *m_alternate_screen_buffer[index];
|
||||
} else {
|
||||
if (index < m_history.size())
|
||||
return m_history[(m_history_start + index) % m_history.size()];
|
||||
return m_normal_screen_buffer[index - m_history.size()];
|
||||
return *m_history[(m_history_start + index) % m_history.size()];
|
||||
return *m_normal_screen_buffer[index - m_history.size()];
|
||||
}
|
||||
}
|
||||
Line const& line(size_t index) const
|
||||
|
@ -134,12 +134,12 @@ public:
|
|||
|
||||
Line& visible_line(size_t index)
|
||||
{
|
||||
return active_buffer()[index];
|
||||
return *active_buffer()[index];
|
||||
}
|
||||
|
||||
Line const& visible_line(size_t index) const
|
||||
{
|
||||
return active_buffer()[index];
|
||||
return *active_buffer()[index];
|
||||
}
|
||||
|
||||
size_t max_history_size() const { return m_max_history_lines; }
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_max_history_lines > value) {
|
||||
NonnullOwnPtrVector<Line> new_history;
|
||||
Vector<NonnullOwnPtr<Line>> new_history;
|
||||
new_history.ensure_capacity(value);
|
||||
auto existing_line_count = min(m_history.size(), value);
|
||||
for (size_t i = m_history.size() - existing_line_count; i < m_history.size(); ++i) {
|
||||
|
@ -381,7 +381,7 @@ protected:
|
|||
EscapeSequenceParser m_parser;
|
||||
#ifndef KERNEL
|
||||
size_t m_history_start = 0;
|
||||
NonnullOwnPtrVector<Line> m_history;
|
||||
Vector<NonnullOwnPtr<Line>> m_history;
|
||||
void add_line_to_history(NonnullOwnPtr<Line>&& line)
|
||||
{
|
||||
if (max_history_size() == 0)
|
||||
|
@ -397,14 +397,14 @@ protected:
|
|||
|
||||
return;
|
||||
}
|
||||
m_history.ptr_at(m_history_start) = move(line);
|
||||
m_history[m_history_start] = move(line);
|
||||
m_history_start = (m_history_start + 1) % m_history.size();
|
||||
}
|
||||
|
||||
NonnullOwnPtrVector<Line>& active_buffer() { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
|
||||
NonnullOwnPtrVector<Line> const& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
|
||||
NonnullOwnPtrVector<Line> m_normal_screen_buffer;
|
||||
NonnullOwnPtrVector<Line> m_alternate_screen_buffer;
|
||||
Vector<NonnullOwnPtr<Line>>& active_buffer() { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
|
||||
Vector<NonnullOwnPtr<Line>> const& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
|
||||
Vector<NonnullOwnPtr<Line>> m_normal_screen_buffer;
|
||||
Vector<NonnullOwnPtr<Line>> m_alternate_screen_buffer;
|
||||
#endif
|
||||
|
||||
bool m_use_alternate_screen_buffer { false };
|
||||
|
|
|
@ -257,7 +257,7 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_not(NonnullOwnPtr<MediaCondit
|
|||
return adopt_own(*result);
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(NonnullOwnPtrVector<MediaCondition>&& conditions)
|
||||
NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(Vector<NonnullOwnPtr<MediaCondition>>&& conditions)
|
||||
{
|
||||
auto result = new MediaCondition;
|
||||
result->type = Type::And;
|
||||
|
@ -266,7 +266,7 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(NonnullOwnPtrVector<
|
|||
return adopt_own(*result);
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(NonnullOwnPtrVector<MediaCondition>&& conditions)
|
||||
NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(Vector<NonnullOwnPtr<MediaCondition>>&& conditions)
|
||||
{
|
||||
auto result = new MediaCondition;
|
||||
result->type = Type::Or;
|
||||
|
@ -285,7 +285,7 @@ ErrorOr<String> MediaCondition::to_string() const
|
|||
break;
|
||||
case Type::Not:
|
||||
builder.append("not "sv);
|
||||
builder.append(TRY(conditions.first().to_string()));
|
||||
builder.append(TRY(conditions.first()->to_string()));
|
||||
break;
|
||||
case Type::And:
|
||||
builder.join(" and "sv, conditions);
|
||||
|
@ -307,11 +307,11 @@ MatchResult MediaCondition::evaluate(HTML::Window const& window) const
|
|||
case Type::Single:
|
||||
return as_match_result(feature->evaluate(window));
|
||||
case Type::Not:
|
||||
return negate(conditions.first().evaluate(window));
|
||||
return negate(conditions.first()->evaluate(window));
|
||||
case Type::And:
|
||||
return evaluate_and(conditions, [&](auto& child) { return child.evaluate(window); });
|
||||
return evaluate_and(conditions, [&](auto& child) { return child->evaluate(window); });
|
||||
case Type::Or:
|
||||
return evaluate_or(conditions, [&](auto& child) { return child.evaluate(window); });
|
||||
return evaluate_or(conditions, [&](auto& child) { return child->evaluate(window); });
|
||||
case Type::GeneralEnclosed:
|
||||
return general_enclosed->evaluate();
|
||||
}
|
||||
|
|
|
@ -197,8 +197,8 @@ struct MediaCondition {
|
|||
static NonnullOwnPtr<MediaCondition> from_general_enclosed(GeneralEnclosed&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_feature(MediaFeature&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_not(NonnullOwnPtr<MediaCondition>&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_and_list(NonnullOwnPtrVector<MediaCondition>&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_and_list(Vector<NonnullOwnPtr<MediaCondition>>&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_or_list(Vector<NonnullOwnPtr<MediaCondition>>&&);
|
||||
|
||||
MatchResult evaluate(HTML::Window const&) const;
|
||||
ErrorOr<String> to_string() const;
|
||||
|
@ -207,7 +207,7 @@ private:
|
|||
MediaCondition() = default;
|
||||
Type type;
|
||||
Optional<MediaFeature> feature;
|
||||
NonnullOwnPtrVector<MediaCondition> conditions;
|
||||
Vector<NonnullOwnPtr<MediaCondition>> conditions;
|
||||
Optional<GeneralEnclosed> general_enclosed;
|
||||
};
|
||||
|
||||
|
|
|
@ -834,7 +834,7 @@ OwnPtr<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
|
|||
return maybe_media_in_parens.release_nonnull();
|
||||
}
|
||||
|
||||
NonnullOwnPtrVector<MediaCondition> child_conditions;
|
||||
Vector<NonnullOwnPtr<MediaCondition>> child_conditions;
|
||||
child_conditions.append(maybe_media_in_parens.release_nonnull());
|
||||
|
||||
// `<media-and>*`
|
||||
|
@ -7091,7 +7091,7 @@ OwnPtr<CalculatedStyleValue::CalcNumberProduct> Parser::parse_calc_number_produc
|
|||
{
|
||||
auto calc_number_product = make<CalculatedStyleValue::CalcNumberProduct>(
|
||||
CalculatedStyleValue::CalcNumberValue { Number {} },
|
||||
NonnullOwnPtrVector<CalculatedStyleValue::CalcNumberProductPartWithOperator> {});
|
||||
Vector<NonnullOwnPtr<CalculatedStyleValue::CalcNumberProductPartWithOperator>> {});
|
||||
|
||||
auto first_calc_number_value_or_error = parse_calc_number_value(tokens);
|
||||
if (!first_calc_number_value_or_error.has_value())
|
||||
|
@ -7139,7 +7139,7 @@ OwnPtr<CalculatedStyleValue::CalcNumberSum> Parser::parse_calc_number_sum(TokenS
|
|||
if (!first_calc_number_product_or_error)
|
||||
return nullptr;
|
||||
|
||||
NonnullOwnPtrVector<CalculatedStyleValue::CalcNumberSumPartWithOperator> additional {};
|
||||
Vector<NonnullOwnPtr<CalculatedStyleValue::CalcNumberSumPartWithOperator>> additional {};
|
||||
while (tokens.has_next_token()) {
|
||||
auto calc_sum_part = parse_calc_number_sum_part_with_operator(tokens);
|
||||
if (!calc_sum_part)
|
||||
|
@ -7175,7 +7175,7 @@ OwnPtr<CalculatedStyleValue::CalcProduct> Parser::parse_calc_product(TokenStream
|
|||
{
|
||||
auto calc_product = make<CalculatedStyleValue::CalcProduct>(
|
||||
CalculatedStyleValue::CalcValue { Number {} },
|
||||
NonnullOwnPtrVector<CalculatedStyleValue::CalcProductPartWithOperator> {});
|
||||
Vector<NonnullOwnPtr<CalculatedStyleValue::CalcProductPartWithOperator>> {});
|
||||
|
||||
auto first_calc_value_or_error = parse_calc_value(tokens);
|
||||
if (!first_calc_value_or_error.has_value())
|
||||
|
@ -7225,7 +7225,7 @@ OwnPtr<CalculatedStyleValue::CalcSum> Parser::parse_calc_sum(TokenStream<Compone
|
|||
if (!parsed_calc_product)
|
||||
return nullptr;
|
||||
|
||||
NonnullOwnPtrVector<CalculatedStyleValue::CalcSumPartWithOperator> additional {};
|
||||
Vector<NonnullOwnPtr<CalculatedStyleValue::CalcSumPartWithOperator>> additional {};
|
||||
while (tokens.has_next_token()) {
|
||||
auto calc_sum_part = parse_calc_sum_part_with_operator(tokens);
|
||||
if (!calc_sum_part)
|
||||
|
|
|
@ -602,7 +602,7 @@ ErrorOr<String> CalculatedStyleValue::CalcSum::to_string() const
|
|||
StringBuilder builder;
|
||||
TRY(builder.try_append(TRY(first_calc_product->to_string())));
|
||||
for (auto const& item : zero_or_more_additional_calc_products)
|
||||
TRY(builder.try_append(TRY(item.to_string())));
|
||||
TRY(builder.try_append(TRY(item->to_string())));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ ErrorOr<String> CalculatedStyleValue::CalcNumberSum::to_string() const
|
|||
StringBuilder builder;
|
||||
TRY(builder.try_append(TRY(first_calc_number_product->to_string())));
|
||||
for (auto const& item : zero_or_more_additional_calc_number_products)
|
||||
TRY(builder.try_append(TRY(item.to_string())));
|
||||
TRY(builder.try_append(TRY(item->to_string())));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ ErrorOr<String> CalculatedStyleValue::CalcProduct::to_string() const
|
|||
StringBuilder builder;
|
||||
TRY(builder.try_append(TRY(first_calc_value.to_string())));
|
||||
for (auto const& item : zero_or_more_additional_calc_values)
|
||||
TRY(builder.try_append(TRY(item.to_string())));
|
||||
TRY(builder.try_append(TRY(item->to_string())));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ ErrorOr<String> CalculatedStyleValue::CalcNumberProduct::to_string() const
|
|||
StringBuilder builder;
|
||||
TRY(builder.try_append(TRY(first_calc_number_value.to_string())));
|
||||
for (auto const& item : zero_or_more_additional_calc_number_values)
|
||||
TRY(builder.try_append(TRY(item.to_string())));
|
||||
TRY(builder.try_append(TRY(item->to_string())));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
@ -790,12 +790,12 @@ static bool is_dimension(CalculatedStyleValue::ResolvedType type)
|
|||
}
|
||||
|
||||
template<typename SumWithOperator>
|
||||
static Optional<CalculatedStyleValue::ResolvedType> resolve_sum_type(CalculatedStyleValue::ResolvedType first_type, NonnullOwnPtrVector<SumWithOperator> const& zero_or_more_additional_products)
|
||||
static Optional<CalculatedStyleValue::ResolvedType> resolve_sum_type(CalculatedStyleValue::ResolvedType first_type, Vector<NonnullOwnPtr<SumWithOperator>> const& zero_or_more_additional_products)
|
||||
{
|
||||
auto type = first_type;
|
||||
|
||||
for (auto const& product : zero_or_more_additional_products) {
|
||||
auto maybe_product_type = product.resolved_type();
|
||||
auto maybe_product_type = product->resolved_type();
|
||||
if (!maybe_product_type.has_value())
|
||||
return {};
|
||||
auto product_type = maybe_product_type.value();
|
||||
|
@ -869,17 +869,17 @@ Optional<CalculatedStyleValue::ResolvedType> CalculatedStyleValue::CalcNumberSum
|
|||
}
|
||||
|
||||
template<typename ProductWithOperator>
|
||||
static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(CalculatedStyleValue::ResolvedType first_type, NonnullOwnPtrVector<ProductWithOperator> const& zero_or_more_additional_values)
|
||||
static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(CalculatedStyleValue::ResolvedType first_type, Vector<NonnullOwnPtr<ProductWithOperator>> const& zero_or_more_additional_values)
|
||||
{
|
||||
auto type = first_type;
|
||||
|
||||
for (auto const& value : zero_or_more_additional_values) {
|
||||
auto maybe_value_type = value.resolved_type();
|
||||
auto maybe_value_type = value->resolved_type();
|
||||
if (!maybe_value_type.has_value())
|
||||
return {};
|
||||
auto value_type = maybe_value_type.value();
|
||||
|
||||
if (value.op == CalculatedStyleValue::ProductOperation::Multiply) {
|
||||
if (value->op == CalculatedStyleValue::ProductOperation::Multiply) {
|
||||
// At *, check that at least one side is <number>.
|
||||
if (!(is_number(type) || is_number(value_type)))
|
||||
return {};
|
||||
|
@ -894,7 +894,7 @@ static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(Calcula
|
|||
|
||||
continue;
|
||||
} else {
|
||||
VERIFY(value.op == CalculatedStyleValue::ProductOperation::Divide);
|
||||
VERIFY(value->op == CalculatedStyleValue::ProductOperation::Divide);
|
||||
// At /, check that the right side is <number>.
|
||||
if (!is_number(value_type))
|
||||
return {};
|
||||
|
@ -1005,11 +1005,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcSum::resolve(L
|
|||
auto value = first_calc_product->resolve(layout_node, percentage_basis);
|
||||
|
||||
for (auto& additional_product : zero_or_more_additional_calc_products) {
|
||||
auto additional_value = additional_product.resolve(layout_node, percentage_basis);
|
||||
auto additional_value = additional_product->resolve(layout_node, percentage_basis);
|
||||
|
||||
if (additional_product.op == CalculatedStyleValue::SumOperation::Add)
|
||||
if (additional_product->op == CalculatedStyleValue::SumOperation::Add)
|
||||
value.add(additional_value, layout_node, percentage_basis);
|
||||
else if (additional_product.op == CalculatedStyleValue::SumOperation::Subtract)
|
||||
else if (additional_product->op == CalculatedStyleValue::SumOperation::Subtract)
|
||||
value.subtract(additional_value, layout_node, percentage_basis);
|
||||
else
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -1023,11 +1023,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSum::res
|
|||
auto value = first_calc_number_product->resolve(layout_node, percentage_basis);
|
||||
|
||||
for (auto& additional_product : zero_or_more_additional_calc_number_products) {
|
||||
auto additional_value = additional_product.resolve(layout_node, percentage_basis);
|
||||
auto additional_value = additional_product->resolve(layout_node, percentage_basis);
|
||||
|
||||
if (additional_product.op == CSS::CalculatedStyleValue::SumOperation::Add)
|
||||
if (additional_product->op == CSS::CalculatedStyleValue::SumOperation::Add)
|
||||
value.add(additional_value, layout_node, percentage_basis);
|
||||
else if (additional_product.op == CalculatedStyleValue::SumOperation::Subtract)
|
||||
else if (additional_product->op == CalculatedStyleValue::SumOperation::Subtract)
|
||||
value.subtract(additional_value, layout_node, percentage_basis);
|
||||
else
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -1041,14 +1041,14 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcProduct::resol
|
|||
auto value = first_calc_value.resolve(layout_node, percentage_basis);
|
||||
|
||||
for (auto& additional_value : zero_or_more_additional_calc_values) {
|
||||
additional_value.value.visit(
|
||||
additional_value->value.visit(
|
||||
[&](CalculatedStyleValue::CalcValue const& calc_value) {
|
||||
VERIFY(additional_value.op == CalculatedStyleValue::ProductOperation::Multiply);
|
||||
VERIFY(additional_value->op == CalculatedStyleValue::ProductOperation::Multiply);
|
||||
auto resolved_value = calc_value.resolve(layout_node, percentage_basis);
|
||||
value.multiply_by(resolved_value, layout_node);
|
||||
},
|
||||
[&](CalculatedStyleValue::CalcNumberValue const& calc_number_value) {
|
||||
VERIFY(additional_value.op == CalculatedStyleValue::ProductOperation::Divide);
|
||||
VERIFY(additional_value->op == CalculatedStyleValue::ProductOperation::Divide);
|
||||
auto resolved_calc_number_value = calc_number_value.resolve(layout_node, percentage_basis);
|
||||
// FIXME: Checking for division by 0 should happen during parsing.
|
||||
VERIFY(resolved_calc_number_value.value().get<Number>().value() != 0.0f);
|
||||
|
@ -1064,11 +1064,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberProduct:
|
|||
auto value = first_calc_number_value.resolve(layout_node, percentage_basis);
|
||||
|
||||
for (auto& additional_number_value : zero_or_more_additional_calc_number_values) {
|
||||
auto additional_value = additional_number_value.resolve(layout_node, percentage_basis);
|
||||
auto additional_value = additional_number_value->resolve(layout_node, percentage_basis);
|
||||
|
||||
if (additional_number_value.op == CalculatedStyleValue::ProductOperation::Multiply)
|
||||
if (additional_number_value->op == CalculatedStyleValue::ProductOperation::Multiply)
|
||||
value.multiply_by(additional_value, layout_node);
|
||||
else if (additional_number_value.op == CalculatedStyleValue::ProductOperation::Divide)
|
||||
else if (additional_number_value->op == CalculatedStyleValue::ProductOperation::Divide)
|
||||
value.divide_by(additional_value, layout_node);
|
||||
else
|
||||
VERIFY_NOT_REACHED();
|
||||
|
@ -2290,7 +2290,7 @@ bool CalculatedStyleValue::CalcSum::contains_percentage() const
|
|||
if (first_calc_product->contains_percentage())
|
||||
return true;
|
||||
for (auto& part : zero_or_more_additional_calc_products) {
|
||||
if (part.contains_percentage())
|
||||
if (part->contains_percentage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -2306,7 +2306,7 @@ bool CalculatedStyleValue::CalcProduct::contains_percentage() const
|
|||
if (first_calc_value.contains_percentage())
|
||||
return true;
|
||||
for (auto& part : zero_or_more_additional_calc_values) {
|
||||
if (part.contains_percentage())
|
||||
if (part->contains_percentage())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -821,12 +821,12 @@ public:
|
|||
|
||||
// This represents that: https://www.w3.org/TR/css-values-3/#calc-syntax
|
||||
struct CalcSum {
|
||||
CalcSum(NonnullOwnPtr<CalcProduct> first_calc_product, NonnullOwnPtrVector<CalcSumPartWithOperator> additional)
|
||||
CalcSum(NonnullOwnPtr<CalcProduct> first_calc_product, Vector<NonnullOwnPtr<CalcSumPartWithOperator>> additional)
|
||||
: first_calc_product(move(first_calc_product))
|
||||
, zero_or_more_additional_calc_products(move(additional)) {};
|
||||
|
||||
NonnullOwnPtr<CalcProduct> first_calc_product;
|
||||
NonnullOwnPtrVector<CalcSumPartWithOperator> zero_or_more_additional_calc_products;
|
||||
Vector<NonnullOwnPtr<CalcSumPartWithOperator>> zero_or_more_additional_calc_products;
|
||||
|
||||
ErrorOr<String> to_string() const;
|
||||
Optional<ResolvedType> resolved_type() const;
|
||||
|
@ -836,12 +836,12 @@ public:
|
|||
};
|
||||
|
||||
struct CalcNumberSum {
|
||||
CalcNumberSum(NonnullOwnPtr<CalcNumberProduct> first_calc_number_product, NonnullOwnPtrVector<CalcNumberSumPartWithOperator> additional)
|
||||
CalcNumberSum(NonnullOwnPtr<CalcNumberProduct> first_calc_number_product, Vector<NonnullOwnPtr<CalcNumberSumPartWithOperator>> additional)
|
||||
: first_calc_number_product(move(first_calc_number_product))
|
||||
, zero_or_more_additional_calc_number_products(move(additional)) {};
|
||||
|
||||
NonnullOwnPtr<CalcNumberProduct> first_calc_number_product;
|
||||
NonnullOwnPtrVector<CalcNumberSumPartWithOperator> zero_or_more_additional_calc_number_products;
|
||||
Vector<NonnullOwnPtr<CalcNumberSumPartWithOperator>> zero_or_more_additional_calc_number_products;
|
||||
|
||||
ErrorOr<String> to_string() const;
|
||||
Optional<ResolvedType> resolved_type() const;
|
||||
|
@ -850,7 +850,7 @@ public:
|
|||
|
||||
struct CalcProduct {
|
||||
CalcValue first_calc_value;
|
||||
NonnullOwnPtrVector<CalcProductPartWithOperator> zero_or_more_additional_calc_values;
|
||||
Vector<NonnullOwnPtr<CalcProductPartWithOperator>> zero_or_more_additional_calc_values;
|
||||
|
||||
ErrorOr<String> to_string() const;
|
||||
Optional<ResolvedType> resolved_type() const;
|
||||
|
@ -885,7 +885,7 @@ public:
|
|||
|
||||
struct CalcNumberProduct {
|
||||
CalcNumberValue first_calc_number_value;
|
||||
NonnullOwnPtrVector<CalcNumberProductPartWithOperator> zero_or_more_additional_calc_number_values;
|
||||
Vector<NonnullOwnPtr<CalcNumberProductPartWithOperator>> zero_or_more_additional_calc_number_values;
|
||||
|
||||
ErrorOr<String> to_string() const;
|
||||
Optional<ResolvedType> resolved_type() const;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
virtual ~WebAssemblyInstanceObject() override = default;
|
||||
|
||||
size_t index() const { return m_index; }
|
||||
Wasm::ModuleInstance& instance() const { return WebAssemblyObject::s_instantiated_modules.at(m_index); }
|
||||
Wasm::ModuleInstance& instance() const { return *WebAssemblyObject::s_instantiated_modules[m_index]; }
|
||||
auto& cache() { return WebAssemblyObject::s_module_caches.at(m_index); }
|
||||
|
||||
void visit_edges(Visitor&) override;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual ~WebAssemblyModuleObject() override = default;
|
||||
|
||||
size_t index() const { return m_index; }
|
||||
Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; }
|
||||
Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index)->module; }
|
||||
|
||||
private:
|
||||
size_t m_index { 0 };
|
||||
|
|
|
@ -58,8 +58,8 @@ JS::ThrowCompletionOr<void> WebAssemblyObject::initialize(JS::Realm& realm)
|
|||
return {};
|
||||
}
|
||||
|
||||
NonnullOwnPtrVector<WebAssemblyObject::CompiledWebAssemblyModule> WebAssemblyObject::s_compiled_modules;
|
||||
NonnullOwnPtrVector<Wasm::ModuleInstance> WebAssemblyObject::s_instantiated_modules;
|
||||
Vector<NonnullOwnPtr<WebAssemblyObject::CompiledWebAssemblyModule>> WebAssemblyObject::s_compiled_modules;
|
||||
Vector<NonnullOwnPtr<Wasm::ModuleInstance>> WebAssemblyObject::s_instantiated_modules;
|
||||
Vector<WebAssemblyObject::ModuleCache> WebAssemblyObject::s_module_caches;
|
||||
WebAssemblyObject::GlobalModuleCache WebAssemblyObject::s_global_cache;
|
||||
Wasm::AbstractMachine WebAssemblyObject::s_abstract_machine;
|
||||
|
@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::validate)
|
|||
};
|
||||
|
||||
// 3 continued - our "compile" step is lazy with validation, explicitly do the validation.
|
||||
if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()].module).is_error())
|
||||
if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()]->module).is_error())
|
||||
return JS::Value(false);
|
||||
|
||||
// 4. Return true.
|
||||
|
@ -331,7 +331,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
|
|||
promise->reject(*result.release_error().value());
|
||||
return promise;
|
||||
}
|
||||
module = &WebAssemblyObject::s_compiled_modules.at(result.release_value()).module;
|
||||
module = &WebAssemblyObject::s_compiled_modules.at(result.release_value())->module;
|
||||
should_return_module = true;
|
||||
} else if (is<WebAssemblyModuleObject>(buffer)) {
|
||||
module = &static_cast<WebAssemblyModuleObject*>(buffer)->module();
|
||||
|
|
|
@ -54,8 +54,8 @@ public:
|
|||
HashMap<Wasm::FunctionAddress, JS::NativeFunction*> function_instances;
|
||||
};
|
||||
|
||||
static NonnullOwnPtrVector<CompiledWebAssemblyModule> s_compiled_modules;
|
||||
static NonnullOwnPtrVector<Wasm::ModuleInstance> s_instantiated_modules;
|
||||
static Vector<NonnullOwnPtr<CompiledWebAssemblyModule>> s_compiled_modules;
|
||||
static Vector<NonnullOwnPtr<Wasm::ModuleInstance>> s_instantiated_modules;
|
||||
static Vector<ModuleCache> s_module_caches;
|
||||
static GlobalModuleCache s_global_cache;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ bool Node::operator==(Node const& other) const
|
|||
if (element.children.size() != other_element->children.size())
|
||||
return false;
|
||||
for (size_t i = 0; i < element.children.size(); ++i) {
|
||||
if (element.children[i] != other_element->children[i])
|
||||
if (element.children[i].ptr() != other_element->children[i].ptr())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -30,7 +30,7 @@ struct Node {
|
|||
struct Element {
|
||||
Name name;
|
||||
HashMap<Name, DeprecatedString> attributes;
|
||||
NonnullOwnPtrVector<Node> children;
|
||||
Vector<NonnullOwnPtr<Node>> children;
|
||||
};
|
||||
|
||||
bool operator==(Node const&) const;
|
||||
|
|
|
@ -95,7 +95,7 @@ void Parser::append_text(StringView text)
|
|||
m_entered_node->content.visit(
|
||||
[&](Node::Element& node) {
|
||||
if (!node.children.is_empty()) {
|
||||
auto* text_node = node.children.last().content.get_pointer<Node::Text>();
|
||||
auto* text_node = node.children.last()->content.get_pointer<Node::Text>();
|
||||
if (text_node) {
|
||||
text_node->builder.append(text);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue