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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 QualifiedName tag(namespacePrefix, elementName, determinedNamespace); | 1914 QualifiedName tag(namespacePrefix, elementName, determinedNamespace); |
1915 | 1915 |
1916 if (CSSParserSelector* distributedPseudoElementSelector = specifiers->findDi
stributedPseudoElementSelector()) { | 1916 if (CSSParserSelector* distributedPseudoElementSelector = specifiers->findDi
stributedPseudoElementSelector()) { |
1917 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); | 1917 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); |
1918 return rewriteSpecifiersForShadowDistributed(specifiers, distributedPseu
doElementSelector); | 1918 return rewriteSpecifiersForShadowDistributed(specifiers, distributedPseu
doElementSelector); |
1919 } | 1919 } |
1920 | 1920 |
1921 if (specifiers->needsCrossingTreeScopeBoundary()) | 1921 if (specifiers->needsCrossingTreeScopeBoundary()) |
1922 return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, eleme
ntName, specifiers, tagIsForNamespaceRule); | 1922 return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, eleme
ntName, specifiers, tagIsForNamespaceRule); |
1923 | 1923 |
| 1924 if (specifiers->isContentPseudoElement()) |
| 1925 return rewriteSpecifiersWithElementNameForContentPseudoElement(tag, elem
entName, specifiers, tagIsForNamespaceRule); |
| 1926 |
1924 // *:host never matches, so we can't discard the * otherwise we can't tell t
he | 1927 // *:host never matches, so we can't discard the * otherwise we can't tell t
he |
1925 // difference between *:host and just :host. | 1928 // difference between *:host and just :host. |
1926 if (tag == anyQName() && !specifiers->hasHostPseudoSelector()) | 1929 if (tag == anyQName() && !specifiers->hasHostPseudoSelector()) |
1927 return specifiers; | 1930 return specifiers; |
1928 if (specifiers->pseudoType() != CSSSelector::PseudoCue) | 1931 if (specifiers->pseudoType() != CSSSelector::PseudoCue) |
1929 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); | 1932 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); |
1930 return specifiers; | 1933 return specifiers; |
1931 } | 1934 } |
1932 | 1935 |
1933 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseu
doElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSe
lector* specifiers, bool tagIsForNamespaceRule) | 1936 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseu
doElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSe
lector* specifiers, bool tagIsForNamespaceRule) |
(...skipping 22 matching lines...) Expand all Loading... |
1956 lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo); | 1959 lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo); |
1957 return specifiers; | 1960 return specifiers; |
1958 } | 1961 } |
1959 | 1962 |
1960 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForContentPse
udoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserS
elector* specifiers, bool tagIsForNamespaceRule) | 1963 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForContentPse
udoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserS
elector* specifiers, bool tagIsForNamespaceRule) |
1961 { | 1964 { |
1962 CSSParserSelector* last = specifiers; | 1965 CSSParserSelector* last = specifiers; |
1963 CSSParserSelector* history = specifiers; | 1966 CSSParserSelector* history = specifiers; |
1964 while (history->tagHistory()) { | 1967 while (history->tagHistory()) { |
1965 history = history->tagHistory(); | 1968 history = history->tagHistory(); |
1966 if (history->relationIsAffectedByPseudoContent()) | 1969 if (history->isContentPseudoElement() || history->relationIsAffectedByPs
eudoContent()) |
1967 last = history; | 1970 last = history; |
1968 } | 1971 } |
1969 | 1972 |
1970 if (last->tagHistory()) { | 1973 if (last->tagHistory()) { |
1971 if (tag != anyQName()) | 1974 if (tag != anyQName()) |
1972 last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule); | 1975 last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule); |
1973 return specifiers; | 1976 return specifiers; |
1974 } | 1977 } |
1975 | 1978 |
1976 // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo c
ombinator has to be used. | 1979 // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo c
ombinator has to be used. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 } | 2012 } |
2010 } | 2013 } |
2011 | 2014 |
2012 CSSParserSelector* BisonCSSParser::rewriteSpecifiers(CSSParserSelector* specifie
rs, CSSParserSelector* newSpecifier) | 2015 CSSParserSelector* BisonCSSParser::rewriteSpecifiers(CSSParserSelector* specifie
rs, CSSParserSelector* newSpecifier) |
2013 { | 2016 { |
2014 if (newSpecifier->needsCrossingTreeScopeBoundary()) { | 2017 if (newSpecifier->needsCrossingTreeScopeBoundary()) { |
2015 // Unknown pseudo element always goes at the top of selector chain. | 2018 // Unknown pseudo element always goes at the top of selector chain. |
2016 newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSe
lector(specifiers)); | 2019 newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSe
lector(specifiers)); |
2017 return newSpecifier; | 2020 return newSpecifier; |
2018 } | 2021 } |
| 2022 if (newSpecifier->isContentPseudoElement()) { |
| 2023 newSpecifier->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSel
ector(specifiers)); |
| 2024 return newSpecifier; |
| 2025 } |
2019 if (specifiers->needsCrossingTreeScopeBoundary()) { | 2026 if (specifiers->needsCrossingTreeScopeBoundary()) { |
2020 // Specifiers for unknown pseudo element go right behind it in the chain
. | 2027 // Specifiers for unknown pseudo element go right behind it in the chain
. |
2021 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowPseudo); | 2028 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowPseudo); |
2022 return specifiers; | 2029 return specifiers; |
2023 } | 2030 } |
| 2031 if (specifiers->isContentPseudoElement()) { |
| 2032 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::SubSelector); |
| 2033 return specifiers; |
| 2034 } |
2024 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); | 2035 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); |
2025 return specifiers; | 2036 return specifiers; |
2026 } | 2037 } |
2027 | 2038 |
2028 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page
Selector) | 2039 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page
Selector) |
2029 { | 2040 { |
2030 // FIXME: Margin at-rules are ignored. | 2041 // FIXME: Margin at-rules are ignored. |
2031 m_allowImportRules = m_allowNamespaceDeclarations = false; | 2042 m_allowImportRules = m_allowNamespaceDeclarations = false; |
2032 StyleRulePage* pageRule = 0; | 2043 StyleRulePage* pageRule = 0; |
2033 if (pageSelector) { | 2044 if (pageSelector) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 rule->setProperties(createStylePropertySet()); | 2205 rule->setProperties(createStylePropertySet()); |
2195 clearProperties(); | 2206 clearProperties(); |
2196 | 2207 |
2197 StyleRuleViewport* result = rule.get(); | 2208 StyleRuleViewport* result = rule.get(); |
2198 m_parsedRules.append(rule.release()); | 2209 m_parsedRules.append(rule.release()); |
2199 | 2210 |
2200 return result; | 2211 return result; |
2201 } | 2212 } |
2202 | 2213 |
2203 } | 2214 } |
OLD | NEW |