mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 971831 - Replace the call of |RangeBoundToHypertextOffset| with its content. r=surkov
This commit is contained in:
parent
ba44b7e8bd
commit
0c5507d8b8
@ -1761,28 +1761,6 @@ HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame, int32_t aOffset,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// HyperTextAccessible
|
||||
nsresult
|
||||
HyperTextAccessible::RangeBoundToHypertextOffset(nsRange* aRange,
|
||||
bool aIsStartBound,
|
||||
bool aIsStartHTOffset,
|
||||
int32_t* aOffset)
|
||||
{
|
||||
nsINode* node = nullptr;
|
||||
int32_t nodeOffset = 0;
|
||||
|
||||
if (aIsStartBound) {
|
||||
node = aRange->GetStartParent();
|
||||
nodeOffset = aRange->StartOffset();
|
||||
} else {
|
||||
node = aRange->GetEndParent();
|
||||
nodeOffset = aRange->EndOffset();
|
||||
}
|
||||
|
||||
*aOffset = DOMPointToOffset(node, nodeOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// HyperTextAccessible
|
||||
nsresult
|
||||
HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
|
||||
@ -1825,11 +1803,9 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
|
||||
int32_t startOffset = range->StartOffset();
|
||||
if (nsContentUtils::ComparePoints(startNode, startOffset, aNode,
|
||||
aNodeOffset) <= 0) {
|
||||
rv = RangeBoundToHypertextOffset(range, true, true, &startHTOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
startHTOffset = DOMPointToOffset(startNode, startOffset);
|
||||
|
||||
rv = RangeBoundToHypertextOffset(range, false, false, &endHTOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
endHTOffset = DOMPointToOffset(endNode, endOffset);
|
||||
|
||||
if (startHTOffset > *aHTStartOffset)
|
||||
*aHTStartOffset = startHTOffset;
|
||||
@ -1846,13 +1822,12 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
|
||||
}
|
||||
|
||||
// This range came after the point.
|
||||
rv = RangeBoundToHypertextOffset(range, true, false, &endHTOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
endHTOffset = DOMPointToOffset(startNode, startOffset);
|
||||
|
||||
if (idx > 0) {
|
||||
rv = RangeBoundToHypertextOffset(domSel->GetRangeAt(idx - 1), false,
|
||||
true, &startHTOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsRange* prevRange = domSel->GetRangeAt(idx - 1);
|
||||
startHTOffset = DOMPointToOffset(prevRange->GetEndParent(),
|
||||
prevRange->EndOffset());
|
||||
}
|
||||
|
||||
if (startHTOffset > *aHTStartOffset)
|
||||
@ -1868,9 +1843,9 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
|
||||
// the point is not in a range, that we do not need to compute an end offset,
|
||||
// and that we should use the end offset of the last range to compute the
|
||||
// start offset of the text attribute range.
|
||||
rv = RangeBoundToHypertextOffset(domSel->GetRangeAt(rangeCount - 1), false,
|
||||
true, &startHTOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsRange* prevRange = domSel->GetRangeAt(rangeCount - 1);
|
||||
startHTOffset = DOMPointToOffset(prevRange->GetEndParent(),
|
||||
prevRange->EndOffset());
|
||||
|
||||
if (startHTOffset > *aHTStartOffset)
|
||||
*aHTStartOffset = startHTOffset;
|
||||
|
@ -473,25 +473,6 @@ protected:
|
||||
Accessible* aAccessible,
|
||||
mozilla::a11y::DOMPoint* aPoint);
|
||||
|
||||
|
||||
/**
|
||||
* Return hyper text offset for the specified bound of the given DOM range.
|
||||
* If the bound is outside of the hyper text then offset value is either
|
||||
* 0 or number of characters of hyper text, it depends on type of requested
|
||||
* offset. The method is a wrapper for DOMPointToOffset.
|
||||
*
|
||||
* @param aRange [in] the given range
|
||||
* @param aIsStartBound [in] specifies whether the required range bound is
|
||||
* start bound
|
||||
* @param aIsStartOffset [in] the offset type, used when the range bound is
|
||||
* outside of hyper text
|
||||
* @param aHTOffset [out] the result offset
|
||||
*/
|
||||
nsresult RangeBoundToHypertextOffset(nsRange *aRange,
|
||||
bool aIsStartBound,
|
||||
bool aIsStartOffset,
|
||||
int32_t *aHTOffset);
|
||||
|
||||
/**
|
||||
* Set 'misspelled' text attribute and return range offsets where the
|
||||
* attibute is stretched. If the text is not misspelled at the given offset
|
||||
|
Loading…
Reference in New Issue
Block a user