Bug 1562655: rename `Selection::HasSameRoot` to `HasSameRootOrSameComposedDoc`. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D36492
This commit is contained in:
Mirko Brodesser 2019-07-01 17:20:28 +02:00
Родитель f6f9c2a74c
Коммит 7f1ac5a842
2 изменённых файлов: 7 добавлений и 8 удалений

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

@ -2188,7 +2188,7 @@ void Selection::Collapse(const RawRangeBoundary& aPoint, ErrorResult& aRv) {
return;
}
if (!HasSameRoot(*aPoint.Container())) {
if (!HasSameRootOrSameComposedDoc(*aPoint.Container())) {
// Return with no error
return;
}
@ -2489,7 +2489,7 @@ void Selection::Extend(nsINode& aContainer, uint32_t aOffset,
return;
}
if (!HasSameRoot(aContainer)) {
if (!HasSameRootOrSameComposedDoc(aContainer)) {
// Return with no error
return;
}
@ -2759,7 +2759,7 @@ void Selection::SelectAllChildren(nsINode& aNode, ErrorResult& aRv) {
return;
}
if (!HasSameRoot(aNode)) {
if (!HasSameRootOrSameComposedDoc(aNode)) {
// Return with no error
return;
}
@ -3405,8 +3405,8 @@ void Selection::SetBaseAndExtentInternal(InLimiter aInLimiter,
return;
}
if (!HasSameRoot(*aAnchorRef.Container()) ||
!HasSameRoot(*aFocusRef.Container())) {
if (!HasSameRootOrSameComposedDoc(*aAnchorRef.Container()) ||
!HasSameRootOrSameComposedDoc(*aFocusRef.Container())) {
// Return with no error
return;
}
@ -3670,7 +3670,7 @@ AutoHideSelectionChanges::AutoHideSelectionChanges(
: AutoHideSelectionChanges(
aFrame ? aFrame->GetSelection(SelectionType::eNormal) : nullptr) {}
bool Selection::HasSameRoot(nsINode& aNode) {
bool Selection::HasSameRootOrSameComposedDoc(const nsINode& aNode) {
nsINode* root = aNode.SubtreeRoot();
Document* doc = GetParentObject();
return doc == root || (root && doc == root->GetComposedDoc());

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

@ -590,8 +590,7 @@ class Selection final : public nsSupportsWeakReference,
MOZ_CAN_RUN_SCRIPT nsresult DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint);
// We are not allowed to be in nodes whose root is not our document
bool HasSameRoot(nsINode& aNode);
bool HasSameRootOrSameComposedDoc(const nsINode& aNode);
// XXX Please don't add additional uses of this method, it's only for
// XXX supporting broken code (bug 1245883) in the following classes: