summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-03 20:06:54 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-03 22:35:13 +0100
commit545ec334f00791c39b0e7497a89e9e5001336c0e (patch)
tree39828051d23e10f5b775899ab44814316169ea03 /Userland/Libraries
parent90a874482370d98ee76726683aed4c0e1b7a847a (diff)
downloadserenity-545ec334f00791c39b0e7497a89e9e5001336c0e.zip
LibWeb: Add Document.hasFocus() stub
This always returns true for now. A proper implementation needs to check if the document is in the focused widget within an active window.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp6
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.h2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.idl2
3 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index f47bca16cb..6689fa5f43 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -1147,4 +1147,10 @@ NonnullRefPtr<DOMImplementation> Document::implementation() const
return *m_implementation;
}
+bool Document::has_focus() const
+{
+ // FIXME: Return whether we actually have focus.
+ return true;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index d8277447d2..371b204e39 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -304,6 +304,8 @@ public:
void evaluate_media_queries_and_report_changes();
void add_media_query_list(NonnullRefPtr<CSS::MediaQueryList>&);
+ bool has_focus() const;
+
private:
explicit Document(const AK::URL&);
diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl
index 275a75941f..63ca8d0ff7 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.idl
+++ b/Userland/Libraries/LibWeb/DOM/Document.idl
@@ -2,6 +2,8 @@ interface Document : Node {
constructor();
+ boolean hasFocus();
+
// FIXME: These attributes currently don't do anything.
[PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;