From e09be3fb17865968a70b3baa9a4f5f61a0189fb2 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Wed, 16 Sep 2020 02:17:33 +0000 Subject: [PATCH] Bug 1664109 - Fix `!=` operator of `EditorDOMRangeBase` r=m_kato This is causes taking back bugs in `WSRunScanner::GetNewInvisibleLeadingWhiteSpaceRangeIfSplittingAt()` and `WSRunScanner::GetNewInvisibleTrailingWhiteSpaceRangeIfSplittingAt()` (I.e., they were fixed by bug 1647556). Therefore, this removes the odd `if` blocks which are pointed with `XXX` comment for avoiding "regressions" (without them, some WPTs for `InputEvents.getTargetRanges()` become failure). Depends on D89582 Differential Revision: https://phabricator.services.mozilla.com/D89869 --- editor/libeditor/EditorDOMPoint.h | 2 +- editor/libeditor/WSRunObject.h | 12 ------------ editor/libeditor/crashtests/crashtests.list | 2 +- editor/libeditor/tests/test_bug1425997.html | 4 ++-- editor/libeditor/tests/test_bug772796.html | 2 -- ...ts-get-target-ranges-backspace.tentative.html.ini | 6 ------ 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/editor/libeditor/EditorDOMPoint.h b/editor/libeditor/EditorDOMPoint.h index 9084ad369461..81e3a4a60e21 100644 --- a/editor/libeditor/EditorDOMPoint.h +++ b/editor/libeditor/EditorDOMPoint.h @@ -1100,7 +1100,7 @@ class EditorDOMRangeBase final { } template bool operator!=(const OtherRangeType& aOther) const { - return *this == aOther; + return !(*this == aOther); } EditorDOMRangeInTexts GetAsInTexts() const { diff --git a/editor/libeditor/WSRunObject.h b/editor/libeditor/WSRunObject.h index e0d2754970ef..a3cefd850b86 100644 --- a/editor/libeditor/WSRunObject.h +++ b/editor/libeditor/WSRunObject.h @@ -959,12 +959,6 @@ class MOZ_STACK_CLASS WSRunScanner final { if (!trailingWhiteSpaceRange.IsPositioned()) { return trailingWhiteSpaceRange; } - // XXX Why don't we need to treat new trailing white-spaces are invisible - // when the trailing white-spaces are only the content in current - // line? - if (trailingWhiteSpaceRange != InvisibleLeadingWhiteSpaceRangeRef()) { - return EditorDOMRange(); - } // If the point is before the trailing white-spaces, the new line won't // start with leading white-spaces. if (aPointToSplit.IsBefore(trailingWhiteSpaceRange.StartRef())) { @@ -1008,12 +1002,6 @@ class MOZ_STACK_CLASS WSRunScanner final { if (!leadingWhiteSpaceRange.IsPositioned()) { return leadingWhiteSpaceRange; } - // XXX Why don't we need to treat new leading white-spaces are invisible - // when the leading white-spaces are only the content in current - // line? - if (leadingWhiteSpaceRange != InvisibleTrailingWhiteSpaceRangeRef()) { - return EditorDOMRange(); - } // If the point equals or is after the leading white-spaces, the line // will end without trailing white-spaces. if (leadingWhiteSpaceRange.EndRef().IsBefore(aPointToSplit)) { diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index fbf4a94ab454..6ff616e06b43 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -96,7 +96,7 @@ load 1402526.html pref(dom.document.exec_command.nested_calls_allowed,true) asserts(1) load 1402904.html # assertion is that mutation event listener caused by execCommand calls another execCommand pref(dom.document.exec_command.nested_calls_allowed,true) asserts(1) load 1405747.html # assertion is that mutation event listener caused by execCommand calls another execCommand load 1405897.html -asserts(6) load 1408170.html # 4: assertion in WSRunScanner::GetEditableBlockParentOrTopmotEditableInlineContent(), 2: assertion in WhiteSpaceVisibilityKeeper::DeleteInvisibleASCIIWhiteSpacesInternal() +asserts(4) load 1408170.html # 4: assertion in WSRunScanner::GetEditableBlockParentOrTopmotEditableInlineContent() asserts(0-1) load 1414581.html load 1415231.html load 1423767.html diff --git a/editor/libeditor/tests/test_bug1425997.html b/editor/libeditor/tests/test_bug1425997.html index 6787420cae2f..637d77a0caaf 100644 --- a/editor/libeditor/tests/test_bug1425997.html +++ b/editor/libeditor/tests/test_bug1425997.html @@ -24,9 +24,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1425997