2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2022-03-04 19:16:57 +03:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2022-02-10 22:28:48 +03:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2020-01-02 16:55:19 +03:00
|
|
|
#include "InspectorWidget.h"
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/BoxLayout.h>
|
2023-11-24 03:50:16 +03:00
|
|
|
#include <LibWebView/InspectorClient.h>
|
2022-04-30 11:46:33 +03:00
|
|
|
#include <LibWebView/OutOfProcessWebView.h>
|
2020-01-02 16:55:19 +03:00
|
|
|
|
2020-05-08 22:38:30 +03:00
|
|
|
namespace Browser {
|
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
NonnullRefPtr<InspectorWidget> InspectorWidget::create(WebView::OutOfProcessWebView& content_view)
|
2021-08-27 19:40:25 +03:00
|
|
|
{
|
2023-11-24 03:50:16 +03:00
|
|
|
return adopt_ref(*new (nothrow) InspectorWidget(content_view));
|
2021-08-17 19:00:27 +03:00
|
|
|
}
|
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
InspectorWidget::InspectorWidget(WebView::OutOfProcessWebView& content_view)
|
2020-01-02 16:55:19 +03:00
|
|
|
{
|
2023-11-24 03:50:16 +03:00
|
|
|
set_layout<GUI::VerticalBoxLayout>(4);
|
2021-09-13 18:17:43 +03:00
|
|
|
set_fill_with_background_color(true);
|
|
|
|
|
2023-11-28 00:18:32 +03:00
|
|
|
m_inspector_view = add<WebView::OutOfProcessWebView>();
|
2023-11-24 03:50:16 +03:00
|
|
|
m_inspector_client = make<WebView::InspectorClient>(content_view, *m_inspector_view);
|
2020-06-12 23:30:11 +03:00
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
m_inspector_view->set_focus(true);
|
2020-01-02 16:55:19 +03:00
|
|
|
}
|
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
InspectorWidget::~InspectorWidget() = default;
|
2021-08-27 22:21:30 +03:00
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
void InspectorWidget::inspect()
|
2021-06-08 00:21:16 +03:00
|
|
|
{
|
2023-11-24 03:50:16 +03:00
|
|
|
m_inspector_client->inspect();
|
2021-06-08 00:21:16 +03:00
|
|
|
}
|
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
void InspectorWidget::reset()
|
2021-09-01 14:50:47 +03:00
|
|
|
{
|
2023-11-24 03:50:16 +03:00
|
|
|
m_inspector_client->reset();
|
2021-09-01 14:50:47 +03:00
|
|
|
}
|
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
void InspectorWidget::select_default_node()
|
2021-09-02 14:05:32 +03:00
|
|
|
{
|
2023-11-24 03:50:16 +03:00
|
|
|
m_inspector_client->select_default_node();
|
|
|
|
}
|
2021-09-02 14:05:32 +03:00
|
|
|
|
2023-11-24 03:50:16 +03:00
|
|
|
void InspectorWidget::select_hovered_node()
|
|
|
|
{
|
|
|
|
m_inspector_client->select_hovered_node();
|
2021-08-27 19:40:25 +03:00
|
|
|
}
|
|
|
|
|
2020-05-08 22:38:30 +03:00
|
|
|
}
|