OLD | NEW |
---|---|
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 #include "wtf/HexNumber.h" | 78 #include "wtf/HexNumber.h" |
79 #include "wtf/text/StringBuffer.h" | 79 #include "wtf/text/StringBuffer.h" |
80 #include "wtf/text/StringBuilder.h" | 80 #include "wtf/text/StringBuilder.h" |
81 #include "wtf/text/StringImpl.h" | 81 #include "wtf/text/StringImpl.h" |
82 #include "wtf/text/TextEncoding.h" | 82 #include "wtf/text/TextEncoding.h" |
83 #include <limits.h> | 83 #include <limits.h> |
84 | 84 |
85 namespace blink { | 85 namespace blink { |
86 | 86 |
87 static const double MAX_SCALE = 1000000; | 87 static const double MAX_SCALE = 1000000; |
88 static const unsigned minRepetitions = 10000; | 88 static const size_t maxRepetitions = 10000; |
alancutter (OOO until 2018)
2014/08/15 05:06:42
Can this constant live inside parseGridTrackRepeat
Timothy Loh
2014/08/15 05:29:10
Done.
| |
89 | 89 |
90 template <unsigned N> | 90 template <unsigned N> |
91 static bool equal(const CSSParserString& a, const char (&b)[N]) | 91 static bool equal(const CSSParserString& a, const char (&b)[N]) |
92 { | 92 { |
93 unsigned length = N - 1; // Ignore the trailing null character | 93 unsigned length = N - 1; // Ignore the trailing null character |
94 if (a.length() != length) | 94 if (a.length() != length) |
95 return false; | 95 return false; |
96 | 96 |
97 return a.is8Bit() ? WTF::equal(a.characters8(), reinterpret_cast<const LChar *>(b), length) : WTF::equal(a.characters16(), reinterpret_cast<const LChar*>(b), length); | 97 return a.is8Bit() ? WTF::equal(a.characters8(), reinterpret_cast<const LChar *>(b), length) : WTF::equal(a.characters16(), reinterpret_cast<const LChar*>(b), length); |
98 } | 98 } |
(...skipping 3663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3762 } | 3762 } |
3763 | 3763 |
3764 bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list) | 3764 bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list) |
3765 { | 3765 { |
3766 CSSParserValueList* arguments = m_valueList->current()->function->args.get() ; | 3766 CSSParserValueList* arguments = m_valueList->current()->function->args.get() ; |
3767 if (!arguments || arguments->size() < 3 || !validUnit(arguments->valueAt(0), FPositiveInteger) || !isComma(arguments->valueAt(1))) | 3767 if (!arguments || arguments->size() < 3 || !validUnit(arguments->valueAt(0), FPositiveInteger) || !isComma(arguments->valueAt(1))) |
3768 return false; | 3768 return false; |
3769 | 3769 |
3770 ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); | 3770 ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); |
3771 size_t repetitions = arguments->valueAt(0)->fValue; | 3771 size_t repetitions = arguments->valueAt(0)->fValue; |
3772 // Clamp repetitions at minRepetitions. | 3772 // The spec allows us to clamp the number of repetitions: http://www.w3.org/ TR/css-grid-1/#repeat-notation |
3773 // http://www.w3.org/TR/css-grid-1/#repeat-notation | 3773 repetitions = std::min(repetitions, maxRepetitions); |
3774 if (repetitions > minRepetitions) | 3774 |
3775 repetitions = minRepetitions; | |
3776 RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceS eparated(); | 3775 RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceS eparated(); |
3777 arguments->next(); // Skip the repetition count. | 3776 arguments->next(); // Skip the repetition count. |
3778 arguments->next(); // Skip the comma. | 3777 arguments->next(); // Skip the comma. |
3779 | 3778 |
3780 // Handle leading <ident>*. | 3779 // Handle leading <ident>*. |
3781 CSSParserValue* currentValue = arguments->current(); | 3780 CSSParserValue* currentValue = arguments->current(); |
3782 if (currentValue && currentValue->unit == CSSParserValue::ValueList) | 3781 if (currentValue && currentValue->unit == CSSParserValue::ValueList) |
3783 parseGridLineNames(*arguments, *repeatedValues); | 3782 parseGridLineNames(*arguments, *repeatedValues); |
3784 | 3783 |
3785 while (arguments->current()) { | 3784 while (arguments->current()) { |
(...skipping 4746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8532 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8531 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8533 if (!seenStroke) | 8532 if (!seenStroke) |
8534 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); | 8533 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); |
8535 if (!seenMarkers) | 8534 if (!seenMarkers) |
8536 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); | 8535 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); |
8537 | 8536 |
8538 return parsedValues.release(); | 8537 return parsedValues.release(); |
8539 } | 8538 } |
8540 | 8539 |
8541 } // namespace blink | 8540 } // namespace blink |
OLD | NEW |