Stop abusing RenderTableSection::needsRecalcCells logic
https://bugs.webkit.org/show_bug.cgi?id=71420

Reviewed by Darin Adler.

Source/WebCore:

Change covered by existing tests like fast/repaint/table-extra-bottom-grow.html
and fast/table/row-height-recalc* (among others).

Cell recalculation is very expensive and should only be called when the section's structure
changed in a way that requires a safe update to its structure (like removing a row as our
column split may not be appropriate anymore).

The current code would abuse cell recalculation to actually reset the logical height on the
RowStruct. This change makes it do the right thing.

* rendering/RenderTableCell.h:
* rendering/RenderTableRow.h:
Removed styleWillChange override as it was unneeded.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleDidChange):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::styleDidChange):
Move the code from styleWillChange to styleDidChange.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::rowLogicalHeightChanged):
This function just reset the height on the |RowStruct| which is the
only part of recalcCells that we would need.

(WebCore::RenderTableSection::rowIndexForRenderer):
Added this function to find out which index a column has (strangely
RenderTableRow does not have this information).

* rendering/RenderTableSection.h: Added the 2 previous functions.

LayoutTests:

* platform/chromium-linux/fast/repaint/table-extra-bottom-grow-expected.png:
Update this test as this is a progression: we are not over-repainting the table
anymore.

* platform/chromium/test_expectations.txt:
* platform/efl/Skipped:
* platform/mac/Skipped:
* platform/qt/test_expectations.txt:
Skipped the test here as it needs a rebaseline.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@99212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp
index 91dd49f..a8bc77c 100644
--- a/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/Source/WebCore/rendering/RenderTableSection.cpp
@@ -1158,6 +1158,11 @@
     setNeedsLayout(true);
 }
 
+void RenderTableSection::rowLogicalHeightChanged(unsigned rowIndex)
+{
+    setRowLogicalHeightToRowStyleLogicalHeightIfNotRelative(m_grid[rowIndex]);
+}
+
 void RenderTableSection::setNeedsCellRecalc()
 {
     m_needsCellRecalc = true;
@@ -1300,4 +1305,14 @@
 
 }
 
+unsigned RenderTableSection::rowIndexForRenderer(const RenderTableRow* row) const
+{
+    for (size_t i = 0; i < m_grid.size(); ++i) {
+        if (m_grid[i].rowRenderer == row)
+            return i;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
 } // namespace WebCore