OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSParser.h" | 5 #include "core/css/parser/CSSParser.h" |
6 | 6 |
7 #include "core/css/CSSColorValue.h" | 7 #include "core/css/CSSColorValue.h" |
8 #include "core/css/CSSKeyframeRule.h" | 8 #include "core/css/CSSKeyframeRule.h" |
9 #include "core/css/StyleColor.h" | 9 #include "core/css/StyleColor.h" |
10 #include "core/css/StylePropertySet.h" | 10 #include "core/css/StylePropertySet.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 { | 30 { |
31 CSSParserImpl::parseDeclarationListForInspector(declaration, context, observ er); | 31 CSSParserImpl::parseDeclarationListForInspector(declaration, context, observ er); |
32 } | 32 } |
33 | 33 |
34 CSSSelectorList CSSParser::parseSelector(const CSSParserContext& context, StyleS heetContents* styleSheetContents, const String& selector) | 34 CSSSelectorList CSSParser::parseSelector(const CSSParserContext& context, StyleS heetContents* styleSheetContents, const String& selector) |
35 { | 35 { |
36 CSSTokenizer::Scope scope(selector); | 36 CSSTokenizer::Scope scope(selector); |
37 return CSSSelectorParser::parseSelector(scope.tokenRange(), context, styleSh eetContents); | 37 return CSSSelectorParser::parseSelector(scope.tokenRange(), context, styleSh eetContents); |
38 } | 38 } |
39 | 39 |
40 CSSSelectorList CSSParser::parsePageSelector(const CSSParserContext& context, St yleSheetContents* styleSheetContents, const String& selector) | |
41 { | |
42 CSSTokenizer::Scope scope(selector); | |
43 CSSParserTokenRange range = scope.tokenRange(); | |
44 const CSSParserToken* preludeStart = &range.peek(); | |
45 while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek ().type() != SemicolonToken) | |
Timothy Loh
2016/02/01 21:55:15
Seems wrong, if you specify ":left { bla" as a pag
ramya.v
2016/02/02 05:43:24
In the existing implementation ":left { bla" is pa
Timothy Loh
2016/02/02 05:49:12
Yes, but this function only concerns itself with p
ramya.v
2016/02/02 06:40:17
Got your point. Thanks :)
Done in https://coderev
| |
46 range.consumeComponentValue(); | |
47 return CSSParserImpl::parsePageSelector(range.makeSubRange(preludeStart, &ra nge.peek()), styleSheetContents); | |
48 } | |
49 | |
40 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule) | 50 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule) |
41 { | 51 { |
42 return CSSParserImpl::parseRule(rule, context, styleSheet, CSSParserImpl::Al lowImportRules); | 52 return CSSParserImpl::parseRule(rule, context, styleSheet, CSSParserImpl::Al lowImportRules); |
43 } | 53 } |
44 | 54 |
45 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text) | 55 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text) |
46 { | 56 { |
47 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); | 57 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); |
48 } | 58 } |
49 | 59 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 builder.appendLiteral(" : "); | 177 builder.appendLiteral(" : "); |
168 builder.append(propertyValue); | 178 builder.append(propertyValue); |
169 builder.appendLiteral("; }"); | 179 builder.appendLiteral("; }"); |
170 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString()); | 180 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString()); |
171 if (!rule || !rule->isFontFaceRule()) | 181 if (!rule || !rule->isFontFaceRule()) |
172 return nullptr; | 182 return nullptr; |
173 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); | 183 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); |
174 } | 184 } |
175 | 185 |
176 } // namespace blink | 186 } // namespace blink |
OLD | NEW |