Bug 1587433: part 7.5) Adapt callers of `RangeBoundaryBase::Offset()`. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D54495

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2019-12-16 11:31:46 +00:00
Родитель 06368d19e3
Коммит 1b964c5f36
3 изменённых файлов: 20 добавлений и 10 удалений

Просмотреть файл

@ -154,18 +154,22 @@ nsresult RangeUtils::CompareNodeToRange(nsINode* aNode,
// is RANGE(start) <= NODE(start) ?
bool disconnected = false;
*aNodeIsBeforeRange =
nsContentUtils::ComparePoints(aAbstractRange->StartRef().Container(),
aAbstractRange->StartRef().Offset(), parent,
nodeStart, &disconnected) > 0;
nsContentUtils::ComparePoints(
aAbstractRange->StartRef().Container(),
*aAbstractRange->StartRef().Offset(
RangeBoundary::OffsetFilter::kValidOrInvalidOffsets),
parent, nodeStart, &disconnected) > 0;
if (NS_WARN_IF(disconnected)) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
// is RANGE(end) >= NODE(end) ?
*aNodeIsAfterRange =
nsContentUtils::ComparePoints(aAbstractRange->EndRef().Container(),
aAbstractRange->EndRef().Offset(), parent,
nodeEnd, &disconnected) < 0;
nsContentUtils::ComparePoints(
aAbstractRange->EndRef().Container(),
*aAbstractRange->EndRef().Offset(
RangeBoundary::OffsetFilter::kValidOrInvalidOffsets),
parent, nodeEnd, &disconnected) < 0;
if (NS_WARN_IF(disconnected)) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}

Просмотреть файл

@ -2496,9 +2496,14 @@ int32_t nsContentUtils::ComparePoints(
}
// XXX Re-implement this without calling `Offset()` as far as possible,
// and the other overload should be an alias of this.
return ComparePoints(aFirstBoundary.Container(), aFirstBoundary.Offset(),
aSecondBoundary.Container(), aSecondBoundary.Offset(),
aDisconnected);
return ComparePoints(
aFirstBoundary.Container(),
*aFirstBoundary.Offset(
RangeBoundaryBase<FPT, FRT>::OffsetFilter::kValidOrInvalidOffsets),
aSecondBoundary.Container(),
*aSecondBoundary.Offset(
RangeBoundaryBase<SPT, SRT>::OffsetFilter::kValidOrInvalidOffsets),
aDisconnected);
}
inline bool IsCharInSet(const char* aSet, const char16_t aChar) {

Просмотреть файл

@ -7194,7 +7194,8 @@ EditorDOMPoint HTMLEditor::GetWhiteSpaceEndPoint(
bool isSpace = false, isNBSP = false;
nsIContent* newContent = aPoint.Container()->AsContent();
int32_t newOffset = aPoint.Offset();
int32_t newOffset = *aPoint.Offset(
RangeBoundaryBase<PT, RT>::OffsetFilter::kValidOrInvalidOffsets);
while (newContent) {
int32_t offset = -1;
nsCOMPtr<nsIContent> content;