| 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/CSSParserImpl.h" | 5 #include "core/css/parser/CSSParserImpl.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCustomIdentValue.h" | 7 #include "core/css/CSSCustomIdentValue.h" |
| 8 #include "core/css/CSSCustomPropertyDeclaration.h" | 8 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 9 #include "core/css/CSSKeyframesRule.h" | 9 #include "core/css/CSSKeyframesRule.h" |
| 10 #include "core/css/CSSStyleSheet.h" | 10 #include "core/css/CSSStyleSheet.h" |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 CSSSelectorParser::parseSelector(prelude, m_context, m_styleSheet); | 773 CSSSelectorParser::parseSelector(prelude, m_context, m_styleSheet); |
| 774 if (!selectorList.isValid()) | 774 if (!selectorList.isValid()) |
| 775 return nullptr; // Parse error, invalid selector list | 775 return nullptr; // Parse error, invalid selector list |
| 776 | 776 |
| 777 // TODO(csharrison): How should we lazily parse css that needs the observer? | 777 // TODO(csharrison): How should we lazily parse css that needs the observer? |
| 778 if (m_observerWrapper) { | 778 if (m_observerWrapper) { |
| 779 observeSelectors(*m_observerWrapper, prelude); | 779 observeSelectors(*m_observerWrapper, prelude); |
| 780 } else if (m_deferPropertyParsing && | 780 } else if (m_deferPropertyParsing && |
| 781 shouldLazilyParseProperties(selectorList)) { | 781 shouldLazilyParseProperties(selectorList)) { |
| 782 DCHECK(m_styleSheet); | 782 DCHECK(m_styleSheet); |
| 783 return StyleRule::createLazy( | 783 auto s = StyleRule::createLazy( |
| 784 std::move(selectorList), | 784 std::move(selectorList), |
| 785 createDeferredPropertiesClosure(block, m_styleSheet->parserContext(), | 785 createDeferredPropertiesClosure(block, m_styleSheet->parserContext(), |
| 786 m_context.useCounter())); | 786 m_context.useCounter())); |
| 787 s->properties(); |
| 788 return s; |
| 787 } | 789 } |
| 788 consumeDeclarationList(block, StyleRule::Style); | 790 consumeDeclarationList(block, StyleRule::Style); |
| 789 return StyleRule::create( | 791 return StyleRule::create( |
| 790 std::move(selectorList), | 792 std::move(selectorList), |
| 791 createStylePropertySet(m_parsedProperties, m_context.mode())); | 793 createStylePropertySet(m_parsedProperties, m_context.mode())); |
| 792 } | 794 } |
| 793 | 795 |
| 794 void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, | 796 void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, |
| 795 StyleRule::RuleType ruleType) { | 797 StyleRule::RuleType ruleType) { |
| 796 ASSERT(m_parsedProperties.isEmpty()); | 798 ASSERT(m_parsedProperties.isEmpty()); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 const CSSSelectorList& selectors) { | 991 const CSSSelectorList& selectors) { |
| 990 for (const auto* s = selectors.first(); s; s = CSSSelectorList::next(*s)) { | 992 for (const auto* s = selectors.first(); s; s = CSSSelectorList::next(*s)) { |
| 991 const CSSSelector::PseudoType type(s->getPseudoType()); | 993 const CSSSelector::PseudoType type(s->getPseudoType()); |
| 992 if (type == CSSSelector::PseudoBefore || type == CSSSelector::PseudoAfter) | 994 if (type == CSSSelector::PseudoBefore || type == CSSSelector::PseudoAfter) |
| 993 return false; | 995 return false; |
| 994 } | 996 } |
| 995 return true; | 997 return true; |
| 996 } | 998 } |
| 997 | 999 |
| 998 } // namespace blink | 1000 } // namespace blink |
| OLD | NEW |