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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp

Issue 2799793002: Implement color stop position syntax from CSS Image Values 4 (Closed)
Patch Set: hide behind RTEF Created 3 years, 8 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSPropertyParserHelpers.h" 5 #include "core/css/parser/CSSPropertyParserHelpers.h"
6 6
7 #include "core/css/CSSCalculationValue.h" 7 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSColorValue.h" 8 #include "core/css/CSSColorValue.h"
9 #include "core/css/CSSCrossfadeValue.h" 9 #include "core/css/CSSCrossfadeValue.h"
10 #include "core/css/CSSGradientValue.h" 10 #include "core/css/CSSGradientValue.h"
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 stop.m_color = consumeColor(range, cssParserMode); 960 stop.m_color = consumeColor(range, cssParserMode);
961 // Two hints in a row are not allowed. 961 // Two hints in a row are not allowed.
962 if (!stop.m_color && (!supportsColorHints || previousStopWasColorHint)) 962 if (!stop.m_color && (!supportsColorHints || previousStopWasColorHint))
963 return false; 963 return false;
964 previousStopWasColorHint = !stop.m_color; 964 previousStopWasColorHint = !stop.m_color;
965 stop.m_offset = consumePositionFunc(range, cssParserMode, ValueRangeAll, 965 stop.m_offset = consumePositionFunc(range, cssParserMode, ValueRangeAll,
966 UnitlessQuirk::Forbid); 966 UnitlessQuirk::Forbid);
967 if (!stop.m_color && !stop.m_offset) 967 if (!stop.m_color && !stop.m_offset)
968 return false; 968 return false;
969 gradient->addStop(stop); 969 gradient->addStop(stop);
970
971 if (!stop.m_color || !stop.m_offset ||
972 !RuntimeEnabledFeatures::multipleColorStopPositionsEnabled())
fs 2017/04/06 19:58:48 Ponder: Maybe we could have this as a: if (Runtim
f(malita) 2017/04/06 20:29:42 Done.
973 continue;
974
975 // Optional second position.
976 stop.m_offset = consumePositionFunc(range, cssParserMode, ValueRangeAll,
977 UnitlessQuirk::Forbid);
978 if (stop.m_offset)
979 gradient->addStop(stop);
970 } while (consumeCommaIncludingWhitespace(range)); 980 } while (consumeCommaIncludingWhitespace(range));
971 981
972 // The last color stop cannot be a color hint. 982 // The last color stop cannot be a color hint.
973 if (previousStopWasColorHint) 983 if (previousStopWasColorHint)
974 return false; 984 return false;
975 985
976 // Must have 2 or more stops to be valid. 986 // Must have 2 or more stops to be valid.
977 return gradient->stopCount() >= 2; 987 return gradient->stopCount() >= 2;
978 } 988 }
979 989
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 1417
1408 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box 1418 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
1409 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) { 1419 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) {
1410 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, 1420 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox,
1411 CSSValueMarginBox>(range); 1421 CSSValueMarginBox>(range);
1412 } 1422 }
1413 1423
1414 } // namespace CSSPropertyParserHelpers 1424 } // namespace CSSPropertyParserHelpers
1415 1425
1416 } // namespace blink 1426 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698