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

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

Issue 1386733003: Do not accept CSS-wide keywords for descriptors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/CSSParserFastPaths.h" 5 #include "core/css/parser/CSSParserFastPaths.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSFunctionValue.h" 8 #include "core/css/CSSFunctionValue.h"
9 #include "core/css/CSSValuePool.h" 9 #include "core/css/CSSValuePool.h"
10 #include "core/css/parser/CSSParserIdioms.h" 10 #include "core/css/parser/CSSParserIdioms.h"
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) { 838 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) {
839 // All properties accept the values of "initial" and "inherit". 839 // All properties accept the values of "initial" and "inherit".
840 String lowerCaseString = string.lower(); 840 String lowerCaseString = string.lower();
841 if (lowerCaseString != "initial" && lowerCaseString != "inherit") 841 if (lowerCaseString != "initial" && lowerCaseString != "inherit")
842 return nullptr; 842 return nullptr;
843 843
844 // Parse initial/inherit shorthands using the CSSPropertyParser. 844 // Parse initial/inherit shorthands using the CSSPropertyParser.
845 if (shorthandForProperty(propertyId).length()) 845 if (shorthandForProperty(propertyId).length())
846 return nullptr; 846 return nullptr;
847
848 // Descriptors do not support css wide keywords.
849 if (CSSPropertyMetadata::isDescriptor(propertyId))
Timothy Loh 2016/05/19 05:44:42 Maybe this check should just be at the top of the
rwlbuis 2016/05/20 00:51:11 This was placed here to minimize calls to isDescri
850 return nullptr;
847 } 851 }
848 852
849 CSSParserString cssString; 853 CSSParserString cssString;
850 cssString.init(string); 854 cssString.init(string);
851 CSSValueID valueID = cssValueKeywordID(cssString); 855 CSSValueID valueID = cssValueKeywordID(cssString);
852 856
853 if (!valueID) 857 if (!valueID)
854 return nullptr; 858 return nullptr;
855 859
856 if (valueID == CSSValueInherit) 860 if (valueID == CSSValueInherit)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 if (isColorPropertyID(propertyID)) 1035 if (isColorPropertyID(propertyID))
1032 return parseColor(string, parserMode); 1036 return parseColor(string, parserMode);
1033 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) 1037 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
1034 return keyword; 1038 return keyword;
1035 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) 1039 if (CSSValue* transform = parseSimpleTransform(propertyID, string))
1036 return transform; 1040 return transform;
1037 return nullptr; 1041 return nullptr;
1038 } 1042 }
1039 1043
1040 } // namespace blink 1044 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698