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

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

Issue 1924313002: Make <attr-name> accept any CSS identifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/attr-parsing-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/attr-parsing-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698