OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 // http://w3c.github.io/selection-api/#idl-def-Selection | 30 // http://w3c.github.io/selection-api/#idl-def-Selection |
31 | 31 |
32 // TODO(yoichio): All long types should be unsigned long. crbug.com/391673 | |
33 [ | 32 [ |
34 ImplementedAs=DOMSelection, | 33 ImplementedAs=DOMSelection, |
35 WillBeGarbageCollected, | 34 WillBeGarbageCollected, |
36 ] interface Selection { | 35 ] interface Selection { |
37 readonly attribute Node? anchorNode; | 36 readonly attribute Node? anchorNode; |
38 readonly attribute long anchorOffset; | 37 readonly attribute unsigned long anchorOffset; |
39 readonly attribute Node? focusNode; | 38 readonly attribute Node? focusNode; |
40 readonly attribute long focusOffset; | 39 readonly attribute unsigned long focusOffset; |
41 readonly attribute boolean isCollapsed; | 40 readonly attribute boolean isCollapsed; |
42 readonly attribute long rangeCount; | 41 readonly attribute unsigned long rangeCount; |
43 [RaisesException] Range getRangeAt(long index); | 42 [RaisesException] Range getRangeAt(unsigned long index); |
44 void addRange(Range range); | 43 void addRange(Range range); |
45 // TODO(yoichio): Implement removeRange. crbug.com/391673 | 44 // TODO(yoichio): Implement removeRange. crbug.com/391673 |
46 //void removeRange(Range range); | 45 //void removeRange(Range range); |
47 void removeAllRanges(); | 46 void removeAllRanges(); |
48 // TODO(yoichio): The node argument should not be nullable. crbug.com/391673 | 47 // TODO(yoichio): The node argumendt should not be nullable. crbug.com/39167
3 |
49 // TODO(philipj): The offset argument should not have a default value. | 48 // TODO(philipj): The offset argument should not have a default value. |
50 [RaisesException] void collapse(Node? node, optional long offset = 0); | 49 [RaisesException] void collapse(Node? node, optional unsigned long offset =
0); |
51 [RaisesException] void collapseToStart(); | 50 [RaisesException] void collapseToStart(); |
52 [RaisesException] void collapseToEnd(); | 51 [RaisesException] void collapseToEnd(); |
53 // TODO(philipj): The offset argument should not have a default value. | 52 // TODO(philipj): The offset argument should not have a default value. |
54 [RaisesException, TypeChecking=Interface] void extend(Node node, optional lo
ng offset = 0); | 53 [RaisesException, TypeChecking=Interface] void extend(Node node, optional un
signed long offset = 0); |
55 // TODO(philipj): The arguments should be anchorNode, anchorOffset, | 54 // TODO(philipj): The arguments should be anchorNode, anchorOffset, |
56 // focusNode and focusOffset, and none of them should be optional. | 55 // focusNode and focusOffset, and none of them should be optional. |
57 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, | 56 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, |
58
[Default=Undefined] optional long baseOffset, | 57
[Default=Undefined] optional unsigned long baseOffset, |
59
[Default=Undefined] optional Node extentNode, | 58
[Default=Undefined] optional Node extentNode, |
60
[Default=Undefined] optional long extentOffset); | 59
[Default=Undefined] optional unsigned long extentOffset); |
61 [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node); | 60 [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node); |
62 [CustomElementCallbacks] void deleteFromDocument(); | 61 [CustomElementCallbacks] void deleteFromDocument(); |
63 // TODO(philipj): The arguments should not be optional. | 62 // TODO(philipj): The arguments should not be optional. |
64 [MeasureAs=SelectionContainsNode] boolean containsNode([Default=Undefined] o
ptional Node node, [Default=Undefined] optional boolean allowPartialContainment)
; | 63 [MeasureAs=SelectionContainsNode] boolean containsNode([Default=Undefined] o
ptional Node node, [Default=Undefined] optional boolean allowPartialContainment)
; |
65 // TODO(philipj): The spec does not use [NotEnumerable]. See also: | 64 // TODO(philipj): The spec does not use [NotEnumerable]. See also: |
66 // https://codereview.chromium.org/345983004/ | 65 // https://codereview.chromium.org/345983004/ |
67 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179 | 66 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179 |
68 [NotEnumerable] stringifier DOMString (); | 67 [NotEnumerable] stringifier DOMString (); |
69 | 68 |
70 // Non-standard APIs | 69 // Non-standard APIs |
71 | 70 |
72 // https://github.com/w3c/selection-api/issues/34 | 71 // https://github.com/w3c/selection-api/issues/34 |
73 [MeasureAs=SelectionBaseNode] readonly attribute Node? baseNode; | 72 [MeasureAs=SelectionBaseNode] readonly attribute Node? baseNode; |
74 [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; | 73 [MeasureAs=SelectionBaseOffset] readonly attribute unsigned long baseOffset; |
75 [MeasureAs=SelectionExtentNode] readonly attribute Node? extentNode; | 74 [MeasureAs=SelectionExtentNode] readonly attribute Node? extentNode; |
76 [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; | 75 [MeasureAs=SelectionExtentOffset] readonly attribute unsigned long extentOff
set; |
77 | 76 |
78 // https://github.com/w3c/selection-api/issues/14 | 77 // https://github.com/w3c/selection-api/issues/14 |
79 [MeasureAs=SelectionType] readonly attribute DOMString type; | 78 [MeasureAs=SelectionType] readonly attribute DOMString type; |
80 | 79 |
81 // https://github.com/w3c/selection-api/issues/36 | 80 // https://github.com/w3c/selection-api/issues/36 |
82 [MeasureAs=SelectionEmpty] void empty(); | 81 [MeasureAs=SelectionEmpty] void empty(); |
83 | 82 |
84 // https://github.com/w3c/selection-api/issues/37 | 83 // https://github.com/w3c/selection-api/issues/37 |
85 [MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMStri
ng alter, | 84 [MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMStri
ng alter, |
86 [Default=Undefined] optional DOMStri
ng direction, | 85 [Default=Undefined] optional DOMStri
ng direction, |
87 [Default=Undefined] optional DOMStri
ng granularity); | 86 [Default=Undefined] optional DOMStri
ng granularity); |
88 | 87 |
89 // https://github.com/w3c/selection-api/issues/38 | 88 // https://github.com/w3c/selection-api/issues/38 |
90 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] vo
id setPosition(Node? node, optional long offset = 0); | 89 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] vo
id setPosition(Node? node, optional unsigned long offset = 0); |
91 }; | 90 }; |
OLD | NEW |