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

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

Issue 879483002: [New Multicolumn] Intrinsic/preferred logical width calculation for spanners. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add assert in adjustIntrinsicLogicalWidthsForColumns() Created 5 years, 11 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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // If there were no adjacent spanners, it has to mean that there's only one column set, 573 // If there were no adjacent spanners, it has to mean that there's only one column set,
574 // since it's only spanners that may cause creation of multiple sets. 574 // since it's only spanners that may cause creation of multiple sets.
575 columnSetToRemove = firstMultiColumnSet(); 575 columnSetToRemove = firstMultiColumnSet();
576 ASSERT(columnSetToRemove); 576 ASSERT(columnSetToRemove);
577 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet()); 577 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet());
578 } 578 }
579 ASSERT(columnSetToRemove); 579 ASSERT(columnSetToRemove);
580 columnSetToRemove->destroy(); 580 columnSetToRemove->destroy();
581 } 581 }
582 582
583 void RenderMultiColumnFlowThread::computePreferredLogicalWidths()
584 {
585 RenderFlowThread::computePreferredLogicalWidths();
586
587 // The min/max intrinsic widths calculated really tell how much space elemen ts need when
588 // laid out inside the columns. In order to eventually end up with the desir ed column width,
589 // we need to convert them to values pertaining to the multicol container.
590 RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
Julien - ping for review 2015/01/27 11:02:43 const RenderBlockFlow* (you're not supposed to mod
mstensho (USE GERRIT) 2015/01/27 11:54:42 Done.
591 const RenderStyle* multicolStyle = multicolContainer->style();
592 int columnCount = multicolStyle->hasAutoColumnCount() ? 1 : multicolStyle->c olumnCount();
593 LayoutUnit columnWidth;
594 LayoutUnit gapExtra = (columnCount - 1) * multicolContainer->columnGap();
595 if (multicolStyle->hasAutoColumnWidth()) {
596 m_minPreferredLogicalWidth = m_minPreferredLogicalWidth * columnCount + gapExtra;
597 } else {
598 columnWidth = multicolStyle->columnWidth();
599 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, column Width);
600 }
601 // FIXME: If column-count is auto here, we should resolve it to calculate th e maximum
602 // intrinsic width, instead of pretending that it's 1. The only way to do th at is by
603 // performing a layout pass, but this is not an appropriate time or place fo r layout. The
604 // good news is that if height is unconstrained and there are no explicit br eaks, the
605 // resolved column-count really should be 1.
Julien - ping for review 2015/01/27 11:02:43 In the end, is that really a FIXME? (seems like th
mstensho (USE GERRIT) 2015/01/27 11:54:41 Done.
606 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, columnWidt h) * columnCount + gapExtra;
607 }
608
583 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const 609 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
584 { 610 {
585 // We simply remain at our intrinsic height. 611 // We simply remain at our intrinsic height.
586 computedValues.m_extent = logicalHeight; 612 computedValues.m_extent = logicalHeight;
587 computedValues.m_position = logicalTop; 613 computedValues.m_position = logicalTop;
588 } 614 }
589 615
590 void RenderMultiColumnFlowThread::updateLogicalWidth() 616 void RenderMultiColumnFlowThread::updateLogicalWidth()
591 { 617 {
592 LayoutUnit columnWidth; 618 LayoutUnit columnWidth;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 668 }
643 669
644 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const 670 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const
645 { 671 {
646 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) 672 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet())
647 return columnSet->pageLogicalHeight(); 673 return columnSet->pageLogicalHeight();
648 return false; 674 return false;
649 } 675 }
650 676
651 } 677 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.h ('k') | Source/core/rendering/RenderMultiColumnSpannerPlaceholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698