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

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

Issue 2288633002: Recognise variable names when parsing CSS property names (Closed)
Patch Set: Created 4 years, 3 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/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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 --last; 759 --last;
760 while (last->type() == WhitespaceToken) 760 while (last->type() == WhitespaceToken)
761 --last; 761 --last;
762 if (last->type() == DelimiterToken && last->delimiter() == '!') { 762 if (last->type() == DelimiterToken && last->delimiter() == '!') {
763 important = true; 763 important = true;
764 declarationValueEnd = last; 764 declarationValueEnd = last;
765 } 765 }
766 } 766 }
767 767
768 size_t propertiesCount = m_parsedProperties.size(); 768 size_t propertiesCount = m_parsedProperties.size();
769 if (unresolvedProperty == CSSPropertyInvalid && CSSVariableParser::isValidVa riableName(token)) { 769 // TODO(timloh): Shouldn't this only be for StyleRule::Style?
rune 2016/08/29 07:48:42 Yes, and it's observable as a bug. Reported 641873
Timothy Loh 2016/08/29 08:15:50 Done.
770 if (unresolvedProperty == CSSPropertyVariable) {
770 AtomicString variableName = token.value().toAtomicString(); 771 AtomicString variableName = token.value().toAtomicString();
771 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueE nd), variableName, important); 772 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueE nd), variableName, important);
772 } 773 }
773 774
774 if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule:: Keyframe)) 775 if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule:: Keyframe))
775 return; 776 return;
776 777
777 if (unresolvedProperty != CSSPropertyInvalid) { 778 if (unresolvedProperty != CSSPropertyInvalid && unresolvedProperty != CSSPro pertyVariable) {
778 if (m_styleSheet && m_styleSheet->singleOwnerDocument()) 779 if (m_styleSheet && m_styleSheet->singleOwnerDocument())
779 Deprecation::warnOnDeprecatedProperties(m_styleSheet->singleOwnerDoc ument()->frame(), unresolvedProperty); 780 Deprecation::warnOnDeprecatedProperties(m_styleSheet->singleOwnerDoc ument()->frame(), unresolvedProperty);
780 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationVal ueEnd), unresolvedProperty, important, ruleType); 781 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationVal ueEnd), unresolvedProperty, important, ruleType);
781 } 782 }
782 783
783 if (m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleR ule::Keyframe)) { 784 if (m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleR ule::Keyframe)) {
784 m_observerWrapper->observer().observeProperty( 785 m_observerWrapper->observer().observeProperty(
785 m_observerWrapper->startOffset(rangeCopy), m_observerWrapper->endOff set(rangeCopy), 786 m_observerWrapper->startOffset(rangeCopy), m_observerWrapper->endOff set(rangeCopy),
786 important, m_parsedProperties.size() != propertiesCount); 787 important, m_parsedProperties.size() != propertiesCount);
787 } 788 }
(...skipping 25 matching lines...) Expand all
813 else 814 else
814 return nullptr; // Parser error, invalid value in keyframe selector 815 return nullptr; // Parser error, invalid value in keyframe selector
815 if (range.atEnd()) 816 if (range.atEnd())
816 return result; 817 return result;
817 if (range.consume().type() != CommaToken) 818 if (range.consume().type() != CommaToken)
818 return nullptr; // Parser error 819 return nullptr; // Parser error
819 } 820 }
820 } 821 }
821 822
822 } // namespace blink 823 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698