forked from LadybirdBrowser/ancient-history
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebView.h
66 lines (50 loc) · 1.79 KB
/
WebView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright (c) 2022, Andreas Kling <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#define AK_DONT_REPLACE_STD
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <LibGfx/Forward.h>
#include <QAbstractScrollArea>
#include <QPointer>
class QTextEdit;
class QLineEdit;
class HeadlessBrowserPageClient;
class WebView final : public QAbstractScrollArea {
Q_OBJECT
public:
WebView();
virtual ~WebView() override;
void load(String const& url);
void reload();
virtual void paintEvent(QPaintEvent*) override;
virtual void resizeEvent(QResizeEvent*) override;
virtual void mouseMoveEvent(QMouseEvent*) override;
virtual void mousePressEvent(QMouseEvent*) override;
virtual void mouseReleaseEvent(QMouseEvent*) override;
virtual void keyPressEvent(QKeyEvent *event) override;
virtual void keyReleaseEvent(QKeyEvent *event) override;
void debug_request(String const& request, String const& argument);
String source() const;
void run_javascript(String const& js_source) const;
void did_output_js_console_message(i32 message_index);
void did_get_js_console_messages(i32 start_index, Vector<String> message_types, Vector<String> messages);
void show_js_console();
signals:
void linkHovered(QString, int timeout = 0);
void linkUnhovered();
void loadStarted(const URL&);
void title_changed(QString);
void favicon_changed(QIcon);
private:
Gfx::IntPoint to_content(Gfx::IntPoint) const;
OwnPtr<HeadlessBrowserPageClient> m_page_client;
qreal m_inverse_pixel_scaling_ratio { 1.0 };
bool m_should_show_line_box_borders { false };
QPointer<QWidget> m_js_console_widget;
QTextEdit* m_js_console_output_edit { nullptr };
QLineEdit* m_js_console_input_edit { nullptr };
};