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

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

Issue 1151893003: Properties labelled !important must be ignored in keyframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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 "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSParserImpl.h" 6 #include "core/css/parser/CSSParserImpl.h"
7 7
8 #include "core/css/CSSKeyframesRule.h" 8 #include "core/css/CSSKeyframesRule.h"
9 #include "core/css/CSSStyleSheet.h" 9 #include "core/css/CSSStyleSheet.h"
10 #include "core/css/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRule::Typ e ruleType) 655 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRule::Typ e ruleType)
656 { 656 {
657 CSSParserTokenRange rangeCopy = range; // For inspector callbacks 657 CSSParserTokenRange rangeCopy = range; // For inspector callbacks
658 658
659 ASSERT(range.peek().type() == IdentToken); 659 ASSERT(range.peek().type() == IdentToken);
660 CSSPropertyID unresolvedProperty = range.consumeIncludingWhitespace().parseA sUnresolvedCSSPropertyID(); 660 CSSPropertyID unresolvedProperty = range.consumeIncludingWhitespace().parseA sUnresolvedCSSPropertyID();
661 if (range.consume().type() != ColonToken) 661 if (range.consume().type() != ColonToken)
662 return; // Parse error 662 return; // Parse error
663 663
664 // FIXME: We shouldn't allow !important in @keyframes or @font-face
665 bool important = false; 664 bool important = false;
666 const CSSParserToken* declarationValueEnd = range.end(); 665 const CSSParserToken* declarationValueEnd = range.end();
667 const CSSParserToken* last = range.end() - 1; 666 const CSSParserToken* last = range.end() - 1;
668 while (last->type() == WhitespaceToken) 667 while (last->type() == WhitespaceToken)
669 --last; 668 --last;
670 if (last->type() == IdentToken && last->valueEqualsIgnoringCase("important") ) { 669 if (last->type() == IdentToken && last->valueEqualsIgnoringCase("important") ) {
671 --last; 670 --last;
672 while (last->type() == WhitespaceToken) 671 while (last->type() == WhitespaceToken)
673 --last; 672 --last;
674 if (last->type() == DelimiterToken && last->delimiter() == '!') { 673 if (last->type() == DelimiterToken && last->delimiter() == '!') {
675 important = true; 674 important = true;
676 declarationValueEnd = last; 675 declarationValueEnd = last;
677 } 676 }
678 } 677 }
679 678
679 // Properties labelled !important in @keyframes or @font-face should be igno red
Timothy Loh 2015/05/28 04:47:03 I don't think this comment adds any value
patro 2015/05/28 08:20:52 Removed it Done.
680 if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule:: Keyframes))
681 return;
682
680 if (m_observerWrapper && ruleType == StyleRule::Style) { 683 if (m_observerWrapper && ruleType == StyleRule::Style) {
681 size_t propertiesCount = m_parsedProperties.size(); 684 size_t propertiesCount = m_parsedProperties.size();
682 if (unresolvedProperty != CSSPropertyInvalid) 685 if (unresolvedProperty != CSSPropertyInvalid)
683 consumeDeclarationValue(range.makeSubRange(&range.peek(), declaratio nValueEnd), unresolvedProperty, important, ruleType); 686 consumeDeclarationValue(range.makeSubRange(&range.peek(), declaratio nValueEnd), unresolvedProperty, important, ruleType);
684 m_observerWrapper->observer().startProperty(m_observerWrapper->startOffs et(rangeCopy)); 687 m_observerWrapper->observer().startProperty(m_observerWrapper->startOffs et(rangeCopy));
685 m_observerWrapper->observer().endProperty(important, 688 m_observerWrapper->observer().endProperty(important,
686 m_parsedProperties.size() != propertiesCount, 689 m_parsedProperties.size() != propertiesCount,
687 m_observerWrapper->endOffset(rangeCopy), NoCSSError); 690 m_observerWrapper->endOffset(rangeCopy), NoCSSError);
688 return; 691 return;
689 } 692 }
(...skipping 30 matching lines...) Expand all
720 else 723 else
721 return nullptr; // Parser error, invalid value in keyframe selector 724 return nullptr; // Parser error, invalid value in keyframe selector
722 if (range.atEnd()) 725 if (range.atEnd())
723 return result.release(); 726 return result.release();
724 if (range.consume().type() != CommaToken) 727 if (range.consume().type() != CommaToken)
725 return nullptr; // Parser error 728 return nullptr; // Parser error
726 } 729 }
727 } 730 }
728 731
729 } // namespace blink 732 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698