Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Libraries/LibWeb/DOM/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6954,4 +6954,9 @@ void Document::remove_pending_css_import_rule(Badge<CSS::CSSImportRule>, GC::Ref
m_pending_css_import_rules.remove(rule);
}

void Document::exit_pointer_lock()
{
dbgln("FIXME: exit_pointer_lock()");
}

}
2 changes: 2 additions & 0 deletions Libraries/LibWeb/DOM/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ class WEB_API Document
CSS::StyleScope const& style_scope() const { return m_style_scope; }
CSS::StyleScope& style_scope() { return m_style_scope; }

void exit_pointer_lock();

protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
Expand Down
3 changes: 3 additions & 0 deletions Libraries/LibWeb/DOM/Document.idl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ interface Document : Node {

// https://www.w3.org/TR/SVG2/struct.html#InterfaceDocumentExtensions
readonly attribute SVGSVGElement? rootElement;

// https://w3c.github.io/pointerlock/#extensions-to-the-document-interface
undefined exitPointerLock();
};

dictionary ElementCreationOptions {
Expand Down
9 changes: 9 additions & 0 deletions Libraries/LibWeb/DOM/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4338,6 +4338,15 @@ double Element::ensure_css_random_base_value(CSS::RandomCachingKey const& random
});
}

GC::Ref<WebIDL::Promise> Element::request_pointer_lock(Optional<PointerLockOptions>)
{
dbgln("FIXME: request_pointer_lock()");
auto promise = WebIDL::create_promise(realm());
auto error = WebIDL::NotSupportedError::create(realm(), "request_pointer_lock() is not implemented"_utf16);
WebIDL::reject_promise(realm(), promise, error);
return promise;
}

// The element to inherit style from.
// If a pseudo-element is specified, this will return the element itself.
// Otherwise, if this element is slotted somewhere, it will return the slot's element to inherit style from.
Expand Down
7 changes: 7 additions & 0 deletions Libraries/LibWeb/DOM/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ enum class ProximityToTheViewport : u8 {
NotDetermined,
};

// https://w3c.github.io/pointerlock/#pointerlockoptions-dictionary
struct PointerLockOptions {
bool unadjusted_movement = false;
};

class WEB_API Element
: public ParentNode
, public ChildNode<Element>
Expand Down Expand Up @@ -523,6 +528,8 @@ class WEB_API Element

double ensure_css_random_base_value(CSS::RandomCachingKey const&);

GC::Ref<WebIDL::Promise> request_pointer_lock(Optional<PointerLockOptions>);

protected:
Element(Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
Expand Down
8 changes: 8 additions & 0 deletions Libraries/LibWeb/DOM/Element.idl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ dictionary CheckVisibilityOptions {
boolean visibilityProperty = false;
};

// https://w3c.github.io/pointerlock/#pointerlockoptions-dictionary
dictionary PointerLockOptions {
boolean unadjustedMovement = false;
};

// https://dom.spec.whatwg.org/#element
[Exposed=Window]
interface Element : Node {
Expand Down Expand Up @@ -126,6 +131,9 @@ interface Element : Node {

// https://drafts.csswg.org/css-shadow-parts/#idl
[SameObject, PutForwards=value, ImplementedAs=part_list] readonly attribute DOMTokenList part;

// https://w3c.github.io/pointerlock/#requestPointerLock
Promise<undefined> requestPointerLock(optional PointerLockOptions options = {});
};

dictionary GetHTMLOptions {
Expand Down
Loading