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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 578723003: Don't allow negative width for positioned elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix nit Created 6 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 | « LayoutTests/fast/css/absolute-position-with-negative-width-expected.txt ('k') | 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 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu to) { 3288 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu to) {
3289 // RULE 4: (solve for left) 3289 // RULE 4: (solve for left)
3290 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth)); 3290 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth));
3291 logicalLeftValue = availableSpace - (computedValues.m_extent + value ForLength(logicalRight, containerLogicalWidth)); 3291 logicalLeftValue = availableSpace - (computedValues.m_extent + value ForLength(logicalRight, containerLogicalWidth));
3292 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAu to) { 3292 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAu to) {
3293 // RULE 5: (solve for width) 3293 // RULE 5: (solve for width)
3294 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth ); 3294 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth );
3295 if (autoWidthShouldFitContent()) 3295 if (autoWidthShouldFitContent())
3296 shrinkToFitWidth(availableSpace, logicalLeftValue, bordersPlusPa dding, computedValues); 3296 shrinkToFitWidth(availableSpace, logicalLeftValue, bordersPlusPa dding, computedValues);
3297 else 3297 else
3298 computedValues.m_extent = availableSpace - (logicalLeftValue + v alueForLength(logicalRight, containerLogicalWidth)); 3298 computedValues.m_extent = std::max<LayoutUnit>(0, availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth)));
3299 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAu to) { 3299 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAu to) {
3300 // RULE 6: (no need solve for right) 3300 // RULE 6: (no need solve for right)
3301 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth ); 3301 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth );
3302 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth)); 3302 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v alueForLength(logicalWidth, containerLogicalWidth));
3303 } 3303 }
3304 } 3304 }
3305 3305
3306 // Use computed values to calculate the horizontal position. 3306 // Use computed values to calculate the horizontal position.
3307 3307
3308 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively 3308 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
4735 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4735 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4736 { 4736 {
4737 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); 4737 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor);
4738 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4738 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4739 ASSERT(hasBackground == style.hasBackground()); 4739 ASSERT(hasBackground == style.hasBackground());
4740 hasBorder = style.hasBorder(); 4740 hasBorder = style.hasBorder();
4741 hasAppearance = style.hasAppearance(); 4741 hasAppearance = style.hasAppearance();
4742 } 4742 }
4743 4743
4744 } // namespace blink 4744 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/absolute-position-with-negative-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698