OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
8 #include "core/css/CSSBasicShapeValues.h" | 8 #include "core/css/CSSBasicShapeValues.h" |
9 #include "core/css/CSSBorderImage.h" | 9 #include "core/css/CSSBorderImage.h" |
10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 return consumeIdent(range); | 2319 return consumeIdent(range); |
2320 return consumeImage(range, context); | 2320 return consumeImage(range, context); |
2321 } | 2321 } |
2322 | 2322 |
2323 static CSSValue* consumeAttr(CSSParserTokenRange args, CSSParserContext context) | 2323 static CSSValue* consumeAttr(CSSParserTokenRange args, CSSParserContext context) |
2324 { | 2324 { |
2325 if (args.peek().type() != IdentToken) | 2325 if (args.peek().type() != IdentToken) |
2326 return nullptr; | 2326 return nullptr; |
2327 | 2327 |
2328 String attrName = args.consumeIncludingWhitespace().value(); | 2328 String attrName = args.consumeIncludingWhitespace().value(); |
2329 // CSS allows identifiers with "-" at the start, like "-webkit-mask-image". | 2329 if (!args.atEnd()) |
2330 // But HTML attribute names can't have those characters, and we should not | |
2331 // even parse them inside attr(). | |
2332 // TODO(timloh): We should allow any <ident-token> here. | |
2333 if (attrName[0] == '-' || !args.atEnd()) | |
2334 return nullptr; | 2330 return nullptr; |
2335 | 2331 |
2336 if (context.isHTMLDocument()) | 2332 if (context.isHTMLDocument()) |
2337 attrName = attrName.lower(); | 2333 attrName = attrName.lower(); |
2338 | 2334 |
2339 CSSFunctionValue* attrValue = CSSFunctionValue::create(CSSValueAttr); | 2335 CSSFunctionValue* attrValue = CSSFunctionValue::create(CSSValueAttr); |
2340 attrValue->append(CSSCustomIdentValue::create(attrName)); | 2336 attrValue->append(CSSCustomIdentValue::create(attrName)); |
2341 return attrValue; | 2337 return attrValue; |
2342 } | 2338 } |
2343 | 2339 |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4956 case CSSPropertyGridTemplate: | 4952 case CSSPropertyGridTemplate: |
4957 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 4953 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
4958 case CSSPropertyGrid: | 4954 case CSSPropertyGrid: |
4959 return consumeGridShorthand(important); | 4955 return consumeGridShorthand(important); |
4960 default: | 4956 default: |
4961 return false; | 4957 return false; |
4962 } | 4958 } |
4963 } | 4959 } |
4964 | 4960 |
4965 } // namespace blink | 4961 } // namespace blink |
OLD | NEW |