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

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: Add a test 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
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 3284 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = availableSpace - (logicalLeftValue + v alueForLength(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 if (computedValues.m_extent < 0)
mstensho (USE GERRIT) 2014/09/17 11:48:22 Might consider moving this to "RULE 5" a few lines
Kyungtae Kim 2014/09/18 12:50:07 Done.
3306 computedValues.m_extent = 0;
3305 3307
3306 // Use computed values to calculate the horizontal position. 3308 // Use computed values to calculate the horizontal position.
3307 3309
3308 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively 3310 // FIXME: This hack is needed to calculate the logical left position for a 'rtl' relatively
3309 // positioned, inline because right now, it is using the logical left positi on 3311 // positioned, inline because right now, it is using the logical left positi on
3310 // of the first line box when really it should use the last line box. When 3312 // of the first line box when really it should use the last line box. When
3311 // this is fixed elsewhere, this block should be removed. 3313 // this is fixed elsewhere, this block should be removed.
3312 if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRi ghtDirection()) { 3314 if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRi ghtDirection()) {
3313 const RenderInline* flow = toRenderInline(containerBlock); 3315 const RenderInline* flow = toRenderInline(containerBlock);
3314 InlineFlowBox* firstLine = flow->firstLineBox(); 3316 InlineFlowBox* firstLine = flow->firstLineBox();
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
4735 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4737 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4736 { 4738 {
4737 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); 4739 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor);
4738 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4740 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4739 ASSERT(hasBackground == style.hasBackground()); 4741 ASSERT(hasBackground == style.hasBackground());
4740 hasBorder = style.hasBorder(); 4742 hasBorder = style.hasBorder();
4741 hasAppearance = style.hasAppearance(); 4743 hasAppearance = style.hasAppearance();
4742 } 4744 }
4743 4745
4744 } // namespace blink 4746 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698