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

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

Issue 2006413002: Avoid calling lower() on inline styles in parseKeywordValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return false; 829 return false;
830 } 830 }
831 } 831 }
832 832
833 static CSSValue* parseKeywordValue(CSSPropertyID propertyId, const String& strin g, CSSParserMode parserMode) 833 static CSSValue* parseKeywordValue(CSSPropertyID propertyId, const String& strin g, CSSParserMode parserMode)
834 { 834 {
835 ASSERT(!string.isEmpty()); 835 ASSERT(!string.isEmpty());
836 836
837 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) { 837 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) {
838 // All properties accept the values of "initial" and "inherit". 838 // All properties accept the values of "initial" and "inherit".
839 String lowerCaseString = string.lower(); 839 if (!equalIgnoringASCIICase(string, "initial") && !equalIgnoringASCIICas e(string, "inherit"))
840 if (lowerCaseString != "initial" && lowerCaseString != "inherit")
841 return nullptr; 840 return nullptr;
842 841
843 // Parse initial/inherit shorthands using the CSSPropertyParser. 842 // Parse initial/inherit shorthands using the CSSPropertyParser.
844 if (shorthandForProperty(propertyId).length()) 843 if (shorthandForProperty(propertyId).length())
845 return nullptr; 844 return nullptr;
846 } 845 }
847 846
848 CSSParserString cssString; 847 CSSParserString cssString;
849 cssString.init(string); 848 cssString.init(string);
850 CSSValueID valueID = cssValueKeywordID(cssString); 849 CSSValueID valueID = cssValueKeywordID(cssString);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 if (isColorPropertyID(propertyID)) 1027 if (isColorPropertyID(propertyID))
1029 return parseColor(string, parserMode); 1028 return parseColor(string, parserMode);
1030 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) 1029 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
1031 return keyword; 1030 return keyword;
1032 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) 1031 if (CSSValue* transform = parseSimpleTransform(propertyID, string))
1033 return transform; 1032 return transform;
1034 return nullptr; 1033 return nullptr;
1035 } 1034 }
1036 1035
1037 } // namespace blink 1036 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698