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, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights 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 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 } | 402 } |
403 | 403 |
404 void RenderTable::simplifiedNormalFlowLayout() | 404 void RenderTable::simplifiedNormalFlowLayout() |
405 { | 405 { |
406 for (RenderTableSection* section = topSection(); section; section = sectionB elow(section)) { | 406 for (RenderTableSection* section = topSection(); section; section = sectionB elow(section)) { |
407 section->layoutIfNeeded(); | 407 section->layoutIfNeeded(); |
408 section->computeOverflowFromCells(); | 408 section->computeOverflowFromCells(); |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 void RenderTable::layout() | 412 void RenderTable::layoutContents(SubtreeLayoutScope& layouter, bool& sectionMove d, LayoutUnit& movedSectionLogicalTop) |
413 { | 413 { |
414 // Note: RenderTable is handled differently than other RenderBlocks and the LayoutScope | |
415 // must be created before the table begins laying out. | |
416 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); | |
417 ASSERT(needsLayout()); | |
418 | |
419 LayoutRectRecorder recorder(*this); | |
420 | |
421 if (simplifiedLayout()) | |
422 return; | |
423 | |
424 recalcSectionsIfNeeded(); | |
425 // FIXME: We should do this recalc lazily in borderStart/borderEnd so that w e don't have to make sure | |
426 // to call this before we call borderStart/borderEnd to avoid getting a stal e value. | |
427 recalcBordersInRowDirection(); | |
428 | |
429 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | |
430 LayoutStateMaintainer statePusher(*this, locationOffset()); | 414 LayoutStateMaintainer statePusher(*this, locationOffset()); |
431 | 415 |
432 setLogicalHeight(0); | 416 setLogicalHeight(0); |
433 | 417 |
434 LayoutUnit oldLogicalWidth = logicalWidth(); | 418 LayoutUnit oldLogicalWidth = logicalWidth(); |
435 updateLogicalWidth(); | 419 updateLogicalWidth(); |
436 | 420 |
437 SubtreeLayoutScope layouter(this); | |
438 | |
439 if (logicalWidth() != oldLogicalWidth) { | 421 if (logicalWidth() != oldLogicalWidth) { |
440 for (unsigned i = 0; i < m_captions.size(); i++) | 422 for (unsigned i = 0; i < m_captions.size(); i++) |
441 layouter.setNeedsLayout(m_captions[i]); | 423 layouter.setNeedsLayout(m_captions[i]); |
442 } | 424 } |
443 // FIXME: The optimisation below doesn't work since the internal table | 425 // FIXME: The optimisation below doesn't work since the internal table |
444 // layout could have changed. we need to add a flag to the table | 426 // layout could have changed. we need to add a flag to the table |
445 // layout that tells us if something has changed in the min max | 427 // layout that tells us if something has changed in the min max |
446 // calculations to do it correctly. | 428 // calculations to do it correctly. |
447 // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() ) | 429 // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() ) |
448 m_tableLayout->layout(); | 430 m_tableLayout->layout(); |
(...skipping 19 matching lines...) Expand all Loading... | |
468 child->layoutIfNeeded(); | 450 child->layoutIfNeeded(); |
469 ASSERT(!child->needsLayout()); | 451 ASSERT(!child->needsLayout()); |
470 } else { | 452 } else { |
471 // FIXME: We should never have other type of children (they should b e wrapped in an | 453 // FIXME: We should never have other type of children (they should b e wrapped in an |
472 // anonymous table section) but our code is too crazy and this can h appen in practice. | 454 // anonymous table section) but our code is too crazy and this can h appen in practice. |
473 // Until this is fixed, let's make sure we don't leave non laid out children in the tree. | 455 // Until this is fixed, let's make sure we don't leave non laid out children in the tree. |
474 child->layoutIfNeeded(); | 456 child->layoutIfNeeded(); |
475 } | 457 } |
476 } | 458 } |
477 | 459 |
478 // If any table section moved vertically, we will just repaint everything fr om that | |
479 // section down (it is quite unlikely that any of the following sections | |
480 // did not shift). | |
481 bool sectionMoved = false; | |
482 LayoutUnit movedSectionLogicalTop = 0; | |
483 | |
484 // FIXME: Collapse caption margin. | 460 // FIXME: Collapse caption margin. |
485 if (!m_captions.isEmpty()) { | 461 if (!m_captions.isEmpty()) { |
486 for (unsigned i = 0; i < m_captions.size(); i++) { | 462 for (unsigned i = 0; i < m_captions.size(); i++) { |
487 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) | 463 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) |
488 continue; | 464 continue; |
489 layoutCaption(m_captions[i]); | 465 layoutCaption(m_captions[i]); |
490 } | 466 } |
491 if (logicalHeight() != oldTableLogicalTop) { | 467 if (logicalHeight() != oldTableLogicalTop) { |
492 sectionMoved = true; | 468 sectionMoved = true; |
493 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop); | 469 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 // table can be containing block of positioned elements. | 538 // table can be containing block of positioned elements. |
563 // FIXME: Only pass true if width or height changed. | 539 // FIXME: Only pass true if width or height changed. |
564 layoutPositionedObjects(true); | 540 layoutPositionedObjects(true); |
565 | 541 |
566 updateLayerTransform(); | 542 updateLayerTransform(); |
567 | 543 |
568 // Layout was changed, so probably borders too. | 544 // Layout was changed, so probably borders too. |
569 invalidateCollapsedBorders(); | 545 invalidateCollapsedBorders(); |
570 | 546 |
571 computeOverflow(clientLogicalBottom()); | 547 computeOverflow(clientLogicalBottom()); |
548 } | |
572 | 549 |
573 statePusher.pop(); | 550 void RenderTable::layout() |
551 { | |
552 // Note: RenderTable is handled differently than other RenderBlocks and the LayoutScope | |
553 // must be created before the table begins laying out. | |
554 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); | |
555 ASSERT(needsLayout()); | |
556 | |
557 LayoutRectRecorder recorder(*this); | |
558 | |
559 if (simplifiedLayout()) | |
560 return; | |
561 | |
562 recalcSectionsIfNeeded(); | |
563 // FIXME: We should do this recalc lazily in borderStart/borderEnd so that w e don't have to make sure | |
564 // to call this before we call borderStart/borderEnd to avoid getting a stal e value. | |
565 recalcBordersInRowDirection(); | |
566 | |
567 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | |
568 SubtreeLayoutScope layouter(this); | |
569 | |
570 // If any table section moved vertically, we will just repaint everything fr om that | |
571 // section down (it is quite unlikely that any of the following sections | |
572 // did not shift). | |
573 bool sectionMoved = false; | |
574 LayoutUnit movedSectionLogicalTop = 0; | |
Julien - ping for review
2014/03/13 17:44:27
Really not a huge fan of these variables (along wi
| |
575 | |
576 layoutContents(layouter, sectionMoved, movedSectionLogicalTop); | |
574 | 577 |
575 if (view()->layoutState()->pageLogicalHeight()) | 578 if (view()->layoutState()->pageLogicalHeight()) |
576 setPageLogicalOffset(view()->layoutState()->pageLogicalOffset(*this, log icalTop())); | 579 setPageLogicalOffset(view()->layoutState()->pageLogicalOffset(*this, log icalTop())); |
577 | 580 |
578 bool didFullRepaint = repainter.repaintAfterLayout(); | 581 bool didFullRepaint = repainter.repaintAfterLayout(); |
579 // Repaint with our new bounds if they are different from our old bounds. | 582 // Repaint with our new bounds if they are different from our old bounds. |
580 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() | 583 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() |
581 && !didFullRepaint && sectionMoved) { | 584 && !didFullRepaint && sectionMoved) { |
582 if (style()->isHorizontalWritingMode()) | 585 if (style()->isHorizontalWritingMode()) |
583 repaintRectangle(LayoutRect(visualOverflowRect().x(), movedSectionLo gicalTop, visualOverflowRect().width(), visualOverflowRect().maxY() - movedSecti onLogicalTop)); | 586 repaintRectangle(LayoutRect(visualOverflowRect().x(), movedSectionLo gicalTop, visualOverflowRect().width(), visualOverflowRect().maxY() - movedSecti onLogicalTop)); |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const | 1458 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const |
1456 { | 1459 { |
1457 ASSERT(cell->isFirstOrLastCellInRow()); | 1460 ASSERT(cell->isFirstOrLastCellInRow()); |
1458 if (hasSameDirectionAs(cell->row())) | 1461 if (hasSameDirectionAs(cell->row())) |
1459 return style()->borderEnd(); | 1462 return style()->borderEnd(); |
1460 | 1463 |
1461 return style()->borderStart(); | 1464 return style()->borderStart(); |
1462 } | 1465 } |
1463 | 1466 |
1464 } | 1467 } |
OLD | NEW |