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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "wtf/text/StringBuilder.h" | 82 #include "wtf/text/StringBuilder.h" |
83 #include "wtf/text/StringImpl.h" | 83 #include "wtf/text/StringImpl.h" |
84 #include "wtf/text/TextEncoding.h" | 84 #include "wtf/text/TextEncoding.h" |
85 #include <limits.h> | 85 #include <limits.h> |
86 | 86 |
87 using namespace std; | 87 using namespace std; |
88 | 88 |
89 namespace WebCore { | 89 namespace WebCore { |
90 | 90 |
91 static const double MAX_SCALE = 1000000; | 91 static const double MAX_SCALE = 1000000; |
| 92 static const unsigned minRepetitions = 10000; |
92 | 93 |
93 template <unsigned N> | 94 template <unsigned N> |
94 static bool equal(const CSSParserString& a, const char (&b)[N]) | 95 static bool equal(const CSSParserString& a, const char (&b)[N]) |
95 { | 96 { |
96 unsigned length = N - 1; // Ignore the trailing null character | 97 unsigned length = N - 1; // Ignore the trailing null character |
97 if (a.length() != length) | 98 if (a.length() != length) |
98 return false; | 99 return false; |
99 | 100 |
100 return a.is8Bit() ? WTF::equal(a.characters8(), reinterpret_cast<const LChar
*>(b), length) : WTF::equal(a.characters16(), reinterpret_cast<const LChar*>(b),
length); | 101 return a.is8Bit() ? WTF::equal(a.characters8(), reinterpret_cast<const LChar
*>(b), length) : WTF::equal(a.characters16(), reinterpret_cast<const LChar*>(b),
length); |
101 } | 102 } |
(...skipping 3688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3790 } | 3791 } |
3791 | 3792 |
3792 bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list) | 3793 bool CSSPropertyParser::parseGridTrackRepeatFunction(CSSValueList& list) |
3793 { | 3794 { |
3794 CSSParserValueList* arguments = m_valueList->current()->function->args.get()
; | 3795 CSSParserValueList* arguments = m_valueList->current()->function->args.get()
; |
3795 if (!arguments || arguments->size() < 3 || !validUnit(arguments->valueAt(0),
FPositiveInteger) || !isComma(arguments->valueAt(1))) | 3796 if (!arguments || arguments->size() < 3 || !validUnit(arguments->valueAt(0),
FPositiveInteger) || !isComma(arguments->valueAt(1))) |
3796 return false; | 3797 return false; |
3797 | 3798 |
3798 ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); | 3799 ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); |
3799 size_t repetitions = arguments->valueAt(0)->fValue; | 3800 size_t repetitions = arguments->valueAt(0)->fValue; |
| 3801 // Clamp repetitions at minRepetitions. |
| 3802 // http://www.w3.org/TR/css-grid-1/#repeat-notation |
| 3803 if (repetitions > minRepetitions) |
| 3804 repetitions = minRepetitions; |
3800 RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceS
eparated(); | 3805 RefPtrWillBeRawPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceS
eparated(); |
3801 arguments->next(); // Skip the repetition count. | 3806 arguments->next(); // Skip the repetition count. |
3802 arguments->next(); // Skip the comma. | 3807 arguments->next(); // Skip the comma. |
3803 | 3808 |
3804 // Handle leading <ident>*. | 3809 // Handle leading <ident>*. |
3805 CSSParserValue* currentValue = arguments->current(); | 3810 CSSParserValue* currentValue = arguments->current(); |
3806 if (currentValue && currentValue->unit == CSSParserValue::ValueList) | 3811 if (currentValue && currentValue->unit == CSSParserValue::ValueList) |
3807 parseGridLineNames(*arguments, *repeatedValues); | 3812 parseGridLineNames(*arguments, *repeatedValues); |
3808 | 3813 |
3809 while (arguments->current()) { | 3814 while (arguments->current()) { |
(...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8487 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8492 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8488 if (!seenStroke) | 8493 if (!seenStroke) |
8489 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8494 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8490 if (!seenMarkers) | 8495 if (!seenMarkers) |
8491 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8496 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8492 | 8497 |
8493 return parsedValues.release(); | 8498 return parsedValues.release(); |
8494 } | 8499 } |
8495 | 8500 |
8496 } // namespace WebCore | 8501 } // namespace WebCore |
OLD | NEW |