Closed Bug 1484126 Opened 6 years ago Closed 6 years ago

Split HTMLEditor::GetCellDataAt() for internal use

Categories

(Core :: DOM: Editor, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox63 --- wontfix
firefox64 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(22 files)

46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
No description provided.
Priority: -- → P3
nsITableEditor::GetCellDataAt() is an XPCOM method but used internally a lot. Additionally, it scatters a lot of variables (including unused) since it takes a lot of out arguments to return. Therefore, this should be implemented as struct and users should refer each member as result. This does not replaces the callers yet since it's too risky if the caller is not tested by automated test. Following patches will replace the method call and each variable step by step.
This patch makes all nsITableEditor::GetCellDataAt() use CellData, and if each caller checks the result of GetCellDataAt() with NS_FAILED(), this replaces it with CellData::FailedOrNotFound() since GetCellDataAt() returns error even when it does not find a cell element. Finally, copies each CellData member to the variable which received corresponding value from GetCellDataAt() for making this change safe. Note that for easier to review, the copying blocks have odd indent. Those variables will be removed or corrected the indent by the following patches.
A lot of loops in HTMLTableEditor.cpp scans cells along column-axis or row-axis. In those cases, they need to skip columns/rows which are spanned from prior column/row. So, we can rewrite them with CellData::NextColumnIndex() or CellData::NextRowColumn().
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/d7f0492bf262 part 0: Add automated tests for nsITableEditor.getCellDataAt() r=m_kato https://hg.mozilla.org/integration/autoland/rev/bf74fc63e816 part 1: Create CellData struct which implements nsITableEditor::GetCellDataAt() r=m_kato https://hg.mozilla.org/integration/autoland/rev/d3609fcd3c88 part 2: Make all nsITableEditor::GetCellDataAt() use CellData r=m_kato https://hg.mozilla.org/integration/autoland/rev/24e31e2070fa part 3: Make all CellData users use CellData::mCurrent.mRow r=m_kato https://hg.mozilla.org/integration/autoland/rev/539a4c3e1946 part 4: Make all CellData users use CellData::mCurrent.mColumn r=m_kato https://hg.mozilla.org/integration/autoland/rev/181c07ae07c5 part 5: Make all CellData users refer CellData::mElement directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/0f9a168cb7c8 part 6: Make all CellData users refer CellData::mFirst.mRow directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/448d887560d4 part 7: Replace all comparisons of CellData::mFirst.mRow and CellData::mCurrent.mRow with CellData::IsSpannedFromOtherRow() r=m_kato https://hg.mozilla.org/integration/autoland/rev/b23363aa593d part 8: Replace |CellData::mCurrent.mRow - CellData::mFirst.mRow| with CellData::NumberOfPrecedingRows() r=m_kato https://hg.mozilla.org/integration/autoland/rev/8f7afde0a6f6 part 9: Make all CellData users refer CellData::mFirst.mColumn directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/3e9c08f4f705 part 10: Replace all comparisons of CellData::mFirst.mColumn and CellData::mCurrent.mColumn with CellData::IsSpannedFromOtherColumn() or CellData::IsSpannedFromOtherRowOrColumn() r=m_kato https://hg.mozilla.org/integration/autoland/rev/6ab5dd75fbf4 part 11: Make all CellData users refer CellData.mRowSpan directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/e0cea47221b8 part 12: Make all CellData users refer CellData::mColSpan directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/3e1b1e01e6a4 part 13: Make all CellData users refer CellData::mEffectiveRowSpan directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/ed17432df28c part 14: Replace |CellData::mEffectiveRowSpan - 1| with CellData::NumberOfFollowingRows() r=m_kato https://hg.mozilla.org/integration/autoland/rev/e5c8e5cbaf3d part 15: Make all CellData users refer CellData::mEffectiveColspan directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/4c70964d90fd part 16: Replace |CellData::mEffectiveColSpan - 1| with CellData::NumberOfFollowingColumns() r=m_kato https://hg.mozilla.org/integration/autoland/rev/cbb895793f89 part 17: Make all CellData users refer CellData::mIsSelected directly r=m_kato https://hg.mozilla.org/integration/autoland/rev/8a2722c90ac9 part 18: Make HTMLEditor::InsertTableCellsWithTransaction() use CellData::NextColumnIndex() instead of |CellData::mCurrent::mColumn + CellData::mColSpan| r=m_kato https://hg.mozilla.org/integration/autoland/rev/35c3aff251f0 part 19: Replace |CellData::mCurrent.mColumn + CellData::NumberOfFollowingColumns()| with CellData::LastColumnIndex() r=m_kato https://hg.mozilla.org/integration/autoland/rev/19605351b361 part 20: Replace |CellData::mFirst.mColumn + CellData::mEffectiveColSpan| with CellData::NextColumnIndex() r=m_kato https://hg.mozilla.org/integration/autoland/rev/92c8efea7714 part 21: Rewrite some loops in HTMLTableEditor.cpp with CellData::NextColumnIndex() or CellData::NextRowIndex() r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: