nsISelectionPrivate 编辑

dom/base/nsISelectionPrivate.idlScriptable Internal support for content selection handling. Inherits from: nsISupports Last changed in Gecko 35 (Firefox 35 / Thunderbird 35 / SeaMonkey 2.32)

Warning: The content of this article may be out of date. This page wasn't updated since the initial import in 2011. See the idl file linked above for up-to-date information.

Method overview

void addSelectionListener(in nsISelectionListener newListener);
void endBatchChanges();
void getCachedFrameOffset(in nsIFrame aFrame, in PRInt32 inOffset, in nsPointRef aPoint); Native code only!
nsIEnumerator getEnumerator();
nsFrameSelection getFrameSelection(); Native code only!
void GetRangesForInterval(in nsIDOMNode beginNode, in PRInt32 beginOffset, in nsIDOMNode endNode, in PRInt32 endOffset, in PRBool allowAdjacent, out PRUint32 resultCount, [retval, array, size_is(resultCount)] out nsIDOMRange results);
void GetRangesForIntervalArray(in nsINode beginNode, in PRInt32 beginoffset, in nsINode endNode, in PRInt32 endOffset, in boolean allowAdjacent, in RangeArray results); Native code only!
void GetRangesForIntervalCOMArray(in nsIDOMNode beginNode, in PRInt32 beginOffset, in nsIDOMNode endNode, in PRInt32 endOffset, in PRBool allowAdjacent, in RangeArray results); Native code only! Obsolete since Gecko 12.0
long getTableSelectionType(in nsIDOMRange range);
void removeSelectionListener(in nsISelectionListener listenerToRemove);
void scrollIntoView(in short aRegion, in boolean aIsSynchronous, in short aVPercent, in short aHPercent);
void setAncestorLimiter(in nsIContent aContent); Native code only!
void setPresShell(in nsIPresShell aPresShell); Native code only!
void setTextRangeStyle(in nsIDOMRange range, in constTextRangeStyleRef textRangeStyle); Native code only!
void startBatchChanges();
wstring toStringWithFormat(in string formatType, in unsigned long flags, in PRInt32 wrapColumn);

Attributes

AttributeTypeDescription
canCacheFrameOffsetboolean

Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction.

EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times of nsTextFrame::GetPointFromOffset whose return value is to be cached. See bug 35296 and bug 199412 Native code only!

interlinePositionboolean 
typeshortReturns the type of the selection (see nsISelectionController for available constants). Read only.

Constants

ConstantValueDescription
ENDOFPRECEDINGLINE0 
STARTOFNEXTLINE1 
TABLESELECTION_NONE0 
TABLESELECTION_CELL1 
TABLESELECTION_ROW2 
TABLESELECTION_COLUMN3 
TABLESELECTION_TABLE4 
TABLESELECTION_ALLCELLS5 

Methods

addSelectionListener()

void addSelectionListener(
  in nsISelectionListener newListener
);
Parameters
newListener
 

endBatchChanges()

Will resume User Interface updates after a previous call to startBatchChanges().

void endBatchChanges();
Parameters

None.

Native code only!

getCachedFrameOffset

Returns cached value for nsTextFrame::GetPointFromOffset.

void getCachedFrameOffset(
  in nsIFrame aFrame,
  in PRInt32 inOffset,
  in nsPointRef aPoint
);
Parameters
aFrame
 
inOffset
 
aPoint
 

getEnumerator()

nsIEnumerator getEnumerator();
Parameters

None.

Return value

 

Native code only!

getFrameSelection

nsFrameSelection getFrameSelection();
Parameters

None.

Return value

A reference to the frame selection associated with this selection.

GetRangesForInterval()

Return array of ranges intersecting with the given DOM interval.

void GetRangesForInterval(
  in nsIDOMNode beginNode,
  in PRInt32 beginOffset,
  in nsIDOMNode endNode,
  in PRInt32 endOffset,
  in PRBool allowAdjacent,
  out PRUint32 resultCount,
  [retval, array, size_is(resultCount)] out nsIDOMRange results
);
Parameters
beginNode
 
beginOffset
 
endNode
 
