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

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

Issue 2478623003: Disallow CSS custom properties as descriptors (Closed)
Patch Set: Created 4 years, 1 month 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/variables/variables-in-at-rules-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 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/CSSParserImpl.h" 5 #include "core/css/parser/CSSParserImpl.h"
6 6
7 #include "core/css/CSSCustomIdentValue.h" 7 #include "core/css/CSSCustomIdentValue.h"
8 #include "core/css/CSSCustomPropertyDeclaration.h" 8 #include "core/css/CSSCustomPropertyDeclaration.h"
9 #include "core/css/CSSKeyframesRule.h" 9 #include "core/css/CSSKeyframesRule.h"
10 #include "core/css/CSSStyleSheet.h" 10 #include "core/css/CSSStyleSheet.h"
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 equalIgnoringASCIICase(last->value(), "important")) { 878 equalIgnoringASCIICase(last->value(), "important")) {
879 --last; 879 --last;
880 while (last->type() == WhitespaceToken) 880 while (last->type() == WhitespaceToken)
881 --last; 881 --last;
882 if (last->type() == DelimiterToken && last->delimiter() == '!') { 882 if (last->type() == DelimiterToken && last->delimiter() == '!') {
883 important = true; 883 important = true;
884 declarationValueEnd = last; 884 declarationValueEnd = last;
885 } 885 }
886 } 886 }
887 887
888 if (important &&
889 (ruleType == StyleRule::FontFace || ruleType == StyleRule::Keyframe))
890 return;
891
888 size_t propertiesCount = m_parsedProperties.size(); 892 size_t propertiesCount = m_parsedProperties.size();
889 // TODO(timloh): This should only be for StyleRule::Style/Keyframe, 893
890 // crbug.com/641873.
891 if (unresolvedProperty == CSSPropertyVariable) { 894 if (unresolvedProperty == CSSPropertyVariable) {
895 if (ruleType != StyleRule::Style && ruleType != StyleRule::Keyframe)
896 return;
892 AtomicString variableName = token.value().toAtomicString(); 897 AtomicString variableName = token.value().toAtomicString();
893 bool isAnimationTainted = ruleType == StyleRule::Keyframe; 898 bool isAnimationTainted = ruleType == StyleRule::Keyframe;
894 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueEnd), 899 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueEnd),
895 variableName, important, isAnimationTainted); 900 variableName, important, isAnimationTainted);
896 } 901 } else if (unresolvedProperty != CSSPropertyInvalid) {
897
898 // TODO(timloh): Should this check occur before the call to
899 // consumeVariableValue()?
900 if (important &&
901 (ruleType == StyleRule::FontFace || ruleType == StyleRule::Keyframe))
902 return;
903
904 if (unresolvedProperty != CSSPropertyInvalid &&
905 unresolvedProperty != CSSPropertyVariable) {
906 if (m_styleSheet && m_styleSheet->singleOwnerDocument()) 902 if (m_styleSheet && m_styleSheet->singleOwnerDocument())
907 Deprecation::warnOnDeprecatedProperties( 903 Deprecation::warnOnDeprecatedProperties(
908 m_styleSheet->singleOwnerDocument()->frame(), unresolvedProperty); 904 m_styleSheet->singleOwnerDocument()->frame(), unresolvedProperty);
909 consumeDeclarationValue( 905 consumeDeclarationValue(
910 range.makeSubRange(&range.peek(), declarationValueEnd), 906 range.makeSubRange(&range.peek(), declarationValueEnd),
911 unresolvedProperty, important, ruleType); 907 unresolvedProperty, important, ruleType);
912 } 908 }
913 909
914 if (m_observerWrapper && 910 if (m_observerWrapper &&
915 (ruleType == StyleRule::Style || ruleType == StyleRule::Keyframe)) { 911 (ruleType == StyleRule::Style || ruleType == StyleRule::Keyframe)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 else 953 else
958 return nullptr; // Parser error, invalid value in keyframe selector 954 return nullptr; // Parser error, invalid value in keyframe selector
959 if (range.atEnd()) 955 if (range.atEnd())
960 return result; 956 return result;
961 if (range.consume().type() != CommaToken) 957 if (range.consume().type() != CommaToken)
962 return nullptr; // Parser error 958 return nullptr; // Parser error
963 } 959 }
964 } 960 }
965 961
966 } // namespace blink 962 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/variables/variables-in-at-rules-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698