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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar tweaks! Created 4 years, 10 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 LayoutBlock* columnBlock = multiColumnBlockFlow(); 480 LayoutBlock* columnBlock = multiColumnBlockFlow();
481 const ComputedStyle* columnStyle = columnBlock->style(); 481 const ComputedStyle* columnStyle = columnBlock->style();
482 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); 482 LayoutUnit availableWidth = columnBlock->contentLogicalWidth();
483 LayoutUnit columnGap = columnBlock->columnGap(); 483 LayoutUnit columnGap = columnBlock->columnGap();
484 LayoutUnit computedColumnWidth = max<LayoutUnit>(1, LayoutUnit(columnStyle-> columnWidth())); 484 LayoutUnit computedColumnWidth = max<LayoutUnit>(1, LayoutUnit(columnStyle-> columnWidth()));
485 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); 485 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount());
486 486
487 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt h()); 487 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt h());
488 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) { 488 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) {
489 count = computedColumnCount; 489 count = computedColumnCount;
490 width = std::max<LayoutUnit>(0, (availableWidth - ((count - 1) * columnG ap)) / count); 490 width = std::max<LayoutUnit>(0, (availableWidth - ((count - 1) * columnG ap)) / count);
eae 2016/01/29 03:38:12 LayoutUnit()
491 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC ount()) { 491 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC ount()) {
492 count = std::max<LayoutUnit>(1, (availableWidth + columnGap) / (computed ColumnWidth + columnGap)); 492 count = std::max<LayoutUnit>(1, (availableWidth + columnGap) / (computed ColumnWidth + columnGap));
eae 2016/01/29 03:38:12 LayoutUnit(1)
493 width = ((availableWidth + columnGap) / count) - columnGap; 493 width = ((availableWidth + columnGap) / count) - columnGap;
494 } else { 494 } else {
495 count = std::max<LayoutUnit>(std::min<LayoutUnit>(computedColumnCount, ( availableWidth + columnGap) / (computedColumnWidth + columnGap)), 1); 495 count = std::max<LayoutUnit>(std::min<LayoutUnit>(LayoutUnit(computedCol umnCount), (availableWidth + columnGap) / (computedColumnWidth + columnGap)), 1) ;
eae 2016/01/29 03:38:12 LayoutUnit(computedColumnCount)
496 width = ((availableWidth + columnGap) / count) - columnGap; 496 width = ((availableWidth + columnGap) / count) - columnGap;
497 } 497 }
498 } 498 }
499 499
500 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser tBefore) 500 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser tBefore)
501 { 501 {
502 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); 502 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow();
503 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this, multicolContainer->styleRef()); 503 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this, multicolContainer->styleRef());
504 multicolContainer->LayoutBlock::addChild(newSet, insertBefore); 504 multicolContainer->LayoutBlock::addChild(newSet, insertBefore);
505 invalidateColumnSets(); 505 invalidateColumnSets();
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // the "mayBe"), if we're in an out-of-flow subtree and have an outer multic ol container that 925 // the "mayBe"), if we're in an out-of-flow subtree and have an outer multic ol container that
926 // doesn't affect us, but that's okay. We'll discover that further down the road when trying to 926 // doesn't affect us, but that's okay. We'll discover that further down the road when trying to
927 // locate our enclosing flow thread for real. 927 // locate our enclosing flow thread for real.
928 bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread() || view()->f ragmentationContext(); 928 bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread() || view()->f ragmentationContext();
929 if (!mayBeNested) 929 if (!mayBeNested)
930 return; 930 return;
931 appendNewFragmentainerGroupIfNeeded(logicalBottomInFlowThreadAfterPagination ); 931 appendNewFragmentainerGroupIfNeeded(logicalBottomInFlowThreadAfterPagination );
932 } 932 }
933 933
934 } // namespace blink 934 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698