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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 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
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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 ASSERT(box); 1038 ASSERT(box);
1039 if (!box) 1039 if (!box)
1040 break; 1040 break;
1041 } 1041 }
1042 } 1042 }
1043 } 1043 }
1044 1044
1045 LayoutUnit LayoutBlock::textIndentOffset() const 1045 LayoutUnit LayoutBlock::textIndentOffset() const
1046 { 1046 {
1047 LayoutUnit cw; 1047 LayoutUnit cw;
1048 if (style()->textIndent().hasPercent()) 1048 if (style()->textIndent().isPercentOrCalc())
1049 cw = containingBlock()->availableLogicalWidth(); 1049 cw = containingBlock()->availableLogicalWidth();
1050 return minimumValueForLength(style()->textIndent(), cw); 1050 return minimumValueForLength(style()->textIndent(), cw);
1051 } 1051 }
1052 1052
1053 bool LayoutBlock::isPointInOverflowControl(HitTestResult& result, const LayoutPo int& locationInContainer, const LayoutPoint& accumulatedOffset) const 1053 bool LayoutBlock::isPointInOverflowControl(HitTestResult& result, const LayoutPo int& locationInContainer, const LayoutPoint& accumulatedOffset) const
1054 { 1054 {
1055 if (!scrollsOverflow()) 1055 if (!scrollsOverflow())
1056 return false; 1056 return false;
1057 1057
1058 return layer()->getScrollableArea()->hitTestOverflowControls(result, rounded IntPoint(locationInContainer - toLayoutSize(accumulatedOffset))); 1058 return layer()->getScrollableArea()->hitTestOverflowControls(result, rounded IntPoint(locationInContainer - toLayoutSize(accumulatedOffset)));
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 if (isFlexItem()) 1911 if (isFlexItem())
1912 stretchedFlexHeight = toLayoutFlexibleBox(parent())->childLogicalHeightF orPercentageResolution(*this); 1912 stretchedFlexHeight = toLayoutFlexibleBox(parent())->childLogicalHeightF orPercentageResolution(*this);
1913 1913
1914 if (stretchedFlexHeight != LayoutUnit(-1)) { 1914 if (stretchedFlexHeight != LayoutUnit(-1)) {
1915 availableHeight = stretchedFlexHeight; 1915 availableHeight = stretchedFlexHeight;
1916 } else if (isGridItem() && hasOverrideLogicalContentHeight()) { 1916 } else if (isGridItem() && hasOverrideLogicalContentHeight()) {
1917 availableHeight = overrideLogicalContentHeight(); 1917 availableHeight = overrideLogicalContentHeight();
1918 } else if (style.logicalHeight().isFixed()) { 1918 } else if (style.logicalHeight().isFixed()) {
1919 LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing( style.logicalHeight().value()); 1919 LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing( style.logicalHeight().value());
1920 availableHeight = std::max(LayoutUnit(), constrainContentBoxLogicalHeigh tByMinMax(contentBoxHeight - scrollbarLogicalHeight(), LayoutUnit(-1))); 1920 availableHeight = std::max(LayoutUnit(), constrainContentBoxLogicalHeigh tByMinMax(contentBoxHeight - scrollbarLogicalHeight(), LayoutUnit(-1)));
1921 } else if (style.logicalHeight().hasPercent() && !isOutOfFlowPositionedWithS pecifiedHeight) { 1921 } else if (style.logicalHeight().isPercentOrCalc() && !isOutOfFlowPositioned WithSpecifiedHeight) {
1922 LayoutUnit heightWithScrollbar = computePercentageLogicalHeight(style.lo gicalHeight()); 1922 LayoutUnit heightWithScrollbar = computePercentageLogicalHeight(style.lo gicalHeight());
1923 if (heightWithScrollbar != -1) { 1923 if (heightWithScrollbar != -1) {
1924 LayoutUnit contentBoxHeightWithScrollbar = adjustContentBoxLogicalHe ightForBoxSizing(heightWithScrollbar); 1924 LayoutUnit contentBoxHeightWithScrollbar = adjustContentBoxLogicalHe ightForBoxSizing(heightWithScrollbar);
1925 // We need to adjust for min/max height because this method does not 1925 // We need to adjust for min/max height because this method does not
1926 // handle the min/max of the current block, its caller does. So the 1926 // handle the min/max of the current block, its caller does. So the
1927 // return value from the recursive call will not have been adjusted 1927 // return value from the recursive call will not have been adjusted
1928 // yet. 1928 // yet.
1929 LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinM ax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), LayoutUnit(-1)); 1929 LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinM ax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), LayoutUnit(-1));
1930 availableHeight = std::max(LayoutUnit(), contentBoxHeight); 1930 availableHeight = std::max(LayoutUnit(), contentBoxHeight);
1931 } 1931 }
1932 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { 1932 } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
1933 // Don't allow this to affect the block' size() member variable, since t his 1933 // Don't allow this to affect the block' size() member variable, since t his
1934 // can get called while the block is still laying out its kids. 1934 // can get called while the block is still laying out its kids.
1935 LogicalExtentComputedValues computedValues; 1935 LogicalExtentComputedValues computedValues;
1936 computeLogicalHeight(logicalHeight(), LayoutUnit(), computedValues); 1936 computeLogicalHeight(logicalHeight(), LayoutUnit(), computedValues);
1937 availableHeight = computedValues.m_extent - borderAndPaddingLogicalHeigh t() - scrollbarLogicalHeight(); 1937 availableHeight = computedValues.m_extent - borderAndPaddingLogicalHeigh t() - scrollbarLogicalHeight();
1938 } else if (isLayoutView()) { 1938 } else if (isLayoutView()) {
1939 availableHeight = view()->viewLogicalHeightForPercentages(); 1939 availableHeight = view()->viewLogicalHeightForPercentages();
1940 } 1940 }
1941 1941
1942 return availableHeight; 1942 return availableHeight;
1943 } 1943 }
1944 1944
1945 bool LayoutBlock::hasDefiniteLogicalHeight() const 1945 bool LayoutBlock::hasDefiniteLogicalHeight() const
1946 { 1946 {
1947 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 1947 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
1948 } 1948 }
1949 1949
1950 } // namespace blink 1950 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698