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
This commit is contained in:
Masayuki Nakano 2020-09-16 02:17:33 +00:00
Родитель a5c5234e6f
Коммит e09be3fb17
6 изменённых файлов: 4 добавлений и 24 удалений

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

@ -1100,7 +1100,7 @@ class EditorDOMRangeBase final {
}
template <typename OtherRangeType>
bool operator!=(const OtherRangeType& aOther) const {
return *this == aOther;
return !(*this == aOther);
}
EditorDOMRangeInTexts GetAsInTexts() const {

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

@ -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)) {

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

@ -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

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

@ -24,9 +24,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1425997
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
// 3 assertions are recorded due to nested execCommand() but not a problem.
// 2 assertions are recorded due to nested execCommand() but not a problem.
// They are necessary to detect invalid method call without mutation event listers.
SimpleTest.expectAssertions(3, 3);
SimpleTest.expectAssertions(2, 2);
SimpleTest.waitForFocus(async function() {
await SpecialPowers.pushPrefEnv({set: [["dom.document.exec_command.nested_calls_allowed", true]]});
let selection = window.getSelection();

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

@ -144,8 +144,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=772796
/** Test for Bug 772796 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.expectAssertions(13); // assertion in WhiteSpaceVisibilityKeeper::DeleteInvisibleASCIIWhiteSpaces()
SimpleTest.waitForFocus(function() {
var sel = window.getSelection();
var theEdit = document.getElementById("editable");

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

@ -20,9 +20,6 @@
[Backspace at "<p>abc </p><pre>[\] def</pre>"]
expected: FAIL
[Backspace at "<div>abc <p> [\]def<br>ghi</p></div>"]
expected: FAIL
[Backspace at "<p> a[\]bc</p>"]
expected: FAIL
@ -38,9 +35,6 @@
[Backspace at "<p>abc [</p><p>\] def</p>"]
expected: FAIL
[Backspace at "<div><p>abc </p> [\]def</div>"]
expected: FAIL
[Backspace at "<p>a<span>b</span>[\]c</p>"]
expected: FAIL