Closed Bug 1618085 Opened 5 years ago Closed 5 years ago

Unnecessary calls to aCellFrame->GetRowSpan() and aCellFrame->GetColSpan() in nsCellMap::RemoveCell

Categories

(Core :: Layout: Tables, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: alexhenrie24, Assigned: alexhenrie24)

Details

Attachments

(1 file)

nsCellMap::RemoveCell currently has the following code:

  bool spansCauseRebuild = CellsSpanInOrOut(aRowIndex, aRowIndex + rowSpan - 1,
                                            startColIndex, numCols - 1);
  // XXX if the cell has a col span to the end of the map, and the end has no
  // originating cells, we need to assume that this the only such cell, and
  // rebuild so that there are no extraneous cols at the end. The same is true
  // for removing rows.
  if (!aCellFrame->GetRowSpan() || !aCellFrame->GetColSpan())
    spansCauseRebuild = true;

In other functions in this class with similar logic, there is an outer if (!spansCauseRebuild) to skip the extra checks if we already know that a rebuild is required. We should do the same here because calling a function in another module can be expensive compared to if statements which are practically free.

Assignee: nobody → alexhenrie24
Status: NEW → ASSIGNED
Pushed by shindli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b7887ba587ec Avoid calling Get(Row|Col)Span unnecessarily in nsCellMap::RemoveCell. r=dbaron
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: