Skip to content

Commit 4355d20

Browse files
author
Julien Chaffraix
committed
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. Canonical link: https://commits.webkit.org/87802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3227c42 commit 4355d20

13 files changed

Lines changed: 97 additions & 23 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2011-11-03 Julien Chaffraix <jchaffraix@webkit.org>
2+
3+
Stop abusing RenderTableSection::needsRecalcCells logic
4+
https://bugs.webkit.org/show_bug.cgi?id=71420
5+
6+
Reviewed by Darin Adler.
7+
8+
* platform/chromium-linux/fast/repaint/table-extra-bottom-grow-expected.png:
9+
Update this test as this is a progression: we are not over-repainting the table
10+
anymore.
11+
12+
* platform/chromium/test_expectations.txt:
13+
* platform/efl/Skipped:
14+
* platform/mac/Skipped:
15+
* platform/qt/test_expectations.txt:
16+
Skipped the test here as it needs a rebaseline.
17+
118
2011-11-03 Kentaro Hara <haraken@chromium.org>
219

320
Unreviewed rebaselining. Unskipped progress-event-constructor.html in Qt-Arm
11 Bytes
Loading

LayoutTests/platform/chromium/test_expectations.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3886,4 +3886,6 @@ BUGWK71450 MAC DEBUG SLOW : fast/frames/valid.html = PASS
38863886
BUGWK71451 SLOW : fast/frames/sandboxed-iframe-navigation-windowopen.html = PASS
38873887
BUGWK71451 LINUX : http/tests/security/contentSecurityPolicy/policy-does-not-affect-child.html = TEXT PASS
38883888
BUGWK71451 LINUX : http/tests/security/contentSecurityPolicy/object-src-none-allowed.html = TEXT PASS
3889-
3889+
3890+
// This just needs a rebaseline.
3891+
BUGWK71420 WIN : fast/repaint/table-extra-bottom-grow.html = IMAGE

LayoutTests/platform/efl/Skipped

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,3 +1923,6 @@ fast/dom/MicroData
19231923
# Tests for MediaSource API. Feature is not yet functional.
19241924
# https://bugs.webkit.org/show_bug.cgi?id=64731
19251925
http/tests/media/media-source/
1926+
1927+
# Needs a rebaseline
1928+
fast/repaint/table-extra-bottom-grow.html

LayoutTests/platform/mac/Skipped

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,7 @@ fast/css/webkit-mask-crash-table.html
467467
# https://bugs.webkit.org/show_bug.cgi?id=70989
468468
fast/canvas/webgl/attrib-location-length-limits.html
469469
fast/canvas/webgl/uniform-location-length-limits.html
470+
471+
# https://bugs.webkit.org/show_bug.cgi?id=71420
472+
# It needs a rebaseline
473+
fast/repaint/table-extra-bottom-grow.html

LayoutTests/platform/qt/test_expectations.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ BUGWK67007 DEBUG : fast/ruby/generated-after-counter-doesnt-crash.html = CRASH
2525
BUGWK67007 DEBUG : fast/ruby/generated-before-and-after-counter-doesnt-crash.html = CRASH
2626

2727
BUGWK62662 DEBUG : inspector/cookie-parser.html = CRASH PASS
28+
29+
// Needs a rebaseline
30+
BUGWK71420 : fast/repaint/table-extra-bottom-grow.html = IMAGE

