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

Side by Side Diff: Source/core/rendering/RenderTableSection.cpp

Issue 18553003: Add a runtime flag for distributing extra logical height to rowspans (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments Addressed Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/RuntimeEnabledFeatures.in ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public 11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either 12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version. 13 * version 2 of the License, or (at your option) any later version.
14 * 14 *
15 * This library is distributed in the hope that it will be useful, 15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details. 18 * Library General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU Library General Public License 20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to 21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/rendering/RenderTableSection.h"
28
29 // FIXME: Remove 'RuntimeEnabledFeatures.h' when http://crbug.com/78724 is close d.
30 #include "RuntimeEnabledFeatures.h"
27 #include <limits> 31 #include <limits>
28 #include "core/rendering/HitTestResult.h" 32 #include "core/rendering/HitTestResult.h"
29 #include "core/rendering/PaintInfo.h" 33 #include "core/rendering/PaintInfo.h"
30 #include "core/rendering/RenderTableCell.h" 34 #include "core/rendering/RenderTableCell.h"
31 #include "core/rendering/RenderTableCol.h" 35 #include "core/rendering/RenderTableCol.h"
32 #include "core/rendering/RenderTableRow.h" 36 #include "core/rendering/RenderTableRow.h"
33 #include "core/rendering/RenderTableSection.h"
34 #include "core/rendering/RenderView.h" 37 #include "core/rendering/RenderView.h"
35 #include <wtf/HashSet.h> 38 #include <wtf/HashSet.h>
36 #include <wtf/MemoryInstrumentationHashMap.h> 39 #include <wtf/MemoryInstrumentationHashMap.h>
37 #include <wtf/MemoryInstrumentationHashSet.h> 40 #include <wtf/MemoryInstrumentationHashSet.h>
38 #include <wtf/MemoryInstrumentationVector.h> 41 #include <wtf/MemoryInstrumentationVector.h>
39 #include <wtf/Vector.h> 42 #include <wtf/Vector.h>
40 43
41 using namespace std; 44 using namespace std;
42 45
43 namespace WebCore { 46 namespace WebCore {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 Row& row = m_grid[r].row; 356 Row& row = m_grid[r].row;
354 unsigned totalCols = row.size(); 357 unsigned totalCols = row.size();
355 358
356 for (unsigned c = 0; c < totalCols; c++) { 359 for (unsigned c = 0; c < totalCols; c++) {
357 CellStruct& current = cellAt(r, c); 360 CellStruct& current = cellAt(r, c);
358 for (unsigned i = 0; i < current.cells.size(); i++) { 361 for (unsigned i = 0; i < current.cells.size(); i++) {
359 cell = current.cells[i]; 362 cell = current.cells[i];
360 if (current.inColSpan && cell->rowSpan() == 1) 363 if (current.inColSpan && cell->rowSpan() == 1)
361 continue; 364 continue;
362 365
363 if (cell->rowSpan() > 1) { 366 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) {
364 // For row spanning cells, we only handle them for the first row they span. This ensures we take their baseline into account. 367 if (cell->rowSpan() > 1) {
365 if (cell->rowIndex() == r) { 368 // For row spanning cells, we only handle them for the f irst row they span. This ensures we take their baseline into account.
366 rowSpanCells.append(cell); 369 if (cell->rowIndex() == r) {
370 rowSpanCells.append(cell);
367 371
368 // Find out the baseline. The baseline is set on the fir st row in a rowSpan. 372 // Find out the baseline. The baseline is set on the first row in a rowSpan.
369 updateBaselineForCell(cell, r, baselineDescent); 373 updateBaselineForCell(cell, r, baselineDescent);
374 }
375 continue;
370 } 376 }
371 continue; 377
378 ASSERT(cell->rowSpan() == 1);
379 } else {
380 // FIXME: We add all the logical row of a rowspan to the las t rows
381 // until crbug.com/78724 is fixed and the runtime flag remov ed.
382 // This avoids propagating temporary regressions while we fi x the bug.
383 if ((cell->rowIndex() + cell->rowSpan() - 1) != r)
384 continue;
372 } 385 }
373 386
374 ASSERT(cell->rowSpan() == 1);
375
376 if (cell->hasOverrideHeight()) { 387 if (cell->hasOverrideHeight()) {
377 if (!statePusher.didPush()) { 388 if (!statePusher.didPush()) {
378 // Technically, we should also push state for the row, b ut since 389 // Technically, we should also push state for the row, b ut since
379 // rows don't push a coordinate transform, that's not ne cessary. 390 // rows don't push a coordinate transform, that's not ne cessary.
380 statePusher.push(this, locationOffset()); 391 statePusher.push(this, locationOffset());
381 } 392 }
382 cell->clearIntrinsicPadding(); 393 cell->clearIntrinsicPadding();
383 cell->clearOverrideSize(); 394 cell->clearOverrideSize();
384 cell->setChildNeedsLayout(true, MarkOnlyThis); 395 cell->setChildNeedsLayout(true, MarkOnlyThis);
385 cell->layoutIfNeeded(); 396 cell->layoutIfNeeded();
386 } 397 }
387 398
388 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing()); 399 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) {
400 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->l ogicalHeightForRowSizing());
389 401
390 // Find out the baseline. 402 // Find out the baseline.
391 updateBaselineForCell(cell, r, baselineDescent); 403 updateBaselineForCell(cell, r, baselineDescent);
404 } else {
405 // For row spanning cells, |r| is the last row in the span.
406 unsigned cellStartRow = cell->rowIndex();
407
408 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow ] + cell->logicalHeightForRowSizing());
409
410 // Find out the baseline.
411 updateBaselineForCell(cell, cellStartRow, baselineDescent);
412 }
392 } 413 }
393 } 414 }
394 415
395 // Add the border-spacing to our final position. 416 // Add the border-spacing to our final position.
396 m_rowPos[r + 1] += borderSpacingForRow(r); 417 m_rowPos[r + 1] += borderSpacingForRow(r);
397 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]); 418 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]);
398 } 419 }
399 420
400 if (!rowSpanCells.isEmpty()) 421 if (!rowSpanCells.isEmpty()) {
422 ASSERT(RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled());
401 distributeRowSpanHeightToRows(rowSpanCells); 423 distributeRowSpanHeightToRows(rowSpanCells);
424 }
402 425
403 ASSERT(!needsLayout()); 426 ASSERT(!needsLayout());
404 427
405 statePusher.pop(); 428 statePusher.pop();
406 429
407 return m_rowPos[m_grid.size()]; 430 return m_rowPos[m_grid.size()];
408 } 431 }
409 432
410 void RenderTableSection::layout() 433 void RenderTableSection::layout()
411 { 434 {
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 info.addMember(logicalHeight, "logicalHeight"); 1544 info.addMember(logicalHeight, "logicalHeight");
1522 } 1545 }
1523 1546
1524 void RenderTableSection::CellStruct::reportMemoryUsage(MemoryObjectInfo* memoryO bjectInfo) const 1547 void RenderTableSection::CellStruct::reportMemoryUsage(MemoryObjectInfo* memoryO bjectInfo) const
1525 { 1548 {
1526 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 1549 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
1527 info.addMember(cells, "cells"); 1550 info.addMember(cells, "cells");
1528 } 1551 }
1529 1552
1530 } // namespace WebCore 1553 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/RuntimeEnabledFeatures.in ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698