Bug 1484126 - part 10: Replace all comparisons of CellData::mFirst.mColumn and CellData::mCurrent.mColumn with CellData::IsSpannedFromOtherColumn() or CellData::IsSpannedFromOtherRowOrColumn() r=m_kato

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2018-10-15 08:06:14 +00:00
Родитель 632c38026b
Коммит 5b5f57c621
1 изменённых файлов: 10 добавлений и 16 удалений

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

@ -530,7 +530,7 @@ HTMLEditor::InsertTableColumnsWithTransaction(int32_t aNumberOfColumnsToInsert,
continue;
}
if (cellData.mFirst.mColumn < cellData.mCurrent.mColumn) {
if (cellData.IsSpannedFromOtherColumn()) {
// If we have a cell spanning this location, simply increase its
// colspan to keep table rectangular.
// Note: we do nothing if colsspan=0, since it should automatically
@ -1407,7 +1407,7 @@ HTMLEditor::DeleteTableColumnWithTransaction(Element& aTableElement,
// Find cells that don't start in column we are deleting.
MOZ_ASSERT(colSpan >= 0);
if (cellData.mFirst.mColumn < cellData.mCurrent.mColumn || colSpan != 1) {
if (cellData.IsSpannedFromOtherColumn() || colSpan != 1) {
// If we have a cell spanning this location, decrease its colspan to
// keep table rectangular, but if colspan is 0, it'll be adjusted
// automatically.
@ -1415,7 +1415,7 @@ HTMLEditor::DeleteTableColumnWithTransaction(Element& aTableElement,
NS_WARNING_ASSERTION(colSpan > 1, "colspan should be 2 or larger");
SetColSpan(cellData.mElement, colSpan - 1);
}
if (cellData.mFirst.mColumn == cellData.mCurrent.mColumn) {
if (!cellData.IsSpannedFromOtherColumn()) {
// Cell is in column to be deleted, but must have colspan > 1,
// so delete contents of cell instead of cell itself (We must have
// reset colspan above).
@ -1905,8 +1905,7 @@ HTMLEditor::SelectBlockOfCells(Element* aStartCell,
// XXX So, we should distinguish whether CellData returns error or just
// not found later.
if (!isSelected && cellData.mElement &&
!cellData.IsSpannedFromOtherRow() &&
cellData.mCurrent.mColumn == cellData.mFirst.mColumn) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
rv = AppendNodeToSelectionAsRange(cellData.mElement);
if (NS_FAILED(rv)) {
break;
@ -1978,8 +1977,7 @@ HTMLEditor::SelectAllTableCells()
// XXX So, we should distinguish whether CellData returns error or just
// not found later.
if (cellData.mElement &&
!cellData.IsSpannedFromOtherRow() &&
cellData.mCurrent.mColumn == cellData.mFirst.mColumn) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
rv = AppendNodeToSelectionAsRange(cellData.mElement);
if (NS_FAILED(rv)) {
break;
@ -2070,8 +2068,7 @@ HTMLEditor::SelectTableRow()
// XXX So, we should distinguish whether CellData returns error or just
// not found later.
if (cellData.mElement &&
!cellData.IsSpannedFromOtherRow() &&
cellData.mFirst.mColumn == cellData.mCurrent.mColumn) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
rv = AppendNodeToSelectionAsRange(cellData.mElement);
if (NS_FAILED(rv)) {
break;
@ -2157,8 +2154,7 @@ HTMLEditor::SelectTableColumn()
// XXX So, we should distinguish whether CellData returns error or just
// not found later.
if (cellData.mElement &&
!cellData.IsSpannedFromOtherRow() &&
cellData.mFirst.mColumn == cellData.mCurrent.mColumn) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
rv = AppendNodeToSelectionAsRange(cellData.mElement);
if (NS_FAILED(rv)) {
break;
@ -3034,8 +3030,7 @@ HTMLEditor::FixBadRowSpan(Element* aTable,
// XXX So, this does not assume that CellData returns error when just
// not found a cell. Fix this later.
if (cellData.mElement && rowSpan > 0 &&
!cellData.IsSpannedFromOtherRow() &&
cellData.mFirst.mColumn == cellData.mCurrent.mColumn) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
nsresult rv = SetRowSpan(cellData.mElement, rowSpan-rowsReduced);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -3094,7 +3089,7 @@ HTMLEditor::FixBadColSpan(Element* aTable,
break;
}
if (colSpan > 0 &&
cellData.mFirst.mColumn == cellData.mCurrent.mColumn &&
!cellData.IsSpannedFromOtherColumn() &&
(colSpan < minColSpan || minColSpan == -1)) {
minColSpan = colSpan;
}
@ -3122,8 +3117,7 @@ HTMLEditor::FixBadColSpan(Element* aTable,
// XXX So, this does not assume that CellData returns error when just
// not found a cell. Fix this later.
if (cellData.mElement && colSpan > 0 &&
cellData.mFirst.mColumn == cellData.mCurrent.mColumn &&
!cellData.IsSpannedFromOtherRow()) {
!cellData.IsSpannedFromOtherRowOrColumn()) {
nsresult rv = SetColSpan(cellData.mElement, colSpan-colsReduced);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;