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

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: Using RuntimeEnabledFeature for fixing 'extra height of rowspan is not distributing in all rows und… 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 the master bug #78724 is closed .
Julien - ping for review 2013/07/08 16:26:13 Better still: when http://crbug.com/78724 is close
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 // Below issue, Fix is in progress under RuntimeEnabledFeatu re flag
381 // 'RowSpanLogicalHeightSpreading'. crbug.com/78724
382 // Issue : We are always adding the height of a rowspan to t he last rows which doesn't match
383 // other browsers. See crbug.com/78724 for example.
Julien - ping for review 2013/07/08 16:26:13 Not sure I understand your comment. First you repe
384 if ((cell->rowIndex() + cell->rowSpan() - 1) != r)
385 continue;
372 } 386 }
373 387
374 ASSERT(cell->rowSpan() == 1);
375
376 if (cell->hasOverrideHeight()) { 388 if (cell->hasOverrideHeight()) {
377 if (!statePusher.didPush()) { 389 if (!statePusher.didPush()) {
378 // Technically, we should also push state for the row, b ut since 390 // 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. 391 // rows don't push a coordinate transform, that's not ne cessary.
380 statePusher.push(this, locationOffset()); 392 statePusher.push(this, locationOffset());
381 } 393 }
382 cell->clearIntrinsicPadding(); 394 cell->clearIntrinsicPadding();
383 cell->clearOverrideSize(); 395 cell->clearOverrideSize();
384 cell->setChildNeedsLayout(true, MarkOnlyThis); 396 cell->setChildNeedsLayout(true, MarkOnlyThis);
385 cell->layoutIfNeeded(); 397 cell->layoutIfNeeded();
386 } 398 }
387 399
388 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing()); 400 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) {
401 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->l ogicalHeightForRowSizing());
389 402
390 // Find out the baseline. 403 // Find out the baseline.
391 updateBaselineForCell(cell, r, baselineDescent); 404 updateBaselineForCell(cell, r, baselineDescent);
405 } else {
406 // For row spanning cells, |r| is the last row in the span.
407 unsigned cellStartRow = cell->rowIndex();
408
409 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow ] + cell->logicalHeightForRowSizing());
410
411 // Find out the baseline.
412 updateBaselineForCell(cell, cellStartRow, baselineDescent);
413 }
392 } 414 }
393 } 415 }
394 416
395 // Add the border-spacing to our final position. 417 // Add the border-spacing to our final position.
396 m_rowPos[r + 1] += borderSpacingForRow(r); 418 m_rowPos[r + 1] += borderSpacingForRow(r);
397 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]); 419 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]);
398 } 420 }
399 421
400 if (!rowSpanCells.isEmpty()) 422 if (!rowSpanCells.isEmpty()) {
423 ASSERT(RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled());
401 distributeRowSpanHeightToRows(rowSpanCells); 424 distributeRowSpanHeightToRows(rowSpanCells);
425 }
402 426
403 ASSERT(!needsLayout()); 427 ASSERT(!needsLayout());
404 428
405 statePusher.pop(); 429 statePusher.pop();
406 430
407 return m_rowPos[m_grid.size()]; 431 return m_rowPos[m_grid.size()];
408 } 432 }
409 433
410 void RenderTableSection::layout() 434 void RenderTableSection::layout()
411 { 435 {
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 info.addMember(logicalHeight, "logicalHeight"); 1545 info.addMember(logicalHeight, "logicalHeight");
1522 } 1546 }
1523 1547
1524 void RenderTableSection::CellStruct::reportMemoryUsage(MemoryObjectInfo* memoryO bjectInfo) const 1548 void RenderTableSection::CellStruct::reportMemoryUsage(MemoryObjectInfo* memoryO bjectInfo) const
1525 { 1549 {
1526 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 1550 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
1527 info.addMember(cells, "cells"); 1551 info.addMember(cells, "cells");
1528 } 1552 }
1529 1553
1530 } // namespace WebCore 1554 } // 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