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

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 479493002: Rename minRepetitions to maxRepetitions and clamp with min() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move constant to inside function Created 6 years, 4 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 | « no previous file | 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 81f39eeb9d516d0674b378673fb105cdf2c220d9..31f50ada7631fd6d2e0d90fc9130860a54a068bc 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -85,7 +85,6 @@
namespace blink {
static const double MAX_SCALE = 1000000;
-static const unsigned minRepetitions = 10000;
template <unsigned N>
static bool equal(const CSSParserString& a, const char (&b)[N])
@@ -3769,10 +3768,11 @@ bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list)
ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0);
size_t repetitions = arguments->valueAt(0)->fValue;
- // Clamp repetitions at minRepetitions.
- // http://www.w3.org/TR/css-grid-1/#repeat-notation
- if (repetitions > minRepetitions)
- repetitions = minRepetitions;
+
+ // The spec allows us to clamp the number of repetitions: http://www.w3.org/TR/css-grid-1/#repeat-notation
+ const size_t maxRepetitions = 10000;
+ repetitions = std::min(repetitions, maxRepetitions);
+
RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated();
arguments->next(); // Skip the repetition count.
arguments->next(); // Skip the comma.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698