endOffset
These four parameters represent the range to compare against the selection.
allowAdjacent
Specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it.
resultCount
Returns the number of ranges that overlap (or touch) the input range.
results
Returns the ranges that overlap (or touch) the input range.
Native code only!

GetRangesForIntervalCOMArray

Obsolete since Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This method became obsolete in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). Use GetRangesForIntervalArray() instead.

void GetRangesForIntervalCOMArray(
  in nsIDOMNode beginNode,
  in PRInt32 beginOffset,
  in nsIDOMNode endNode,
  in PRInt32 endOffset,
  in PRBool allowAdjacent,
  in RangeArray results
);
Parameters
beginNode
 
beginOffset
 
endNode
 
endOffset
These four parameters represent the range to compare against the selection.
allowAdjacent
Specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it.
results
Returns the ranges that overlap (or touch) the input range.
Native code only!

GetRangesForIntervalArray

void GetRangesForIntervalArray(
  in nsINode beginNode,
  in PRInt32 beginoffset,
  in nsINode endNode,
  in PRInt32 endOffset,
  in boolean allowAdjacent,
  in RangeArray results
);
Parameters
beginNode
 
beginOffset
 
endNode
 
endOffset
These four parameters represent the range to compare against the selection.
allowAdjacent
Specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it.
results
Returns the ranges that overlap (or touch) the input range.

getTableSelectionType()

Test if supplied range points to a single table element.

long getTableSelectionType(
  in nsIDOMRange range
);
Parameters
range
 
Return value

One of TABLESELECTION_* constants. "None" means a table element is not selected.

 

removeSelectionListener()

void removeSelectionListener(
  in nsISelectionListener listenerToRemove
);
Parameters
listenerToRemove
 

scrollIntoView()

Scrolls a region of the selection, so that it is visible in the scrolled view.

void scrollIntoView(
  in short aRegion,
  in boolean aIsSynchronous,
  in short aVPercent,
  in short aHPercent
);
Parameters
aRegion
The region inside the selection to scroll into view (see selection region constants defined in nsISelectionController).
aIsSynchronous
When true, scrolls the selection into view before returning. If false, posts a request which is processed at some point after the method returns.
aVPercent
How to align the frame vertically. A value of 0 means the frame's upper edge is aligned with the top edge of the visible area. A value of 100 means the frame's bottom edge is aligned with the bottom edge of the visible area. For values in between, the point "aVPercent" down the frame is placed at the point "aVPercent" down the visible area. A value of 50 centers the frame vertically. A value of -1 means move the frame the minimum amount necessary in order for the entire frame to be visible vertically (if possible).
aHPercent
How to align the frame horizontally. A value of 0 means the frame's left edge is aligned with the left edge of the visible area. A value of 100 means the frame's right edge is aligned with the right edge of the visible area. For values in between, the point "aHPercent" across the frame is placed at the point "aHPercent" across the visible area. A value of 50 centers the frame horizontally . A value of -1 means move the frame the minimum amount necessary in order for the entire frame to be visible horizontally (if possible).
Native code only!

setAncestorLimiter

void setAncestorLimiter(
  in nsIContent aContent
);
Parameters
aContent
 
Native code only!

setPresShell

Internal utility method to set the pres shell on a newly created selection.

void setPresShell(
  in nsIPresShell aPresShell
);
Parameters
aPresShell
 
Native code only!

setTextRangeStyle

Set the painting style for the range. The range must be a range in the selection. The textRangeStyle will be used by text frame when it is painting the selection.

void setTextRangeStyle(
  in nsIDOMRange range,
  in constTextRangeStyleRef textRangeStyle
);
Parameters
range
 
textRangeStyle
 

startBatchChanges()

Will stop User Interface updates while multiple selection methods are called. Call endBatchChanges() to resume User Interface updates.

void startBatchChanges();
Parameters

None.

toStringWithFormat()

wstring toStringWithFormat(
  in string formatType,
  in unsigned long flags,
  in PRInt32 wrapColumn
);
Parameters
formatType
 
flags
 
wrapColumn
 
Return value

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:35 次

字数:16768

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文