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

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: Try to fix ASSERTs 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // auto | use-script | no-change | reset-size | ideographic | 521 // auto | use-script | no-change | reset-size | ideographic |
522 // alphabetic | hanging | mathematical | central | middle | 522 // alphabetic | hanging | mathematical | central | middle |
523 // text-after-edge | text-before-edge 523 // text-after-edge | text-before-edge
524 return valueID == CSSValueAuto || valueID == CSSValueMiddle 524 return valueID == CSSValueAuto || valueID == CSSValueMiddle
525 || (valueID >= CSSValueUseScript && valueID <= CSSValueResetSize) 525 || (valueID >= CSSValueUseScript && valueID <= CSSValueResetSize)
526 || (valueID >= CSSValueCentral && valueID <= CSSValueMathematical); 526 || (valueID >= CSSValueCentral && valueID <= CSSValueMathematical);
527 case CSSPropertyEmptyCells: // show | hide 527 case CSSPropertyEmptyCells: // show | hide
528 return valueID == CSSValueShow || valueID == CSSValueHide; 528 return valueID == CSSValueShow || valueID == CSSValueHide;
529 case CSSPropertyFloat: // left | right | none 529 case CSSPropertyFloat: // left | right | none
530 return valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone; 530 return valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone;
531 case CSSPropertyFontDisplay: // auto | block | swap | fallback | optional
532 return valueID == CSSValueAuto || valueID == CSSValueBlock || valueID == CSSValueSwap || valueID == CSSValueFallback || valueID == CSSValueOptional;
533 case CSSPropertyFontStyle: // normal | italic | oblique 531 case CSSPropertyFontStyle: // normal | italic | oblique
534 return valueID == CSSValueNormal || valueID == CSSValueItalic || valueID == CSSValueOblique; 532 return valueID == CSSValueNormal || valueID == CSSValueItalic || valueID == CSSValueOblique;
535 case CSSPropertyFontStretch: // normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra- expanded 533 case CSSPropertyFontStretch: // normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra- expanded
536 return valueID == CSSValueNormal || (valueID >= CSSValueUltraCondensed & & valueID <= CSSValueUltraExpanded); 534 return valueID == CSSValueNormal || (valueID >= CSSValueUltraCondensed & & valueID <= CSSValueUltraExpanded);
537 case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated 535 case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated
538 return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContr ast || (RuntimeEnabledFeatures::imageRenderingPixelatedEnabled() && valueID == C SSValuePixelated); 536 return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContr ast || (RuntimeEnabledFeatures::imageRenderingPixelatedEnabled() && valueID == C SSValuePixelated);
539 case CSSPropertyIsolation: // auto | isolate 537 case CSSPropertyIsolation: // auto | isolate
540 return valueID == CSSValueAuto || valueID == CSSValueIsolate; 538 return valueID == CSSValueAuto || valueID == CSSValueIsolate;
541 case CSSPropertyListStylePosition: // inside | outside 539 case CSSPropertyListStylePosition: // inside | outside
542 return valueID == CSSValueInside || valueID == CSSValueOutside; 540 return valueID == CSSValueInside || valueID == CSSValueOutside;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 834
837 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) { 835 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) {
838 // All properties accept the values of "initial" and "inherit". 836 // All properties accept the values of "initial" and "inherit".
839 String lowerCaseString = string.lower(); 837 String lowerCaseString = string.lower();
840 if (lowerCaseString != "initial" && lowerCaseString != "inherit") 838 if (lowerCaseString != "initial" && lowerCaseString != "inherit")
841 return nullptr; 839 return nullptr;
842 840
843 // Parse initial/inherit shorthands using the CSSPropertyParser. 841 // Parse initial/inherit shorthands using the CSSPropertyParser.
844 if (shorthandForProperty(propertyId).length()) 842 if (shorthandForProperty(propertyId).length())
845 return nullptr; 843 return nullptr;
844
845 // Descriptors do not support css wide keywords.
846 if (CSSPropertyMetadata::isDescriptor(propertyId))
847 return nullptr;
846 } 848 }
847 849
848 CSSParserString cssString; 850 CSSParserString cssString;
849 cssString.init(string); 851 cssString.init(string);
850 CSSValueID valueID = cssValueKeywordID(cssString); 852 CSSValueID valueID = cssValueKeywordID(cssString);
851 853
852 if (!valueID) 854 if (!valueID)
853 return nullptr; 855 return nullptr;
854 856
855 if (valueID == CSSValueInherit) 857 if (valueID == CSSValueInherit)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 if (isColorPropertyID(propertyID)) 1032 if (isColorPropertyID(propertyID))
1031 return parseColor(string, parserMode); 1033 return parseColor(string, parserMode);
1032 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode)) 1034 if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
1033 return keyword; 1035 return keyword;
1034 if (CSSValue* transform = parseSimpleTransform(propertyID, string)) 1036 if (CSSValue* transform = parseSimpleTransform(propertyID, string))
1035 return transform; 1037 return transform;
1036 return nullptr; 1038 return nullptr;
1037 } 1039 }
1038 1040
1039 } // namespace blink 1041 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698