mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1136065 - Remove GetRangeCount() in Selection.h. r=ehsan
We replace GetRangeCount() with the identical function RangeCount() to avoid any confusion.
This commit is contained in:
parent
c63833039b
commit
c4db413d6a
@ -139,7 +139,7 @@ AccTextSelChangeEvent::~AccTextSelChangeEvent() { }
|
||||
bool
|
||||
AccTextSelChangeEvent::IsCaretMoveOnly() const
|
||||
{
|
||||
return mSel->GetRangeCount() == 1 && mSel->IsCollapsed() &&
|
||||
return mSel->RangeCount() == 1 && mSel->IsCollapsed() &&
|
||||
((mReason & (nsISelectionListener::COLLAPSETOSTART_REASON |
|
||||
nsISelectionListener::COLLAPSETOEND_REASON)) == 0);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ HyperTextAccessible::AddToSelection(int32_t aStartOffset, int32_t aEndOffset)
|
||||
{
|
||||
dom::Selection* domSel = DOMSelection();
|
||||
return domSel &&
|
||||
SetSelectionBoundsAt(domSel->GetRangeCount(), aStartOffset, aEndOffset);
|
||||
SetSelectionBoundsAt(domSel->RangeCount(), aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -1169,7 +1169,7 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
|
||||
NS_ENSURE_STATE(domSel);
|
||||
|
||||
// Set up the selection.
|
||||
for (int32_t idx = domSel->GetRangeCount() - 1; idx > 0; idx--)
|
||||
for (int32_t idx = domSel->RangeCount() - 1; idx > 0; idx--)
|
||||
domSel->RemoveRange(domSel->GetRangeAt(idx));
|
||||
SetSelectionBoundsAt(0, aStartPos, aEndPos);
|
||||
|
||||
@ -1474,7 +1474,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
|
||||
return false;
|
||||
|
||||
nsRefPtr<nsRange> range;
|
||||
uint32_t rangeCount = domSel->GetRangeCount();
|
||||
uint32_t rangeCount = domSel->RangeCount();
|
||||
if (aSelectionNum == static_cast<int32_t>(rangeCount))
|
||||
range = new nsRange(mContent);
|
||||
else
|
||||
@ -1502,7 +1502,7 @@ HyperTextAccessible::RemoveFromSelection(int32_t aSelectionNum)
|
||||
if (!domSel)
|
||||
return false;
|
||||
|
||||
if (aSelectionNum < 0 || aSelectionNum >= domSel->GetRangeCount())
|
||||
if (aSelectionNum < 0 || aSelectionNum >= static_cast<int32_t>(domSel->RangeCount()))
|
||||
return false;
|
||||
|
||||
domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum));
|
||||
@ -1948,7 +1948,7 @@ HyperTextAccessible::GetSpellTextAttr(nsINode* aNode,
|
||||
if (!domSel)
|
||||
return;
|
||||
|
||||
int32_t rangeCount = domSel->GetRangeCount();
|
||||
int32_t rangeCount = domSel->RangeCount();
|
||||
if (rangeCount <= 0)
|
||||
return;
|
||||
|
||||
|
@ -6772,7 +6772,7 @@ nsContentUtils::GetSelectionInTextControl(Selection* aSelection,
|
||||
{
|
||||
MOZ_ASSERT(aSelection && aRoot);
|
||||
|
||||
if (!aSelection->GetRangeCount()) {
|
||||
if (!aSelection->RangeCount()) {
|
||||
// Nothing selected
|
||||
aOutStartOffset = aOutEndOffset = 0;
|
||||
return;
|
||||
@ -6833,7 +6833,7 @@ nsContentUtils::GetSelectionBoundingRect(Selection* aSel)
|
||||
res = nsLayoutUtils::TransformFrameRectToAncestor(frame, res, relativeTo);
|
||||
}
|
||||
} else {
|
||||
int32_t rangeCount = aSel->GetRangeCount();
|
||||
int32_t rangeCount = aSel->RangeCount();
|
||||
nsLayoutUtils::RectAccumulator accumulator;
|
||||
for (int32_t idx = 0; idx < rangeCount; ++idx) {
|
||||
nsRange* range = aSel->GetRangeAt(idx);
|
||||
|
@ -1354,7 +1354,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
nsCOMPtr<nsIDOMNode> commonParent;
|
||||
Selection* selection = static_cast<Selection*>(aSelection);
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
|
||||
// if selection is uninitialized return
|
||||
if (!rangeCount)
|
||||
|
@ -86,7 +86,7 @@ NS_IMETHODIMP TypeInState::NotifySelectionChanged(nsIDOMDocument *, nsISelection
|
||||
nsRefPtr<Selection> selection = static_cast<Selection*>(aSelection);
|
||||
|
||||
if (aSelection) {
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
|
||||
if (selection->Collapsed() && rangeCount) {
|
||||
nsCOMPtr<nsIDOMNode> selNode;
|
||||
|
@ -3561,7 +3561,7 @@ nsEditor::GetStartNodeAndOffset(Selection* aSelection, nsINode** aStartNode,
|
||||
*aStartNode = nullptr;
|
||||
*aStartOffset = 0;
|
||||
|
||||
NS_ENSURE_TRUE(aSelection->GetRangeCount(), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aSelection->RangeCount(), NS_ERROR_FAILURE);
|
||||
|
||||
const nsRange* range = aSelection->GetRangeAt(0);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
@ -3608,7 +3608,7 @@ nsEditor::GetEndNodeAndOffset(Selection* aSelection, nsINode** aEndNode,
|
||||
*aEndNode = nullptr;
|
||||
*aEndOffset = 0;
|
||||
|
||||
NS_ENSURE_TRUE(aSelection->GetRangeCount(), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aSelection->RangeCount(), NS_ERROR_FAILURE);
|
||||
|
||||
const nsRange* range = aSelection->GetRangeAt(0);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
@ -4162,7 +4162,7 @@ nsEditor::CreateTxnForDeleteSelection(EDirection aAction,
|
||||
// allocate the out-param transaction
|
||||
nsRefPtr<EditAggregateTxn> aggTxn = new EditAggregateTxn();
|
||||
|
||||
for (int32_t rangeIdx = 0; rangeIdx < selection->GetRangeCount(); ++rangeIdx) {
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < selection->RangeCount(); ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
NS_ENSURE_STATE(range);
|
||||
|
||||
|
@ -315,7 +315,7 @@ nsHTMLEditRules::BeforeEdit(EditAction action,
|
||||
nsRefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
|
||||
// get the selection location
|
||||
NS_ENSURE_STATE(selection->GetRangeCount());
|
||||
NS_ENSURE_STATE(selection->RangeCount());
|
||||
mRangeItem->startNode = selection->GetRangeAt(0)->GetStartParent();
|
||||
mRangeItem->startOffset = selection->GetRangeAt(0)->StartOffset();
|
||||
mRangeItem->endNode = selection->GetRangeAt(0)->GetEndParent();
|
||||
@ -582,7 +582,7 @@ nsHTMLEditRules::WillDoAction(Selection* aSelection,
|
||||
if (!aSelection) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ENSURE_TRUE(aSelection->GetRangeCount(), NS_OK);
|
||||
NS_ENSURE_TRUE(aSelection->RangeCount(), NS_OK);
|
||||
|
||||
nsRefPtr<nsRange> range = aSelection->GetRangeAt(0);
|
||||
nsCOMPtr<nsINode> selStartNode = range->GetStartParent();
|
||||
@ -2425,7 +2425,7 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
||||
// except table elements.
|
||||
join = true;
|
||||
|
||||
uint32_t rangeCount = aSelection->GetRangeCount();
|
||||
uint32_t rangeCount = aSelection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = aSelection->GetRangeAt(rangeIdx);
|
||||
|
||||
@ -6050,7 +6050,7 @@ nsHTMLEditRules::GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes,
|
||||
// is only in part of it. used by list item dialog.
|
||||
if (aEntireList)
|
||||
{
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
nsCOMPtr<nsIDOMNode> commonParent, parent, tmp;
|
||||
@ -7519,7 +7519,7 @@ nsHTMLEditRules::ReapplyCachedStyles()
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsRefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
MOZ_ASSERT(selection);
|
||||
if (!selection->GetRangeCount()) {
|
||||
if (!selection->RangeCount()) {
|
||||
// Nothing to do
|
||||
return NS_OK;
|
||||
}
|
||||
@ -8179,7 +8179,7 @@ nsHTMLEditRules::SelectionEndpointInNode(nsINode* aNode, bool* aResult)
|
||||
nsRefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
NS_ENSURE_STATE(selection);
|
||||
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
nsCOMPtr<nsIDOMNode> startParent, endParent;
|
||||
|
@ -3275,7 +3275,7 @@ nsHTMLEditor::GetIsSelectionEditable(bool* aIsSelectionEditable)
|
||||
// Per the editing spec as of June 2012: we have to have a selection whose
|
||||
// start and end nodes are editable, and which share an ancestor editing
|
||||
// host. (Bug 766387.)
|
||||
*aIsSelectionEditable = selection->GetRangeCount() &&
|
||||
*aIsSelectionEditable = selection->RangeCount() &&
|
||||
selection->GetAnchorNode()->IsEditable() &&
|
||||
selection->GetFocusNode()->IsEditable();
|
||||
|
||||
@ -4547,7 +4547,7 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
|
||||
{
|
||||
// loop thru the ranges in the selection
|
||||
nsAutoString bgcolor; bgcolor.AssignLiteral("bgcolor");
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsCOMPtr<nsIDOMNode> cachedBlockParent = nullptr;
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
|
@ -144,7 +144,7 @@ nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty,
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (!cancel && !handled) {
|
||||
// loop thru the ranges in the selection
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
|
||||
@ -1369,7 +1369,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
|
||||
if (!cancel && !handled)
|
||||
{
|
||||
// loop thru the ranges in the selection
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
if (aProperty == nsGkAtoms::name) {
|
||||
@ -1542,7 +1542,7 @@ nsHTMLEditor::RelativeFontChange( int32_t aSizeChange)
|
||||
nsAutoTxnsConserveSelection dontSpazMySelection(this);
|
||||
|
||||
// loop thru the ranges in the selection
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
uint32_t rangeCount = selection->RangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
|
||||
|
@ -55,7 +55,7 @@ nsSelectionState::SaveSelection(Selection* aSel)
|
||||
{
|
||||
MOZ_ASSERT(aSel);
|
||||
int32_t arrayCount = mArray.Length();
|
||||
int32_t rangeCount = aSel->GetRangeCount();
|
||||
int32_t rangeCount = aSel->RangeCount();
|
||||
|
||||
// if we need more items in the array, new them
|
||||
if (arrayCount < rangeCount) {
|
||||
|
@ -2956,7 +2956,7 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell)
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
|
||||
// Don't even try if index exceeds range count
|
||||
if (mSelectedCellIndex >= rangeCount)
|
||||
|
@ -1347,7 +1347,7 @@ mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
||||
// elements inside the selection
|
||||
nsTArray<nsRefPtr<nsRange>> ranges;
|
||||
|
||||
int32_t count = aSpellCheckSelection->GetRangeCount();
|
||||
int32_t count = aSpellCheckSelection->RangeCount();
|
||||
|
||||
for (int32_t idx = 0; idx < count; idx++) {
|
||||
nsRange *range = aSpellCheckSelection->GetRangeAt(idx);
|
||||
@ -1441,7 +1441,7 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
||||
// see if the selection has any ranges, if not, then we can optimize checking
|
||||
// range inclusion later (we have no ranges when we are initially checking or
|
||||
// when there are no misspelled words yet).
|
||||
int32_t originalRangeCount = aSpellCheckSelection->GetRangeCount();
|
||||
int32_t originalRangeCount = aSpellCheckSelection->RangeCount();
|
||||
|
||||
// set the starting DOM position to be the beginning of our range
|
||||
{
|
||||
@ -1643,7 +1643,7 @@ mozInlineSpellChecker::ResumeCheck(mozInlineSpellStatus* aStatus)
|
||||
rv = mSpellCheck->GetCurrentDictionary(currentDictionary);
|
||||
if (NS_FAILED(rv)) {
|
||||
// no active dictionary
|
||||
int32_t count = spellCheckSelection->GetRangeCount();
|
||||
int32_t count = spellCheckSelection->RangeCount();
|
||||
for (int32_t index = count - 1; index >= 0; index--) {
|
||||
nsRange *checkRange = spellCheckSelection->GetRangeAt(index);
|
||||
if (checkRange) {
|
||||
@ -1714,7 +1714,7 @@ mozInlineSpellChecker::CleanupRangesInSelection(Selection *aSelection)
|
||||
if (!aSelection)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t count = aSelection->GetRangeCount();
|
||||
int32_t count = aSelection->RangeCount();
|
||||
|
||||
for (int32_t index = 0; index < count; index++)
|
||||
{
|
||||
|
@ -457,7 +457,7 @@ SelectionCarets::UpdateSelectionCarets()
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
nsRefPtr<nsRange> firstRange = selection->GetRangeAt(0);
|
||||
nsRefPtr<nsRange> lastRange = selection->GetRangeAt(rangeCount - 1);
|
||||
|
||||
@ -763,7 +763,7 @@ SelectionCarets::DragSelection(const nsPoint &movePoint)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
if (rangeCount <= 0) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
@ -819,7 +819,7 @@ SelectionCarets::GetCaretYCenterPosition()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
if (rangeCount <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -115,7 +115,6 @@ public:
|
||||
nsresult Collapse(nsINode* aParentNode, int32_t aOffset);
|
||||
nsresult Extend(nsINode* aParentNode, int32_t aOffset);
|
||||
nsRange* GetRangeAt(int32_t aIndex);
|
||||
int32_t GetRangeCount() { return mRanges.Length(); }
|
||||
|
||||
// Get the anchor-to-focus range if we don't care which end is
|
||||
// anchor and which end is focus.
|
||||
|
@ -3178,7 +3178,7 @@ nsFrameSelection::DeleteFromDocument()
|
||||
}
|
||||
|
||||
nsRefPtr<Selection> selection = mDomSelections[index];
|
||||
for (int32_t rangeIdx = 0; rangeIdx < selection->GetRangeCount(); ++rangeIdx) {
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < selection->RangeCount(); ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
res = range->DeleteContents();
|
||||
if (NS_FAILED(res))
|
||||
|
@ -1105,7 +1105,7 @@ nsPrintEngine::IsThereARangeSelection(nsIDOMWindow* aDOMWin)
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t rangeCount = selection->GetRangeCount();
|
||||
int32_t rangeCount = selection->RangeCount();
|
||||
if (!rangeCount) {
|
||||
return false;
|
||||
}
|
||||
@ -2014,7 +2014,7 @@ nsPrintEngine::UpdateSelectionAndShrinkPrintObject(nsPrintObject* aPO,
|
||||
selectionPS->RemoveAllRanges();
|
||||
}
|
||||
if (selection && selectionPS) {
|
||||
int32_t cnt = selection->GetRangeCount();
|
||||
int32_t cnt = selection->RangeCount();
|
||||
int32_t inx;
|
||||
for (inx = 0; inx < cnt; ++inx) {
|
||||
selectionPS->AddRange(selection->GetRangeAt(inx));
|
||||
@ -2428,7 +2428,7 @@ static nsresult CloneSelection(nsIDocument* aOrigDoc, nsIDocument* aDoc)
|
||||
shell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_STATE(origSelection && selection);
|
||||
|
||||
int32_t rangeCount = origSelection->GetRangeCount();
|
||||
int32_t rangeCount = origSelection->RangeCount();
|
||||
for (int32_t i = 0; i < rangeCount; ++i) {
|
||||
CloneRangeToSelection(origSelection->GetRangeAt(i), aDoc, selection);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user