OLD | NEW |
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 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 TrackedLayoutBoxListHashSet::const_iterator end = positionedDescendantSe
t->end(); | 1870 TrackedLayoutBoxListHashSet::const_iterator end = positionedDescendantSe
t->end(); |
1871 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 1871 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
1872 LayoutBox* currBox = *it; | 1872 LayoutBox* currBox = *it; |
1873 ASSERT(!currBox->needsLayout()); | 1873 ASSERT(!currBox->needsLayout()); |
1874 } | 1874 } |
1875 } | 1875 } |
1876 } | 1876 } |
1877 | 1877 |
1878 #endif | 1878 #endif |
1879 | 1879 |
| 1880 LayoutUnit LayoutBlock::availableLogicalHeightForPercentageComputation() const |
| 1881 { |
| 1882 LayoutUnit availableHeight(-1); |
| 1883 |
| 1884 // For anonymous blocks that are skipped during percentage height calculatio
n, we consider them to have an indefinite height. |
| 1885 if (skipContainingBlockForPercentHeightCalculation(this)) |
| 1886 return availableHeight; |
| 1887 |
| 1888 const ComputedStyle& style = styleRef(); |
| 1889 |
| 1890 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height |
| 1891 // explicitly specified that can be used for any percentage computations. |
| 1892 bool isOutOfFlowPositionedWithSpecifiedHeight = isOutOfFlowPositioned() && (
!style.logicalHeight().isAuto() || (!style.logicalTop().isAuto() && !style.logic
alBottom().isAuto())); |
| 1893 |
| 1894 LayoutUnit stretchedFlexHeight(-1); |
| 1895 if (isFlexItem()) |
| 1896 stretchedFlexHeight = toLayoutFlexibleBox(parent())->childLogicalHeightF
orPercentageResolution(*this); |
| 1897 |
| 1898 if (stretchedFlexHeight != LayoutUnit(-1)) { |
| 1899 availableHeight = stretchedFlexHeight; |
| 1900 } else if (isGridItem() && hasOverrideLogicalContentHeight()) { |
| 1901 availableHeight = overrideLogicalContentHeight(); |
| 1902 } else if (style.logicalHeight().isFixed()) { |
| 1903 LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing(
style.logicalHeight().value()); |
| 1904 availableHeight = constrainContentBoxLogicalHeightByMinMax( |
| 1905 contentBoxHeight - scrollbarLogicalHeight(), LayoutUnit(-1)).clampNe
gativeToZero(); |
| 1906 } else if (style.logicalHeight().hasPercent() && !isOutOfFlowPositionedWithS
pecifiedHeight) { |
| 1907 LayoutUnit heightWithScrollbar = computePercentageLogicalHeight(style.lo
gicalHeight()); |
| 1908 if (heightWithScrollbar != -1) { |
| 1909 LayoutUnit contentBoxHeightWithScrollbar = adjustContentBoxLogicalHe
ightForBoxSizing(heightWithScrollbar); |
| 1910 // We need to adjust for min/max height because this method does not |
| 1911 // handle the min/max of the current block, its caller does. So the |
| 1912 // return value from the recursive call will not have been adjusted |
| 1913 // yet. |
| 1914 LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinM
ax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), LayoutUnit(-1)); |
| 1915 availableHeight = std::max(LayoutUnit(), contentBoxHeight); |
| 1916 } |
| 1917 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
| 1918 // Don't allow this to affect the block' size() member variable, since t
his |
| 1919 // can get called while the block is still laying out its kids. |
| 1920 LogicalExtentComputedValues computedValues; |
| 1921 computeLogicalHeight(logicalHeight(), LayoutUnit(), computedValues); |
| 1922 availableHeight = computedValues.m_extent - borderAndPaddingLogicalHeigh
t() - scrollbarLogicalHeight(); |
| 1923 } else if (isLayoutView()) { |
| 1924 availableHeight = view()->viewLogicalHeightForPercentages(); |
| 1925 } |
| 1926 |
| 1927 return availableHeight; |
| 1928 } |
| 1929 |
| 1930 bool LayoutBlock::hasDefiniteLogicalHeight() const |
| 1931 { |
| 1932 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); |
| 1933 } |
| 1934 |
1880 } // namespace blink | 1935 } // namespace blink |
OLD | NEW |