Index: core/editing/Selection.idl |
diff --git a/core/editing/Selection.idl b/core/editing/Selection.idl |
index a7ad07b414cbc02147f84e07a9b0386b600e5cb4..51c2879f4dd019f13fe6a95f63ced68cb611bbc0 100644 |
--- a/core/editing/Selection.idl |
+++ b/core/editing/Selection.idl |
@@ -30,42 +30,44 @@ |
// http://w3c.github.io/selection-api/#idl-def-Selection |
// TODO(yoichio): All long types should be unsigned long. crbug.com/391673 |
+// TODO(philipj): No arguments are optional in the spec, but some should be: |
+// https://github.com/w3c/selection-api/issues/30 |
[ |
ImplementedAs=DOMSelection, |
WillBeGarbageCollected, |
] interface Selection { |
- readonly attribute Node? anchorNode; |
- readonly attribute long anchorOffset; |
- readonly attribute Node? focusNode; |
- readonly attribute long focusOffset; |
- readonly attribute boolean isCollapsed; |
- readonly attribute long rangeCount; |
- [RaisesException] Range getRangeAt(long index); |
- void addRange(Range range); |
+ [MeasureAs=SelectionAnchorNode] readonly attribute Node? anchorNode; |
+ [MeasureAs=SelectionAnchorOffset] readonly attribute long anchorOffset; |
+ [MeasureAs=SelectionFocusNode] readonly attribute Node? focusNode; |
+ [MeasureAs=SelectionFocusOffset] readonly attribute long focusOffset; |
+ [MeasureAs=SelectionIsCollapsed] readonly attribute boolean isCollapsed; |
+ [MeasureAs=SelectionRangeCount] readonly attribute long rangeCount; |
+ [MeasureAs=SelectionType] readonly attribute DOMString type; |
+ [MeasureAs=SelectionGetRangeAt, RaisesException] Range getRangeAt(long index); |
+ [MeasureAs=SelectionAddRange] void addRange(Range range); |
// TODO(yoichio): Implement removeRange. crbug.com/391673 |
//void removeRange(Range range); |
- void removeAllRanges(); |
- // TODO(yoichio): The node argument should not be nullable. crbug.com/391673 |
- // TODO(philipj): The offset argument should not have a default value. |
- [RaisesException] void collapse(Node? node, optional long offset = 0); |
- [RaisesException] void collapseToStart(); |
- [RaisesException] void collapseToEnd(); |
- // TODO(philipj): The offset argument should not have a default value. |
- [RaisesException, TypeChecking=Interface] void extend(Node node, optional long offset = 0); |
+ [MeasureAs=SelectionRemoveAllRanges] void removeAllRanges(); |
+ [MeasureAs=SelectionEmpty] void empty(); |
+ [MeasureAs=SelectionCollapse, RaisesException, LegacyInterfaceTypeChecking] void collapse(Node? node, optional long offset = 0); |
+ [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException, LegacyInterfaceTypeChecking] void setPosition(Node? node, optional long offset = 0); |
+ [MeasureAs=SelectionCollapseToStart, RaisesException] void collapseToStart(); |
+ [MeasureAs=SelectionCollapseToEnd, RaisesException] void collapseToEnd(); |
+ [MeasureAs=SelectionExtend, RaisesException] void extend(Node node, optional long offset = 0); |
// TODO(philipj): The arguments should be anchorNode, anchorOffset, |
- // focusNode and focusOffset, and none of them should be optional. |
- [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent([Default=Undefined] optional Node baseNode, |
- [Default=Undefined] optional long baseOffset, |
- [Default=Undefined] optional Node extentNode, |
- [Default=Undefined] optional long extentOffset); |
- [RaisesException, TypeChecking=Interface] void selectAllChildren(Node node); |
- [CustomElementCallbacks] void deleteFromDocument(); |
- // TODO(philipj): The arguments should not be optional. |
- [MeasureAs=SelectionContainsNode] boolean containsNode([Default=Undefined] optional Node node, [Default=Undefined] optional boolean allowPartialContainment); |
+ // focusNode and focusOffset, and none of them are optional or nullable in |
+ // the spec. |
+ [MeasureAs=SelectionSetBaseAndExtent, RaisesException, LegacyInterfaceTypeChecking] void setBaseAndExtent([Default=Undefined] optional Node? baseNode, |
+ [Default=Undefined] optional long baseOffset, |
+ [Default=Undefined] optional Node? extentNode, |
+ [Default=Undefined] optional long extentOffset); |
+ [MeasureAs=SelectionSelectAllChildren, RaisesException] void selectAllChildren(Node node); |
+ [MeasureAs=SelectionDeleteDromDocument, CustomElementCallbacks] void deleteFromDocument(); |
+ [MeasureAs=SelectionContainsNode] boolean containsNode(Node node, optional boolean allowPartialContainment = false); |
// TODO(philipj): The spec does not use [NotEnumerable]. See also: |
// https://codereview.chromium.org/345983004/ |
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=26179 |
- [NotEnumerable] stringifier DOMString (); |
+ [MeasureAs=SelectionDOMString, NotEnumerable] stringifier DOMString(); |
// Non-standard APIs |
@@ -75,17 +77,8 @@ |
[MeasureAs=SelectionExtentNode] readonly attribute Node? extentNode; |
[MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; |
- // https://github.com/w3c/selection-api/issues/14 |
- [MeasureAs=SelectionType] readonly attribute DOMString type; |
- |
- // https://github.com/w3c/selection-api/issues/36 |
- [MeasureAs=SelectionEmpty] void empty(); |
- |
// https://github.com/w3c/selection-api/issues/37 |
[MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMString alter, |
[Default=Undefined] optional DOMString direction, |
[Default=Undefined] optional DOMString granularity); |
- |
- // https://github.com/w3c/selection-api/issues/38 |
- [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] void setPosition(Node? node, optional long offset = 0); |
}; |