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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 396263003: flex shorthand incorrectly accepting 1 0% 1 (i.e. flex-basis in the middle) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP Patch 2 Created 6 years, 5 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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 5712 matching lines...) Expand 10 before | Expand all | Expand 10 after
5723 flexGrow = arg->fValue; 5723 flexGrow = arg->fValue;
5724 else if (flexShrink == unsetValue) 5724 else if (flexShrink == unsetValue)
5725 flexShrink = arg->fValue; 5725 flexShrink = arg->fValue;
5726 else if (!arg->fValue) { 5726 else if (!arg->fValue) {
5727 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set. 5727 // flex only allows a basis of 0 (sans units) if flex-grow and f lex-shrink values have already been set.
5728 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX); 5728 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS _PX);
5729 } else { 5729 } else {
5730 // We only allow 3 numbers without units if the last value is 0. E.g., flex:1 1 1 is invalid. 5730 // We only allow 3 numbers without units if the last value is 0. E.g., flex:1 1 1 is invalid.
5731 return false; 5731 return false;
5732 } 5732 }
5733 } else if (!flexBasis && (arg->id == CSSValueAuto || validUnit(arg, FLen gth | FPercent | FNonNeg))) 5733 } else if (!flexBasis && (arg->id == CSSValueAuto || (validUnit(arg, FLe ngth | FPercent | FNonNeg) && !(flexGrow != unsetValue && flexShrink == unsetVal ue && args->size() == 3))))
tony 2014/07/16 17:12:38 I would make a helper function for this to help do
harpreet.sk 2014/07/17 08:03:25 Done.
5734 flexBasis = parseValidPrimitive(arg->id, arg); 5734 flexBasis = parseValidPrimitive(arg->id, arg);
5735 else { 5735 else {
5736 // Not a valid arg for flex. 5736 // Not a valid arg for flex.
5737 return false; 5737 return false;
5738 } 5738 }
5739 args->next(); 5739 args->next();
5740 } 5740 }
5741 5741
5742 if (flexGrow == unsetValue) 5742 if (flexGrow == unsetValue)
5743 flexGrow = 1; 5743 flexGrow = 1;
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
8503 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8503 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8504 if (!seenStroke) 8504 if (!seenStroke)
8505 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8505 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8506 if (!seenMarkers) 8506 if (!seenMarkers)
8507 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8507 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8508 8508
8509 return parsedValues.release(); 8509 return parsedValues.release();
8510 } 8510 }
8511 8511
8512 } // namespace WebCore 8512 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698