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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 24360004: Use shrink-to-fit for width for Button, input, select, textarea, and legend treat width value of 'a… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index f8701312bfd61f38a443479ad7901352007b805a..4402f7d7e7ad42f41312f9f59e93cf03f4e148ab 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -3422,7 +3422,17 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
} else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
// RULE 5: (solve for width)
logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
- computedValues.m_extent = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth, renderView));
+ // Use shrink-to-fit for width for Button, input, select, textarea, and legend treat width value of
+ // 'auto' as 'intrinsic' unless it's in a stretching column flexbox.
+ if (!isStretchingColumnFlexItem(this) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag)
ojan 2013/09/24 23:58:44 This should share more code withe RenderBox::sizes
cbiesinger 2013/09/26 18:03:14 Can you explain a bit why you need the isStretchin
pals 2013/10/03 11:00:05 Done.
pals 2013/10/03 11:00:05 Done. Removed the check. Thanks for pointing it ou
+ || node()->hasTagName(buttonTag) || isHTMLTextAreaElement(node()) || node()->hasTagName(legendTag))) {
+ LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
+ LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPadding;
ojan 2013/09/24 23:58:44 Make sure to add layout tests with and without bor
pals 2013/10/03 11:00:05 Done.
cbiesinger 2013/10/03 21:43:30 Thanks for the updated patch. On 2013/10/03 11:00
+ LayoutUnit availableWidth = availableSpace - logicalLeftValue;
+ computedValues.m_extent = min(max(preferredMinWidth, availableWidth), preferredWidth);
+ } else {
+ computedValues.m_extent = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth, renderView));
+ }
} else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
// RULE 6: (no need solve for right)
logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698