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

Side by Side Diff: Source/core/layout/LayoutTable.cpp

Issue 1121173002: Fix shrink-to-fit when children's writing-mode is orthogonal (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: float tests added + cleanup a bit Created 5 years, 7 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
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // section down (it is quite unlikely that any of the following sections 438 // section down (it is quite unlikely that any of the following sections
439 // did not shift). 439 // did not shift).
440 bool sectionMoved = false; 440 bool sectionMoved = false;
441 LayoutUnit movedSectionLogicalTop = 0; 441 LayoutUnit movedSectionLogicalTop = 0;
442 { 442 {
443 LayoutState state(*this, locationOffset()); 443 LayoutState state(*this, locationOffset());
444 LayoutUnit oldLogicalWidth = logicalWidth(); 444 LayoutUnit oldLogicalWidth = logicalWidth();
445 LayoutUnit oldLogicalHeight = logicalHeight(); 445 LayoutUnit oldLogicalHeight = logicalHeight();
446 446
447 setLogicalHeight(0); 447 setLogicalHeight(0);
448 recalcLogicalWidthAfterLayoutChildren:
448 updateLogicalWidth(); 449 updateLogicalWidth();
449 450
450 if (logicalWidth() != oldLogicalWidth) { 451 if (logicalWidth() != oldLogicalWidth) {
451 for (unsigned i = 0; i < m_captions.size(); i++) 452 for (unsigned i = 0; i < m_captions.size(); i++)
452 layouter.setNeedsLayout(m_captions[i], LayoutInvalidationReason: :TableChanged); 453 layouter.setNeedsLayout(m_captions[i], LayoutInvalidationReason: :TableChanged);
453 } 454 }
454 // FIXME: The optimisation below doesn't work since the internal table 455 // FIXME: The optimisation below doesn't work since the internal table
455 // layout could have changed. We need to add a flag to the table 456 // layout could have changed. We need to add a flag to the table
456 // layout that tells us if something has changed in the min max 457 // layout that tells us if something has changed in the min max
457 // calculations to do it correctly. 458 // calculations to do it correctly.
(...skipping 23 matching lines...) Expand all
481 child->layoutIfNeeded(); 482 child->layoutIfNeeded();
482 ASSERT(!child->needsLayout()); 483 ASSERT(!child->needsLayout());
483 } else { 484 } else {
484 // FIXME: We should never have other type of children (they shou ld be wrapped in an 485 // FIXME: We should never have other type of children (they shou ld be wrapped in an
485 // anonymous table section) but our code is too crazy and this c an happen in practice. 486 // anonymous table section) but our code is too crazy and this c an happen in practice.
486 // Until this is fixed, let's make sure we don't leave non laid out children in the tree. 487 // Until this is fixed, let's make sure we don't leave non laid out children in the tree.
487 child->layoutIfNeeded(); 488 child->layoutIfNeeded();
488 } 489 }
489 } 490 }
490 491
492 if (needsRecalcLogicalWidthAfterLayoutChildren()) {
493 clearNeedsRecalcLogicalWidthAfterLayoutChildren();
494 setPreferredLogicalWidthsDirty(MarkOnlyThis);
495 goto recalcLogicalWidthAfterLayoutChildren;
496 }
497
491 // FIXME: Collapse caption margin. 498 // FIXME: Collapse caption margin.
492 if (!m_captions.isEmpty()) { 499 if (!m_captions.isEmpty()) {
493 for (unsigned i = 0; i < m_captions.size(); i++) { 500 for (unsigned i = 0; i < m_captions.size(); i++) {
494 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) 501 if (m_captions[i]->style()->captionSide() == CAPBOTTOM)
495 continue; 502 continue;
496 layoutCaption(*m_captions[i]); 503 layoutCaption(*m_captions[i]);
497 } 504 }
498 if (logicalHeight() != oldTableLogicalTop) { 505 if (logicalHeight() != oldTableLogicalTop) {
499 sectionMoved = true; 506 sectionMoved = true;
500 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogic alTop); 507 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogic alTop);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 cell->invalidateDisplayItemClient(*cell); 1412 cell->invalidateDisplayItemClient(*cell);
1406 } 1413 }
1407 } 1414 }
1408 } 1415 }
1409 } 1416 }
1410 1417
1411 LayoutBlock::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); 1418 LayoutBlock::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState);
1412 } 1419 }
1413 1420
1414 } 1421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698