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 22 matching lines...) Expand all Loading... |
33 [ | 33 [ |
34 ImplementedAs=DOMSelection, | 34 ImplementedAs=DOMSelection, |
35 WillBeGarbageCollected, | 35 WillBeGarbageCollected, |
36 ] interface Selection { | 36 ] interface Selection { |
37 readonly attribute Node? anchorNode; | 37 readonly attribute Node? anchorNode; |
38 readonly attribute long anchorOffset; | 38 readonly attribute long anchorOffset; |
39 readonly attribute Node? focusNode; | 39 readonly attribute Node? focusNode; |
40 readonly attribute long focusOffset; | 40 readonly attribute long focusOffset; |
41 readonly attribute boolean isCollapsed; | 41 readonly attribute boolean isCollapsed; |
42 readonly attribute long rangeCount; | 42 readonly attribute long rangeCount; |
| 43 [MeasureAs=SelectionType] readonly attribute DOMString type; |
43 [RaisesException] Range getRangeAt(long index); | 44 [RaisesException] Range getRangeAt(long index); |
44 void addRange(Range range); | 45 void addRange(Range range); |
45 // TODO(yoichio): Implement removeRange. crbug.com/391673 | 46 // TODO(yoichio): Implement removeRange. crbug.com/391673 |
46 //void removeRange(Range range); | 47 //void removeRange(Range range); |
47 void removeAllRanges(); | 48 void removeAllRanges(); |
| 49 [MeasureAs=SelectionEmpty] void empty(); |
48 // TODO(yoichio): The node argument should not be nullable. crbug.com/391673 | 50 // TODO(yoichio): The node argument should not be nullable. crbug.com/391673 |
49 // TODO(philipj): The offset argument should not have a default value. | 51 // TODO(philipj): The offset argument should not have a default value. |
50 [RaisesException] void collapse(Node? node, optional long offset = 0); | 52 [RaisesException] void collapse(Node? node, optional long offset = 0); |
| 53 // TODO(yoichio): The node argument should not be nullable. crbug.com/391673 |
| 54 // TODO(philipj): The offset argument should not have a default value. |
| 55 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] vo
id setPosition(Node? node, optional long offset = 0); |
51 [RaisesException] void collapseToStart(); | 56 [RaisesException] void collapseToStart(); |
52 [RaisesException] void collapseToEnd(); | 57 [RaisesException] void collapseToEnd(); |
53 // TODO(philipj): The offset argument should not have a default value. | 58 // TODO(philipj): The offset argument should not have a default value. |
54 [RaisesException, TypeChecking=Interface] void extend(Node node, optional lo
ng offset = 0); | 59 [RaisesException, TypeChecking=Interface] void extend(Node node, optional lo
ng offset = 0); |
55 // TODO(philipj): The arguments should be anchorNode, anchorOffset, | 60 // TODO(philipj): The arguments should be anchorNode, anchorOffset, |
56 // focusNode and focusOffset, and none of them should be optional. | 61 // focusNode and focusOffset, and none of them should be optional. |
57 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, | 62 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, |
58
[Default=Undefined] optional long baseOffset, | 63
[Default=Undefined] optional long baseOffset, |
59
[Default=Undefined] optional Node extentNode, | 64
[Default=Undefined] optional Node extentNode, |
60
[Default=Undefined] optional long extentOffset); | 65
[Default=Undefined] optional long extentOffset); |
61 [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node); | 66 [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node); |
62 [CustomElementCallbacks] void deleteFromDocument(); | 67 [CustomElementCallbacks] void deleteFromDocument(); |
63 // TODO(philipj): The arguments should not be optional. | 68 // TODO(philipj): The arguments should not be optional. |
64 [MeasureAs=SelectionContainsNode] boolean containsNode([Default=Undefined] o
ptional Node node, [Default=Undefined] optional boolean allowPartialContainment)
; | 69 [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: | 70 // TODO(philipj): The spec does not use [NotEnumerable]. See also: |
66 // https://codereview.chromium.org/345983004/ | 71 // https://codereview.chromium.org/345983004/ |
67 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179 | 72 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179 |
68 [NotEnumerable] stringifier DOMString (); | 73 [NotEnumerable] stringifier DOMString (); |
69 | 74 |
70 // Non-standard APIs | 75 // Non-standard APIs |
71 | 76 |
72 // https://github.com/w3c/selection-api/issues/34 | 77 // https://github.com/w3c/selection-api/issues/34 |
73 [MeasureAs=SelectionBaseNode] readonly attribute Node? baseNode; | 78 [MeasureAs=SelectionBaseNode] readonly attribute Node? baseNode; |
74 [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; | 79 [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; |
75 [MeasureAs=SelectionExtentNode] readonly attribute Node? extentNode; | 80 [MeasureAs=SelectionExtentNode] readonly attribute Node? extentNode; |
76 [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; | 81 [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; |
77 | 82 |
78 // https://github.com/w3c/selection-api/issues/14 | |
79 [MeasureAs=SelectionType] readonly attribute DOMString type; | |
80 | |
81 // https://github.com/w3c/selection-api/issues/36 | |
82 [MeasureAs=SelectionEmpty] void empty(); | |
83 | |
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 | |
89 // https://github.com/w3c/selection-api/issues/38 | |
90 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] vo
id setPosition(Node? node, optional long offset = 0); | |
91 }; | 87 }; |
OLD | NEW |