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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/css3/flexbox/flex-shorthand-flex-basis-middle-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index b1c38e7488cb82bd9722c130f1a38c4aa51d2e05..42d88d991d5dd2235f2a25983e92f64d58f16ff7 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -5708,6 +5708,11 @@ bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important)
return true;
}
+static bool isFlexBasisMiddleArg(double flexGrow, double flexShrink, double unsetValue, int argSize)
+{
+ return flexGrow != unsetValue && flexShrink == unsetValue && argSize == 3;
+}
+
bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
{
if (!args || !args->size() || args->size() > 3)
@@ -5730,7 +5735,7 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
// We only allow 3 numbers without units if the last value is 0. E.g., flex:1 1 1 is invalid.
return false;
}
- } else if (!flexBasis && (arg->id == CSSValueAuto || validUnit(arg, FLength | FPercent | FNonNeg)))
+ } else if (!flexBasis && (arg->id == CSSValueAuto || (validUnit(arg, FLength | FPercent | FNonNeg) && !isFlexBasisMiddleArg(flexGrow, flexShrink, unsetValue, args->size()))))
flexBasis = parseValidPrimitive(arg->id, arg);
else {
// Not a valid arg for flex.
« no previous file with comments | « LayoutTests/css3/flexbox/flex-shorthand-flex-basis-middle-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698