1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"domstubs.idl"
9 [scriptable
, uuid(91375f52
-20e6
-4757-9835-eb04fabe5498
)]
11 interface nsIHTMLAbsPosEditor
: nsISupports
14 * true if the selection container is absolutely positioned
16 readonly attribute
boolean selectionContainerAbsolutelyPositioned
;
19 * this contains the absolutely positioned element currently edited
22 readonly attribute nsIDOMElement positionedElement
;
25 * true if Absolute Positioning handling is enabled in the editor
27 attribute
boolean absolutePositioningEnabled
;
33 * true if Snap To Grid is enabled in the editor.
35 attribute
boolean snapToGridEnabled
;
38 * sets the grid size in pixels.
39 * @param aSizeInPixels [IN] the size of the grid in pixels
41 attribute
unsigned long gridSize
;
43 /* Selection-based methods */
46 * returns the deepest absolutely positioned container of the selection
47 * if it exists or null.
49 readonly attribute nsIDOMElement absolutelyPositionedSelectionContainer
;
52 * extracts the selection from the normal flow of the document and
54 * @param aEnabled [IN] true to absolutely position the selection,
55 * false to put it back in the normal flow
57 void absolutePositionSelection
(in boolean aEnabled
);
60 * adds aChange to the z-index of the currently positioned element.
61 * @param aChange [IN] relative change to apply to current z-index
63 void relativeChangeZIndex
(in long aChange
);
65 /* Element-based methods */
68 * extracts an element from the normal flow of the document and
69 * positions it, and puts it back in the normal flow.
70 * @param aElement [IN] the element
71 * @param aEnabled [IN] true to absolutely position the element,
72 * false to put it back in the normal flow
74 void absolutelyPositionElement
(in nsIDOMElement aElement
,
78 * sets the position of an element; warning it does NOT check if the
79 * element is already positioned or not and that's on purpose.
80 * @param aElement [IN] the element
81 * @param aX [IN] the x position in pixels.
82 * @param aY [IN] the y position in pixels.
84 void setElementPosition
(in nsIDOMElement aElement
, in long aX
, in long aY
);
87 * returns the absolute z-index of a positioned element. Never returns 'auto'.
88 * @return the z-index of the element
89 * @param aElement [IN] the element.
91 long getElementZIndex
(in nsIDOMElement aElement
);
94 * sets the z-index of an element.
95 * @param aElement [IN] the element
96 * @param aZorder [IN] the z-index
98 void setElementZIndex
(in nsIDOMElement aElement
, in long aZorder
);
101 * adds aChange to the z-index of an arbitrary element.
102 * @return the new z-index of the element
103 * @param aElement [IN] the element
104 * @param aChange [IN] relative change to apply to current z-index of
107 long relativeChangeElementZIndex
(in nsIDOMElement aElement
, in long aChange
);
112 * shows a grabber attached to an arbitrary element. The grabber is an image
113 * positioned on the left hand side of the top border of the element. Dragging
114 * and dropping it allows to change the element's absolute position in the
115 * document. See chrome://editor/content/images/grabber.gif
116 * @param aElement [IN] the element
118 void showGrabberOnElement
(in nsIDOMElement aElement
);
121 * hide the grabber if it shown.
126 * refreshes the grabber if it shown, possibly updating its position or
129 void refreshGrabber
();