Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / Element.idl
1 /*
2  * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3  * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 [
22     SpecialWrapFor=HTMLElement|SVGElement
23 ] interface Element : Node {
24
25     // DOM Level 1 Core
26
27     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
28
29     [TreatReturnedNullStringAs=Null] DOMString getAttribute(DOMString name);
30     [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name, DOMString value);
31     [CustomElementCallbacks] void removeAttribute(DOMString name);
32     [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
33     [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
34     [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
35     [PerWorldBindings] HTMLCollection getElementsByTagName(DOMString name);
36
37     [PerWorldBindings] readonly attribute NamedNodeMap     attributes;
38     [MeasureAs=HasAttributes] boolean hasAttributes();
39
40     // DOM Level 2 Core
41
42     DOMString getAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
43     [RaisesException, CustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, DOMString value);
44     [CustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
45     HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
46     [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
47                                                                   [Default=Undefined] optional DOMString localName); // Removed from DOM4.
48     [RaisesException, CustomElementCallbacks, DeprecateAs=ElementSetAttributeNodeNS] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
49     boolean hasAttribute(DOMString name);
50     boolean hasAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
51
52     [PerWorldBindings] readonly attribute CSSStyleDeclaration style;
53
54     // DOM4
55     [Reflect, PerWorldBindings] attribute DOMString id;
56     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
57     [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, RaisesException=Setter] attribute DOMString prefix;
58     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
59
60     [RaisesException] boolean matches(DOMString selectors);
61
62     // Common extensions
63
64     [PerWorldBindings] readonly attribute long offsetLeft;
65     [PerWorldBindings] readonly attribute long offsetTop;
66     [PerWorldBindings] readonly attribute long offsetWidth;
67     [PerWorldBindings] readonly attribute long offsetHeight;
68     [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute Element offsetParent;
69     [PerWorldBindings] readonly attribute long clientLeft;
70     [PerWorldBindings] readonly attribute long clientTop;
71     [PerWorldBindings] readonly attribute long clientWidth;
72     [PerWorldBindings] readonly attribute long clientHeight;
73
74     // FIXME: should be:
75     // [PerWorldBindings] attribute (Dictionary or long) scrollLeft;
76     // [PerWorldBindings] attribute (Dictionary or long) scrollTop;
77     // http://crbug.com/240176
78     [PerWorldBindings, Custom=Setter] attribute long scrollLeft;
79     [PerWorldBindings, Custom=Setter] attribute long scrollTop;
80     [PerWorldBindings] readonly attribute long scrollWidth;
81     [PerWorldBindings] readonly attribute long scrollHeight;
82
83     void focus();
84     void blur();
85     void scrollIntoView(optional boolean alignWithTop);
86
87     // WebKit extensions
88
89     void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
90     void scrollByLines([Default=Undefined] optional long lines);
91     void scrollByPages([Default=Undefined] optional long pages);
92
93     // HTML 5
94     HTMLCollection getElementsByClassName(DOMString classNames);
95     [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, RaisesException=Setter] attribute DOMString innerHTML;
96     [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString outerHTML;
97
98     [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement(DOMString where, Element element);
99     [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMString where, DOMString text);
100     [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void insertAdjacentHTML(DOMString where, DOMString html);
101
102     [Reflect=class, PerWorldBindings] attribute DOMString className;
103     [PerWorldBindings] readonly attribute DOMTokenList classList;
104
105     [PerWorldBindings] readonly attribute DOMStringMap dataset;
106
107     // NodeSelector - Selector API
108     [RaisesException] Element querySelector(DOMString selectors);
109     [RaisesException] NodeList querySelectorAll(DOMString selectors);
110
111     // WebKit extension
112     [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSelector] boolean webkitMatchesSelector(DOMString selectors);
113
114     // Shadow DOM API
115     [RaisesException] ShadowRoot createShadowRoot();
116     [PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
117     [PerWorldBindings] NodeList getDestinationInsertionPoints();
118
119     // To-be-deprecated prefixed Shadow DOM API
120     [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot();
121     [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot;
122
123     // CSSOM View Module API
124     ClientRectList getClientRects();
125     ClientRect getBoundingClientRect();
126
127     // Mozilla version
128     const unsigned short ALLOW_KEYBOARD_INPUT = 1;
129     [PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
130
131     // W3C version
132     [PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen();
133
134     void webkitRequestPointerLock();
135
136     // Event handler attributes
137     attribute EventHandler onbeforecopy;
138     attribute EventHandler onbeforecut;
139     attribute EventHandler onbeforepaste;
140     attribute EventHandler oncopy;
141     attribute EventHandler oncut;
142     attribute EventHandler onpaste;
143     attribute EventHandler onsearch;
144     attribute EventHandler onselectstart;
145     [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
146     [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
147     [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
148     [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
149     attribute EventHandler onwebkitfullscreenchange;
150     attribute EventHandler onwebkitfullscreenerror;
151     [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel;
152 };
153
154 Element implements ParentNode;
155 Element implements ChildNode;