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

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

Issue 951213004: Make CSSRuleSourceData use the CSSRule Type enum (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use StyleRule::Type Created 5 years, 10 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 /* 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent icalValues) 81 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent icalValues)
82 { 82 {
83 return cssValuePool().createValue(Pair::create(first, second, identicalValue sPolicy)); 83 return cssValuePool().createValue(Pair::create(first, second, identicalValue sPolicy));
84 } 84 }
85 85
86 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, 86 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList,
87 const CSSParserContext& context, bool inViewport, 87 const CSSParserContext& context, bool inViewport,
88 WillBeHeapVector<CSSProperty, 256>& parsedProperties, 88 WillBeHeapVector<CSSProperty, 256>& parsedProperties,
89 CSSRuleSourceData::Type ruleType) 89 StyleRule::Type ruleType)
90 : m_valueList(valueList) 90 : m_valueList(valueList)
91 , m_context(context) 91 , m_context(context)
92 , m_inViewport(inViewport) 92 , m_inViewport(inViewport)
93 , m_parsedProperties(parsedProperties) 93 , m_parsedProperties(parsedProperties)
94 , m_ruleType(ruleType) 94 , m_ruleType(ruleType)
95 , m_inParseShorthand(0) 95 , m_inParseShorthand(0)
96 , m_currentShorthand(CSSPropertyInvalid) 96 , m_currentShorthand(CSSPropertyInvalid)
97 , m_implicitShorthand(false) 97 , m_implicitShorthand(false)
98 { 98 {
99 } 99 }
100 100
101 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, 101 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important,
102 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort, 102 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort,
103 WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Typ e ruleType) 103 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy pe)
104 { 104 {
105 int parsedPropertiesSize = parsedProperties.size(); 105 int parsedPropertiesSize = parsedProperties.size();
106 106
107 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType); 107 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType);
108 bool parseSuccess = parser.parseValue(property, important); 108 bool parseSuccess = parser.parseValue(property, important);
109 109
110 // This doesn't count UA style sheets 110 // This doesn't count UA style sheets
111 if (parseSuccess && context.useCounter()) 111 if (parseSuccess && context.useCounter())
112 context.useCounter()->count(context, property); 112 context.useCounter()->count(context, property);
113 113
(...skipping 4630 matching lines...) Expand 10 before | Expand all | Expand 10 after
4744 4744
4745 if (values) 4745 if (values)
4746 values->append(parsedValue.release()); 4746 values->append(parsedValue.release());
4747 else { 4747 else {
4748 addProperty(CSSPropertyFontVariant, parsedValue.release(), important ); 4748 addProperty(CSSPropertyFontVariant, parsedValue.release(), important );
4749 return true; 4749 return true;
4750 } 4750 }
4751 } 4751 }
4752 4752
4753 if (values && values->length()) { 4753 if (values && values->length()) {
4754 if (m_ruleType != CSSRuleSourceData::FONT_FACE_RULE) 4754 if (m_ruleType != StyleRule::FontFace)
4755 return false; 4755 return false;
4756 addProperty(CSSPropertyFontVariant, values.release(), important); 4756 addProperty(CSSPropertyFontVariant, values.release(), important);
4757 return true; 4757 return true;
4758 } 4758 }
4759 4759
4760 return false; 4760 return false;
4761 } 4761 }
4762 4762
4763 bool CSSPropertyParser::parseFontWeight(bool important) 4763 bool CSSPropertyParser::parseFontWeight(bool important)
4764 { 4764 {
(...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after
8471 } 8471 }
8472 } 8472 }
8473 8473
8474 if (!list->length()) 8474 if (!list->length())
8475 return nullptr; 8475 return nullptr;
8476 8476
8477 return list.release(); 8477 return list.release();
8478 } 8478 }
8479 8479
8480 } // namespace blink 8480 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698