Bug 1946787 - Avoid creating redundant GradientCache::OnMaxEntriesBreached tasks...
[gecko.git] / dom / chrome-webidl / XULTreeElement.webidl
blob45dd3100d092be4860a781e02fda6f491ed82f34
2 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5  * You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
8 interface MozTreeView;
10 dictionary TreeCellInfo {
11     long row = 0;
12     TreeColumn? col = null;
13     DOMString childElt = "";
16 [ChromeOnly,
17  Exposed=Window]
18 interface XULTreeElement : XULElement
20   [HTMLConstructor] constructor();
22   /**
23    * Obtain the columns.
24    */
25   readonly attribute TreeColumns? columns;
27   /**
28    * The view that backs the tree and that supplies it with its data.
29    * It is dynamically settable, either using a view attribute on the
30    * tree tag or by setting this attribute to a new value.
31    */
32   [SetterThrows, NeedsCallerType]
33   attribute MozTreeView? view;
35   /**
36    * Whether or not we are currently focused.
37    */
38   attribute boolean focused;
40   /**
41    * Obtain the treebody content node
42    */
43   readonly attribute Element? treeBody;
45   /**
46    * Obtain the height of a row.
47    */
48   readonly attribute long rowHeight;
50   /**
51    * Obtain the width of a row.
52    */
53   readonly attribute long rowWidth;
55   /**
56    * Get the index of the first visible row.
57    */
58   long getFirstVisibleRow();
60   /**
61    * Get the index of the last visible row.
62    */
63   long getLastVisibleRow();
65   /**
66    * Gets the number of possible visible rows.
67    */
68   long getPageLength();
70   /**
71    * Ensures that a row at a given index is visible.
72    */
73   undefined ensureRowIsVisible(long index);
75   /**
76    * Ensures that a given cell in the tree is visible.
77    */
78   [Throws]
79   undefined ensureCellIsVisible(long row, TreeColumn? col);
81   /**
82    * Scrolls such that the row at index is at the top of the visible view.
83    */
84   undefined scrollToRow(long index);
86   /**
87    * Scroll the tree up or down by numLines lines. Positive
88    * values move down in the tree. Prevents scrolling off the
89    * end of the tree.
90    */
91   undefined scrollByLines(long numLines);
93   /**
94    * Scroll the tree up or down by numPages pages. A page
95    * is considered to be the amount displayed by the tree.
96    * Positive values move down in the tree. Prevents scrolling
97    * off the end of the tree.
98    */
99   undefined scrollByPages(long numPages);
101   /**
102    * Invalidation methods for fine-grained painting control.
103    */
104   undefined invalidate();
105   undefined invalidateColumn(TreeColumn? col);
106   undefined invalidateRow(long index);
107   undefined invalidateCell(long row, TreeColumn? col);
108   undefined invalidateRange(long startIndex, long endIndex);
110   /**
111    * A hit test that can tell you what row the mouse is over.
112    * returns -1 for invalid mouse coordinates.
113    *
114    * The coordinate system is the client coordinate system for the
115    * document this tree lives in, and the units are CSS pixels.
116    */
117   long getRowAt(long x, long y);
119   /**
120    * A hit test that can tell you what cell the mouse is over.
121    * TreeCellInfo.row is the row index hit,  returns -1 for invalid mouse
122    * coordinates.  TreeCellInfo.col is the column hit.
123    * TreeCellInfo.childElt is the pseudoelement hit: this can have values of
124    * "cell", "twisty", "image", and "text".
125    *
126    * The coordinate system is the client coordinate system for the
127    * document this tree lives in, and the units are CSS pixels.
128    */
129   [Throws]
130   TreeCellInfo getCellAt(long x, long y);
132   /**
133    * Find the coordinates of an element within a specific cell.
134    */
135   [Throws]
136   DOMRect? getCoordsForCellItem(long row, TreeColumn col, DOMString element);
138   /**
139    * Determine if the text of a cell is being cropped or not.
140    */
141   [Throws]
142   boolean isCellCropped(long row, TreeColumn? col);
144   /**
145    * The view is responsible for calling these notification methods when
146    * rows are added or removed.  Index is the position at which the new
147    * rows were added or at which rows were removed.  For
148    * non-contiguous additions/removals, this method should be called multiple times.
149    */
150   undefined rowCountChanged(long index, long count);
152   /**
153    * Notify the tree that the view is about to perform a batch
154    * update, that is, add, remove or invalidate several rows at once.
155    * This must be followed by calling endUpdateBatch(), otherwise the tree
156    * will get out of sync.
157    */
158   undefined beginUpdateBatch();
160   /**
161    * Notify the tree that the view has completed a batch update.
162    */
163   undefined endUpdateBatch();
165   /**
166    * Called on a theme switch to flush out the tree's style and image caches.
167    */
168   undefined clearStyleAndImageCaches();
170   /**
171    * Remove an image source from the image cache to allow its invalidation.
172    */
173   [Throws]
174   undefined removeImageCacheEntry(long row, TreeColumn col);