diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-12-21 16:25:55 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-01-27 08:07:24 -0500 |
commit | 22b0089783353a73a60b55936b8edbd1779e5792 (patch) | |
tree | dc2ce71587c524ecbea39f2c94ead3b573adc40b | |
parent | 0716b2afdc5f871c480c3e143d0b0c3db16f8c95 (diff) | |
download | serenity-22b0089783353a73a60b55936b8edbd1779e5792.zip |
Browser: Replace uses of JsonObject::get_deprecated()/get_ptr()
-rw-r--r-- | Userland/Applications/Browser/BrowserWindow.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/Browser/InspectorWidget.cpp | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 26acac1a76..2f149c8aeb 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -506,8 +506,8 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu) if (!json_item.is_object()) continue; auto search_engine = json_item.as_object(); - auto name = search_engine.get_deprecated("title"sv).to_deprecated_string(); - auto url_format = search_engine.get_deprecated("url_format"sv).to_deprecated_string(); + auto name = search_engine.get_deprecated_string("title"sv).value(); + auto url_format = search_engine.get_deprecated_string("url_format"sv).value(); auto action = GUI::Action::create_checkable( name, [&, url_format](auto&) { diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index a5876be19a..8e8ad57ee1 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -52,10 +52,10 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index) Selection selection {}; if (json->has_u32("pseudo-element"sv)) { - selection.dom_node_id = json->get_deprecated("parent-id"sv).to_i32(); - selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get_deprecated("pseudo-element"sv).to_u32()); + selection.dom_node_id = json->get_i32("parent-id"sv).value_or(0); + selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get_u32("pseudo-element"sv).value_or(0)); } else { - selection.dom_node_id = json->get_deprecated("id"sv).to_i32(); + selection.dom_node_id = json->get_i32("id"sv).value_or(0); } if (selection == m_selection) @@ -181,21 +181,21 @@ void InspectorWidget::update_node_box_model(StringView node_box_sizing_json) auto json_value = json_or_error.release_value(); auto const& json_object = json_value.as_object(); - m_node_box_sizing.margin.top = json_object.get_deprecated("margin_top"sv).to_float(); - m_node_box_sizing.margin.right = json_object.get_deprecated("margin_right"sv).to_float(); - m_node_box_sizing.margin.bottom = json_object.get_deprecated("margin_bottom"sv).to_float(); - m_node_box_sizing.margin.left = json_object.get_deprecated("margin_left"sv).to_float(); - m_node_box_sizing.padding.top = json_object.get_deprecated("padding_top"sv).to_float(); - m_node_box_sizing.padding.right = json_object.get_deprecated("padding_right"sv).to_float(); - m_node_box_sizing.padding.bottom = json_object.get_deprecated("padding_bottom"sv).to_float(); - m_node_box_sizing.padding.left = json_object.get_deprecated("padding_left"sv).to_float(); - m_node_box_sizing.border.top = json_object.get_deprecated("border_top"sv).to_float(); - m_node_box_sizing.border.right = json_object.get_deprecated("border_right"sv).to_float(); - m_node_box_sizing.border.bottom = json_object.get_deprecated("border_bottom"sv).to_float(); - m_node_box_sizing.border.left = json_object.get_deprecated("border_left"sv).to_float(); - - m_element_size_view->set_node_content_width(json_object.get_deprecated("content_width"sv).to_float()); - m_element_size_view->set_node_content_height(json_object.get_deprecated("content_height"sv).to_float()); + m_node_box_sizing.margin.top = json_object.get_float("margin_top"sv).value_or(0); + m_node_box_sizing.margin.right = json_object.get_float("margin_right"sv).value_or(0); + m_node_box_sizing.margin.bottom = json_object.get_float("margin_bottom"sv).value_or(0); + m_node_box_sizing.margin.left = json_object.get_float("margin_left"sv).value_or(0); + m_node_box_sizing.padding.top = json_object.get_float("padding_top"sv).value_or(0); + m_node_box_sizing.padding.right = json_object.get_float("padding_right"sv).value_or(0); + m_node_box_sizing.padding.bottom = json_object.get_float("padding_bottom"sv).value_or(0); + m_node_box_sizing.padding.left = json_object.get_float("padding_left"sv).value_or(0); + m_node_box_sizing.border.top = json_object.get_float("border_top"sv).value_or(0); + m_node_box_sizing.border.right = json_object.get_float("border_right"sv).value_or(0); + m_node_box_sizing.border.bottom = json_object.get_float("border_bottom"sv).value_or(0); + m_node_box_sizing.border.left = json_object.get_float("border_left"sv).value_or(0); + + m_element_size_view->set_node_content_width(json_object.get_float("content_width"sv).value_or(0)); + m_element_size_view->set_node_content_height(json_object.get_float("content_height"sv).value_or(0)); m_element_size_view->set_box_model(m_node_box_sizing); } |