| 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 11073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11084 } | 11084 } |
| 11085 | 11085 |
| 11086 if (!specifiers->isCustomPseudoElement()) { | 11086 if (!specifiers->isCustomPseudoElement()) { |
| 11087 if (tag == anyQName()) | 11087 if (tag == anyQName()) |
| 11088 return specifiers; | 11088 return specifiers; |
| 11089 if (!(specifiers->pseudoType() == CSSSelector::PseudoCue)) | 11089 if (!(specifiers->pseudoType() == CSSSelector::PseudoCue)) |
| 11090 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); | 11090 specifiers->prependTagSelector(tag, tagIsForNamespaceRule); |
| 11091 return specifiers; | 11091 return specifiers; |
| 11092 } | 11092 } |
| 11093 | 11093 |
| 11094 CSSParserSelector* lastShadowDescendant = specifiers; | 11094 CSSParserSelector* lastShadowPseudo = specifiers; |
| 11095 CSSParserSelector* history = specifiers; | 11095 CSSParserSelector* history = specifiers; |
| 11096 while (history->tagHistory()) { | 11096 while (history->tagHistory()) { |
| 11097 history = history->tagHistory(); | 11097 history = history->tagHistory(); |
| 11098 if (history->isCustomPseudoElement() || history->hasShadowDescendant()) | 11098 if (history->isCustomPseudoElement() || history->hasShadowPseudo()) |
| 11099 lastShadowDescendant = history; | 11099 lastShadowPseudo = history; |
| 11100 } | 11100 } |
| 11101 | 11101 |
| 11102 if (lastShadowDescendant->tagHistory()) { | 11102 if (lastShadowPseudo->tagHistory()) { |
| 11103 if (tag != anyQName()) | 11103 if (tag != anyQName()) |
| 11104 lastShadowDescendant->tagHistory()->prependTagSelector(tag, tagIsFor
NamespaceRule); | 11104 lastShadowPseudo->tagHistory()->prependTagSelector(tag, tagIsForName
spaceRule); |
| 11105 return specifiers; | 11105 return specifiers; |
| 11106 } | 11106 } |
| 11107 | 11107 |
| 11108 // For shadow-ID pseudo-elements to be correctly matched, the ShadowDescenda
nt combinator has to be used. | 11108 // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo c
ombinator has to be used. |
| 11109 // We therefore create a new Selector with that combinator here in any case,
even if matching any (host) element in any namespace (i.e. '*'). | 11109 // We therefore create a new Selector with that combinator here in any case,
even if matching any (host) element in any namespace (i.e. '*'). |
| 11110 OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelect
or(tag)); | 11110 OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelect
or(tag)); |
| 11111 lastShadowDescendant->setTagHistory(elementNameSelector.release()); | 11111 lastShadowPseudo->setTagHistory(elementNameSelector.release()); |
| 11112 lastShadowDescendant->setRelation(CSSSelector::ShadowDescendant); | 11112 lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo); |
| 11113 return specifiers; | 11113 return specifiers; |
| 11114 } | 11114 } |
| 11115 | 11115 |
| 11116 CSSParserSelector* CSSParser::rewriteSpecifiersForShadowDistributed(CSSParserSel
ector* specifiers, CSSParserSelector* distributedPseudoElementSelector) | 11116 CSSParserSelector* CSSParser::rewriteSpecifiersForShadowDistributed(CSSParserSel
ector* specifiers, CSSParserSelector* distributedPseudoElementSelector) |
| 11117 { | 11117 { |
| 11118 CSSParserSelector* argumentSelector = distributedPseudoElementSelector->func
tionArgumentSelector(); | 11118 CSSParserSelector* argumentSelector = distributedPseudoElementSelector->func
tionArgumentSelector(); |
| 11119 ASSERT(argumentSelector); | 11119 ASSERT(argumentSelector); |
| 11120 ASSERT(!specifiers->isDistributedPseudoElement()); | 11120 ASSERT(!specifiers->isDistributedPseudoElement()); |
| 11121 for (CSSParserSelector* end = specifiers; end->tagHistory(); end = end->tagH
istory()) { | 11121 for (CSSParserSelector* end = specifiers; end->tagHistory(); end = end->tagH
istory()) { |
| 11122 if (end->tagHistory()->isDistributedPseudoElement()) { | 11122 if (end->tagHistory()->isDistributedPseudoElement()) { |
| 11123 end->clearTagHistory(); | 11123 end->clearTagHistory(); |
| 11124 break; | 11124 break; |
| 11125 } | 11125 } |
| 11126 } | 11126 } |
| 11127 CSSParserSelector* end = argumentSelector; | 11127 CSSParserSelector* end = argumentSelector; |
| 11128 while (end->tagHistory()) | 11128 while (end->tagHistory()) |
| 11129 end = end->tagHistory(); | 11129 end = end->tagHistory(); |
| 11130 end->setTagHistory(sinkFloatingSelector(specifiers)); | 11130 end->setTagHistory(sinkFloatingSelector(specifiers)); |
| 11131 end->setRelation(CSSSelector::ShadowDistributed); | 11131 end->setRelation(CSSSelector::ShadowDistributed); |
| 11132 return argumentSelector; | 11132 return argumentSelector; |
| 11133 } | 11133 } |
| 11134 | 11134 |
| 11135 CSSParserSelector* CSSParser::rewriteSpecifiers(CSSParserSelector* specifiers, C
SSParserSelector* newSpecifier) | 11135 CSSParserSelector* CSSParser::rewriteSpecifiers(CSSParserSelector* specifiers, C
SSParserSelector* newSpecifier) |
| 11136 { | 11136 { |
| 11137 if (newSpecifier->isCustomPseudoElement() || newSpecifier->pseudoType() == C
SSSelector::PseudoCue) { | 11137 if (newSpecifier->isCustomPseudoElement() || newSpecifier->pseudoType() == C
SSSelector::PseudoCue) { |
| 11138 // Unknown pseudo element always goes at the top of selector chain. | 11138 // Unknown pseudo element always goes at the top of selector chain. |
| 11139 newSpecifier->appendTagHistory(CSSSelector::ShadowDescendant, sinkFloati
ngSelector(specifiers)); | 11139 newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSe
lector(specifiers)); |
| 11140 return newSpecifier; | 11140 return newSpecifier; |
| 11141 } | 11141 } |
| 11142 if (specifiers->isCustomPseudoElement()) { | 11142 if (specifiers->isCustomPseudoElement()) { |
| 11143 // Specifiers for unknown pseudo element go right behind it in the chain
. | 11143 // Specifiers for unknown pseudo element go right behind it in the chain
. |
| 11144 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowDescendant); | 11144 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelec
tor(newSpecifier), CSSSelector::ShadowPseudo); |
| 11145 return specifiers; | 11145 return specifiers; |
| 11146 } | 11146 } |
| 11147 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); | 11147 specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(
newSpecifier)); |
| 11148 return specifiers; | 11148 return specifiers; |
| 11149 } | 11149 } |
| 11150 | 11150 |
| 11151 StyleRuleBase* CSSParser::createPageRule(PassOwnPtr<CSSParserSelector> pageSelec
tor) | 11151 StyleRuleBase* CSSParser::createPageRule(PassOwnPtr<CSSParserSelector> pageSelec
tor) |
| 11152 { | 11152 { |
| 11153 // FIXME: Margin at-rules are ignored. | 11153 // FIXME: Margin at-rules are ignored. |
| 11154 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11154 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11700 result.lineNumber = lineNumber; | 11700 result.lineNumber = lineNumber; |
| 11701 result.content = content; | 11701 result.content = content; |
| 11702 size_t newLength = content.length(); | 11702 size_t newLength = content.length(); |
| 11703 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) | 11703 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) |
| 11704 --newLength; | 11704 --newLength; |
| 11705 result.content.setLength(newLength); | 11705 result.content.setLength(newLength); |
| 11706 return result; | 11706 return result; |
| 11707 } | 11707 } |
| 11708 | 11708 |
| 11709 } | 11709 } |
| OLD | NEW |