mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibWeb: Implement a simple version of Element.scrollIntoView()
We parse the arguments that come in, but since we don't yet track scrollable overflow, we can't do the full "scroll an element into view" algorithm. For now, we just call out to the PageClient and ask it to bring the nearest principal box into the visible viewport.
This commit is contained in:
parent
3ca44e2258
commit
162e4179fc
3 changed files with 103 additions and 0 deletions
|
@ -9,6 +9,17 @@
|
|||
#import <Geometry/DOMRect.idl>
|
||||
#import <Geometry/DOMRectList.idl>
|
||||
|
||||
enum ScrollBehavior { "auto", "smooth" };
|
||||
dictionary ScrollOptions {
|
||||
ScrollBehavior behavior = "auto";
|
||||
};
|
||||
|
||||
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
|
||||
dictionary ScrollIntoViewOptions : ScrollOptions {
|
||||
ScrollLogicalPosition block = "start";
|
||||
ScrollLogicalPosition inline = "nearest";
|
||||
};
|
||||
|
||||
// https://dom.spec.whatwg.org/#element
|
||||
interface Element : Node {
|
||||
readonly attribute DOMString? namespaceURI;
|
||||
|
@ -56,6 +67,9 @@ interface Element : Node {
|
|||
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element);
|
||||
undefined insertAdjacentText(DOMString where, DOMString data);
|
||||
[CEReactions] undefined insertAdjacentHTML(DOMString position, DOMString text);
|
||||
|
||||
undefined scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {});
|
||||
|
||||
};
|
||||
|
||||
Element includes ParentNode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue