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

Side by Side Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 993713002: Fix template angle bracket syntax in CSS subdirs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « Source/core/css/parser/BisonCSSParser.h ('k') | Source/core/css/parser/BisonCSSParserTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> BisonCSSParser::parseKeyframeRule(Styl eSheetContents* sheet, const String& string) 175 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> BisonCSSParser::parseKeyframeRule(Styl eSheetContents* sheet, const String& string)
176 { 176 {
177 setStyleSheet(sheet); 177 setStyleSheet(sheet);
178 setupParser("@-internal-keyframe-rule ", string, ""); 178 setupParser("@-internal-keyframe-rule ", string, "");
179 cssyyparse(this); 179 cssyyparse(this);
180 return m_keyframe.release(); 180 return m_keyframe.release();
181 } 181 }
182 182
183 PassOwnPtr<Vector<double> > BisonCSSParser::parseKeyframeKeyList(const String& s tring) 183 PassOwnPtr<Vector<double>> BisonCSSParser::parseKeyframeKeyList(const String& st ring)
184 { 184 {
185 setupParser("@-internal-keyframe-key-list ", string, ""); 185 setupParser("@-internal-keyframe-key-list ", string, "");
186 cssyyparse(this); 186 cssyyparse(this);
187 return StyleRuleKeyframe::createKeyList(m_valueList.get()); 187 return StyleRuleKeyframe::createKeyList(m_valueList.get());
188 } 188 }
189 189
190 bool BisonCSSParser::parseSupportsCondition(const String& string) 190 bool BisonCSSParser::parseSupportsCondition(const String& string)
191 { 191 {
192 m_supportsCondition = false; 192 m_supportsCondition = false;
193 setupParser("@-internal-supports-condition ", string, ""); 193 setupParser("@-internal-supports-condition ", string, "");
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 PassOwnPtr<CSSParserSelector> BisonCSSParser::sinkFloatingSelector(CSSParserSele ctor* selector) 385 PassOwnPtr<CSSParserSelector> BisonCSSParser::sinkFloatingSelector(CSSParserSele ctor* selector)
386 { 386 {
387 if (selector) { 387 if (selector) {
388 size_t index = m_floatingSelectors.reverseFind(selector); 388 size_t index = m_floatingSelectors.reverseFind(selector);
389 ASSERT(index != kNotFound); 389 ASSERT(index != kNotFound);
390 m_floatingSelectors.remove(index); 390 m_floatingSelectors.remove(index);
391 } 391 }
392 return adoptPtr(selector); 392 return adoptPtr(selector);
393 } 393 }
394 394
395 Vector<OwnPtr<CSSParserSelector> >* BisonCSSParser::createFloatingSelectorVector () 395 Vector<OwnPtr<CSSParserSelector>>* BisonCSSParser::createFloatingSelectorVector( )
396 { 396 {
397 Vector<OwnPtr<CSSParserSelector> >* selectorVector = new Vector<OwnPtr<CSSPa rserSelector> >; 397 Vector<OwnPtr<CSSParserSelector>>* selectorVector = new Vector<OwnPtr<CSSPar serSelector>>;
398 m_floatingSelectorVectors.append(selectorVector); 398 m_floatingSelectorVectors.append(selectorVector);
399 return selectorVector; 399 return selectorVector;
400 } 400 }
401 401
402 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > BisonCSSParser::sinkFloatingSele ctorVector(Vector<OwnPtr<CSSParserSelector> >* selectorVector) 402 PassOwnPtr<Vector<OwnPtr<CSSParserSelector>>> BisonCSSParser::sinkFloatingSelect orVector(Vector<OwnPtr<CSSParserSelector>>* selectorVector)
403 { 403 {
404 if (selectorVector) { 404 if (selectorVector) {
405 size_t index = m_floatingSelectorVectors.reverseFind(selectorVector); 405 size_t index = m_floatingSelectorVectors.reverseFind(selectorVector);
406 ASSERT(index != kNotFound); 406 ASSERT(index != kNotFound);
407 m_floatingSelectorVectors.remove(index); 407 m_floatingSelectorVectors.remove(index);
408 } 408 }
409 return adoptPtr(selectorVector); 409 return adoptPtr(selectorVector);
410 } 410 }
411 411
412 CSSParserValueList* BisonCSSParser::createFloatingValueList() 412 CSSParserValueList* BisonCSSParser::createFloatingValueList()
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 475 }
476 return m_floatingMediaQueryExp.get(); 476 return m_floatingMediaQueryExp.get();
477 } 477 }
478 478
479 PassOwnPtrWillBeRawPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp( MediaQueryExp* expression) 479 PassOwnPtrWillBeRawPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp( MediaQueryExp* expression)
480 { 480 {
481 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp); 481 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp);
482 return m_floatingMediaQueryExp.release(); 482 return m_floatingMediaQueryExp.release();
483 } 483 }
484 484
485 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* BisonCSSParser::createFloa tingMediaQueryExpList() 485 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>>* BisonCSSParser::createFloat ingMediaQueryExpList()
486 { 486 {
487 m_floatingMediaQueryExpList = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr WillBeMember<MediaQueryExp> >); 487 m_floatingMediaQueryExpList = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr WillBeMember<MediaQueryExp>>);
488 return m_floatingMediaQueryExpList.get(); 488 return m_floatingMediaQueryExpList.get();
489 } 489 }
490 490
491 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > Bi sonCSSParser::sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember< MediaQueryExp> >* list) 491 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>>> Biso nCSSParser::sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember<Me diaQueryExp>>* list)
492 { 492 {
493 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList); 493 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList);
494 return m_floatingMediaQueryExpList.release(); 494 return m_floatingMediaQueryExpList.release();
495 } 495 }
496 496
497 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtrWillBeRawPtr<WillBeHeapVector<O wnPtrWillBeMember<MediaQueryExp> > > expressions) 497 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtrWillBeRawPtr<WillBeHeapVector<O wnPtrWillBeMember<MediaQueryExp>>> expressions)
498 { 498 {
499 m_floatingMediaQuery = adoptPtrWillBeNoop(new MediaQuery(restrictor, mediaTy pe, expressions)); 499 m_floatingMediaQuery = adoptPtrWillBeNoop(new MediaQuery(restrictor, mediaTy pe, expressions));
500 if (m_observer) 500 if (m_observer)
501 m_observer->endMediaQuery(); 501 m_observer->endMediaQuery();
502 return m_floatingMediaQuery.get(); 502 return m_floatingMediaQuery.get();
503 } 503 }
504 504
505 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<Will BeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > expressions) 505 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<Will BeHeapVector<OwnPtrWillBeMember<MediaQueryExp>>> expressions)
506 { 506 {
507 return createFloatingMediaQuery(MediaQuery::None, MediaTypeNames::all, expre ssions); 507 return createFloatingMediaQuery(MediaQuery::None, MediaTypeNames::all, expre ssions);
508 } 508 }
509 509
510 MediaQuery* BisonCSSParser::createFloatingNotAllQuery() 510 MediaQuery* BisonCSSParser::createFloatingNotAllQuery()
511 { 511 {
512 return createFloatingMediaQuery(MediaQuery::Not, MediaTypeNames::all, sinkFl oatingMediaQueryExpList(createFloatingMediaQueryExpList())); 512 return createFloatingMediaQuery(MediaQuery::Not, MediaTypeNames::all, sinkFl oatingMediaQueryExpList(createFloatingMediaQueryExpList()));
513 } 513 }
514 514
515 PassOwnPtrWillBeRawPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQ uery* query) 515 PassOwnPtrWillBeRawPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQ uery* query)
516 { 516 {
517 ASSERT_UNUSED(query, query == m_floatingMediaQuery); 517 ASSERT_UNUSED(query, query == m_floatingMediaQuery);
518 return m_floatingMediaQuery.release(); 518 return m_floatingMediaQuery.release();
519 } 519 }
520 520
521 WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> >* BisonCSSParser::create FloatingKeyframeVector() 521 WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>* BisonCSSParser::createF loatingKeyframeVector()
522 { 522 {
523 m_floatingKeyframeVector = adoptPtrWillBeNoop(new WillBeHeapVector<RefPtrWil lBeMember<StyleRuleKeyframe> >()); 523 m_floatingKeyframeVector = adoptPtrWillBeNoop(new WillBeHeapVector<RefPtrWil lBeMember<StyleRuleKeyframe>>());
524 return m_floatingKeyframeVector.get(); 524 return m_floatingKeyframeVector.get();
525 } 525 }
526 526
527 PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> > > BisonCSSParser::sinkFloatingKeyframeVector(WillBeHeapVector<RefPtrWillBeMember <StyleRuleKeyframe> >* keyframeVector) 527 PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>> BisonCSSParser::sinkFloatingKeyframeVector(WillBeHeapVector<RefPtrWillBeMember<S tyleRuleKeyframe>>* keyframeVector)
528 { 528 {
529 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector); 529 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector);
530 return m_floatingKeyframeVector.release(); 530 return m_floatingKeyframeVector.release();
531 } 531 }
532 532
533 MediaQuerySet* BisonCSSParser::createMediaQuerySet() 533 MediaQuerySet* BisonCSSParser::createMediaQuerySet()
534 { 534 {
535 RefPtrWillBeRawPtr<MediaQuerySet> queries = MediaQuerySet::create(); 535 RefPtrWillBeRawPtr<MediaQuerySet> queries = MediaQuerySet::create();
536 MediaQuerySet* result = queries.get(); 536 MediaQuerySet* result = queries.get();
537 m_parsedMediaQuerySets.append(queries.release()); 537 m_parsedMediaQuerySets.append(queries.release());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 reportError(location, m_ruleHeaderType == StyleRule::Style ? InvalidSelector CSSError : InvalidRuleCSSError); 685 reportError(location, m_ruleHeaderType == StyleRule::Style ? InvalidSelector CSSError : InvalidRuleCSSError);
686 686
687 endRuleHeader(); 687 endRuleHeader();
688 } 688 }
689 689
690 void BisonCSSParser::reportError(const CSSParserLocation&, CSSParserError) 690 void BisonCSSParser::reportError(const CSSParserLocation&, CSSParserError)
691 { 691 {
692 // FIXME: error reporting temporatily disabled. 692 // FIXME: error reporting temporatily disabled.
693 } 693 }
694 694
695 StyleRuleKeyframes* BisonCSSParser::createKeyframesRule(const String& name, Pass OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> > > po pKeyframes, bool isPrefixed) 695 StyleRuleKeyframes* BisonCSSParser::createKeyframesRule(const String& name, Pass OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>> popK eyframes, bool isPrefixed)
696 { 696 {
697 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> > > keyframes = popKeyframes; 697 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>> keyframes = popKeyframes;
698 m_allowImportRules = m_allowNamespaceDeclarations = false; 698 m_allowImportRules = m_allowNamespaceDeclarations = false;
699 RefPtrWillBeRawPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); 699 RefPtrWillBeRawPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create();
700 for (size_t i = 0; i < keyframes->size(); ++i) 700 for (size_t i = 0; i < keyframes->size(); ++i)
701 rule->parserAppendKeyframe(keyframes->at(i)); 701 rule->parserAppendKeyframe(keyframes->at(i));
702 rule->setName(name); 702 rule->setName(name);
703 rule->setVendorPrefixed(isPrefixed); 703 rule->setVendorPrefixed(isPrefixed);
704 StyleRuleKeyframes* rulePtr = rule.get(); 704 StyleRuleKeyframes* rulePtr = rule.get();
705 m_parsedRules.append(rule.release()); 705 m_parsedRules.append(rule.release());
706 return rulePtr; 706 return rulePtr;
707 } 707 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (feature != UseCounter::NumberOfFeatures) 745 if (feature != UseCounter::NumberOfFeatures)
746 context.useCounter()->count(feature); 746 context.useCounter()->count(feature);
747 if (current->relation() == CSSSelector::ShadowDeep) 747 if (current->relation() == CSSSelector::ShadowDeep)
748 context.useCounter()->count(UseCounter::CSSDeepCombinator); 748 context.useCounter()->count(UseCounter::CSSDeepCombinator);
749 if (current->selectorList()) 749 if (current->selectorList())
750 recordSelectorStats(context, *current->selectorList()); 750 recordSelectorStats(context, *current->selectorList());
751 } 751 }
752 } 752 }
753 } 753 }
754 754
755 StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors) 755 StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector>> * selectors)
756 { 756 {
757 StyleRule* result = 0; 757 StyleRule* result = 0;
758 if (selectors) { 758 if (selectors) {
759 m_allowImportRules = m_allowNamespaceDeclarations = false; 759 m_allowImportRules = m_allowNamespaceDeclarations = false;
760 RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create(); 760 RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create();
761 rule->parserAdoptSelectorVector(*selectors); 761 rule->parserAdoptSelectorVector(*selectors);
762 rule->setProperties(createStylePropertySet()); 762 rule->setProperties(createStylePropertySet());
763 result = rule.get(); 763 result = rule.get();
764 m_parsedRules.append(rule.release()); 764 m_parsedRules.append(rule.release());
765 recordSelectorStats(m_context, result->selectorList()); 765 recordSelectorStats(m_context, result->selectorList());
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 return specifiers; 909 return specifiers;
910 } 910 }
911 911
912 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page Selector) 912 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page Selector)
913 { 913 {
914 // FIXME: Margin at-rules are ignored. 914 // FIXME: Margin at-rules are ignored.
915 m_allowImportRules = m_allowNamespaceDeclarations = false; 915 m_allowImportRules = m_allowNamespaceDeclarations = false;
916 StyleRulePage* pageRule = 0; 916 StyleRulePage* pageRule = 0;
917 if (pageSelector) { 917 if (pageSelector) {
918 RefPtrWillBeRawPtr<StyleRulePage> rule = StyleRulePage::create(); 918 RefPtrWillBeRawPtr<StyleRulePage> rule = StyleRulePage::create();
919 Vector<OwnPtr<CSSParserSelector> > selectorVector; 919 Vector<OwnPtr<CSSParserSelector>> selectorVector;
920 selectorVector.append(pageSelector); 920 selectorVector.append(pageSelector);
921 rule->parserAdoptSelectorVector(selectorVector); 921 rule->parserAdoptSelectorVector(selectorVector);
922 rule->setProperties(createStylePropertySet()); 922 rule->setProperties(createStylePropertySet());
923 pageRule = rule.get(); 923 pageRule = rule.get();
924 m_parsedRules.append(rule.release()); 924 m_parsedRules.append(rule.release());
925 } 925 }
926 clearProperties(); 926 clearProperties();
927 return pageRule; 927 return pageRule;
928 } 928 }
929 929
(...skipping 14 matching lines...) Expand all
944 } 944 }
945 945
946 void BisonCSSParser::endDeclarationsForMarginBox() 946 void BisonCSSParser::endDeclarationsForMarginBox()
947 { 947 {
948 rollbackLastProperties(m_parsedProperties.size() - m_numParsedPropertiesBefo reMarginBox); 948 rollbackLastProperties(m_parsedProperties.size() - m_numParsedPropertiesBefo reMarginBox);
949 m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; 949 m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
950 } 950 }
951 951
952 StyleRuleKeyframe* BisonCSSParser::createKeyframe(CSSParserValueList* keys) 952 StyleRuleKeyframe* BisonCSSParser::createKeyframe(CSSParserValueList* keys)
953 { 953 {
954 OwnPtr<Vector<double> > keyVector = StyleRuleKeyframe::createKeyList(keys); 954 OwnPtr<Vector<double>> keyVector = StyleRuleKeyframe::createKeyList(keys);
955 if (keyVector->isEmpty()) 955 if (keyVector->isEmpty())
956 return 0; 956 return 0;
957 957
958 RefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe = StyleRuleKeyframe::create() ; 958 RefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe = StyleRuleKeyframe::create() ;
959 keyframe->setKeys(keyVector.release()); 959 keyframe->setKeys(keyVector.release());
960 keyframe->setProperties(createStylePropertySet()); 960 keyframe->setProperties(createStylePropertySet());
961 961
962 clearProperties(); 962 clearProperties();
963 963
964 StyleRuleKeyframe* keyframePtr = keyframe.get(); 964 StyleRuleKeyframe* keyframePtr = keyframe.get();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 rule->setProperties(createStylePropertySet()); 1059 rule->setProperties(createStylePropertySet());
1060 clearProperties(); 1060 clearProperties();
1061 1061
1062 StyleRuleViewport* result = rule.get(); 1062 StyleRuleViewport* result = rule.get();
1063 m_parsedRules.append(rule.release()); 1063 m_parsedRules.append(rule.release());
1064 1064
1065 return result; 1065 return result;
1066 } 1066 }
1067 1067
1068 } 1068 }
OLDNEW
« no previous file with comments | « Source/core/css/parser/BisonCSSParser.h ('k') | Source/core/css/parser/BisonCSSParserTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698