| 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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 { | 1052 { |
| 1053 m_selectorListForParseSelector = &selectorList; | 1053 m_selectorListForParseSelector = &selectorList; |
| 1054 | 1054 |
| 1055 setupParser("@-internal-selector ", string, ""); | 1055 setupParser("@-internal-selector ", string, ""); |
| 1056 | 1056 |
| 1057 cssyyparse(this); | 1057 cssyyparse(this); |
| 1058 | 1058 |
| 1059 m_selectorListForParseSelector = 0; | 1059 m_selectorListForParseSelector = 0; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseInlineStyleDeclaratio
n(const String& string, Element* element) | 1062 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::parseInlineSty
leDeclaration(const String& string, Element* element) |
| 1063 { | 1063 { |
| 1064 Document& document = element->document(); | 1064 Document& document = element->document(); |
| 1065 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), UseCounter::getFrom(&document)); | 1065 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), UseCounter::getFrom(&document)); |
| 1066 context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTM
LStandardMode : HTMLQuirksMode); | 1066 context.setMode((element->isHTMLElement() && !document.inQuirksMode()) ? HTM
LStandardMode : HTMLQuirksMode); |
| 1067 return BisonCSSParser(context).parseDeclaration(string, document.elementShee
t().contents()); | 1067 return BisonCSSParser(context).parseDeclaration(string, document.elementShee
t().contents()); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclaration(const Str
ing& string, StyleSheetContents* contextStyleSheet) | 1070 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclarati
on(const String& string, StyleSheetContents* contextStyleSheet) |
| 1071 { | 1071 { |
| 1072 setStyleSheet(contextStyleSheet); | 1072 setStyleSheet(contextStyleSheet); |
| 1073 | 1073 |
| 1074 setupParser("@-internal-decls ", string, ""); | 1074 setupParser("@-internal-decls ", string, ""); |
| 1075 cssyyparse(this); | 1075 cssyyparse(this); |
| 1076 m_rule = nullptr; | 1076 m_rule = nullptr; |
| 1077 | 1077 |
| 1078 RefPtr<ImmutableStylePropertySet> style = createStylePropertySet(); | 1078 RefPtrWillBeRawPtr<ImmutableStylePropertySet> style = createStylePropertySet
(); |
| 1079 clearProperties(); | 1079 clearProperties(); |
| 1080 return style.release(); | 1080 return style.release(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 | 1083 |
| 1084 bool BisonCSSParser::parseDeclaration(MutableStylePropertySet* declaration, cons
t String& string, CSSParserObserver* observer, StyleSheetContents* contextStyleS
heet) | 1084 bool BisonCSSParser::parseDeclaration(MutableStylePropertySet* declaration, cons
t String& string, CSSParserObserver* observer, StyleSheetContents* contextStyleS
heet) |
| 1085 { | 1085 { |
| 1086 setStyleSheet(contextStyleSheet); | 1086 setStyleSheet(contextStyleSheet); |
| 1087 | 1087 |
| 1088 TemporaryChange<CSSParserObserver*> scopedObsever(m_observer, observer); | 1088 TemporaryChange<CSSParserObserver*> scopedObsever(m_observer, observer); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 if (property.isImportant() != important) | 1135 if (property.isImportant() != important) |
| 1136 continue; | 1136 continue; |
| 1137 const unsigned propertyIDIndex = property.id() - firstCSSProperty; | 1137 const unsigned propertyIDIndex = property.id() - firstCSSProperty; |
| 1138 if (seenProperties.get(propertyIDIndex)) | 1138 if (seenProperties.get(propertyIDIndex)) |
| 1139 continue; | 1139 continue; |
| 1140 seenProperties.set(propertyIDIndex); | 1140 seenProperties.set(propertyIDIndex); |
| 1141 output[--unusedEntries] = property; | 1141 output[--unusedEntries] = property; |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 PassRefPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePropertySet() | 1145 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::createStylePro
pertySet() |
| 1146 { | 1146 { |
| 1147 BitArray<numCSSProperties> seenProperties; | 1147 BitArray<numCSSProperties> seenProperties; |
| 1148 size_t unusedEntries = m_parsedProperties.size(); | 1148 size_t unusedEntries = m_parsedProperties.size(); |
| 1149 WillBeHeapVector<CSSProperty, 256> results(unusedEntries); | 1149 WillBeHeapVector<CSSProperty, 256> results(unusedEntries); |
| 1150 | 1150 |
| 1151 // Important properties have higher priority, so add them first. Duplicate d
efinitions can then be ignored when found. | 1151 // Important properties have higher priority, so add them first. Duplicate d
efinitions can then be ignored when found. |
| 1152 filterProperties(true, m_parsedProperties, results, unusedEntries, seenPrope
rties); | 1152 filterProperties(true, m_parsedProperties, results, unusedEntries, seenPrope
rties); |
| 1153 filterProperties(false, m_parsedProperties, results, unusedEntries, seenProp
erties); | 1153 filterProperties(false, m_parsedProperties, results, unusedEntries, seenProp
erties); |
| 1154 if (unusedEntries) | 1154 if (unusedEntries) |
| 1155 results.remove(0, unusedEntries); | 1155 results.remove(0, unusedEntries); |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 rule->setProperties(createStylePropertySet()); | 2111 rule->setProperties(createStylePropertySet()); |
| 2112 clearProperties(); | 2112 clearProperties(); |
| 2113 | 2113 |
| 2114 StyleRuleViewport* result = rule.get(); | 2114 StyleRuleViewport* result = rule.get(); |
| 2115 m_parsedRules.append(rule.release()); | 2115 m_parsedRules.append(rule.release()); |
| 2116 | 2116 |
| 2117 return result; | 2117 return result; |
| 2118 } | 2118 } |
| 2119 | 2119 |
| 2120 } | 2120 } |
| OLD | NEW |