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/CSSSelectorParser.h" | 5 #include "core/css/parser/CSSSelectorParser.h" |
6 | 6 |
7 #include "core/css/CSSSelectorList.h" | 7 #include "core/css/CSSSelectorList.h" |
8 #include "core/css/StyleSheetContents.h" | 8 #include "core/css/StyleSheetContents.h" |
9 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
10 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 AtomicString namespaceURI = determineNamespace(namespacePrefix); | 265 AtomicString namespaceURI = determineNamespace(namespacePrefix); |
266 if (namespaceURI.isNull()) { | 266 if (namespaceURI.isNull()) { |
267 m_failedParsing = true; | 267 m_failedParsing = true; |
268 return nullptr; | 268 return nullptr; |
269 } | 269 } |
270 if (namespaceURI == defaultNamespace()) | 270 if (namespaceURI == defaultNamespace()) |
271 namespacePrefix = nullAtom; | 271 namespacePrefix = nullAtom; |
272 return CSSParserSelector::create( | 272 return CSSParserSelector::create( |
273 QualifiedName(namespacePrefix, elementName, namespaceURI)); | 273 QualifiedName(namespacePrefix, elementName, namespaceURI)); |
274 } | 274 } |
| 275 // TODO(rune@opera.com): Prepending a type selector to the compound is |
| 276 // unnecessary if this compound is an argument to a pseudo selector like |
| 277 // :not(), since a type selector will be prepended at the top level of the |
| 278 // selector if necessary. We need to propagate that context information here |
| 279 // to tell if we are at the top level. |
275 prependTypeSelectorIfNeeded(namespacePrefix, elementName, | 280 prependTypeSelectorIfNeeded(namespacePrefix, elementName, |
276 compoundSelector.get()); | 281 compoundSelector.get()); |
277 return splitCompoundAtImplicitShadowCrossingCombinator( | 282 return splitCompoundAtImplicitShadowCrossingCombinator( |
278 std::move(compoundSelector)); | 283 std::move(compoundSelector)); |
279 } | 284 } |
280 | 285 |
281 std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector( | 286 std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector( |
282 CSSParserTokenRange& range) { | 287 CSSParserTokenRange& range) { |
283 const CSSParserToken& token = range.peek(); | 288 const CSSParserToken& token = range.peek(); |
284 std::unique_ptr<CSSParserSelector> selector; | 289 std::unique_ptr<CSSParserSelector> selector; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 890 } |
886 if (current->relation() == CSSSelector::IndirectAdjacent) | 891 if (current->relation() == CSSSelector::IndirectAdjacent) |
887 m_context->count(UseCounter::CSSSelectorIndirectAdjacent); | 892 m_context->count(UseCounter::CSSSelectorIndirectAdjacent); |
888 if (current->selectorList()) | 893 if (current->selectorList()) |
889 recordUsageAndDeprecations(*current->selectorList()); | 894 recordUsageAndDeprecations(*current->selectorList()); |
890 } | 895 } |
891 } | 896 } |
892 } | 897 } |
893 | 898 |
894 } // namespace blink | 899 } // namespace blink |
OLD | NEW |