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

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

Issue 201573006: Cleaned up MediaQueryExp creation from BisonCSSParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@mqexp_create
Patch Set: Created 6 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') | 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 /* 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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 declaration->addParsedProperties(m_parsedProperties); 1201 declaration->addParsedProperties(m_parsedProperties);
1202 clearProperties(); 1202 clearProperties();
1203 } 1203 }
1204 1204
1205 if (m_observer) 1205 if (m_observer)
1206 m_observer->endRuleBody(string.length(), false); 1206 m_observer->endRuleBody(string.length(), false);
1207 1207
1208 return ok; 1208 return ok;
1209 } 1209 }
1210 1210
1211 PassRefPtrWillBeRawPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& string)
1212 {
1213 ASSERT(!m_mediaList);
1214
1215 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token.
1216 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y)
1217 setupParser("@-internal-medialist ", string, "");
1218 cssyyparse(this);
1219
1220 ASSERT(m_mediaList);
1221 return m_mediaList.release();
1222 }
1223
1224 static inline void filterProperties(bool important, const WillBeHeapVector<CSSPr operty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedE ntries, BitArray<numCSSProperties>& seenProperties) 1211 static inline void filterProperties(bool important, const WillBeHeapVector<CSSPr operty, 256>& input, WillBeHeapVector<CSSProperty, 256>& output, size_t& unusedE ntries, BitArray<numCSSProperties>& seenProperties)
1225 { 1212 {
1226 // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. 1213 // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
1227 for (int i = input.size() - 1; i >= 0; --i) { 1214 for (int i = input.size() - 1; i >= 0; --i) {
1228 const CSSProperty& property = input[i]; 1215 const CSSProperty& property = input[i];
1229 if (property.isImportant() != important) 1216 if (property.isImportant() != important)
1230 continue; 1217 continue;
1231 const unsigned propertyIDIndex = property.id() - firstCSSProperty; 1218 const unsigned propertyIDIndex = property.id() - firstCSSProperty;
1232 if (seenProperties.get(propertyIDIndex)) 1219 if (seenProperties.get(propertyIDIndex))
1233 continue; 1220 continue;
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 rule->setProperties(createStylePropertySet()); 2192 rule->setProperties(createStylePropertySet());
2206 clearProperties(); 2193 clearProperties();
2207 2194
2208 StyleRuleViewport* result = rule.get(); 2195 StyleRuleViewport* result = rule.get();
2209 m_parsedRules.append(rule.release()); 2196 m_parsedRules.append(rule.release());
2210 2197
2211 return result; 2198 return result;
2212 } 2199 }
2213 2200
2214 } 2201 }
OLDNEW
« no previous file with comments | « Source/core/css/parser/BisonCSSParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698