Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "RuntimeEnabledFeatures.h" | |
|
Julien - ping for review
2013/07/03 19:52:26
Nit: Add a FIXME to remove this when the master bu
a.suchit
2013/07/04 14:14:50
Done.
| |
| 27 #include <limits> | 30 #include <limits> |
| 28 #include "core/rendering/HitTestResult.h" | 31 #include "core/rendering/HitTestResult.h" |
| 29 #include "core/rendering/PaintInfo.h" | 32 #include "core/rendering/PaintInfo.h" |
| 30 #include "core/rendering/RenderTableCell.h" | 33 #include "core/rendering/RenderTableCell.h" |
| 31 #include "core/rendering/RenderTableCol.h" | 34 #include "core/rendering/RenderTableCol.h" |
| 32 #include "core/rendering/RenderTableRow.h" | 35 #include "core/rendering/RenderTableRow.h" |
| 33 #include "core/rendering/RenderTableSection.h" | |
| 34 #include "core/rendering/RenderView.h" | 36 #include "core/rendering/RenderView.h" |
| 35 #include <wtf/HashSet.h> | 37 #include <wtf/HashSet.h> |
| 36 #include <wtf/MemoryInstrumentationHashMap.h> | 38 #include <wtf/MemoryInstrumentationHashMap.h> |
| 37 #include <wtf/MemoryInstrumentationHashSet.h> | 39 #include <wtf/MemoryInstrumentationHashSet.h> |
| 38 #include <wtf/MemoryInstrumentationVector.h> | 40 #include <wtf/MemoryInstrumentationVector.h> |
| 39 #include <wtf/Vector.h> | 41 #include <wtf/Vector.h> |
| 40 | 42 |
| 41 using namespace std; | 43 using namespace std; |
| 42 | 44 |
| 43 namespace WebCore { | 45 namespace WebCore { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 Row& row = m_grid[r].row; | 355 Row& row = m_grid[r].row; |
| 354 unsigned totalCols = row.size(); | 356 unsigned totalCols = row.size(); |
| 355 | 357 |
| 356 for (unsigned c = 0; c < totalCols; c++) { | 358 for (unsigned c = 0; c < totalCols; c++) { |
| 357 CellStruct& current = cellAt(r, c); | 359 CellStruct& current = cellAt(r, c); |
| 358 for (unsigned i = 0; i < current.cells.size(); i++) { | 360 for (unsigned i = 0; i < current.cells.size(); i++) { |
| 359 cell = current.cells[i]; | 361 cell = current.cells[i]; |
| 360 if (current.inColSpan && cell->rowSpan() == 1) | 362 if (current.inColSpan && cell->rowSpan() == 1) |
| 361 continue; | 363 continue; |
| 362 | 364 |
| 363 if (cell->rowSpan() > 1) { | 365 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. | 366 if (cell->rowSpan() > 1) { |
| 365 if (cell->rowIndex() == r) { | 367 // 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); | 368 if (cell->rowIndex() == r) { |
| 369 rowSpanCells.append(cell); | |
| 367 | 370 |
| 368 // Find out the baseline. The baseline is set on the fir st row in a rowSpan. | 371 // Find out the baseline. The baseline is set on the first row in a rowSpan. |
| 369 updateBaselineForCell(cell, r, baselineDescent); | 372 updateBaselineForCell(cell, r, baselineDescent); |
| 373 } | |
| 374 continue; | |
| 370 } | 375 } |
| 371 continue; | 376 |
| 377 ASSERT(cell->rowSpan() == 1); | |
| 378 } else { | |
| 379 // Below issue, Fix is in progress under RuntimeEnabledFeatu re flag | |
| 380 // 'RowSpanLogicalHeightSpreading'. crbug.com/78724 | |
| 381 // Issue : We are always adding the height of a rowspan to t he last rows which doesn't match | |
| 382 // other browsers. See crbug.com/78724 for example. | |
| 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 Loading... | |
| 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 |
| OLD | NEW |