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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3404 matching lines...) Expand 10 before | Expand all | Expand 10 after
3415 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersP lusPadding; 3415 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersP lusPadding;
3416 LayoutUnit availableWidth = availableSpace - logicalLeftValue; 3416 LayoutUnit availableWidth = availableSpace - logicalLeftValue;
3417 computedValues.m_extent = min(max(preferredMinWidth, availableWidth) , preferredWidth); 3417 computedValues.m_extent = min(max(preferredMinWidth, availableWidth) , preferredWidth);
3418 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu to) { 3418 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu to) {
3419 // RULE 4: (solve for left) 3419 // RULE 4: (solve for left)
3420 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth, renderView)); 3420 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth, renderView));
3421 logicalLeftValue = availableSpace - (computedValues.m_extent + value ForLength(logicalRight, containerLogicalWidth, renderView)); 3421 logicalLeftValue = availableSpace - (computedValues.m_extent + value ForLength(logicalRight, containerLogicalWidth, renderView));
3422 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAu to) { 3422 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAu to) {
3423 // RULE 5: (solve for width) 3423 // RULE 5: (solve for width)
3424 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth , renderView); 3424 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth , renderView);
3425 computedValues.m_extent = availableSpace - (logicalLeftValue + value ForLength(logicalRight, containerLogicalWidth, renderView)); 3425 // Use shrink-to-fit for width for Button, input, select, textarea, and legend treat width value of
3426 // 'auto' as 'intrinsic' unless it's in a stretching column flexbox.
3427 if (!isStretchingColumnFlexItem(this) && node() && (node()->hasTagNa me(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
3428 || node()->hasTagName(buttonTag) || isHTMLTextAreaElement(node() ) || node()->hasTagName(legendTag))) {
3429 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - borders PlusPadding;
3430 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bord ersPlusPadding;
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
3431 LayoutUnit availableWidth = availableSpace - logicalLeftValue;
3432 computedValues.m_extent = min(max(preferredMinWidth, availableWi dth), preferredWidth);
3433 } else {
3434 computedValues.m_extent = availableSpace - (logicalLeftValue + v alueForLength(logicalRight, containerLogicalWidth, renderView));
3435 }
3426 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAu to) { 3436 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAu to) {
3427 // RULE 6: (no need solve for right) 3437 // RULE 6: (no need solve for right)
3428 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth , renderView); 3438 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth , renderView);
3429 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth, renderView)); 3439 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth, renderView));
3430 } 3440 }
3431 } 3441 }
3432 3442
3433 // Use computed values to calculate the horizontal position. 3443 // Use computed values to calculate the horizontal position.
3434 3444
3435 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively 3445 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4722 return 0; 4732 return 0;
4723 4733
4724 if (!layoutState && !flowThreadContainingBlock()) 4734 if (!layoutState && !flowThreadContainingBlock())
4725 return 0; 4735 return 0;
4726 4736
4727 RenderBlock* containerBlock = containingBlock(); 4737 RenderBlock* containerBlock = containingBlock();
4728 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4738 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4729 } 4739 }
4730 4740
4731 } // namespace WebCore 4741 } // namespace WebCore
OLDNEW
« 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