| OLD | NEW |
| 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 { | 1207 { |
| 1208 m_selectorListForParseSelector = &selectorList; | 1208 m_selectorListForParseSelector = &selectorList; |
| 1209 | 1209 |
| 1210 setupParser("@-internal-selector ", string, ""); | 1210 setupParser("@-internal-selector ", string, ""); |
| 1211 | 1211 |
| 1212 cssyyparse(this); | 1212 cssyyparse(this); |
| 1213 | 1213 |
| 1214 m_selectorListForParseSelector = 0; | 1214 m_selectorListForParseSelector = 0; |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseInlineStyleDeclaratio
n(const String& string, Element* element) | 1217 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::parseInlineSty
leDeclaration(const String& string, Element* element) |
| 1218 { | 1218 { |
| 1219 Document& document = element->document(); | 1219 Document& document = element->document(); |
| 1220 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), UseCounter::getFrom(&document)); | 1220 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), UseCounter::getFrom(&document)); |
| 1221 context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTM
LStandardMode : HTMLQuirksMode); | 1221 context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTM
LStandardMode : HTMLQuirksMode); |
| 1222 return BisonCSSParser(context).parseDeclaration(string, document.elementShee
t().contents()); | 1222 return BisonCSSParser(context).parseDeclaration(string, document.elementShee
t().contents()); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclaration(const Str
ing& string, StyleSheetContents* contextStyleSheet) | 1225 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclarati
on(const String& string, StyleSheetContents* contextStyleSheet) |
| 1226 { | 1226 { |
| 1227 setStyleSheet(contextStyleSheet); | 1227 setStyleSheet(contextStyleSheet); |
| 1228 | 1228 |
| 1229 setupParser("@-internal-decls ", string, ""); | 1229 setupParser("@-internal-decls ", string, ""); |
| 1230 cssyyparse(this); | 1230 cssyyparse(this); |
| 1231 m_rule = nullptr; | 1231 m_rule = nullptr; |
| 1232 | 1232 |
| 1233 if (m_hasFontFaceOnlyValues) | 1233 if (m_hasFontFaceOnlyValues) |
| 1234 deleteFontFaceOnlyValues(); | 1234 deleteFontFaceOnlyValues(); |
| 1235 | 1235 |
| 1236 RefPtr<ImmutableStylePropertySet> style = createStylePropertySet(); | 1236 RefPtrWillBeRawPtr<ImmutableStylePropertySet> style = createStylePropertySet
(); |
| 1237 clearProperties(); | 1237 clearProperties(); |
| 1238 return style.release(); | 1238 return style.release(); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 | 1241 |
| 1242 bool BisonCSSParser::parseDeclaration(MutableStylePropertySet* declaration, cons
t String& string, CSSParserObserver* observer, StyleSheetContents* contextStyleS
heet) | 1242 bool BisonCSSParser::parseDeclaration(MutableStylePropertySet* declaration, cons
t String& string, CSSParserObserver* observer, StyleSheetContents* contextStyleS
heet) |
| 1243 { | 1243 { |
| 1244 setStyleSheet(contextStyleSheet); | 1244 setStyleSheet(contextStyleSheet); |
| 1245 | 1245 |
| 1246 TemporaryChange<CSSParserObserver*> scopedObsever(m_observer, observer); | 1246 TemporaryChange<CSSParserObserver*> scopedObsever(m_observer, observer); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 if (property.isImportant() != important) | 1295 if (property.isImportant() != important) |
| 1296 continue; | 1296 continue; |
| 1297 const unsigned propertyIDIndex = property.id() - firstCSSProperty; | 1297 const unsigned propertyIDIndex = property.id() - firstCSSProperty; |
| 1298 if (seenProperties.get(propertyIDIndex)) | 1298 if (seenProperties.get(propertyIDIndex)) |
| 1299 continue; | 1299 continue; |
| 1300 seenProperties.set(propertyIDIndex); | 1300 seenProperties.set(propertyIDIndex); |
| 1301 output[--unusedEntries] = property; | 1301 output[--unusedEntries] = property; |
| 1302 } | 1302 } |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePropertySet() | 1305 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePro
pertySet() |
| 1306 { | 1306 { |
| 1307 BitArray<numCSSProperties> seenProperties; | 1307 BitArray<numCSSProperties> seenProperties; |
| 1308 size_t unusedEntries = m_parsedProperties.size(); | 1308 size_t unusedEntries = m_parsedProperties.size(); |
| 1309 WillBeHeapVector<CSSProperty, 256> results(unusedEntries); | 1309 WillBeHeapVector<CSSProperty, 256> results(unusedEntries); |
| 1310 | 1310 |
| 1311 // Important properties have higher priority, so add them first. Duplicate d
efinitions can then be ignored when found. | 1311 // Important properties have higher priority, so add them first. Duplicate d
efinitions can then be ignored when found. |
| 1312 filterProperties(true, m_parsedProperties, results, unusedEntries, seenPrope
rties); | 1312 filterProperties(true, m_parsedProperties, results, unusedEntries, seenPrope
rties); |
| 1313 filterProperties(false, m_parsedProperties, results, unusedEntries, seenProp
erties); | 1313 filterProperties(false, m_parsedProperties, results, unusedEntries, seenProp
erties); |
| 1314 if (unusedEntries) | 1314 if (unusedEntries) |
| 1315 results.remove(0, unusedEntries); | 1315 results.remove(0, unusedEntries); |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 rule->setProperties(createStylePropertySet()); | 2249 rule->setProperties(createStylePropertySet()); |
| 2250 clearProperties(); | 2250 clearProperties(); |
| 2251 | 2251 |
| 2252 StyleRuleViewport* result = rule.get(); | 2252 StyleRuleViewport* result = rule.get(); |
| 2253 m_parsedRules.append(rule.release()); | 2253 m_parsedRules.append(rule.release()); |
| 2254 | 2254 |
| 2255 return result; | 2255 return result; |
| 2256 } | 2256 } |
| 2257 | 2257 |
| 2258 } | 2258 } |
| OLD | NEW |