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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 QualifiedName tag(namespacePrefix, elementName, determinedNamespace); | 1927 QualifiedName tag(namespacePrefix, elementName, determinedNamespace); |
1928 | 1928 |
1929 if (CSSParserSelector* distributedPseudoElementSelector = specifiers->findDi
stributedPseudoElementSelector()) { | 1929 if (CSSParserSelector* distributedPseudoElementSelector = specifiers->findDi
stributedPseudoElementSelector()) { |
1930 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); | 1930 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); |
1931 return rewriteSpecifiersForShadowDistributed(specifiers, distributedPseu
doElementSelector); | 1931 return rewriteSpecifiersForShadowDistributed(specifiers, distributedPseu
doElementSelector); |
1932 } | 1932 } |
1933 | 1933 |
1934 if (specifiers->needsCrossingTreeScopeBoundary()) | 1934 if (specifiers->needsCrossingTreeScopeBoundary()) |
1935 return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, eleme
ntName, specifiers, tagIsForNamespaceRule); | 1935 return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, eleme
ntName, specifiers, tagIsForNamespaceRule); |
1936 | 1936 |
1937 if (specifiers->isContentPseudoElement()) | |
1938 return rewriteSpecifiersWithElementNameForContentPseudoElement(tag, elem
entName, specifiers, tagIsForNamespaceRule); | |
1939 | |
1940 if (tag == anyQName()) | 1937 if (tag == anyQName()) |
1941 return specifiers; | 1938 return specifiers; |
1942 if (!(specifiers->pseudoType() == CSSSelector::PseudoCue)) | 1939 if (!(specifiers->pseudoType() == CSSSelector::PseudoCue)) |
1943 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); | 1940 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); |
1944 return specifiers; | 1941 return specifiers; |
1945 } | 1942 } |
1946 | 1943 |
1947 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseu
doElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSe
lector* specifiers, bool tagIsForNamespaceRule) | 1944 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForCustomPseu
doElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSe
lector* specifiers, bool tagIsForNamespaceRule) |
1948 { | 1945 { |
1949 if (m_context.useCounter() && specifiers->pseudoType() == CSSSelector::Pseud
oUserAgentCustomElement) | 1946 if (m_context.useCounter() && specifiers->pseudoType() == CSSSelector::Pseud
oUserAgentCustomElement) |
(...skipping 20 matching lines...) Expand all Loading... |
1970 lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo); | 1967 lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo); |
1971 return specifiers; | 1968 return specifiers; |
1972 } | 1969 } |
1973 | 1970 |
1974 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForContentPse
udoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserS
elector* specifiers, bool tagIsForNamespaceRule) | 1971 CSSParserSelector* BisonCSSParser::rewriteSpecifiersWithElementNameForContentPse
udoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserS
elector* specifiers, bool tagIsForNamespaceRule) |
1975 { | 1972 { |
1976 CSSParserSelector* last = specifiers; | 1973 CSSParserSelector* last = specifiers; |
1977 CSSParserSelector* history = specifiers; | 1974 CSSParserSelector* history = specifiers; |
1978 while (history->tagHistory()) { | 1975 while (history->tagHistory()) { |
1979 history = history->tagHistory(); | 1976 history = history->tagHistory(); |
1980 if (history->isContentPseudoElement() || history->relationIsAffectedByPs
eudoContent()) | 1977 if (history->relationIsAffectedByPseudoContent()) |
1981 last = history; | 1978 last = history; |
1982 } | 1979 } |
1983 | 1980 |
1984 if (last->tagHistory()) { | 1981 if (last->tagHistory()) { |
1985 if (tag != anyQName()) | 1982 if (tag != anyQName()) |
1986 last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule); | 1983 last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule); |
1987 return specifiers; | 1984 return specifiers; |
1988 } | 1985 } |
1989 | 1986 |
1990 // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo c
ombinator has to be used. | 1987 // 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... |
2023 } | 2020 } |
2024 } | 2021 } |
2025 | 2022 |
2026 CSSParserSelector* BisonCSSParser::rewriteSpecifiers(CSSParserSelector* specifie
rs, CSSParserSelector* newSpecifier) | 2023 CSSParserSelector* BisonCSSParser::rewriteSpecifiers(CSSParserSelector* specifie
rs, CSSParserSelector* newSpecifier) |
2027 { | 2024 { |
2028 if (newSpecifier->needsCrossingTreeScopeBoundary()) { | 2025 if (newSpecifier->needsCrossingTreeScopeBoundary()) { |
2029 // Unknown pseudo element always goes at the top of selector chain. | 2026 // Unknown pseudo element always goes at the top of selector chain. |
2030 newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSe
lector(specifiers)); | 2027 newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSe
lector(specifiers)); |
2031 return newSpecifier; | 2028 return newSpecifier; |
2032 } | 2029 } |
2033 if (newSpecifier->isContentPseudoElement()) { | |
2034 newSpecifier->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSel
ector(specifiers)); | |
2035 return newSpecifier; | |
2036 } | |
2037 if (specifiers->needsCrossingTreeScopeBoundary()) { | 2030 if (specifiers->needsCrossingTreeScopeBoundary()) { |
2038 // Specifiers for unknown pseudo element go right behind it in the chain
. | 2031 // Specifiers for unknown pseudo element go right behind it in the chain
. |
2039 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowPseudo); | 2032 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowPseudo); |
2040 return specifiers; | 2033 return specifiers; |
2041 } | 2034 } |
2042 if (specifiers->isContentPseudoElement()) { | |
2043 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::SubSelector); | |
2044 return specifiers; | |
2045 } | |
2046 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); | 2035 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); |
2047 return specifiers; | 2036 return specifiers; |
2048 } | 2037 } |
2049 | 2038 |
2050 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page
Selector) | 2039 StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> page
Selector) |
2051 { | 2040 { |
2052 // FIXME: Margin at-rules are ignored. | 2041 // FIXME: Margin at-rules are ignored. |
2053 m_allowImportRules = m_allowNamespaceDeclarations = false; | 2042 m_allowImportRules = m_allowNamespaceDeclarations = false; |
2054 StyleRulePage* pageRule = 0; | 2043 StyleRulePage* pageRule = 0; |
2055 if (pageSelector) { | 2044 if (pageSelector) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 rule->setProperties(createStylePropertySet()); | 2205 rule->setProperties(createStylePropertySet()); |
2217 clearProperties(); | 2206 clearProperties(); |
2218 | 2207 |
2219 StyleRuleViewport* result = rule.get(); | 2208 StyleRuleViewport* result = rule.get(); |
2220 m_parsedRules.append(rule.release()); | 2209 m_parsedRules.append(rule.release()); |
2221 | 2210 |
2222 return result; | 2211 return result; |
2223 } | 2212 } |
2224 | 2213 |
2225 } | 2214 } |
OLD | NEW |