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

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

Issue 2022033003: [css-sizing] Adding border and padding to fill-available width (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New approach and tests case. Created 4 years, 6 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 marginStart = minimumValueForLength(style()->marginStart(), availableLogical Width); 2303 marginStart = minimumValueForLength(style()->marginStart(), availableLogical Width);
2304 marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidt h); 2304 marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidt h);
2305 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd; 2305 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd;
2306 available = std::max(available, LayoutUnit()); 2306 available = std::max(available, LayoutUnit());
2307 return available; 2307 return available;
2308 } 2308 }
2309 2309
2310 LayoutUnit LayoutBox::computeIntrinsicLogicalWidthUsing(const Length& logicalWid thLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const 2310 LayoutUnit LayoutBox::computeIntrinsicLogicalWidthUsing(const Length& logicalWid thLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const
2311 { 2311 {
2312 if (logicalWidthLength.type() == FillAvailable) 2312 if (logicalWidthLength.type() == FillAvailable)
2313 return fillAvailableMeasure(availableLogicalWidth); 2313 return std::max(borderAndPadding, fillAvailableMeasure(availableLogicalW idth));
2314 2314
2315 LayoutUnit minLogicalWidth; 2315 LayoutUnit minLogicalWidth;
2316 LayoutUnit maxLogicalWidth; 2316 LayoutUnit maxLogicalWidth;
2317 computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); 2317 computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
2318 2318
2319 if (logicalWidthLength.type() == MinContent) 2319 if (logicalWidthLength.type() == MinContent)
2320 return minLogicalWidth + borderAndPadding; 2320 return minLogicalWidth + borderAndPadding;
2321 2321
2322 if (logicalWidthLength.type() == MaxContent) 2322 if (logicalWidthLength.type() == MaxContent)
2323 return maxLogicalWidth + borderAndPadding; 2323 return maxLogicalWidth + borderAndPadding;
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 m_rareData->m_snapAreas->remove(&snapArea); 4950 m_rareData->m_snapAreas->remove(&snapArea);
4951 } 4951 }
4952 } 4952 }
4953 4953
4954 SnapAreaSet* LayoutBox::snapAreas() const 4954 SnapAreaSet* LayoutBox::snapAreas() const
4955 { 4955 {
4956 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4956 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4957 } 4957 }
4958 4958
4959 } // namespace blink 4959 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698