Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Unified Diff: Source/core/rendering/RenderTableSection.cpp

Issue 23351002: Crash when opening web page http://build.webkit.org/waterfall. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderTableSection.cpp
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index de1f54512902e387a152a99808b85479511d81cf..4313e21b577f463b7b3d00793824dfa64c5d39b4 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -373,17 +373,28 @@ void RenderTableSection::distributeExtraRowSpanHeightToRemainingRows(RenderTable
// To avoid unneeded extra height distributions, we apply the following sorting algorithm:
// 1. We sort by increasing start row but decreasing last row (ie the top-most, shortest cells first).
// 2. For cells spanning the same rows, we sort by intrinsic size.
Julien - ping for review 2013/09/04 20:46:27 As you inlined the description of what you do, the
a.suchit 2013/09/05 06:35:01 Done.
-static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell2, const RenderTableCell* cell1)
+static bool compareRowSpanCellsInHeightDistributionOrder(const RenderTableCell* cell1, const RenderTableCell* cell2)
{
- unsigned cellRowIndex1 = cell1->rowIndex();
- unsigned cellRowSpan1 = cell1->rowSpan();
- unsigned cellRowIndex2 = cell2->rowIndex();
- unsigned cellRowSpan2 = cell2->rowSpan();
+ unsigned cell1RowIndex = cell1->rowIndex();
+ unsigned cell1RowSpan = cell1->rowSpan();
+ unsigned cell2RowIndex = cell2->rowIndex();
+ unsigned cell2RowSpan = cell2->rowSpan();
+
+ // Sorting bigger height cell first if cells are at same index with same span because we will skip smaller
+ // height cell to distribute it's extra height.
+ if (cell1RowIndex == cell2RowIndex && cell1RowSpan == cell2RowSpan)
+ return (cell1->logicalHeightForRowSizing() > cell2->logicalHeightForRowSizing());
+ // Sorting inner most cell first because if inner spanning cell'e extra height is distributed then outer
+ // spanning cell's extra height will adjust accordingly. In reverse order, there is more chances that outer
+ // spanning cell's height will exceed than defined by user.
+ if (cell1RowIndex >= cell2RowIndex && (cell1RowIndex + cell1RowSpan) <= (cell2RowIndex + cell2RowSpan))
Julien - ping for review 2013/09/04 18:35:45 This should be a function as you use it twice: bo
a.suchit 2013/09/05 06:35:01 Done.
+ return true;
+ // Sorting lower row index first because first we need to apply the extra height of spanning cell which
+ // comes first in the table so lower rows's position would increment in sequence.
+ if (!(cell2RowIndex >= cell1RowIndex && (cell2RowIndex + cell2RowSpan) <= (cell1RowIndex + cell1RowSpan)))
+ return (cell1RowIndex < cell2RowIndex);
- if (cellRowIndex1 == cellRowIndex2 && cellRowSpan1 == cellRowSpan2)
- return (cell2->logicalHeightForRowSizing() > cell1->logicalHeightForRowSizing());
-
- return (cellRowIndex2 >= cellRowIndex1 && (cellRowIndex2 + cellRowSpan2) <= (cellRowIndex1 + cellRowSpan1));
+ return false;
Julien - ping for review 2013/09/04 18:35:45 I am concerned about always returning false here b
}
// Distribute rowSpan cell height in rows those comes in rowSpan cell based on the ratio of row's height if

Powered by Google App Engine
This is Rietveld 408576698