Source/WebCore/ChangeLog

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
2011-11-03 Julien Chaffraix <jchaffraix@webkit.org>
2+
3+
Stop abusing RenderTableSection::needsRecalcCells logic
4+
https://bugs.webkit.org/show_bug.cgi?id=71420
5+
6+
Reviewed by Darin Adler.
7+
8+
Change covered by existing tests like fast/repaint/table-extra-bottom-grow.html
9+
and fast/table/row-height-recalc* (among others).
10+
11+
Cell recalculation is very expensive and should only be called when the section's structure
12+
changed in a way that requires a safe update to its structure (like removing a row as our
13+
column split may not be appropriate anymore).
14+
15+
The current code would abuse cell recalculation to actually reset the logical height on the
16+
RowStruct. This change makes it do the right thing.
17+
18+
* rendering/RenderTableCell.h:
19+
* rendering/RenderTableRow.h:
20+
Removed styleWillChange override as it was unneeded.
21+
22+
* rendering/RenderTableCell.cpp:
23+
(WebCore::RenderTableCell::styleDidChange):
24+
* rendering/RenderTableRow.cpp:
25+
(WebCore::RenderTableRow::styleDidChange):
26+
Move the code from styleWillChange to styleDidChange.
27+
28+
* rendering/RenderTableSection.cpp:
29+
(WebCore::RenderTableSection::rowLogicalHeightChanged):
30+
This function just reset the height on the |RowStruct| which is the
31+
only part of recalcCells that we would need.
32+
33+
(WebCore::RenderTableSection::rowIndexForRenderer):
34+
Added this function to find out which index a column has (strangely
35+
RenderTableRow does not have this information).
36+
37+
* rendering/RenderTableSection.h: Added the 2 previous functions.
38+
139
2011-11-03 Andreas Kling <kling@webkit.org>
240

341
CSSRuleList: Move rule orphaning from deleteRule() out to callers.

Source/WebCore/rendering/RenderTableCell.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,16 @@ int RenderTableCell::cellBaselinePosition() const
310310
return paddingBefore() + borderBefore() + contentLogicalHeight();
311311
}
312312

313-
void RenderTableCell::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
314-
{
315-
if (parent() && section() && style() && style()->height() != newStyle->height())
316-
section()->setNeedsCellRecalc();
317-
318-
ASSERT(newStyle->display() == TABLE_CELL);
319-
320-
RenderBlock::styleWillChange(diff, newStyle);
321-
}
322-
323313
void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
324314
{
315+
ASSERT(style()->display() == TABLE_CELL);
316+
325317
RenderBlock::styleDidChange(diff, oldStyle);
326318
setHasBoxDecorations(true);
327319

320+
if (parent() && section() && oldStyle && style()->height() != oldStyle->height())
321+
section()->rowLogicalHeightChanged(row());
322+
328323
// If border was changed, notify table.
329324
if (parent()) {
330325
RenderTable* table = this->table();

Source/WebCore/rendering/RenderTableCell.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class RenderTableCell : public RenderBlock {
153153
void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; }
154154

155155
protected:
156-
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
157156
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
158157

159158
private:

Source/WebCore/rendering/RenderTableRow.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@ void RenderTableRow::willBeDestroyed()
5353
recalcSection->setNeedsCellRecalc();
5454
}
5555

56-
void RenderTableRow::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
57-
{
58-
if (section() && style() && style()->logicalHeight() != newStyle->logicalHeight())
59-
section()->setNeedsCellRecalc();
60-
61-
ASSERT(newStyle->display() == TABLE_ROW);
62-
63-
RenderBox::styleWillChange(diff, newStyle);
64-
}
65-
6656
void RenderTableRow::updateBeforeAndAfterContent()
6757
{
6858
if (!isAnonymous() && document()->usesBeforeAfterRules()) {
@@ -73,12 +63,17 @@ void RenderTableRow::updateBeforeAndAfterContent()
7363

7464
void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
7565
{
66+
ASSERT(style()->display() == TABLE_ROW);
67+
7668
RenderBox::styleDidChange(diff, oldStyle);
7769
propagateStyleToAnonymousChildren();
7870

7971
if (parent())
8072
updateBeforeAndAfterContent();
8173

74+
if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHeight())
75+
section()->rowLogicalHeightChanged(section()->rowIndexForRenderer(this));
76+
8277
// If border was changed, notify table.
8378
if (parent()) {
8479
RenderTable* table = this->table();

0 commit comments

Comments
 (0)