OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 HANDLE_INHERIT(prop, Prop) \ | 182 HANDLE_INHERIT(prop, Prop) \ |
183 if (isInitial) { \ | 183 if (isInitial) { \ |
184 m_state.style()->set##Prop(RenderStyle::initial##Prop()); \ | 184 m_state.style()->set##Prop(RenderStyle::initial##Prop()); \ |
185 return; \ | 185 return; \ |
186 } | 186 } |
187 | 187 |
188 RenderStyle* StyleResolver::s_styleNotYetAvailable; | 188 RenderStyle* StyleResolver::s_styleNotYetAvailable; |
189 | 189 |
190 static StylePropertySet* leftToRightDeclaration() | 190 static StylePropertySet* leftToRightDeclaration() |
191 { | 191 { |
192 DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, leftToRightDecl, (StylePropert
ySet::create())); | 192 DEFINE_STATIC_LOCAL(RefPtr<MutableStylePropertySet>, leftToRightDecl, (Mutab
leStylePropertySet::create())); |
193 if (leftToRightDecl->isEmpty()) | 193 if (leftToRightDecl->isEmpty()) |
194 leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr); | 194 leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr); |
195 return leftToRightDecl.get(); | 195 return leftToRightDecl.get(); |
196 } | 196 } |
197 | 197 |
198 static StylePropertySet* rightToLeftDeclaration() | 198 static StylePropertySet* rightToLeftDeclaration() |
199 { | 199 { |
200 DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, rightToLeftDecl, (StylePropert
ySet::create())); | 200 DEFINE_STATIC_LOCAL(RefPtr<MutableStylePropertySet>, rightToLeftDecl, (Mutab
leStylePropertySet::create())); |
201 if (rightToLeftDecl->isEmpty()) | 201 if (rightToLeftDecl->isEmpty()) |
202 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); | 202 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); |
203 return rightToLeftDecl.get(); | 203 return rightToLeftDecl.get(); |
204 } | 204 } |
205 | 205 |
206 | 206 |
207 void StyleResolver::MatchResult::addMatchedProperties(const StylePropertySet* pr
operties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propert
yWhitelistType) | 207 void StyleResolver::MatchResult::addMatchedProperties(const StylePropertySet* pr
operties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propert
yWhitelistType) |
208 { | 208 { |
209 matchedProperties.grow(matchedProperties.size() + 1); | 209 matchedProperties.grow(matchedProperties.size() + 1); |
210 StyleResolver::MatchedProperties& newProperties = matchedProperties.last(); | 210 StyleResolver::MatchedProperties& newProperties = matchedProperties.last(); |
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 void StyleResolver::resolveVariables(CSSPropertyID id, CSSValue* value, Vector<s
td::pair<CSSPropertyID, String> >& knownExpressions) | 2386 void StyleResolver::resolveVariables(CSSPropertyID id, CSSValue* value, Vector<s
td::pair<CSSPropertyID, String> >& knownExpressions) |
2387 { | 2387 { |
2388 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVar
iables(*m_state.style()->variables())); | 2388 std::pair<CSSPropertyID, String> expression(id, value->serializeResolvingVar
iables(*m_state.style()->variables())); |
2389 | 2389 |
2390 if (knownExpressions.contains(expression)) | 2390 if (knownExpressions.contains(expression)) |
2391 return; // cycle detected. | 2391 return; // cycle detected. |
2392 | 2392 |
2393 knownExpressions.append(expression); | 2393 knownExpressions.append(expression); |
2394 | 2394 |
2395 // FIXME: It would be faster not to re-parse from strings, but for now CSS p
roperty validation lives inside the parser so we do it there. | 2395 // FIXME: It would be faster not to re-parse from strings, but for now CSS p
roperty validation lives inside the parser so we do it there. |
2396 RefPtr<StylePropertySet> resultSet = StylePropertySet::create(); | 2396 RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create(
); |
2397 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do
cument())) | 2397 if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, do
cument())) |
2398 return; // expression failed to parse. | 2398 return; // expression failed to parse. |
2399 | 2399 |
2400 for (unsigned i = 0; i < resultSet->propertyCount(); i++) { | 2400 for (unsigned i = 0; i < resultSet->propertyCount(); i++) { |
2401 StylePropertySet::PropertyReference property = resultSet->propertyAt(i); | 2401 StylePropertySet::PropertyReference property = resultSet->propertyAt(i); |
2402 if (property.id() != CSSPropertyVariable && hasVariableReference(propert
y.value())) | 2402 if (property.id() != CSSPropertyVariable && hasVariableReference(propert
y.value())) |
2403 resolveVariables(property.id(), property.value(), knownExpressions); | 2403 resolveVariables(property.id(), property.value(), knownExpressions); |
2404 else | 2404 else |
2405 applyProperty(property.id(), property.value()); | 2405 applyProperty(property.id(), property.value()); |
2406 } | 2406 } |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3860 info.addMember(m_state, "state"); | 3860 info.addMember(m_state, "state"); |
3861 | 3861 |
3862 // FIXME: move this to a place where it would be called only once? | 3862 // FIXME: move this to a place where it would be called only once? |
3863 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 3863 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
3864 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 3864 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
3865 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); | 3865 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); |
3866 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 3866 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
3867 } | 3867 } |
3868 | 3868 |
3869 } // namespace WebCore | 3869 } // namespace WebCore |
OLD | NEW |