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

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

Issue 752723004: Use references in RenderBlock and RenderBlockFlow methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cover RenderBlockFlow class as well Created 6 years 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
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, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 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
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 computedLogicalHeight = styleLogicalHeight.value() - borders; 341 computedLogicalHeight = styleLogicalHeight.value() - borders;
342 } else if (styleLogicalHeight.isPercent()) 342 } else if (styleLogicalHeight.isPercent())
343 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh t); 343 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh t);
344 else if (styleLogicalHeight.isIntrinsic()) 344 else if (styleLogicalHeight.isIntrinsic())
345 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding); 345 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding);
346 else 346 else
347 ASSERT_NOT_REACHED(); 347 ASSERT_NOT_REACHED();
348 return std::max<LayoutUnit>(0, computedLogicalHeight); 348 return std::max<LayoutUnit>(0, computedLogicalHeight);
349 } 349 }
350 350
351 void RenderTable::layoutCaption(RenderTableCaption* caption) 351 void RenderTable::layoutCaption(RenderTableCaption& caption)
352 { 352 {
353 if (caption->needsLayout()) { 353 if (caption.needsLayout()) {
354 // The margins may not be available but ensure the caption is at least l ocated beneath any previous sibling caption 354 // The margins may not be available but ensure the caption is at least l ocated beneath any previous sibling caption
355 // so that it does not mistakenly think any floats in the previous capti on intrude into it. 355 // so that it does not mistakenly think any floats in the previous capti on intrude into it.
356 caption->setLogicalLocation(LayoutPoint(caption->marginStart(), collapse dMarginBeforeForChild(caption) + logicalHeight())); 356 caption.setLogicalLocation(LayoutPoint(caption.marginStart(), collapsedM arginBeforeForChild(caption) + logicalHeight()));
357 // If RenderTableCaption ever gets a layout() function, use it here. 357 // If RenderTableCaption ever gets a layout() function, use it here.
358 caption->layoutIfNeeded(); 358 caption.layoutIfNeeded();
359 } 359 }
360 // Apply the margins to the location now that they are definitely available from layout 360 // Apply the margins to the location now that they are definitely available from layout
361 LayoutUnit captionLogicalTop = collapsedMarginBeforeForChild(caption) + logi calHeight(); 361 LayoutUnit captionLogicalTop = collapsedMarginBeforeForChild(caption) + logi calHeight();
362 if (view()->layoutState()->isPaginated()) { 362 if (view()->layoutState()->isPaginated()) {
363 captionLogicalTop += caption->paginationStrut(); 363 captionLogicalTop += caption.paginationStrut();
364 caption->setPaginationStrut(0); 364 caption.setPaginationStrut(0);
365 } 365 }
366 caption->setLogicalLocation(LayoutPoint(caption->marginStart(), captionLogic alTop)); 366 caption.setLogicalLocation(LayoutPoint(caption.marginStart(), captionLogical Top));
367 367
368 if (!selfNeedsLayout()) 368 if (!selfNeedsLayout())
369 caption->setMayNeedPaintInvalidation(true); 369 caption.setMayNeedPaintInvalidation(true);
370 370
371 setLogicalHeight(logicalHeight() + caption->logicalHeight() + collapsedMargi nBeforeForChild(caption) + collapsedMarginAfterForChild(caption)); 371 setLogicalHeight(logicalHeight() + caption.logicalHeight() + collapsedMargin BeforeForChild(caption) + collapsedMarginAfterForChild(caption));
372 } 372 }
373 373
374 void RenderTable::distributeExtraLogicalHeight(int extraLogicalHeight) 374 void RenderTable::distributeExtraLogicalHeight(int extraLogicalHeight)
375 { 375 {
376 if (extraLogicalHeight <= 0) 376 if (extraLogicalHeight <= 0)
377 return; 377 return;
378 378
379 // FIXME: Distribute the extra logical height between all table sections ins tead of giving it all to the first one. 379 // FIXME: Distribute the extra logical height between all table sections ins tead of giving it all to the first one.
380 if (RenderTableSection* section = firstBody()) 380 if (RenderTableSection* section = firstBody())
381 extraLogicalHeight -= section->distributeExtraLogicalHeightToRows(extraL ogicalHeight); 381 extraLogicalHeight -= section->distributeExtraLogicalHeightToRows(extraL ogicalHeight);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // Until this is fixed, let's make sure we don't leave non laid out children in the tree. 461 // Until this is fixed, let's make sure we don't leave non laid out children in the tree.
462 child->layoutIfNeeded(); 462 child->layoutIfNeeded();
463 } 463 }
464 } 464 }
465 465
466 // FIXME: Collapse caption margin. 466 // FIXME: Collapse caption margin.
467 if (!m_captions.isEmpty()) { 467 if (!m_captions.isEmpty()) {
468 for (unsigned i = 0; i < m_captions.size(); i++) { 468 for (unsigned i = 0; i < m_captions.size(); i++) {
469 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) 469 if (m_captions[i]->style()->captionSide() == CAPBOTTOM)
470 continue; 470 continue;
471 layoutCaption(m_captions[i]); 471 layoutCaption(*m_captions[i]);
472 } 472 }
473 if (logicalHeight() != oldTableLogicalTop) { 473 if (logicalHeight() != oldTableLogicalTop) {
474 sectionMoved = true; 474 sectionMoved = true;
475 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogic alTop); 475 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogic alTop);
476 } 476 }
477 } 477 }
478 478
479 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? Layou tUnit() : paddingBefore()); 479 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? Layou tUnit() : paddingBefore());
480 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutU nit() : paddingAfter()); 480 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutU nit() : paddingAfter());
481 481
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 setLogicalHeight(logicalHeight() + section->logicalHeight()); 530 setLogicalHeight(logicalHeight() + section->logicalHeight());
531 531
532 section = sectionBelow(section); 532 section = sectionBelow(section);
533 } 533 }
534 534
535 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); 535 setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
536 536
537 for (unsigned i = 0; i < m_captions.size(); i++) { 537 for (unsigned i = 0; i < m_captions.size(); i++) {
538 if (m_captions[i]->style()->captionSide() != CAPBOTTOM) 538 if (m_captions[i]->style()->captionSide() != CAPBOTTOM)
539 continue; 539 continue;
540 layoutCaption(m_captions[i]); 540 layoutCaption(*m_captions[i]);
541 } 541 }
542 542
543 updateLogicalHeight(); 543 updateLogicalHeight();
544 544
545 // table can be containing block of positioned elements. 545 // table can be containing block of positioned elements.
546 bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalH eight != logicalHeight(); 546 bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalH eight != logicalHeight();
547 layoutPositionedObjects(dimensionChanged); 547 layoutPositionedObjects(dimensionChanged);
548 548
549 updateLayerTransformAfterLayout(); 549 updateLayerTransformAfterLayout();
550 550
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1337 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1338 { 1338 {
1339 ASSERT(cell->isFirstOrLastCellInRow()); 1339 ASSERT(cell->isFirstOrLastCellInRow());
1340 if (hasSameDirectionAs(cell->row())) 1340 if (hasSameDirectionAs(cell->row()))
1341 return style()->borderEnd(); 1341 return style()->borderEnd();
1342 1342
1343 return style()->borderStart(); 1343 return style()->borderStart();
1344 } 1344 }
1345 1345
1346 } 1346 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTable.h ('k') | Source/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698