зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1361229 - Add explanatory comments and assertion to nsTableFrame to ensure that the value of both smallerIter and aDeletedRowStoredIndex remains valid. r=dbaron
MozReview-Commit-ID: A0dqwpqB2Q0 --HG-- extra : rebase_source : 6ee0eff4e8bdf8b80090f2deea6824ae3226ef64
This commit is contained in:
Родитель
d0c49e91e8
Коммит
ccf94e7ff7
|
@ -992,10 +992,25 @@ nsTableFrame::AddDeletedRowIndex(int32_t aDeletedRowStoredIndex)
|
|||
// smallerIter->second < aDeletedRowStoredIndex < greaterIter->first
|
||||
auto greaterIter = mDeletedRowIndexRanges.upper_bound(aDeletedRowStoredIndex);
|
||||
auto smallerIter = greaterIter;
|
||||
|
||||
if (smallerIter != mDeletedRowIndexRanges.begin()) {
|
||||
smallerIter--;
|
||||
// While greaterIter might be out-of-bounds (by being equal to end()),
|
||||
// smallerIter now cannot be, since we returned early above for a 0-size map.
|
||||
}
|
||||
|
||||
// Note: smallerIter can only be equal to greaterIter when both
|
||||
// of them point to the beginning of the map and in that case smallerIter
|
||||
// does not "exist" but we clip smallerIter to point to beginning of map
|
||||
// so that it doesn't point to something unknown or outside the map boundry.
|
||||
// Note: When greaterIter is not the end (i.e. it "exists") upper_bound()
|
||||
// ensures aDeletedRowStoredIndex < greaterIter->first so no need to
|
||||
// assert that.
|
||||
MOZ_ASSERT(smallerIter == greaterIter ||
|
||||
aDeletedRowStoredIndex > smallerIter->second,
|
||||
"aDeletedRowIndexRanges already contains aDeletedRowStoredIndex! "
|
||||
"Trying to delete an already deleted row?");
|
||||
|
||||
if (smallerIter->second == aDeletedRowStoredIndex - 1) {
|
||||
if (greaterIter != mDeletedRowIndexRanges.end() &&
|
||||
greaterIter->first == aDeletedRowStoredIndex + 1) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче