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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 : baseURL(baseURL) | 205 : baseURL(baseURL) |
206 , mode(mode) | 206 , mode(mode) |
207 , isHTMLDocument(false) | 207 , isHTMLDocument(false) |
208 , isCSSCustomFilterEnabled(false) | 208 , isCSSCustomFilterEnabled(false) |
209 , isCSSStickyPositionEnabled(false) | 209 , isCSSStickyPositionEnabled(false) |
210 , needsSiteSpecificQuirks(false) | 210 , needsSiteSpecificQuirks(false) |
211 , useLegacyBackgroundSizeShorthandBehavior(false) | 211 , useLegacyBackgroundSizeShorthandBehavior(false) |
212 { | 212 { |
213 } | 213 } |
214 | 214 |
215 CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons
t String& charset) | 215 CSSParserContext::CSSParserContext(const Document& document, const KURL& baseURL
, const String& charset) |
216 : baseURL(baseURL.isNull() ? document->baseURL() : baseURL) | 216 : baseURL(baseURL.isNull() ? document.baseURL() : baseURL) |
217 , charset(charset) | 217 , charset(charset) |
218 , mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode) | 218 , mode(document.inQuirksMode() ? CSSQuirksMode : CSSStrictMode) |
219 , isHTMLDocument(document->isHTMLDocument()) | 219 , isHTMLDocument(document.isHTMLDocument()) |
220 , isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCS
SCustomFilterEnabled() : false) | 220 , isCSSCustomFilterEnabled(document.settings() ? document.settings()->isCSSC
ustomFilterEnabled() : false) |
221 , isCSSStickyPositionEnabled(document->cssStickyPositionEnabled()) | 221 , isCSSStickyPositionEnabled(document.cssStickyPositionEnabled()) |
222 , needsSiteSpecificQuirks(document->settings() ? document->settings()->needs
SiteSpecificQuirks() : false) | 222 , needsSiteSpecificQuirks(document.settings() ? document.settings()->needsSi
teSpecificQuirks() : false) |
223 , useLegacyBackgroundSizeShorthandBehavior(document->settings() ? document->
settings()->useLegacyBackgroundSizeShorthandBehavior() : false) | 223 , useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.se
ttings()->useLegacyBackgroundSizeShorthandBehavior() : false) |
224 { | 224 { |
225 } | 225 } |
226 | 226 |
227 bool operator==(const CSSParserContext& a, const CSSParserContext& b) | 227 bool operator==(const CSSParserContext& a, const CSSParserContext& b) |
228 { | 228 { |
229 return a.baseURL == b.baseURL | 229 return a.baseURL == b.baseURL |
230 && a.charset == b.charset | 230 && a.charset == b.charset |
231 && a.mode == b.mode | 231 && a.mode == b.mode |
232 && a.isHTMLDocument == b.isHTMLDocument | 232 && a.isHTMLDocument == b.isHTMLDocument |
233 && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled | 233 && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& strin
g) | 1144 PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& strin
g) |
1145 { | 1145 { |
1146 if (string.isEmpty()) | 1146 if (string.isEmpty()) |
1147 return 0; | 1147 return 0; |
1148 RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::create
(); | 1148 RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::create
(); |
1149 if (!parseValue(dummyStyle.get(), CSSPropertyFontFamily, string, false, CSSQ
uirksMode, 0)) | 1149 if (!parseValue(dummyStyle.get(), CSSPropertyFontFamily, string, false, CSSQ
uirksMode, 0)) |
1150 return 0; | 1150 return 0; |
1151 return static_pointer_cast<CSSValueList>(dummyStyle->getPropertyCSSValue(CSS
PropertyFontFamily)); | 1151 return static_pointer_cast<CSSValueList>(dummyStyle->getPropertyCSSValue(CSS
PropertyFontFamily)); |
1152 } | 1152 } |
1153 | 1153 |
1154 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
ropertyID, const String& string, bool important, Document* document) | 1154 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
ropertyID, const String& string, bool important, const Document& document) |
1155 { | 1155 { |
1156 ASSERT(!string.isEmpty()); | 1156 ASSERT(!string.isEmpty()); |
1157 | 1157 |
1158 CSSParserContext context(document); | 1158 CSSParserContext context(document); |
1159 | 1159 |
1160 if (parseSimpleLengthValue(declaration, propertyID, string, important, conte
xt.mode)) | 1160 if (parseSimpleLengthValue(declaration, propertyID, string, important, conte
xt.mode)) |
1161 return true; | 1161 return true; |
1162 if (parseColorValue(declaration, propertyID, string, important, context.mode
)) | 1162 if (parseColorValue(declaration, propertyID, string, important, context.mode
)) |
1163 return true; | 1163 return true; |
1164 if (parseKeywordValue(declaration, propertyID, string, important, context)) | 1164 if (parseKeywordValue(declaration, propertyID, string, important, context)) |
1165 return true; | 1165 return true; |
1166 | 1166 |
1167 CSSParser parser(context, UseCounter::getFrom(document)); | 1167 CSSParser parser(context, UseCounter::getFrom(&document)); |
1168 return parser.parseValue(declaration, propertyID, string, important, static_
cast<StyleSheetContents*>(0)); | 1168 return parser.parseValue(declaration, propertyID, string, important, static_
cast<StyleSheetContents*>(0)); |
1169 } | 1169 } |
1170 | 1170 |
1171 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
ropertyID, const String& string, bool important, CSSParserMode cssParserMode, St
yleSheetContents* contextStyleSheet) | 1171 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID p
ropertyID, const String& string, bool important, CSSParserMode cssParserMode, St
yleSheetContents* contextStyleSheet) |
1172 { | 1172 { |
1173 ASSERT(!string.isEmpty()); | 1173 ASSERT(!string.isEmpty()); |
1174 if (parseSimpleLengthValue(declaration, propertyID, string, important, cssPa
rserMode)) | 1174 if (parseSimpleLengthValue(declaration, propertyID, string, important, cssPa
rserMode)) |
1175 return true; | 1175 return true; |
1176 if (parseColorValue(declaration, propertyID, string, important, cssParserMod
e)) | 1176 if (parseColorValue(declaration, propertyID, string, important, cssParserMod
e)) |
1177 return true; | 1177 return true; |
(...skipping 10793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11971 { | 11971 { |
11972 // The tokenizer checks for the construct of an+b. | 11972 // The tokenizer checks for the construct of an+b. |
11973 // However, since the {ident} rule precedes the {nth} rule, some of those | 11973 // However, since the {ident} rule precedes the {nth} rule, some of those |
11974 // tokens are identified as string literal. Furthermore we need to accept | 11974 // tokens are identified as string literal. Furthermore we need to accept |
11975 // "odd" and "even" which does not match to an+b. | 11975 // "odd" and "even" which does not match to an+b. |
11976 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11976 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11977 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11977 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11978 } | 11978 } |
11979 | 11979 |
11980 } | 11980 } |
OLD | NEW |