mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibWeb: Remove Document::is_scripting_enabled() and use Node's
There's no need to have a custom is_scripting_enabled() for the Document class, as it (indirectly) inherits from Node. Also, let's not hardcode false here :^)
This commit is contained in:
parent
c79e4961f6
commit
f60a2a1d80
3 changed files with 11 additions and 4 deletions
|
@ -70,8 +70,6 @@ public:
|
|||
Origin origin() const;
|
||||
void set_origin(const Origin& origin);
|
||||
|
||||
bool is_scripting_enabled() const { return true; }
|
||||
|
||||
AK::URL parse_url(String const&) const;
|
||||
|
||||
CSS::StyleComputer& style_computer() { return *m_style_computer; }
|
||||
|
|
|
@ -843,11 +843,19 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-script
|
||||
bool Node::is_scripting_enabled() const
|
||||
{
|
||||
// Scripting is enabled for a node node if node's node document's browsing context is non-null, and scripting is enabled for node's relevant settings object.
|
||||
// FIXME: Check if scripting is enabled for the ESO.
|
||||
return document().browsing_context();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript
|
||||
bool Node::is_scripting_disabled() const
|
||||
{
|
||||
// FIXME: or when scripting is disabled for its relevant settings object.
|
||||
return !document().browsing_context();
|
||||
// Scripting is disabled for a node when scripting is not enabled, i.e., when its node document's browsing context is null or when scripting is disabled for its relevant settings object.
|
||||
return !is_scripting_enabled();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-contains
|
||||
|
|
|
@ -188,6 +188,7 @@ public:
|
|||
|
||||
bool is_host_including_inclusive_ancestor_of(const Node&) const;
|
||||
|
||||
bool is_scripting_enabled() const;
|
||||
bool is_scripting_disabled() const;
|
||||
|
||||
bool contains(RefPtr<Node>) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue