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

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

Issue 2154593003: [css-grid] Fix indefinite height detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 2 lines for bool includeBorderPadding Created 4 years, 5 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 TrackedLayoutBoxListHashSet::const_iterator end = positionedDescendantSe t->end(); 1865 TrackedLayoutBoxListHashSet::const_iterator end = positionedDescendantSe t->end();
1866 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 1866 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
1867 LayoutBox* currBox = *it; 1867 LayoutBox* currBox = *it;
1868 ASSERT(!currBox->needsLayout()); 1868 ASSERT(!currBox->needsLayout());
1869 } 1869 }
1870 } 1870 }
1871 } 1871 }
1872 1872
1873 #endif 1873 #endif
1874 1874
1875 LayoutUnit LayoutBlock::availableLogicalHeightForPercentageComputation(const Lay outBlock& block)
jfernandez 2016/07/22 11:26:37 Shouldn't be const ?
Manuel Rego 2016/07/22 13:05:37 It's static so you cannot modify anything, but onc
1876 {
1877 LayoutUnit availableHeight(-1);
1878
1879 const ComputedStyle& style = block.styleRef();
1880
1881 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
1882 // explicitly specified that can be used for any percentage computations.
1883 bool isOutOfFlowPositionedWithSpecifiedHeight = block.isOutOfFlowPositioned( ) && (!style.logicalHeight().isAuto() || (!style.logicalTop().isAuto() && !style .logicalBottom().isAuto()));
1884
1885 LayoutUnit stretchedFlexHeight(-1);
1886 if (block.isFlexItem())
1887 stretchedFlexHeight = toLayoutFlexibleBox(block.parent())->childLogicalH eightForPercentageResolution(block);
1888
1889 if (stretchedFlexHeight != LayoutUnit(-1)) {
1890 availableHeight = stretchedFlexHeight;
1891 } else if (block.isGridItem() && block.hasOverrideLogicalContentHeight()) {
1892 availableHeight = block.overrideLogicalContentHeight();
1893 } else if (style.logicalHeight().isFixed()) {
1894 LayoutUnit contentBoxHeight = block.adjustContentBoxLogicalHeightForBoxS izing(style.logicalHeight().value());
1895 availableHeight = block.constrainContentBoxLogicalHeightByMinMax(
1896 contentBoxHeight - block.scrollbarLogicalHeight(), LayoutUnit(-1)).c lampNegativeToZero();
1897 } else if (style.logicalHeight().hasPercent() && !isOutOfFlowPositionedWithS pecifiedHeight) {
1898 // We need to recur and compute the percentage height for our containing block.
jfernandez 2016/07/22 11:26:37 I don't understand this comment. Could you please
Manuel Rego 2016/07/22 13:05:37 This comment was already in computePercentageLogic
1899 LayoutUnit heightWithScrollbar = block.computePercentageLogicalHeight(st yle.logicalHeight());
1900 if (heightWithScrollbar != -1) {
1901 LayoutUnit contentBoxHeightWithScrollbar = block.adjustContentBoxLog icalHeightForBoxSizing(heightWithScrollbar);
1902 // We need to adjust for min/max height because this method does not
1903 // handle the min/max of the current block, its caller does. So the
1904 // return value from the recursive call will not have been adjusted
1905 // yet.
1906 LayoutUnit contentBoxHeight = block.constrainContentBoxLogicalHeight ByMinMax(contentBoxHeightWithScrollbar - block.scrollbarLogicalHeight(), LayoutU nit(-1));
1907 availableHeight = std::max(LayoutUnit(), contentBoxHeight);
1908 }
1909 } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
1910 // Don't allow this to affect the block' size() member variable, since t his
1911 // can get called while the block is still laying out its kids.
1912 LogicalExtentComputedValues computedValues;
1913 block.computeLogicalHeight(block.logicalHeight(), LayoutUnit(), computed Values);
1914 availableHeight = computedValues.m_extent - block.borderAndPaddingLogica lHeight() - block.scrollbarLogicalHeight();
1915 } else if (block.isLayoutView()) {
1916 availableHeight = toLayoutView(block).viewLogicalHeightForPercentages();
1917 }
1918
1919 return availableHeight;
1920 }
1921
1922 bool LayoutBlock::hasDefiniteLogicalHeight() const
1923 {
1924 return availableLogicalHeightForPercentageComputation(*this) != LayoutUnit(- 1);
1925 }
1926
1875 } // namespace blink 1927 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698