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 27 matching lines...) Expand all Loading... |
38 [ | 38 [ |
39 ImplementedAs=DOMSelection, | 39 ImplementedAs=DOMSelection, |
40 WillBeGarbageCollected, | 40 WillBeGarbageCollected, |
41 ] interface Selection { | 41 ] interface Selection { |
42 readonly attribute Node anchorNode; | 42 readonly attribute Node anchorNode; |
43 readonly attribute long anchorOffset; | 43 readonly attribute long anchorOffset; |
44 readonly attribute Node focusNode; | 44 readonly attribute Node focusNode; |
45 readonly attribute long focusOffset; | 45 readonly attribute long focusOffset; |
46 | 46 |
47 readonly attribute boolean isCollapsed; | 47 readonly attribute boolean isCollapsed; |
48 [RaisesException, TypeChecking=Interface] void collapse(Node node, optional
long offset); | 48 [RaisesException] void collapse(Node? node, optional long offset = 0); |
49 [RaisesException] void collapseToStart(); | 49 [RaisesException] void collapseToStart(); |
50 [RaisesException] void collapseToEnd(); | 50 [RaisesException] void collapseToEnd(); |
51 | 51 |
52 // FIXME: should be: optional long offset = 0 http://crbug.com/258153 | |
53 // We mark offset as optional, defaulting to 0; this differs from spec. | 52 // We mark offset as optional, defaulting to 0; this differs from spec. |
54 // http://crbug.com/384966 | 53 // http://crbug.com/384966 |
55 [RaisesException, TypeChecking=Interface] void extend(Node node, optional lo
ng offset); | 54 [RaisesException, TypeChecking=Interface] void extend(Node node, optional lo
ng offset = 0); |
56 | 55 |
57 [RaisesException] void selectAllChildren([Default=Undefined] optional Node n
ode); | 56 [RaisesException] void selectAllChildren([Default=Undefined] optional Node n
ode); |
58 [CustomElementCallbacks] void deleteFromDocument(); | 57 [CustomElementCallbacks] void deleteFromDocument(); |
59 | 58 |
60 readonly attribute long rangeCount; | 59 readonly attribute long rangeCount; |
61 [RaisesException] Range getRangeAt([Default=Undefined] optional long index); | 60 [RaisesException] Range getRangeAt([Default=Undefined] optional long index); |
62 void addRange([Default=Undefined] optional Range range); | 61 void addRange([Default=Undefined] optional Range range); |
63 void removeAllRanges(); | 62 void removeAllRanges(); |
64 | 63 |
65 [NotEnumerable] stringifier; | 64 [NotEnumerable] stringifier; |
66 | 65 |
67 // Firefox extensions | 66 // Firefox extensions |
68 // https://developer.mozilla.org/En/DOM/Selection | 67 // https://developer.mozilla.org/En/DOM/Selection |
69 // | 68 // |
70 // FIXME: Add use counters. | 69 [MeasureAs=SelectionContainsNode] boolean containsNode([Default = Undefined]
optional Node node, [Default = Undefined] optional boolean allowPartial); |
71 boolean containsNode([Default = Undefined] optional Node node, [Default = Un
defined] optional boolean allowPartial); | |
72 | 70 |
73 // WebKit extensions | 71 // WebKit extensions |
74 [MeasureAs=SelectionBaseNode] readonly attribute Node baseNode; | 72 [MeasureAs=SelectionBaseNode] readonly attribute Node baseNode; |
75 [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; | 73 [MeasureAs=SelectionBaseOffset] readonly attribute long baseOffset; |
76 [MeasureAs=SelectionExtentNode] readonly attribute Node extentNode; | 74 [MeasureAs=SelectionExtentNode] readonly attribute Node extentNode; |
77 [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; | 75 [MeasureAs=SelectionExtentOffset] readonly attribute long extentOffset; |
78 | 76 |
79 // WebKit's "type" accessor returns "None", "Range" and "Caret" | 77 // WebKit's "type" accessor returns "None", "Range" and "Caret" |
80 // IE's type accessor returns "none", "text" and "control" | 78 // IE's type accessor returns "none", "text" and "control" |
81 [MeasureAs=SelectionType] readonly attribute DOMString type; | 79 [MeasureAs=SelectionType] readonly attribute DOMString type; |
82 | 80 |
83 [MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMStri
ng alter, | 81 [MeasureAs=SelectionModify] void modify([Default=Undefined] optional DOMStri
ng alter, |
84 [Default=Undefined] optional DOMStri
ng direction, | 82 [Default=Undefined] optional DOMStri
ng direction, |
85 [Default=Undefined] optional DOMStri
ng granularity); | 83 [Default=Undefined] optional DOMStri
ng granularity); |
86 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, | 84 [MeasureAs=SelectionSetBaseAndExtent, RaisesException] void setBaseAndExtent
([Default=Undefined] optional Node baseNode, |
87
[Default=Undefined] optional long baseOffset, | 85
[Default=Undefined] optional long baseOffset, |
88
[Default=Undefined] optional Node extentNode, | 86
[Default=Undefined] optional Node extentNode, |
89
[Default=Undefined] optional long extentOffset); | 87
[Default=Undefined] optional long extentOffset); |
90 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException, Ty
peChecking=Interface] void setPosition(Node node, | 88 [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] vo
id setPosition(Node? node, optional long offset = 0); |
91
optional long offset); | |
92 | 89 |
93 // IE extensions | 90 // IE extensions |
94 // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx | 91 // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx |
95 [MeasureAs=SelectionEmpty] void empty(); | 92 [MeasureAs=SelectionEmpty] void empty(); |
96 }; | 93 }; |
OLD | NEW |