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

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

Issue 1321573005: [CSS Grid Layout] Flex factor sum must be 1 at least. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Just return if accumulatedFractions is 1. Created 5 years, 3 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
« no previous file with comments | « LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 break; 568 break;
569 569
570 fractionValueBasedOnGridItemsRatio = track.m_normalizedFlexValue; 570 fractionValueBasedOnGridItemsRatio = track.m_normalizedFlexValue;
571 } 571 }
572 572
573 accumulatedFractions += track.m_flex; 573 accumulatedFractions += track.m_flex;
574 // This item was processed so we re-add its used breadth to the availabl e space to accurately count the remaining space. 574 // This item was processed so we re-add its used breadth to the availabl e space to accurately count the remaining space.
575 availableLogicalSpaceIgnoringFractionTracks += track.m_track->baseSize() ; 575 availableLogicalSpaceIgnoringFractionTracks += track.m_track->baseSize() ;
576 } 576 }
577 577
578 // Let flex factor sum be the sum of the flex factors of the flexible tracks . If this value
579 // is less than 1, set it to 1 instead.
580 if (accumulatedFractions < 1)
581 return availableLogicalSpaceIgnoringFractionTracks;
582
578 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions; 583 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
579 } 584 }
580 585
581 bool LayoutGrid::hasDefiniteLogicalSize(GridTrackSizingDirection direction) cons t 586 bool LayoutGrid::hasDefiniteLogicalSize(GridTrackSizingDirection direction) cons t
582 { 587 {
583 return (direction == ForRows) ? hasDefiniteLogicalHeight() : hasDefiniteLogi calWidth(); 588 return (direction == ForRows) ? hasDefiniteLogicalHeight() : hasDefiniteLogi calWidth();
584 } 589 }
585 590
586 GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size _t i) const 591 GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size _t i) const
587 { 592 {
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 1924
1920 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); 1925 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child));
1921 } 1926 }
1922 1927
1923 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 1928 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
1924 { 1929 {
1925 GridPainter(*this).paintChildren(paintInfo, paintOffset); 1930 GridPainter(*this).paintChildren(paintInfo, paintOffset);
1926 } 1931 }
1927 1932
1928 } // namespace blink 1933 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698