Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "nsISelection.idl"
8 interface nsRange;
9 interface nsIDOMNode;
10 interface nsISelectionListener;
11 interface nsIContent;
12 interface nsINode;
14 %{C++
15 class nsIFrame;
16 struct nsPoint;
17 struct ScrollAxis;
18 template<class T> class nsTArray;
19 #include "nsDirection.h"
20 #include "nsIPresShell.h" // TODO: Remove this include
21 #include "mozilla/EventForwards.h"
22 %}
24 [ptr] native nsIFrame(nsIFrame);
25 [ptr] native RangeArray(nsTArray<nsRange*>);
26 [ref] native constTextRangeStyleRef(const mozilla::TextRangeStyle);
27 [ref] native nsPointRef(nsPoint);
28 native nsDirection(nsDirection);
29 native ScrollAxis(nsIPresShell::ScrollAxis);
31 [scriptable, builtinclass, uuid(52629837-7b3f-4434-940d-a14de7ef9b7a)]
32 interface nsISelectionPrivate : nsISelection
33 {
34 const short ENDOFPRECEDINGLINE=0;
35 const short STARTOFNEXTLINE=1;
37 attribute boolean interlinePosition;
39 /* startBatchChanges
40 match this up with endbatchChanges. will stop ui updates while multiple selection methods are called
41 */
42 [noscript] void startBatchChanges();
44 /* endBatchChanges
45 match this up with startBatchChanges
46 */
47 [noscript] void endBatchChanges();
49 DOMString toStringWithFormat(in string formatType, in unsigned long flags, in int32_t wrapColumn);
50 void addSelectionListener(in nsISelectionListener newListener);
51 void removeSelectionListener(in nsISelectionListener listenerToRemove);
53 /* Table selection stuff
54 We should probably move this and table-related
55 items in nsFrameSelection to a
56 new nsITableSelection interface
57 */
58 const long TABLESELECTION_NONE = 0;
59 const long TABLESELECTION_CELL = 1;
60 const long TABLESELECTION_ROW = 2;
61 const long TABLESELECTION_COLUMN = 3;
62 const long TABLESELECTION_TABLE = 4;
63 const long TABLESELECTION_ALLCELLS = 5;
65 /** Test if supplied range points to a single table element:
66 * Result is one of above constants. "None" means
67 * a table element isn't selected.
68 */
69 [noscript] long getTableSelectionType(in nsIDOMRange range);
71 /* canCacheFrameOffset
72 * Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction.
73 * EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times
74 * of nsTextFrame::GetPointFromOffset whose return value is to be cached.
75 * see bugs 35296 and 199412
76 */
77 [noscript] attribute boolean canCacheFrameOffset;
79 /* GetCachedOffsetForFrame
80 * Returns cached value for nsTextFrame::GetPointFromOffset.
81 */
82 [noscript] void getCachedFrameOffset(in nsIFrame aFrame, in int32_t inOffset, in nsPointRef aPoint);
84 [noscript] void setAncestorLimiter(in nsIContent aContent);
86 /**
87 * Set the painting style for the range. The range must be a range in
88 * the selection. The textRangeStyle will be used by text frame
89 * when it is painting the selection.
90 */
91 [noscript] void setTextRangeStyle(in nsIDOMRange range,
92 in constTextRangeStyleRef textRangeStyle);
94 /**
95 * Get the direction of the selection.
96 */
97 [noscript, notxpcom] nsDirection getSelectionDirection();
98 [noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection);
100 /**
101 * Returns the type of the selection (see nsISelectionController for
102 * available constants).
103 */
104 readonly attribute short type;
106 /**
107 * Return array of ranges intersecting with the given DOM interval.
108 */
109 void GetRangesForInterval(
110 in nsIDOMNode beginNode, in int32_t beginOffset,
111 in nsIDOMNode endNode, in int32_t endOffset,
112 in boolean allowAdjacent,
113 out uint32_t resultCount,
114 [retval, array, size_is(resultCount)] out nsIDOMRange results);
116 [noscript] void GetRangesForIntervalArray(
117 in nsINode beginNode, in int32_t beginOffset,
118 in nsINode endNode, in int32_t endOffset,
119 in boolean allowAdjacent,
120 in RangeArray results);
122 /**
123 * Scrolls a region of the selection, so that it is visible in
124 * the scrolled view.
125 *
126 * @param aRegion - the region inside the selection to scroll into view
127 * (see selection region constants defined in
128 * nsISelectionController).
129 * @param aIsSynchronous - when true, scrolls the selection into view
130 * before returning. If false, posts a request which
131 * is processed at some point after the method returns.
132 * @param aVPercent - how to align the frame vertically.
133 * @param aHPercent - how to align the frame horizontally.
134 */
135 void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
136 in int16_t aVPercent,
137 in int16_t aHPercent);
139 /**
140 * Scrolls a region of the selection, so that it is visible in
141 * the scrolled view.
142 *
143 * @param aRegion - the region inside the selection to scroll into view
144 * (see selection region constants defined in
145 * nsISelectionController).
146 * @param aIsSynchronous - when true, scrolls the selection into view
147 * before returning. If false, posts a request which
148 * is processed at some point after the method returns.
149 * @param aVertical - how to align the frame vertically and when.
150 * See nsIPresShell.h:ScrollAxis for details.
151 * @param aHorizontal - how to align the frame horizontally and when.
152 * See nsIPresShell.h:ScrollAxis for details.
153 */
154 [noscript] void scrollIntoViewInternal(in short aRegion,
155 in boolean aIsSynchronous,
156 in ScrollAxis aVertical,
157 in ScrollAxis aHorizontal);
159 /**
160 * Modifies the cursor Bidi level after a change in keyboard direction
161 * @param langRTL is PR_TRUE if the new language is right-to-left or
162 * PR_FALSE if the new language is left-to-right.
163 */
164 [noscript] void selectionLanguageChange(in boolean langRTL);
165 };