mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
LibWeb: Add the Web::URL namespace and move URLEncoder to it
This namespace will be used for all interfaces defined in the URL specification, like URL and URLSearchParams. This has the unfortunate side-effect of requiring us to use the fully qualified AK::URL name whenever we want to refer to the AK class, so this commit also fixes all such references.
This commit is contained in:
parent
2b78e227f2
commit
4629f2e4ad
54 changed files with 236 additions and 225 deletions
|
@ -437,7 +437,7 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namespace_.is_one_of("CSS", "DOM", "HTML", "UIEvents", "HighResolutionTime", "NavigationTiming", "SVG", "XHR")) {
|
if (namespace_.is_one_of("CSS", "DOM", "HTML", "UIEvents", "HighResolutionTime", "NavigationTiming", "SVG", "XHR", "URL")) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(namespace_);
|
builder.append(namespace_);
|
||||||
builder.append("::");
|
builder.append("::");
|
||||||
|
@ -968,6 +968,8 @@ static void generate_header(IDL::Interface const& interface)
|
||||||
# include <LibWeb/SVG/@name@.h>
|
# include <LibWeb/SVG/@name@.h>
|
||||||
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
||||||
# include <LibWeb/XHR/@name@.h>
|
# include <LibWeb/XHR/@name@.h>
|
||||||
|
#elif __has_include(<LibWeb/URL/@name@.h>)
|
||||||
|
# include <LibWeb/URL/@name@.h>
|
||||||
#endif
|
#endif
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
|
@ -1235,6 +1237,8 @@ void generate_constructor_implementation(IDL::Interface const& interface)
|
||||||
# include <LibWeb/SVG/@name@.h>
|
# include <LibWeb/SVG/@name@.h>
|
||||||
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
||||||
# include <LibWeb/XHR/@name@.h>
|
# include <LibWeb/XHR/@name@.h>
|
||||||
|
#elif __has_include(<LibWeb/URL/@name@.h>)
|
||||||
|
# include <LibWeb/URL/@name@.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: This is a total hack until we can figure out the namespace for a given type somehow.
|
// FIXME: This is a total hack until we can figure out the namespace for a given type somehow.
|
||||||
|
@ -1504,6 +1508,8 @@ void generate_prototype_implementation(IDL::Interface const& interface)
|
||||||
# include <LibWeb/SVG/@name@.h>
|
# include <LibWeb/SVG/@name@.h>
|
||||||
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
#elif __has_include(<LibWeb/XHR/@name@.h>)
|
||||||
# include <LibWeb/XHR/@name@.h>
|
# include <LibWeb/XHR/@name@.h>
|
||||||
|
#elif __has_include(<LibWeb/URL/@name@.h>)
|
||||||
|
# include <LibWeb/URL/@name@.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: This is a total hack until we can figure out the namespace for a given type somehow.
|
// FIXME: This is a total hack until we can figure out the namespace for a given type somehow.
|
||||||
|
@ -1512,6 +1518,7 @@ using namespace Web::DOM;
|
||||||
using namespace Web::HTML;
|
using namespace Web::HTML;
|
||||||
using namespace Web::NavigationTiming;
|
using namespace Web::NavigationTiming;
|
||||||
using namespace Web::XHR;
|
using namespace Web::XHR;
|
||||||
|
using namespace Web::URL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ set(SOURCES
|
||||||
StylePropertiesModel.cpp
|
StylePropertiesModel.cpp
|
||||||
UIEvents/EventNames.cpp
|
UIEvents/EventNames.cpp
|
||||||
UIEvents/MouseEvent.cpp
|
UIEvents/MouseEvent.cpp
|
||||||
URLEncoder.cpp
|
URL/URL.cpp
|
||||||
WebAssembly/WebAssemblyInstanceConstructor.cpp
|
WebAssembly/WebAssemblyInstanceConstructor.cpp
|
||||||
WebAssembly/WebAssemblyInstanceObject.cpp
|
WebAssembly/WebAssemblyInstanceObject.cpp
|
||||||
WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
|
WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
CSSImportRule::CSSImportRule(URL url)
|
CSSImportRule::CSSImportRule(AK::URL url)
|
||||||
: m_url(move(url))
|
: m_url(move(url))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,14 @@ class CSSImportRule : public CSSRule {
|
||||||
AK_MAKE_NONMOVABLE(CSSImportRule);
|
AK_MAKE_NONMOVABLE(CSSImportRule);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<CSSImportRule> create(URL url)
|
static NonnullRefPtr<CSSImportRule> create(AK::URL url)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new CSSImportRule(move(url)));
|
return adopt_ref(*new CSSImportRule(move(url)));
|
||||||
}
|
}
|
||||||
|
|
||||||
~CSSImportRule();
|
~CSSImportRule();
|
||||||
|
|
||||||
const URL& url() const { return m_url; }
|
const AK::URL& url() const { return m_url; }
|
||||||
|
|
||||||
bool has_import_result() const { return !m_style_sheet.is_null(); }
|
bool has_import_result() const { return !m_style_sheet.is_null(); }
|
||||||
RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; }
|
RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; }
|
||||||
|
@ -34,9 +34,9 @@ public:
|
||||||
virtual Type type() const { return Type::Import; };
|
virtual Type type() const { return Type::Import; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit CSSImportRule(URL);
|
explicit CSSImportRule(AK::URL);
|
||||||
|
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
RefPtr<CSSStyleSheet> m_style_sheet;
|
RefPtr<CSSStyleSheet> m_style_sheet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ bool ParsingContext::in_quirks_mode() const
|
||||||
return m_document ? m_document->in_quirks_mode() : false;
|
return m_document ? m_document->in_quirks_mode() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
URL ParsingContext::complete_url(String const& addr) const
|
AK::URL ParsingContext::complete_url(String const& addr) const
|
||||||
{
|
{
|
||||||
return m_document ? m_document->url().complete_url(addr) : URL::create_with_url_or_path(addr);
|
return m_document ? m_document->url().complete_url(addr) : AK::URL::create_with_url_or_path(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -1159,7 +1159,7 @@ Vector<Vector<StyleComponentValueRule>> Parser::parse_a_comma_separated_list_of_
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<URL> Parser::parse_url_function(ParsingContext const& context, StyleComponentValueRule const& component_value)
|
Optional<AK::URL> Parser::parse_url_function(ParsingContext const& context, StyleComponentValueRule const& component_value)
|
||||||
{
|
{
|
||||||
// FIXME: Handle list of media queries. https://www.w3.org/TR/css-cascade-3/#conditional-import
|
// FIXME: Handle list of media queries. https://www.w3.org/TR/css-cascade-3/#conditional-import
|
||||||
// FIXME: Handle data: urls (RFC2397)
|
// FIXME: Handle data: urls (RFC2397)
|
||||||
|
@ -1201,7 +1201,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
|
||||||
return {};
|
return {};
|
||||||
} else if (rule->m_name.equals_ignoring_case("import"sv) && !rule->prelude().is_empty()) {
|
} else if (rule->m_name.equals_ignoring_case("import"sv) && !rule->prelude().is_empty()) {
|
||||||
|
|
||||||
Optional<URL> url;
|
Optional<AK::URL> url;
|
||||||
for (auto& token : rule->prelude()) {
|
for (auto& token : rule->prelude()) {
|
||||||
if (token.is(Token::Type::Whitespace))
|
if (token.is(Token::Type::Whitespace))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
bool in_quirks_mode() const;
|
bool in_quirks_mode() const;
|
||||||
DOM::Document* document() const { return m_document; }
|
DOM::Document* document() const { return m_document; }
|
||||||
URL complete_url(String const&) const;
|
AK::URL complete_url(String const&) const;
|
||||||
|
|
||||||
PropertyID current_property_id() const { return m_current_property_id; }
|
PropertyID current_property_id() const { return m_current_property_id; }
|
||||||
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
||||||
|
@ -172,7 +172,7 @@ private:
|
||||||
static Optional<float> try_parse_float(StringView string);
|
static Optional<float> try_parse_float(StringView string);
|
||||||
static Optional<Color> parse_color(ParsingContext const&, StyleComponentValueRule const&);
|
static Optional<Color> parse_color(ParsingContext const&, StyleComponentValueRule const&);
|
||||||
static Optional<Length> parse_length(ParsingContext const&, StyleComponentValueRule const&);
|
static Optional<Length> parse_length(ParsingContext const&, StyleComponentValueRule const&);
|
||||||
static Optional<URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
|
static Optional<AK::URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
|
||||||
|
|
||||||
Result<NonnullRefPtr<StyleValue>, ParsingResult> parse_css_value(PropertyID, TokenStream<StyleComponentValueRule>&);
|
Result<NonnullRefPtr<StyleValue>, ParsingResult> parse_css_value(PropertyID, TokenStream<StyleComponentValueRule>&);
|
||||||
static RefPtr<StyleValue> parse_css_value(ParsingContext const&, StyleComponentValueRule const&);
|
static RefPtr<StyleValue> parse_css_value(ParsingContext const&, StyleComponentValueRule const&);
|
||||||
|
|
|
@ -152,7 +152,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageStyleValue::ImageStyleValue(const URL& url, DOM::Document& document)
|
ImageStyleValue::ImageStyleValue(const AK::URL& url, DOM::Document& document)
|
||||||
: StyleValue(Type::Image)
|
: StyleValue(Type::Image)
|
||||||
, m_url(url)
|
, m_url(url)
|
||||||
, m_document(document)
|
, m_document(document)
|
||||||
|
|
|
@ -651,7 +651,7 @@ class ImageStyleValue final
|
||||||
: public StyleValue
|
: public StyleValue
|
||||||
, public ImageResourceClient {
|
, public ImageResourceClient {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<ImageStyleValue> create(const URL& url, DOM::Document& document) { return adopt_ref(*new ImageStyleValue(url, document)); }
|
static NonnullRefPtr<ImageStyleValue> create(const AK::URL& url, DOM::Document& document) { return adopt_ref(*new ImageStyleValue(url, document)); }
|
||||||
virtual ~ImageStyleValue() override { }
|
virtual ~ImageStyleValue() override { }
|
||||||
|
|
||||||
String to_string() const override { return String::formatted("Image({})", m_url.to_string()); }
|
String to_string() const override { return String::formatted("Image({})", m_url.to_string()); }
|
||||||
|
@ -659,12 +659,12 @@ public:
|
||||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ImageStyleValue(const URL&, DOM::Document&);
|
ImageStyleValue(const AK::URL&, DOM::Document&);
|
||||||
|
|
||||||
// ^ResourceClient
|
// ^ResourceClient
|
||||||
virtual void resource_did_load() override;
|
virtual void resource_did_load() override;
|
||||||
|
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
WeakPtr<DOM::Document> m_document;
|
WeakPtr<DOM::Document> m_document;
|
||||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
|
||||||
Document::Document(const URL& url)
|
Document::Document(const AK::URL& url)
|
||||||
: ParentNode(*this, NodeType::DOCUMENT_NODE)
|
: ParentNode(*this, NodeType::DOCUMENT_NODE)
|
||||||
, m_style_resolver(make<CSS::StyleResolver>(*this))
|
, m_style_resolver(make<CSS::StyleResolver>(*this))
|
||||||
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
||||||
|
@ -383,7 +383,7 @@ CSS::Repeat Document::background_repeat_y() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
|
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
|
||||||
URL Document::parse_url(String const& url) const
|
AK::URL Document::parse_url(String const& url) const
|
||||||
{
|
{
|
||||||
// FIXME: Make sure we do this according to spec.
|
// FIXME: Make sure we do this according to spec.
|
||||||
return m_url.complete_url(url);
|
return m_url.complete_url(url);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Document
|
||||||
public:
|
public:
|
||||||
using WrapperType = Bindings::DocumentWrapper;
|
using WrapperType = Bindings::DocumentWrapper;
|
||||||
|
|
||||||
static NonnullRefPtr<Document> create(const URL& url = "about:blank")
|
static NonnullRefPtr<Document> create(const AK::URL& url = "about:blank")
|
||||||
{
|
{
|
||||||
return adopt_ref(*new Document(url));
|
return adopt_ref(*new Document(url));
|
||||||
}
|
}
|
||||||
|
@ -64,15 +64,15 @@ public:
|
||||||
bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
|
bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
|
||||||
void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
|
void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
|
||||||
|
|
||||||
void set_url(const URL& url) { m_url = url; }
|
void set_url(const AK::URL& url) { m_url = url; }
|
||||||
URL url() const { return m_url; }
|
AK::URL url() const { return m_url; }
|
||||||
|
|
||||||
Origin origin() const;
|
Origin origin() const;
|
||||||
void set_origin(const Origin& origin);
|
void set_origin(const Origin& origin);
|
||||||
|
|
||||||
bool is_scripting_enabled() const { return true; }
|
bool is_scripting_enabled() const { return true; }
|
||||||
|
|
||||||
URL parse_url(String const&) const;
|
AK::URL parse_url(String const&) const;
|
||||||
|
|
||||||
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
|
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
|
||||||
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
|
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
|
||||||
|
@ -282,7 +282,7 @@ public:
|
||||||
Bindings::LocationObject* location();
|
Bindings::LocationObject* location();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Document(const URL&);
|
explicit Document(const AK::URL&);
|
||||||
|
|
||||||
// ^DOM::Node
|
// ^DOM::Node
|
||||||
virtual RefPtr<Layout::Node> create_layout_node() override;
|
virtual RefPtr<Layout::Node> create_layout_node() override;
|
||||||
|
@ -316,7 +316,7 @@ private:
|
||||||
RefPtr<Node> m_hovered_node;
|
RefPtr<Node> m_hovered_node;
|
||||||
RefPtr<Node> m_inspected_node;
|
RefPtr<Node> m_inspected_node;
|
||||||
WeakPtr<BrowsingContext> m_browsing_context;
|
WeakPtr<BrowsingContext> m_browsing_context;
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
|
|
||||||
RefPtr<Window> m_window;
|
RefPtr<Window> m_window;
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ void Window::cancel_animation_frame(i32 id)
|
||||||
GUI::DisplayLink::unregister_callback(id);
|
GUI::DisplayLink::unregister_callback(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href)
|
void Window::did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href)
|
||||||
{
|
{
|
||||||
auto* frame = associated_document().browsing_context();
|
auto* frame = associated_document().browsing_context();
|
||||||
if (!frame)
|
if (!frame)
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
int inner_width() const;
|
int inner_width() const;
|
||||||
int inner_height() const;
|
int inner_height() const;
|
||||||
|
|
||||||
void did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href);
|
void did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href);
|
||||||
void did_call_location_reload(Badge<Bindings::LocationObject>);
|
void did_call_location_reload(Badge<Bindings::LocationObject>);
|
||||||
|
|
||||||
Bindings::WindowObject* wrapper() { return m_wrapper; }
|
Bindings::WindowObject* wrapper() { return m_wrapper; }
|
||||||
|
|
|
@ -205,6 +205,9 @@ class XMLHttpRequest;
|
||||||
class XMLHttpRequestEventTarget;
|
class XMLHttpRequestEventTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Web::URL {
|
||||||
|
}
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
class AbortControllerWrapper;
|
class AbortControllerWrapper;
|
||||||
class AbortSignalWrapper;
|
class AbortSignalWrapper;
|
||||||
|
|
|
@ -92,7 +92,7 @@ String HTMLCanvasElement::to_data_url(const String& type, [[maybe_unused]] Optio
|
||||||
if (type != "image/png")
|
if (type != "image/png")
|
||||||
return {};
|
return {};
|
||||||
auto encoded_bitmap = Gfx::PNGWriter::encode(*m_bitmap);
|
auto encoded_bitmap = Gfx::PNGWriter::encode(*m_bitmap);
|
||||||
return URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_string();
|
return AK::URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <LibWeb/HTML/SubmitEvent.h>
|
#include <LibWeb/HTML/SubmitEvent.h>
|
||||||
#include <LibWeb/Page/BrowsingContext.h>
|
#include <LibWeb/Page/BrowsingContext.h>
|
||||||
#include <LibWeb/Page/Page.h>
|
#include <LibWeb/Page/Page.h>
|
||||||
#include <LibWeb/URLEncoder.h>
|
#include <LibWeb/URL/URL.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
URL url(document().parse_url(action()));
|
AK::URL url(document().parse_url(action()));
|
||||||
|
|
||||||
if (!url.is_valid()) {
|
if (!url.is_valid()) {
|
||||||
dbgln("Failed to submit form: Invalid URL: {}", action());
|
dbgln("Failed to submit form: Invalid URL: {}", action());
|
||||||
|
@ -96,7 +96,7 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<URLQueryParam> parameters;
|
Vector<URL::QueryParam> parameters;
|
||||||
|
|
||||||
for_each_in_inclusive_subtree_of_type<HTMLInputElement>([&](auto& input) {
|
for_each_in_inclusive_subtree_of_type<HTMLInputElement>([&](auto& input) {
|
||||||
if (!input.name().is_null() && (input.type() != "submit" || &input == submitter))
|
if (!input.name().is_null() && (input.type() != "submit" || &input == submitter))
|
||||||
|
@ -105,14 +105,14 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
|
||||||
});
|
});
|
||||||
|
|
||||||
if (effective_method == "get") {
|
if (effective_method == "get") {
|
||||||
url.set_query(urlencode(parameters, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded));
|
url.set_query(url_encode(parameters, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest request;
|
LoadRequest request;
|
||||||
request.set_url(url);
|
request.set_url(url);
|
||||||
|
|
||||||
if (effective_method == "post") {
|
if (effective_method == "post") {
|
||||||
auto body = urlencode(parameters, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded).to_byte_buffer();
|
auto body = url_encode(parameters, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded).to_byte_buffer();
|
||||||
request.set_method("POST");
|
request.set_method("POST");
|
||||||
request.set_header("Content-Type", "application/x-www-form-urlencoded");
|
request.set_header("Content-Type", "application/x-www-form-urlencoded");
|
||||||
request.set_header("Content-Length", String::number(body.size()));
|
request.set_header("Content-Length", String::number(body.size()));
|
||||||
|
|
|
@ -304,7 +304,7 @@ void HTMLScriptElement::prepare_script()
|
||||||
document().interpreter();
|
document().interpreter();
|
||||||
|
|
||||||
// FIXME: This is all ad-hoc and needs work.
|
// FIXME: This is all ad-hoc and needs work.
|
||||||
auto script = ClassicScript::create(url.to_string(), data, document().interpreter().realm(), URL());
|
auto script = ClassicScript::create(url.to_string(), data, document().interpreter().realm(), AK::URL());
|
||||||
|
|
||||||
// When the chosen algorithm asynchronously completes, set the script's script to the result. At that time, the script is ready.
|
// When the chosen algorithm asynchronously completes, set the script's script to the result. At that time, the script is ready.
|
||||||
m_script = script;
|
m_script = script;
|
||||||
|
@ -331,7 +331,7 @@ void HTMLScriptElement::prepare_script()
|
||||||
document().interpreter();
|
document().interpreter();
|
||||||
|
|
||||||
// FIXME: Pass settings, base URL and options.
|
// FIXME: Pass settings, base URL and options.
|
||||||
auto script = ClassicScript::create(m_document->url().to_string(), source_text, document().interpreter().realm(), URL());
|
auto script = ClassicScript::create(m_document->url().to_string(), source_text, document().interpreter().realm(), AK::URL());
|
||||||
|
|
||||||
// 2. Set the script's script to script.
|
// 2. Set the script's script to script.
|
||||||
m_script = script;
|
m_script = script;
|
||||||
|
|
|
@ -93,7 +93,7 @@ static Vector<FlyString> s_quirks_public_ids = {
|
||||||
"-//WebTechs//DTD Mozilla HTML//"
|
"-//WebTechs//DTD Mozilla HTML//"
|
||||||
};
|
};
|
||||||
|
|
||||||
RefPtr<DOM::Document> parse_html_document(const StringView& data, const URL& url, const String& encoding)
|
RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& url, const String& encoding)
|
||||||
{
|
{
|
||||||
auto document = DOM::Document::create(url);
|
auto document = DOM::Document::create(url);
|
||||||
HTMLDocumentParser parser(document, data, encoding);
|
HTMLDocumentParser parser(document, data, encoding);
|
||||||
|
@ -116,7 +116,7 @@ HTMLDocumentParser::~HTMLDocumentParser()
|
||||||
m_document->set_should_invalidate_styles_on_attribute_changes(true);
|
m_document->set_should_invalidate_styles_on_attribute_changes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLDocumentParser::run(const URL& url)
|
void HTMLDocumentParser::run(const AK::URL& url)
|
||||||
{
|
{
|
||||||
m_document->set_url(url);
|
m_document->set_url(url);
|
||||||
m_document->set_source(m_tokenizer.source());
|
m_document->set_source(m_tokenizer.source());
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Web::HTML {
|
||||||
__ENUMERATE_INSERTION_MODE(AfterAfterBody) \
|
__ENUMERATE_INSERTION_MODE(AfterAfterBody) \
|
||||||
__ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
|
__ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
|
||||||
|
|
||||||
RefPtr<DOM::Document> parse_html_document(const StringView&, const URL&, const String& encoding);
|
RefPtr<DOM::Document> parse_html_document(const StringView&, const AK::URL&, const String& encoding);
|
||||||
|
|
||||||
class HTMLDocumentParser {
|
class HTMLDocumentParser {
|
||||||
public:
|
public:
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
|
|
||||||
static NonnullOwnPtr<HTMLDocumentParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input);
|
static NonnullOwnPtr<HTMLDocumentParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input);
|
||||||
|
|
||||||
void run(const URL&);
|
void run(const AK::URL&);
|
||||||
|
|
||||||
DOM::Document& document();
|
DOM::Document& document();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
|
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
|
||||||
NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView source, JS::Realm& realm, URL base_url, MutedErrors muted_errors)
|
NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView source, JS::Realm& realm, AK::URL base_url, MutedErrors muted_errors)
|
||||||
{
|
{
|
||||||
// 1. If muted errors was not provided, let it be false. (NOTE: This is taken care of by the default argument.)
|
// 1. If muted errors was not provided, let it be false. (NOTE: This is taken care of by the default argument.)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ JS::Value ClassicScript::run(RethrowErrors rethrow_errors)
|
||||||
return vm.last_value();
|
return vm.last_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassicScript::ClassicScript(URL base_url, String filename)
|
ClassicScript::ClassicScript(AK::URL base_url, String filename)
|
||||||
: Script(move(base_url), move(filename))
|
: Script(move(base_url), move(filename))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
static NonnullRefPtr<ClassicScript> create(String filename, StringView source, JS::Realm&, URL base_url, MutedErrors = MutedErrors::No);
|
static NonnullRefPtr<ClassicScript> create(String filename, StringView source, JS::Realm&, AK::URL base_url, MutedErrors = MutedErrors::No);
|
||||||
|
|
||||||
JS::Script* script_record() { return m_script_record; }
|
JS::Script* script_record() { return m_script_record; }
|
||||||
JS::Script const* script_record() const { return m_script_record; }
|
JS::Script const* script_record() const { return m_script_record; }
|
||||||
|
@ -32,7 +32,7 @@ public:
|
||||||
JS::Value run(RethrowErrors = RethrowErrors::No);
|
JS::Value run(RethrowErrors = RethrowErrors::No);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ClassicScript(URL base_url, String filename);
|
ClassicScript(AK::URL base_url, String filename);
|
||||||
|
|
||||||
RefPtr<JS::Script> m_script_record;
|
RefPtr<JS::Script> m_script_record;
|
||||||
MutedErrors m_muted_errors { MutedErrors::No };
|
MutedErrors m_muted_errors { MutedErrors::No };
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
Script::Script(URL base_url, String filename)
|
Script::Script(AK::URL base_url, String filename)
|
||||||
: m_base_url(move(base_url))
|
: m_base_url(move(base_url))
|
||||||
, m_filename(move(filename))
|
, m_filename(move(filename))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,14 +16,14 @@ class Script : public RefCounted<Script> {
|
||||||
public:
|
public:
|
||||||
virtual ~Script();
|
virtual ~Script();
|
||||||
|
|
||||||
URL const& base_url() const { return m_base_url; }
|
AK::URL const& base_url() const { return m_base_url; }
|
||||||
String const& filename() const { return m_filename; }
|
String const& filename() const { return m_filename; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Script(URL base_url, String filename);
|
Script(AK::URL base_url, String filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
URL m_base_url;
|
AK::URL m_base_url;
|
||||||
String m_filename;
|
String m_filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ WebSocketClientManager::WebSocketClientManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const URL& url)
|
RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const AK::URL& url)
|
||||||
{
|
{
|
||||||
return m_websocket_client->connect(url);
|
return m_websocket_client->connect(url);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const URL& url)
|
||||||
// https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface
|
// https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface
|
||||||
DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(Bindings::WindowObject& window, const String& url)
|
DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(Bindings::WindowObject& window, const String& url)
|
||||||
{
|
{
|
||||||
URL url_record(url);
|
AK::URL url_record(url);
|
||||||
if (!url_record.is_valid())
|
if (!url_record.is_valid())
|
||||||
return DOM::SyntaxError::create("Invalid URL");
|
return DOM::SyntaxError::create("Invalid URL");
|
||||||
if (!url_record.protocol().is_one_of("ws", "wss"))
|
if (!url_record.protocol().is_one_of("ws", "wss"))
|
||||||
|
@ -61,7 +61,7 @@ DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(
|
||||||
return WebSocket::create(window.impl(), url_record);
|
return WebSocket::create(window.impl(), url_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocket::WebSocket(DOM::Window& window, URL& url)
|
WebSocket::WebSocket(DOM::Window& window, AK::URL& url)
|
||||||
: EventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.associated_document()))
|
: EventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.associated_document()))
|
||||||
, m_window(window)
|
, m_window(window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ class WebSocketClientManager : public Core::Object {
|
||||||
public:
|
public:
|
||||||
static WebSocketClientManager& the();
|
static WebSocketClientManager& the();
|
||||||
|
|
||||||
RefPtr<Protocol::WebSocket> connect(const URL&);
|
RefPtr<Protocol::WebSocket> connect(const AK::URL&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebSocketClientManager();
|
WebSocketClientManager();
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
using WrapperType = Bindings::WebSocketWrapper;
|
using WrapperType = Bindings::WebSocketWrapper;
|
||||||
|
|
||||||
static NonnullRefPtr<WebSocket> create(DOM::Window& window, URL& url)
|
static NonnullRefPtr<WebSocket> create(DOM::Window& window, AK::URL& url)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new WebSocket(window, url));
|
return adopt_ref(*new WebSocket(window, url));
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,11 @@ private:
|
||||||
void on_error();
|
void on_error();
|
||||||
void on_close(u16 code, String reason, bool was_clean);
|
void on_close(u16 code, String reason, bool was_clean);
|
||||||
|
|
||||||
explicit WebSocket(DOM::Window&, URL&);
|
explicit WebSocket(DOM::Window&, AK::URL&);
|
||||||
|
|
||||||
NonnullRefPtr<DOM::Window> m_window;
|
NonnullRefPtr<DOM::Window> m_window;
|
||||||
|
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
String m_binary_type { "blob" };
|
String m_binary_type { "blob" };
|
||||||
RefPtr<Protocol::WebSocket> m_websocket;
|
RefPtr<Protocol::WebSocket> m_websocket;
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,13 +72,13 @@ void InProcessWebView::page_did_set_document_in_top_level_browsing_context(DOM::
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_start_loading(const URL& url)
|
void InProcessWebView::page_did_start_loading(const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_load_start)
|
if (on_load_start)
|
||||||
on_load_start(url);
|
on_load_start(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_finish_loading(const URL& url)
|
void InProcessWebView::page_did_finish_loading(const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_load_finish)
|
if (on_load_finish)
|
||||||
on_load_finish(url);
|
on_load_finish(url);
|
||||||
|
@ -100,13 +100,13 @@ void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& conten
|
||||||
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
|
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
|
void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
|
||||||
{
|
{
|
||||||
if (on_link_context_menu_request)
|
if (on_link_context_menu_request)
|
||||||
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
|
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap)
|
void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap)
|
||||||
{
|
{
|
||||||
if (!on_image_context_menu_request)
|
if (!on_image_context_menu_request)
|
||||||
return;
|
return;
|
||||||
|
@ -116,13 +116,13 @@ void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint&
|
||||||
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), shareable_bitmap);
|
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), shareable_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_click_link(const URL& url, const String& target, unsigned modifiers)
|
void InProcessWebView::page_did_click_link(const AK::URL& url, const String& target, unsigned modifiers)
|
||||||
{
|
{
|
||||||
if (on_link_click)
|
if (on_link_click)
|
||||||
on_link_click(url, target, modifiers);
|
on_link_click(url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_middle_click_link(const URL& url, const String& target, unsigned modifiers)
|
void InProcessWebView::page_did_middle_click_link(const AK::URL& url, const String& target, unsigned modifiers)
|
||||||
{
|
{
|
||||||
if (on_link_middle_click)
|
if (on_link_middle_click)
|
||||||
on_link_middle_click(url, target, modifiers);
|
on_link_middle_click(url, target, modifiers);
|
||||||
|
@ -138,7 +138,7 @@ void InProcessWebView::page_did_leave_tooltip_area()
|
||||||
GUI::Application::the()->hide_tooltip();
|
GUI::Application::the()->hide_tooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_hover_link(const URL& url)
|
void InProcessWebView::page_did_hover_link(const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_link_hover)
|
if (on_link_hover)
|
||||||
on_link_hover(url);
|
on_link_hover(url);
|
||||||
|
@ -276,7 +276,7 @@ void InProcessWebView::keydown_event(GUI::KeyEvent& event)
|
||||||
event.accept();
|
event.accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
URL InProcessWebView::url() const
|
AK::URL InProcessWebView::url() const
|
||||||
{
|
{
|
||||||
if (!page().top_level_browsing_context().active_document())
|
if (!page().top_level_browsing_context().active_document())
|
||||||
return {};
|
return {};
|
||||||
|
@ -288,12 +288,12 @@ void InProcessWebView::reload()
|
||||||
load(url());
|
load(url());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::load_html(const StringView& html, const URL& url)
|
void InProcessWebView::load_html(const StringView& html, const AK::URL& url)
|
||||||
{
|
{
|
||||||
page().top_level_browsing_context().loader().load_html(html, url);
|
page().top_level_browsing_context().loader().load_html(html, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InProcessWebView::load(const URL& url)
|
bool InProcessWebView::load(const AK::URL& url)
|
||||||
{
|
{
|
||||||
set_override_cursor(Gfx::StandardCursor::None);
|
set_override_cursor(Gfx::StandardCursor::None);
|
||||||
return page().top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
|
return page().top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
|
||||||
|
@ -372,14 +372,14 @@ String InProcessWebView::page_did_request_prompt(const String& message, const St
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
String InProcessWebView::page_did_request_cookie(const URL& url, Cookie::Source source)
|
String InProcessWebView::page_did_request_cookie(const AK::URL& url, Cookie::Source source)
|
||||||
{
|
{
|
||||||
if (on_get_cookie)
|
if (on_get_cookie)
|
||||||
return on_get_cookie(url, source);
|
return on_get_cookie(url, source);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWebView::page_did_set_cookie(const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
|
void InProcessWebView::page_did_set_cookie(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
|
||||||
{
|
{
|
||||||
if (on_set_cookie)
|
if (on_set_cookie)
|
||||||
on_set_cookie(url, cookie, source);
|
on_set_cookie(url, cookie, source);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class InProcessWebView final
|
||||||
public:
|
public:
|
||||||
virtual ~InProcessWebView() override;
|
virtual ~InProcessWebView() override;
|
||||||
|
|
||||||
void load_html(const StringView&, const URL&);
|
void load_html(const StringView&, const AK::URL&);
|
||||||
void load_empty_document();
|
void load_empty_document();
|
||||||
|
|
||||||
DOM::Document* document();
|
DOM::Document* document();
|
||||||
|
@ -36,9 +36,9 @@ public:
|
||||||
Layout::InitialContainingBlock* layout_root();
|
Layout::InitialContainingBlock* layout_root();
|
||||||
|
|
||||||
void reload();
|
void reload();
|
||||||
bool load(const URL&);
|
bool load(const AK::URL&);
|
||||||
|
|
||||||
URL url() const;
|
AK::URL url() const;
|
||||||
|
|
||||||
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
||||||
|
|
||||||
|
@ -67,18 +67,18 @@ private:
|
||||||
virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); }
|
virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); }
|
||||||
virtual void page_did_change_title(const String&) override;
|
virtual void page_did_change_title(const String&) override;
|
||||||
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) override;
|
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) override;
|
||||||
virtual void page_did_start_loading(const URL&) override;
|
virtual void page_did_start_loading(const AK::URL&) override;
|
||||||
virtual void page_did_finish_loading(const URL&) override;
|
virtual void page_did_finish_loading(const AK::URL&) override;
|
||||||
virtual void page_did_change_selection() override;
|
virtual void page_did_change_selection() override;
|
||||||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
|
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
|
||||||
virtual void page_did_request_context_menu(const Gfx::IntPoint&) override;
|
virtual void page_did_request_context_menu(const Gfx::IntPoint&) override;
|
||||||
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers) override;
|
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers) override;
|
||||||
virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override;
|
virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override;
|
||||||
virtual void page_did_click_link(const URL&, const String& target, unsigned modifiers) override;
|
virtual void page_did_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
|
||||||
virtual void page_did_middle_click_link(const URL&, const String& target, unsigned modifiers) override;
|
virtual void page_did_middle_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
|
||||||
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override;
|
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override;
|
||||||
virtual void page_did_leave_tooltip_area() override;
|
virtual void page_did_leave_tooltip_area() override;
|
||||||
virtual void page_did_hover_link(const URL&) override;
|
virtual void page_did_hover_link(const AK::URL&) override;
|
||||||
virtual void page_did_unhover_link() override;
|
virtual void page_did_unhover_link() override;
|
||||||
virtual void page_did_invalidate(const Gfx::IntRect&) override;
|
virtual void page_did_invalidate(const Gfx::IntRect&) override;
|
||||||
virtual void page_did_change_favicon(const Gfx::Bitmap&) override;
|
virtual void page_did_change_favicon(const Gfx::Bitmap&) override;
|
||||||
|
@ -87,8 +87,8 @@ private:
|
||||||
virtual void page_did_request_alert(const String&) override;
|
virtual void page_did_request_alert(const String&) override;
|
||||||
virtual bool page_did_request_confirm(const String&) override;
|
virtual bool page_did_request_confirm(const String&) override;
|
||||||
virtual String page_did_request_prompt(const String&, const String&) override;
|
virtual String page_did_request_prompt(const String&, const String&) override;
|
||||||
virtual String page_did_request_cookie(const URL&, Cookie::Source) override;
|
virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) override;
|
||||||
virtual void page_did_set_cookie(const URL&, const Cookie::ParsedCookie&, Cookie::Source) override;
|
virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) override;
|
||||||
|
|
||||||
void layout_and_sync_size();
|
void layout_and_sync_size();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void CSSLoader::load_from_text(const String& text)
|
||||||
load_next_import_if_needed();
|
load_next_import_if_needed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSSLoader::load_from_url(const URL& url)
|
void CSSLoader::load_from_url(const AK::URL& url)
|
||||||
{
|
{
|
||||||
m_style_sheet = CSS::CSSStyleSheet::create({});
|
m_style_sheet = CSS::CSSStyleSheet::create({});
|
||||||
m_style_sheet->set_owner_node(&m_owner_element);
|
m_style_sheet->set_owner_node(&m_owner_element);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
explicit CSSLoader(DOM::Element& owner_element);
|
explicit CSSLoader(DOM::Element& owner_element);
|
||||||
|
|
||||||
void load_from_text(const String&);
|
void load_from_text(const String&);
|
||||||
void load_from_url(const URL&);
|
void load_from_url(const AK::URL&);
|
||||||
|
|
||||||
void load_next_import_if_needed();
|
void load_next_import_if_needed();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ ContentFilter::~ContentFilter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentFilter::is_filtered(const URL& url) const
|
bool ContentFilter::is_filtered(const AK::URL& url) const
|
||||||
{
|
{
|
||||||
auto url_string = url.to_string();
|
auto url_string = url.to_string();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ContentFilter {
|
||||||
public:
|
public:
|
||||||
static ContentFilter& the();
|
static ContentFilter& the();
|
||||||
|
|
||||||
bool is_filtered(const URL&) const;
|
bool is_filtered(const AK::URL&) const;
|
||||||
void add_pattern(const String&);
|
void add_pattern(const String&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -162,7 +162,7 @@ bool FrameLoader::load(LoadRequest& request, Type type)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (url.protocol() == "http" || url.protocol() == "https") {
|
if (url.protocol() == "http" || url.protocol() == "https") {
|
||||||
URL favicon_url;
|
AK::URL favicon_url;
|
||||||
favicon_url.set_protocol(url.protocol());
|
favicon_url.set_protocol(url.protocol());
|
||||||
favicon_url.set_host(url.host());
|
favicon_url.set_host(url.host());
|
||||||
favicon_url.set_port(url.port());
|
favicon_url.set_port(url.port());
|
||||||
|
@ -195,7 +195,7 @@ bool FrameLoader::load(LoadRequest& request, Type type)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrameLoader::load(const URL& url, Type type)
|
bool FrameLoader::load(const AK::URL& url, Type type)
|
||||||
{
|
{
|
||||||
dbgln_if(SPAM_DEBUG, "FrameLoader::load: {}", url);
|
dbgln_if(SPAM_DEBUG, "FrameLoader::load: {}", url);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ bool FrameLoader::load(const URL& url, Type type)
|
||||||
return load(request, type);
|
return load(request, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameLoader::load_html(const StringView& html, const URL& url)
|
void FrameLoader::load_html(const StringView& html, const AK::URL& url)
|
||||||
{
|
{
|
||||||
auto document = DOM::Document::create(url);
|
auto document = DOM::Document::create(url);
|
||||||
HTML::HTMLDocumentParser parser(document, html, "utf-8");
|
HTML::HTMLDocumentParser parser(document, html, "utf-8");
|
||||||
|
@ -219,7 +219,7 @@ void FrameLoader::load_html(const StringView& html, const URL& url)
|
||||||
// FIXME: Use an actual templating engine (our own one when it's built, preferably
|
// FIXME: Use an actual templating engine (our own one when it's built, preferably
|
||||||
// with a way to check these usages at compile time)
|
// with a way to check these usages at compile time)
|
||||||
|
|
||||||
void FrameLoader::load_error_page(const URL& failed_url, const String& error)
|
void FrameLoader::load_error_page(const AK::URL& failed_url, const String& error)
|
||||||
{
|
{
|
||||||
auto error_page_url = "file:///res/html/error.html";
|
auto error_page_url = "file:///res/html/error.html";
|
||||||
ResourceLoader::the().load(
|
ResourceLoader::the().load(
|
||||||
|
|
|
@ -26,10 +26,10 @@ public:
|
||||||
explicit FrameLoader(BrowsingContext&);
|
explicit FrameLoader(BrowsingContext&);
|
||||||
~FrameLoader();
|
~FrameLoader();
|
||||||
|
|
||||||
bool load(const URL&, Type);
|
bool load(const AK::URL&, Type);
|
||||||
bool load(LoadRequest&, Type);
|
bool load(LoadRequest&, Type);
|
||||||
|
|
||||||
void load_html(const StringView&, const URL&);
|
void load_html(const StringView&, const AK::URL&);
|
||||||
|
|
||||||
BrowsingContext& browsing_context() { return m_browsing_context; }
|
BrowsingContext& browsing_context() { return m_browsing_context; }
|
||||||
const BrowsingContext& browsing_context() const { return m_browsing_context; }
|
const BrowsingContext& browsing_context() const { return m_browsing_context; }
|
||||||
|
@ -39,7 +39,7 @@ private:
|
||||||
virtual void resource_did_load() override;
|
virtual void resource_did_load() override;
|
||||||
virtual void resource_did_fail() override;
|
virtual void resource_did_fail() override;
|
||||||
|
|
||||||
void load_error_page(const URL& failed_url, const String& error_message);
|
void load_error_page(const AK::URL& failed_url, const String& error_message);
|
||||||
void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr);
|
void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr);
|
||||||
bool parse_document(DOM::Document&, const ByteBuffer& data);
|
bool parse_document(DOM::Document&, const ByteBuffer& data);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ ImageLoader::ImageLoader(DOM::Element& owner_element)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageLoader::load(const URL& url)
|
void ImageLoader::load(const AK::URL& url)
|
||||||
{
|
{
|
||||||
m_loading_state = LoadingState::Loading;
|
m_loading_state = LoadingState::Loading;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ImageLoader : public ImageResourceClient {
|
||||||
public:
|
public:
|
||||||
ImageLoader(DOM::Element& owner_element);
|
ImageLoader(DOM::Element& owner_element);
|
||||||
|
|
||||||
void load(const URL&);
|
void load(const AK::URL&);
|
||||||
|
|
||||||
const Gfx::Bitmap* bitmap(size_t index) const;
|
const Gfx::Bitmap* bitmap(size_t index) const;
|
||||||
size_t current_frame_index() const { return m_current_frame_index; }
|
size_t current_frame_index() const { return m_current_frame_index; }
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace Web {
|
namespace Web {
|
||||||
|
|
||||||
LoadRequest LoadRequest::create_for_url_on_page(const URL& url, Page* page)
|
LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page)
|
||||||
{
|
{
|
||||||
LoadRequest request;
|
LoadRequest request;
|
||||||
request.set_url(url);
|
request.set_url(url);
|
||||||
|
|
|
@ -21,12 +21,12 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static LoadRequest create_for_url_on_page(const URL& url, Page* page);
|
static LoadRequest create_for_url_on_page(const AK::URL& url, Page* page);
|
||||||
|
|
||||||
bool is_valid() const { return m_url.is_valid(); }
|
bool is_valid() const { return m_url.is_valid(); }
|
||||||
|
|
||||||
const URL& url() const { return m_url; }
|
const AK::URL& url() const { return m_url; }
|
||||||
void set_url(const URL& url) { m_url = url; }
|
void set_url(const AK::URL& url) { m_url = url; }
|
||||||
|
|
||||||
const String& method() const { return m_method; }
|
const String& method() const { return m_method; }
|
||||||
void set_method(const String& method) { m_method = method; }
|
void set_method(const String& method) { m_method = method; }
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
const HashMap<String, String>& headers() const { return m_headers; }
|
const HashMap<String, String>& headers() const { return m_headers; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
String m_method { "GET" };
|
String m_method { "GET" };
|
||||||
HashMap<String, String> m_headers;
|
HashMap<String, String> m_headers;
|
||||||
ByteBuffer m_body;
|
ByteBuffer m_body;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
|
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
|
||||||
|
|
||||||
const URL& url() const { return m_request.url(); }
|
const AK::URL& url() const { return m_request.url(); }
|
||||||
const ByteBuffer& encoded_data() const { return m_encoded_data; }
|
const ByteBuffer& encoded_data() const { return m_encoded_data; }
|
||||||
|
|
||||||
const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers() const { return m_response_headers; }
|
const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers() const { return m_response_headers; }
|
||||||
|
|
|
@ -218,7 +218,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, con
|
||||||
error_callback(not_implemented_error, {});
|
error_callback(not_implemented_error, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceLoader::load(const URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
|
void ResourceLoader::load(const AK::URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
|
||||||
{
|
{
|
||||||
LoadRequest request;
|
LoadRequest request;
|
||||||
request.set_url(url);
|
request.set_url(url);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
RefPtr<Resource> load_resource(Resource::Type, LoadRequest&);
|
RefPtr<Resource> load_resource(Resource::Type, LoadRequest&);
|
||||||
|
|
||||||
void load(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
void load(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
||||||
void load(const URL&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
void load(const AK::URL&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
||||||
void load_sync(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
void load_sync(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
|
||||||
|
|
||||||
Function<void()> on_load_counter_change;
|
Function<void()> on_load_counter_change;
|
||||||
|
|
|
@ -74,13 +74,13 @@ void OutOfProcessWebView::create_client()
|
||||||
client().async_update_screen_rects(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
|
client().async_update_screen_rects(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::load(const URL& url)
|
void OutOfProcessWebView::load(const AK::URL& url)
|
||||||
{
|
{
|
||||||
m_url = url;
|
m_url = url;
|
||||||
client().async_load_url(url);
|
client().async_load_url(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::load_html(const StringView& html, const URL& url)
|
void OutOfProcessWebView::load_html(const StringView& html, const AK::URL& url)
|
||||||
{
|
{
|
||||||
m_url = url;
|
m_url = url;
|
||||||
client().async_load_html(html, url);
|
client().async_load_html(html, url);
|
||||||
|
@ -262,7 +262,7 @@ void OutOfProcessWebView::notify_server_did_leave_tooltip_area(Badge<WebContentC
|
||||||
GUI::Application::the()->hide_tooltip();
|
GUI::Application::the()->hide_tooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const URL& url)
|
void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_link_hover)
|
if (on_link_hover)
|
||||||
on_link_hover(url);
|
on_link_hover(url);
|
||||||
|
@ -275,25 +275,25 @@ void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient>
|
||||||
on_link_hover({});
|
on_link_hover({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const URL& url, const String& target, unsigned int modifiers)
|
void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers)
|
||||||
{
|
{
|
||||||
if (on_link_click)
|
if (on_link_click)
|
||||||
on_link_click(url, target, modifiers);
|
on_link_click(url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const URL& url, const String& target, unsigned int modifiers)
|
void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers)
|
||||||
{
|
{
|
||||||
if (on_link_middle_click)
|
if (on_link_middle_click)
|
||||||
on_link_middle_click(url, target, modifiers);
|
on_link_middle_click(url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const URL& url)
|
void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_load_start)
|
if (on_load_start)
|
||||||
on_load_start(url);
|
on_load_start(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClient>, const URL& url)
|
void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL& url)
|
||||||
{
|
{
|
||||||
if (on_load_finish)
|
if (on_load_finish)
|
||||||
on_load_finish(url);
|
on_load_finish(url);
|
||||||
|
@ -305,13 +305,13 @@ void OutOfProcessWebView::notify_server_did_request_context_menu(Badge<WebConten
|
||||||
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
|
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const URL& url, const String&, unsigned)
|
void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned)
|
||||||
{
|
{
|
||||||
if (on_link_context_menu_request)
|
if (on_link_context_menu_request)
|
||||||
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
|
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const URL& url, const String&, unsigned, const Gfx::ShareableBitmap& bitmap)
|
void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned, const Gfx::ShareableBitmap& bitmap)
|
||||||
{
|
{
|
||||||
if (on_image_context_menu_request)
|
if (on_image_context_menu_request)
|
||||||
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap);
|
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap);
|
||||||
|
@ -336,7 +336,7 @@ String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentCli
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_get_source(const URL& url, const String& source)
|
void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, const String& source)
|
||||||
{
|
{
|
||||||
if (on_get_source)
|
if (on_get_source)
|
||||||
on_get_source(url, source);
|
on_get_source(url, source);
|
||||||
|
@ -372,14 +372,14 @@ void OutOfProcessWebView::notify_server_did_change_favicon(const Gfx::Bitmap& fa
|
||||||
on_favicon_change(favicon);
|
on_favicon_change(favicon);
|
||||||
}
|
}
|
||||||
|
|
||||||
String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const URL& url, Cookie::Source source)
|
String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source)
|
||||||
{
|
{
|
||||||
if (on_get_cookie)
|
if (on_get_cookie)
|
||||||
return on_get_cookie(url, source);
|
return on_get_cookie(url, source);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
|
void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
|
||||||
{
|
{
|
||||||
if (on_set_cookie)
|
if (on_set_cookie)
|
||||||
on_set_cookie(url, cookie, source);
|
on_set_cookie(url, cookie, source);
|
||||||
|
|
|
@ -23,10 +23,10 @@ class OutOfProcessWebView final
|
||||||
public:
|
public:
|
||||||
virtual ~OutOfProcessWebView() override;
|
virtual ~OutOfProcessWebView() override;
|
||||||
|
|
||||||
URL url() const { return m_url; }
|
AK::URL url() const { return m_url; }
|
||||||
void load(const URL&);
|
void load(const AK::URL&);
|
||||||
|
|
||||||
void load_html(const StringView&, const URL&);
|
void load_html(const StringView&, const AK::URL&);
|
||||||
void load_empty_document();
|
void load_empty_document();
|
||||||
|
|
||||||
void debug_request(const String& request, const String& argument = {});
|
void debug_request(const String& request, const String& argument = {});
|
||||||
|
@ -62,26 +62,26 @@ public:
|
||||||
void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
|
void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
|
||||||
void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String&);
|
void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String&);
|
||||||
void notify_server_did_leave_tooltip_area(Badge<WebContentClient>);
|
void notify_server_did_leave_tooltip_area(Badge<WebContentClient>);
|
||||||
void notify_server_did_hover_link(Badge<WebContentClient>, const URL&);
|
void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&);
|
||||||
void notify_server_did_unhover_link(Badge<WebContentClient>);
|
void notify_server_did_unhover_link(Badge<WebContentClient>);
|
||||||
void notify_server_did_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers);
|
void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers);
|
||||||
void notify_server_did_middle_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers);
|
void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers);
|
||||||
void notify_server_did_start_loading(Badge<WebContentClient>, const URL&);
|
void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&);
|
||||||
void notify_server_did_finish_loading(Badge<WebContentClient>, const URL&);
|
void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&);
|
||||||
void notify_server_did_request_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&);
|
void notify_server_did_request_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&);
|
||||||
void notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers);
|
void notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers);
|
||||||
void notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers, const Gfx::ShareableBitmap&);
|
void notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::ShareableBitmap&);
|
||||||
void notify_server_did_request_alert(Badge<WebContentClient>, const String& message);
|
void notify_server_did_request_alert(Badge<WebContentClient>, const String& message);
|
||||||
bool notify_server_did_request_confirm(Badge<WebContentClient>, const String& message);
|
bool notify_server_did_request_confirm(Badge<WebContentClient>, const String& message);
|
||||||
String notify_server_did_request_prompt(Badge<WebContentClient>, const String& message, const String& default_);
|
String notify_server_did_request_prompt(Badge<WebContentClient>, const String& message, const String& default_);
|
||||||
void notify_server_did_get_source(const URL& url, const String& source);
|
void notify_server_did_get_source(const AK::URL& url, const String& source);
|
||||||
void notify_server_did_get_dom_tree(const String& dom_tree);
|
void notify_server_did_get_dom_tree(const String& dom_tree);
|
||||||
void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style);
|
void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style);
|
||||||
void notify_server_did_output_js_console_message(i32 message_index);
|
void notify_server_did_output_js_console_message(i32 message_index);
|
||||||
void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
|
void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
|
||||||
void notify_server_did_change_favicon(const Gfx::Bitmap& favicon);
|
void notify_server_did_change_favicon(const Gfx::Bitmap& favicon);
|
||||||
String notify_server_did_request_cookie(Badge<WebContentClient>, const URL& url, Cookie::Source source);
|
String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source);
|
||||||
void notify_server_did_set_cookie(Badge<WebContentClient>, const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
|
void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OutOfProcessWebView();
|
OutOfProcessWebView();
|
||||||
|
@ -108,7 +108,7 @@ private:
|
||||||
|
|
||||||
void handle_web_content_process_crash();
|
void handle_web_content_process_crash();
|
||||||
|
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
|
|
||||||
struct ClientState {
|
struct ClientState {
|
||||||
RefPtr<WebContentClient> client;
|
RefPtr<WebContentClient> client;
|
||||||
|
|
|
@ -311,12 +311,12 @@ void BrowsingContext::unregister_viewport_client(ViewportClient& client)
|
||||||
VERIFY(was_removed);
|
VERIFY(was_removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowsingContext::register_frame_nesting(URL const& url)
|
void BrowsingContext::register_frame_nesting(AK::URL const& url)
|
||||||
{
|
{
|
||||||
m_frame_nesting_levels.ensure(url)++;
|
m_frame_nesting_levels.ensure(url)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowsingContext::is_frame_nesting_allowed(URL const& url) const
|
bool BrowsingContext::is_frame_nesting_allowed(AK::URL const& url) const
|
||||||
{
|
{
|
||||||
return m_frame_nesting_levels.get(url).value_or(0) < 3;
|
return m_frame_nesting_levels.get(url).value_or(0) < 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,11 @@ public:
|
||||||
|
|
||||||
void did_edit(Badge<EditEventHandler>);
|
void did_edit(Badge<EditEventHandler>);
|
||||||
|
|
||||||
void register_frame_nesting(URL const&);
|
void register_frame_nesting(AK::URL const&);
|
||||||
bool is_frame_nesting_allowed(URL const&) const;
|
bool is_frame_nesting_allowed(AK::URL const&) const;
|
||||||
|
|
||||||
void set_frame_nesting_levels(HashMap<URL, size_t> frame_nesting_levels) { m_frame_nesting_levels = move(frame_nesting_levels); };
|
void set_frame_nesting_levels(HashMap<AK::URL, size_t> frame_nesting_levels) { m_frame_nesting_levels = move(frame_nesting_levels); };
|
||||||
HashMap<URL, size_t> const& frame_nesting_levels() const { return m_frame_nesting_levels; }
|
HashMap<AK::URL, size_t> const& frame_nesting_levels() const { return m_frame_nesting_levels; }
|
||||||
|
|
||||||
DOM::Document* container_document();
|
DOM::Document* container_document();
|
||||||
DOM::Document const* container_document() const;
|
DOM::Document const* container_document() const;
|
||||||
|
@ -123,7 +123,7 @@ private:
|
||||||
|
|
||||||
HashTable<ViewportClient*> m_viewport_clients;
|
HashTable<ViewportClient*> m_viewport_clients;
|
||||||
|
|
||||||
HashMap<URL, size_t> m_frame_nesting_levels;
|
HashMap<AK::URL, size_t> m_frame_nesting_levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void Page::set_focused_browsing_context(Badge<EventHandler>, BrowsingContext& br
|
||||||
m_focused_context = browsing_context.make_weak_ptr();
|
m_focused_context = browsing_context.make_weak_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Page::load(const URL& url)
|
void Page::load(const AK::URL& url)
|
||||||
{
|
{
|
||||||
top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
|
top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void Page::load(LoadRequest& request)
|
||||||
top_level_browsing_context().loader().load(request, FrameLoader::Type::Navigation);
|
top_level_browsing_context().loader().load(request, FrameLoader::Type::Navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Page::load_html(const StringView& html, const URL& url)
|
void Page::load_html(const StringView& html, const AK::URL& url)
|
||||||
{
|
{
|
||||||
top_level_browsing_context().loader().load_html(html, url);
|
top_level_browsing_context().loader().load_html(html, url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ public:
|
||||||
|
|
||||||
void set_focused_browsing_context(Badge<EventHandler>, BrowsingContext&);
|
void set_focused_browsing_context(Badge<EventHandler>, BrowsingContext&);
|
||||||
|
|
||||||
void load(const URL&);
|
void load(const AK::URL&);
|
||||||
void load(LoadRequest&);
|
void load(LoadRequest&);
|
||||||
|
|
||||||
void load_html(const StringView&, const URL&);
|
void load_html(const StringView&, const AK::URL&);
|
||||||
|
|
||||||
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||||
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
||||||
|
@ -74,18 +74,18 @@ public:
|
||||||
virtual Gfx::IntRect screen_rect() const = 0;
|
virtual Gfx::IntRect screen_rect() const = 0;
|
||||||
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) { }
|
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) { }
|
||||||
virtual void page_did_change_title(const String&) { }
|
virtual void page_did_change_title(const String&) { }
|
||||||
virtual void page_did_start_loading(const URL&) { }
|
virtual void page_did_start_loading(const AK::URL&) { }
|
||||||
virtual void page_did_finish_loading(const URL&) { }
|
virtual void page_did_finish_loading(const AK::URL&) { }
|
||||||
virtual void page_did_change_selection() { }
|
virtual void page_did_change_selection() { }
|
||||||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
|
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
|
||||||
virtual void page_did_request_context_menu(const Gfx::IntPoint&) { }
|
virtual void page_did_request_context_menu(const Gfx::IntPoint&) { }
|
||||||
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
||||||
virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap*) { }
|
virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap*) { }
|
||||||
virtual void page_did_click_link(const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
virtual void page_did_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
||||||
virtual void page_did_middle_click_link(const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
virtual void page_did_middle_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
|
||||||
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) { }
|
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) { }
|
||||||
virtual void page_did_leave_tooltip_area() { }
|
virtual void page_did_leave_tooltip_area() { }
|
||||||
virtual void page_did_hover_link(const URL&) { }
|
virtual void page_did_hover_link(const AK::URL&) { }
|
||||||
virtual void page_did_unhover_link() { }
|
virtual void page_did_unhover_link() { }
|
||||||
virtual void page_did_invalidate(const Gfx::IntRect&) { }
|
virtual void page_did_invalidate(const Gfx::IntRect&) { }
|
||||||
virtual void page_did_change_favicon(const Gfx::Bitmap&) { }
|
virtual void page_did_change_favicon(const Gfx::Bitmap&) { }
|
||||||
|
@ -96,8 +96,8 @@ public:
|
||||||
virtual void page_did_request_alert(const String&) { }
|
virtual void page_did_request_alert(const String&) { }
|
||||||
virtual bool page_did_request_confirm(const String&) { return false; }
|
virtual bool page_did_request_confirm(const String&) { return false; }
|
||||||
virtual String page_did_request_prompt(const String&, const String&) { return {}; }
|
virtual String page_did_request_prompt(const String&, const String&) { return {}; }
|
||||||
virtual String page_did_request_cookie(const URL&, Cookie::Source) { return {}; }
|
virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; }
|
||||||
virtual void page_did_set_cookie(const URL&, const Cookie::ParsedCookie&, Cookie::Source) { }
|
virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~PageClient() = default;
|
virtual ~PageClient() = default;
|
||||||
|
|
27
Userland/Libraries/LibWeb/URL/URL.cpp
Normal file
27
Userland/Libraries/LibWeb/URL/URL.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||||
|
* Copyright (c) 2021, the SerenityOS developers.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <AK/URL.h>
|
||||||
|
#include <LibWeb/URL/URL.h>
|
||||||
|
|
||||||
|
namespace Web::URL {
|
||||||
|
|
||||||
|
String url_encode(const Vector<QueryParam>& pairs, AK::URL::PercentEncodeSet percent_encode_set)
|
||||||
|
{
|
||||||
|
StringBuilder builder;
|
||||||
|
for (size_t i = 0; i < pairs.size(); ++i) {
|
||||||
|
builder.append(AK::URL::percent_encode(pairs[i].name, percent_encode_set));
|
||||||
|
builder.append('=');
|
||||||
|
builder.append(AK::URL::percent_encode(pairs[i].value, percent_encode_set));
|
||||||
|
if (i != pairs.size() - 1)
|
||||||
|
builder.append('&');
|
||||||
|
}
|
||||||
|
return builder.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
Userland/Libraries/LibWeb/URL/URL.h
Normal file
21
Userland/Libraries/LibWeb/URL/URL.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||||
|
* Copyright (c) 2021, the SerenityOS developers.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/String.h>
|
||||||
|
#include <AK/Vector.h>
|
||||||
|
|
||||||
|
namespace Web::URL {
|
||||||
|
|
||||||
|
struct QueryParam {
|
||||||
|
String name;
|
||||||
|
String value;
|
||||||
|
};
|
||||||
|
String url_encode(const Vector<QueryParam>&, AK::URL::PercentEncodeSet);
|
||||||
|
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
|
||||||
#include <AK/URL.h>
|
|
||||||
#include <LibWeb/URLEncoder.h>
|
|
||||||
|
|
||||||
namespace Web {
|
|
||||||
|
|
||||||
String urlencode(const Vector<URLQueryParam>& pairs, URL::PercentEncodeSet percent_encode_set)
|
|
||||||
{
|
|
||||||
StringBuilder builder;
|
|
||||||
for (size_t i = 0; i < pairs.size(); ++i) {
|
|
||||||
builder.append(URL::percent_encode(pairs[i].name, percent_encode_set));
|
|
||||||
builder.append('=');
|
|
||||||
builder.append(URL::percent_encode(pairs[i].value, percent_encode_set));
|
|
||||||
if (i != pairs.size() - 1)
|
|
||||||
builder.append('&');
|
|
||||||
}
|
|
||||||
return builder.to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <AK/String.h>
|
|
||||||
#include <AK/Vector.h>
|
|
||||||
|
|
||||||
namespace Web {
|
|
||||||
|
|
||||||
struct URLQueryParam {
|
|
||||||
String name;
|
|
||||||
String value;
|
|
||||||
};
|
|
||||||
|
|
||||||
String urlencode(const Vector<URLQueryParam>&, URL::PercentEncodeSet);
|
|
||||||
|
|
||||||
}
|
|
|
@ -28,7 +28,7 @@ void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id)
|
||||||
m_view.notify_server_did_paint({}, bitmap_id);
|
m_view.notify_server_did_paint({}, bitmap_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_finish_loading(URL const& url)
|
void WebContentClient::did_finish_loading(AK::URL const& url)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_finish_loading({}, url);
|
m_view.notify_server_did_finish_loading({}, url);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ void WebContentClient::did_leave_tooltip_area()
|
||||||
m_view.notify_server_did_leave_tooltip_area({});
|
m_view.notify_server_did_leave_tooltip_area({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_hover_link(URL const& url)
|
void WebContentClient::did_hover_link(AK::URL const& url)
|
||||||
{
|
{
|
||||||
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", url);
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", url);
|
||||||
m_view.notify_server_did_hover_link({}, url);
|
m_view.notify_server_did_hover_link({}, url);
|
||||||
|
@ -106,17 +106,17 @@ void WebContentClient::did_unhover_link()
|
||||||
m_view.notify_server_did_unhover_link({});
|
m_view.notify_server_did_unhover_link({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_click_link(URL const& url, String const& target, unsigned modifiers)
|
void WebContentClient::did_click_link(AK::URL const& url, String const& target, unsigned modifiers)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_click_link({}, url, target, modifiers);
|
m_view.notify_server_did_click_link({}, url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_middle_click_link(URL const& url, String const& target, unsigned modifiers)
|
void WebContentClient::did_middle_click_link(AK::URL const& url, String const& target, unsigned modifiers)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_middle_click_link({}, url, target, modifiers);
|
m_view.notify_server_did_middle_click_link({}, url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_start_loading(URL const& url)
|
void WebContentClient::did_start_loading(AK::URL const& url)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_start_loading({}, url);
|
m_view.notify_server_did_start_loading({}, url);
|
||||||
}
|
}
|
||||||
|
@ -126,17 +126,17 @@ void WebContentClient::did_request_context_menu(Gfx::IntPoint const& content_pos
|
||||||
m_view.notify_server_did_request_context_menu({}, content_position);
|
m_view.notify_server_did_request_context_menu({}, content_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint const& content_position, URL const& url, String const& target, unsigned modifiers)
|
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint const& content_position, AK::URL const& url, String const& target, unsigned modifiers)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_request_link_context_menu({}, content_position, url, target, modifiers);
|
m_view.notify_server_did_request_link_context_menu({}, content_position, url, target, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint const& content_position, URL const& url, String const& target, unsigned modifiers, Gfx::ShareableBitmap const& bitmap)
|
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint const& content_position, AK::URL const& url, String const& target, unsigned modifiers, Gfx::ShareableBitmap const& bitmap)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_request_image_context_menu({}, content_position, url, target, modifiers, bitmap);
|
m_view.notify_server_did_request_image_context_menu({}, content_position, url, target, modifiers, bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_get_source(URL const& url, String const& source)
|
void WebContentClient::did_get_source(AK::URL const& url, String const& source)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_get_source(url, source);
|
m_view.notify_server_did_get_source(url, source);
|
||||||
}
|
}
|
||||||
|
@ -185,12 +185,12 @@ void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon)
|
||||||
m_view.notify_server_did_change_favicon(*favicon.bitmap());
|
m_view.notify_server_did_change_favicon(*favicon.bitmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(URL const& url, u8 source)
|
Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source)
|
||||||
{
|
{
|
||||||
return m_view.notify_server_did_request_cookie({}, url, static_cast<Cookie::Source>(source));
|
return m_view.notify_server_did_request_cookie({}, url, static_cast<Cookie::Source>(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentClient::did_set_cookie(URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
|
void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
|
||||||
{
|
{
|
||||||
m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Cookie::Source>(source));
|
m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Cookie::Source>(source));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ private:
|
||||||
virtual void die() override;
|
virtual void die() override;
|
||||||
|
|
||||||
virtual void did_paint(Gfx::IntRect const&, i32) override;
|
virtual void did_paint(Gfx::IntRect const&, i32) override;
|
||||||
virtual void did_finish_loading(URL const&) override;
|
virtual void did_finish_loading(AK::URL const&) override;
|
||||||
virtual void did_invalidate_content_rect(Gfx::IntRect const&) override;
|
virtual void did_invalidate_content_rect(Gfx::IntRect const&) override;
|
||||||
virtual void did_change_selection() override;
|
virtual void did_change_selection() override;
|
||||||
virtual void did_request_cursor_change(i32) override;
|
virtual void did_request_cursor_change(i32) override;
|
||||||
|
@ -41,15 +41,15 @@ private:
|
||||||
virtual void did_request_scroll_into_view(Gfx::IntRect const&) override;
|
virtual void did_request_scroll_into_view(Gfx::IntRect const&) override;
|
||||||
virtual void did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override;
|
virtual void did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override;
|
||||||
virtual void did_leave_tooltip_area() override;
|
virtual void did_leave_tooltip_area() override;
|
||||||
virtual void did_hover_link(URL const&) override;
|
virtual void did_hover_link(AK::URL const&) override;
|
||||||
virtual void did_unhover_link() override;
|
virtual void did_unhover_link() override;
|
||||||
virtual void did_click_link(URL const&, String const&, unsigned) override;
|
virtual void did_click_link(AK::URL const&, String const&, unsigned) override;
|
||||||
virtual void did_middle_click_link(URL const&, String const&, unsigned) override;
|
virtual void did_middle_click_link(AK::URL const&, String const&, unsigned) override;
|
||||||
virtual void did_start_loading(URL const&) override;
|
virtual void did_start_loading(AK::URL const&) override;
|
||||||
virtual void did_request_context_menu(Gfx::IntPoint const&) override;
|
virtual void did_request_context_menu(Gfx::IntPoint const&) override;
|
||||||
virtual void did_request_link_context_menu(Gfx::IntPoint const&, URL const&, String const&, unsigned) override;
|
virtual void did_request_link_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned) override;
|
||||||
virtual void did_request_image_context_menu(Gfx::IntPoint const&, URL const&, String const&, unsigned, Gfx::ShareableBitmap const&) override;
|
virtual void did_request_image_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned, Gfx::ShareableBitmap const&) override;
|
||||||
virtual void did_get_source(URL const&, String const&) override;
|
virtual void did_get_source(AK::URL const&, String const&) override;
|
||||||
virtual void did_get_dom_tree(String const&) override;
|
virtual void did_get_dom_tree(String const&) override;
|
||||||
virtual void did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style) override;
|
virtual void did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style) override;
|
||||||
virtual void did_output_js_console_message(i32 message_index) override;
|
virtual void did_output_js_console_message(i32 message_index) override;
|
||||||
|
@ -58,8 +58,8 @@ private:
|
||||||
virtual void did_request_alert(String const&) override;
|
virtual void did_request_alert(String const&) override;
|
||||||
virtual Messages::WebContentClient::DidRequestConfirmResponse did_request_confirm(String const&) override;
|
virtual Messages::WebContentClient::DidRequestConfirmResponse did_request_confirm(String const&) override;
|
||||||
virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override;
|
virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override;
|
||||||
virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(URL const&, u8) override;
|
virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override;
|
||||||
virtual void did_set_cookie(URL const&, Web::Cookie::ParsedCookie const&, u8) override;
|
virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override;
|
||||||
|
|
||||||
OutOfProcessWebView& m_view;
|
OutOfProcessWebView& m_view;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,24 +15,24 @@ namespace Web {
|
||||||
class WebViewHooks {
|
class WebViewHooks {
|
||||||
public:
|
public:
|
||||||
Function<void(const Gfx::IntPoint& screen_position)> on_context_menu_request;
|
Function<void(const Gfx::IntPoint& screen_position)> on_context_menu_request;
|
||||||
Function<void(const URL&, const String& target, unsigned modifiers)> on_link_click;
|
Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_click;
|
||||||
Function<void(const URL&, const Gfx::IntPoint& screen_position)> on_link_context_menu_request;
|
Function<void(const AK::URL&, const Gfx::IntPoint& screen_position)> on_link_context_menu_request;
|
||||||
Function<void(const URL&, const Gfx::IntPoint& screen_position, const Gfx::ShareableBitmap&)> on_image_context_menu_request;
|
Function<void(const AK::URL&, const Gfx::IntPoint& screen_position, const Gfx::ShareableBitmap&)> on_image_context_menu_request;
|
||||||
Function<void(const URL&, const String& target, unsigned modifiers)> on_link_middle_click;
|
Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_middle_click;
|
||||||
Function<void(const URL&)> on_link_hover;
|
Function<void(const AK::URL&)> on_link_hover;
|
||||||
Function<void(const String&)> on_title_change;
|
Function<void(const String&)> on_title_change;
|
||||||
Function<void(const URL&)> on_load_start;
|
Function<void(const AK::URL&)> on_load_start;
|
||||||
Function<void(const URL&)> on_load_finish;
|
Function<void(const AK::URL&)> on_load_finish;
|
||||||
Function<void(const Gfx::Bitmap&)> on_favicon_change;
|
Function<void(const Gfx::Bitmap&)> on_favicon_change;
|
||||||
Function<void(const URL&)> on_url_drop;
|
Function<void(const AK::URL&)> on_url_drop;
|
||||||
Function<void(DOM::Document*)> on_set_document;
|
Function<void(DOM::Document*)> on_set_document;
|
||||||
Function<void(const URL&, const String&)> on_get_source;
|
Function<void(const AK::URL&, const String&)> on_get_source;
|
||||||
Function<void(const String&)> on_get_dom_tree;
|
Function<void(const String&)> on_get_dom_tree;
|
||||||
Function<void(i32 node_id, String const& specified_style, String const& computed_style)> on_get_dom_node_properties;
|
Function<void(i32 node_id, String const& specified_style, String const& computed_style)> on_get_dom_node_properties;
|
||||||
Function<void(i32 message_id)> on_js_console_new_message;
|
Function<void(i32 message_id)> on_js_console_new_message;
|
||||||
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
|
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
|
||||||
Function<String(const URL& url, Cookie::Source source)> on_get_cookie;
|
Function<String(const AK::URL& url, Cookie::Source source)> on_get_cookie;
|
||||||
Function<void(const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
|
Function<void(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ DOM::ExceptionOr<void> XMLHttpRequest::send()
|
||||||
|
|
||||||
// FIXME: If body is not null, then:
|
// FIXME: If body is not null, then:
|
||||||
|
|
||||||
URL request_url = m_window->associated_document().parse_url(m_url.to_string());
|
AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string());
|
||||||
dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url);
|
dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url);
|
||||||
|
|
||||||
// TODO: Add support for preflight requests to support CORS requests
|
// TODO: Add support for preflight requests to support CORS requests
|
||||||
|
|
|
@ -77,7 +77,7 @@ private:
|
||||||
bool m_send { false };
|
bool m_send { false };
|
||||||
|
|
||||||
String m_method;
|
String m_method;
|
||||||
URL m_url;
|
AK::URL m_url;
|
||||||
|
|
||||||
HashMap<String, String, CaseInsensitiveStringTraits> m_request_headers;
|
HashMap<String, String, CaseInsensitiveStringTraits> m_request_headers;
|
||||||
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
|
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue