1 module libwasm.bindings.Range;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.DOMRect;
7 import libwasm.bindings.DOMRectList;
8 import libwasm.bindings.DocumentFragment;
9 import libwasm.bindings.Node;
10 
11 @safe:
12 nothrow:
13 
14 struct ClientRectsAndTexts {
15   nothrow:
16   JsHandle handle;
17   alias handle this;
18   this(Handle h) {
19     this.handle = JsHandle(h);
20   }
21   static auto create() {
22     return ClientRectsAndTexts(libwasm_add__object());
23   }
24   void rectList()(scope ref DOMRectList rectList) {
25     Object_Call_Handle__void(this.handle, "rectList", rectList.handle);
26   }
27   auto rectList()() {
28     return DOMRectList(Object_Getter__Handle(this.handle, "rectList"));
29   }
30   void textList()(scope ref Sequence!(string) textList) {
31     Object_Call_Handle__void(this.handle, "textList", textList.handle);
32   }
33   auto textList()() {
34     return Sequence!(string)(Object_Getter__Handle(this.handle, "textList"));
35   }
36 }
37 struct Range {
38   nothrow:
39   JsHandle handle;
40   alias handle this;
41   this(Handle h) {
42     this.handle = JsHandle(h);
43   }
44   auto startContainer()() {
45     return Node(Object_Getter__Handle(this.handle, "startContainer"));
46   }
47   uint startOffset()() {
48     return Object_Getter__uint(this.handle, "startOffset");
49   }
50   auto endContainer()() {
51     return Node(Object_Getter__Handle(this.handle, "endContainer"));
52   }
53   uint endOffset()() {
54     return Object_Getter__uint(this.handle, "endOffset");
55   }
56   bool collapsed()() {
57     return Object_Getter__bool(this.handle, "collapsed");
58   }
59   auto commonAncestorContainer()() {
60     return Node(Object_Getter__Handle(this.handle, "commonAncestorContainer"));
61   }
62   void setStart()(scope ref Node refNode, uint offset) {
63     Serialize_Object_VarArgCall!void(this.handle, "setStart", "Handle;uint", tuple(cast(Handle)refNode._parent, offset));
64   }
65   void setEnd()(scope ref Node refNode, uint offset) {
66     Serialize_Object_VarArgCall!void(this.handle, "setEnd", "Handle;uint", tuple(cast(Handle)refNode._parent, offset));
67   }
68   void setStartBefore()(scope ref Node refNode) {
69     Object_Call_Handle__void(this.handle, "setStartBefore", refNode._parent);
70   }
71   void setStartAfter()(scope ref Node refNode) {
72     Object_Call_Handle__void(this.handle, "setStartAfter", refNode._parent);
73   }
74   void setEndBefore()(scope ref Node refNode) {
75     Object_Call_Handle__void(this.handle, "setEndBefore", refNode._parent);
76   }
77   void setEndAfter()(scope ref Node refNode) {
78     Object_Call_Handle__void(this.handle, "setEndAfter", refNode._parent);
79   }
80   void collapse()(bool toStart /* = false */) {
81     Object_Call_bool__void(this.handle, "collapse", toStart);
82   }
83   void collapse()() {
84     Object_Call__void(this.handle, "collapse");
85   }
86   void selectNode()(scope ref Node refNode) {
87     Object_Call_Handle__void(this.handle, "selectNode", refNode._parent);
88   }
89   void selectNodeContents()(scope ref Node refNode) {
90     Object_Call_Handle__void(this.handle, "selectNodeContents", refNode._parent);
91   }
92   enum ushort START_TO_START = 0;
93   enum ushort START_TO_END = 1;
94   enum ushort END_TO_END = 2;
95   enum ushort END_TO_START = 3;
96   short compareBoundaryPoints()(ushort how, scope ref Range sourceRange) {
97     return Serialize_Object_VarArgCall!short(this.handle, "compareBoundaryPoints", "ushort;Handle", tuple(how, cast(Handle)sourceRange.handle));
98   }
99   void deleteContents()() {
100     Object_Call__void(this.handle, "deleteContents");
101   }
102   auto extractContents()() {
103     return DocumentFragment(Object_Getter__Handle(this.handle, "extractContents"));
104   }
105   auto cloneContents()() {
106     return DocumentFragment(Object_Getter__Handle(this.handle, "cloneContents"));
107   }
108   void insertNode()(scope ref Node node) {
109     Object_Call_Handle__void(this.handle, "insertNode", node._parent);
110   }
111   void surroundContents()(scope ref Node newParent) {
112     Object_Call_Handle__void(this.handle, "surroundContents", newParent._parent);
113   }
114   auto cloneRange()() {
115     return Range(Object_Getter__Handle(this.handle, "cloneRange"));
116   }
117   void detach()() {
118     Object_Call__void(this.handle, "detach");
119   }
120   bool isPointInRange()(scope ref Node node, uint offset) {
121     return Serialize_Object_VarArgCall!bool(this.handle, "isPointInRange", "Handle;uint", tuple(cast(Handle)node._parent, offset));
122   }
123   short comparePoint()(scope ref Node node, uint offset) {
124     return Serialize_Object_VarArgCall!short(this.handle, "comparePoint", "Handle;uint", tuple(cast(Handle)node._parent, offset));
125   }
126   bool intersectsNode()(scope ref Node node) {
127     return Serialize_Object_VarArgCall!bool(this.handle, "intersectsNode", "Handle", tuple(cast(Handle)node._parent));
128   }
129   auto createContextualFragment()(string fragment) {
130     return DocumentFragment(Object_Call_string__Handle(this.handle, "createContextualFragment", fragment));
131   }
132   auto getClientRects()() {
133     return recastOpt!(DOMRectList)(Object_Getter__OptionalHandle(this.handle, "getClientRects"));
134   }
135   auto getBoundingClientRect()() {
136     return DOMRect(Object_Getter__Handle(this.handle, "getBoundingClientRect"));
137   }
138   auto getClientRectsAndTexts()() {
139     return ClientRectsAndTexts(Object_Getter__Handle(this.handle, "getClientRectsAndTexts"));
140   }
141 }
142 
143