Upstream version 5.34.104.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     boolean hasAttribute(DOMString name);
49     boolean hasAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
50
51     [PerWorldBindings] readonly attribute CSSStyleDeclaration style;
52
53     // DOM4
54     [Reflect, PerWorldBindings] attribute DOMString id;
55     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
56     [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, RaisesException=Setter] attribute DOMString prefix;
57     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
58
59     [RaisesException] boolean matches(DOMString selectors);
60
61     // Common extensions
62
63     [PerWorldBindings] readonly attribute long offsetLeft;
64     [PerWorldBindings] readonly attribute long offsetTop;
65     [PerWorldBindings] readonly attribute long offsetWidth;
66     [PerWorldBindings] readonly attribute long offsetHeight;
67     [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute Element offsetParent;
68     [PerWorldBindings] readonly attribute long clientLeft;
69     [PerWorldBindings] readonly attribute long clientTop;
70     [PerWorldBindings] readonly attribute long clientWidth;
71     [PerWorldBindings] readonly attribute long clientHeight;
72
73     // FIXME: should be:
74     // [PerWorldBindings] attribute (Dictionary or long) scrollLeft;
75     // [PerWorldBindings] attribute (Dictionary or long) scrollTop;
76     // http://crbug.com/240176
77     [PerWorldBindings, Custom=Setter] attribute long scrollLeft;
78     [PerWorldBindings, Custom=Setter] attribute long scrollTop;
79     [PerWorldBindings] readonly attribute long scrollWidth;
80     [PerWorldBindings] readonly attribute long scrollHeight;
81
82     void focus();
83     void blur();
84     void scrollIntoView(optional boolean alignWithTop);
85
86     // WebKit extensions
87
88     void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
89     void scrollByLines([Default=Undefined] optional long lines);
90     void scrollByPages([Default=Undefined] optional long pages);
91
92     // HTML 5
93     HTMLCollection getElementsByClassName(DOMString classNames);
94     [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, RaisesException=Setter] attribute DOMString innerHTML;
95     [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString outerHTML;
96
97     [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement(DOMString where, Element element);
98     [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMString where, DOMString text);
99     [CustomElementCallbacks, RaisesException] void insertAdjacentHTML(DOMString where, DOMString html);
100
101     [Reflect=class, PerWorldBindings] attribute DOMString className;
102     [PerWorldBindings] readonly attribute DOMTokenList classList;
103
104     [PerWorldBindings] readonly attribute DOMStringMap dataset;
105
106     // NodeSelector - Selector API
107     [RaisesException] Element querySelector(DOMString selectors);
108     [RaisesException] NodeList querySelectorAll(DOMString selectors);
109
110     // WebKit extension
111     [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSelector] boolean webkitMatchesSelector(DOMString selectors);
112
113     // Shadow DOM API
114     [RuntimeEnabled=ShadowDOM, RaisesException] ShadowRoot createShadowRoot();
115     [RuntimeEnabled=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
116     [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
117
118     // To-be-deprecated prefixed Shadow DOM API
119     [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot();
120     [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot;
121
122     // CSSOM View Module API
123     ClientRectList getClientRects();
124     ClientRect getBoundingClientRect();
125
126     // Mozilla version
127     const unsigned short ALLOW_KEYBOARD_INPUT = 1;
128     [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
129
130     // W3C version
131     [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen();
132
133     void webkitRequestPointerLock();
134
135     // Event handler attributes
136     attribute EventHandler onbeforecopy;
137     attribute EventHandler onbeforecut;
138     attribute EventHandler onbeforepaste;
139     attribute EventHandler oncopy;
140     attribute EventHandler oncut;
141     attribute EventHandler onpaste;
142     attribute EventHandler onsearch;
143     attribute EventHandler onselectstart;
144     [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
145     [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
146     [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
147     [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
148     attribute EventHandler onwebkitfullscreenchange;
149     attribute EventHandler onwebkitfullscreenerror;
150     [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel;
151 };
152
153 Element implements ParentNode;
154 Element implements ChildNode;