Changeset 133577 in webkit
- Timestamp:
- Nov 6, 2012 2:43:46 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r133575 r133577 1 2012-11-06 Shinya Kawanaka <shinyak@chromium.org> 2 3 [Shadow] Using isUnknownPseudoElement() for shadow pseudo id seems confusing 4 https://bugs.webkit.org/show_bug.cgi?id=100826 5 6 Reviewed by Hajime Morita. 7 8 * fast/dom/shadow/shadow-nested-pseudo-id.html: Fixed a testcase so that shadowPseudoId starts with 'x-'. 9 * fast/dom/shadow/shadow-pseudo-id-expected.html: Added. 10 * fast/dom/shadow/shadow-pseudo-id.html: Added. 11 1 12 2012-11-06 Shinya Kawanaka <shinyak@chromium.org> 2 13 -
trunk/LayoutTests/fast/dom/shadow/shadow-nested-pseudo-id.html
r120147 r133577 5 5 <style> 6 6 7 p:: -shadow-child {7 p::x-shadow-child { 8 8 color: red; 9 9 } 10 10 11 a:: -nested-shadow-child {11 a::x-nested-shadow-child { 12 12 color: blue; 13 13 } 14 14 15 p:: -shadow-child::-nested-shadow-child {15 p::x-shadow-child::x-nested-shadow-child { 16 16 background-color: green; 17 17 } … … 40 40 41 41 var host = document.getElementById("host"); 42 var tuple = buildShadowWithOneChild(host, "a", " -shadow-child");42 var tuple = buildShadowWithOneChild(host, "a", "x-shadow-child"); 43 43 shouldBe("window.getComputedStyle(tuple.shadowChild).color", "'rgb(255, 0, 0)'"); 44 var shadowTuple = buildShadowWithOneChild(tuple.shadowChild, "b", " -nested-shadow-child");44 var shadowTuple = buildShadowWithOneChild(tuple.shadowChild, "b", "x-nested-shadow-child"); 45 45 shouldBe("window.getComputedStyle(shadowTuple.shadowChild).color", "'rgb(0, 0, 255)'"); 46 46 shouldBe("window.getComputedStyle(shadowTuple.shadowChild).backgroundColor", "'rgb(0, 128, 0)'"); -
trunk/Source/WebCore/ChangeLog
r133575 r133577 1 2012-11-06 Shinya Kawanaka <shinyak@chromium.org> 2 3 [Shadow] Using isUnknownPseudoElement() for shadow pseudo id seems confusing 4 https://bugs.webkit.org/show_bug.cgi?id=100826 5 6 Reviewed by Hajime Morita. 7 8 We used isUnknownPseudoElement() for these 3 meanings: 1) the element is a custom pseudo-element (starting with 'x-'), 9 2) the element is a webkit custom pseudo-element (starting with '-webkit-'), and 3) the element has an unknown type. 10 We would like to distinguish them when parsing CSSSelector types. Also, we disable using (3) type for using 11 shadowPseudoId. 12 13 In this patch, we allow using WebKitCustomPseudoElement in AuthorShadowRoot, and CustomPseudoElement in 14 UAShadowRoot. However, we will disable them later. 15 16 Test: fast/dom/shadow/shadow-pseudo-id.html 17 18 * css/CSSGrammar.y.in: Now we can discard UNKNOWN type. It should not match anything. 19 * css/CSSParser.cpp: 20 (WebCore::CSSParser::updateSpecifiersWithElementName): 21 (WebCore::CSSParser::updateSpecifiers): 22 * css/CSSParserValues.h: 23 (WebCore::CSSParserSelector::isCustomPseudoElement): 24 (CSSParserSelector): 25 * css/CSSSelector.cpp: 26 (WebCore::CSSSelector::pseudoId): 27 (WebCore::CSSSelector::parsePseudoType): 28 (WebCore::CSSSelector::isCustomPseudoType): Returns true if the type is PseudoUserAgentCustomElement or PseudoWebKitCustomElement. 29 (WebCore::CSSSelector::extractPseudoType): 30 * css/CSSSelector.h: 31 (CSSSelector): 32 (WebCore::CSSSelector::isCustomPseudoElement): 33 (WebCore): 34 * css/CSSSelectorList.cpp: 35 (WebCore::SelectorHasInvalidSelectorFunctor::operator()): We will reject all selectors which were judged as 36 UNKNOWN before. i.e. It contians all three types for now. 37 (WebCore::CSSSelectorList::hasInvalidSelector): Renamed. 38 * css/CSSSelectorList.h: 39 (CSSSelectorList): 40 * css/RuleSet.cpp: 41 (WebCore::RuleSet::addRule): 42 * css/SelectorChecker.cpp: 43 (WebCore::SelectorChecker::checkSelector): 44 * dom/Element.cpp: 45 (WebCore::Element::setShadowPseudoId): 46 * dom/SelectorQuery.cpp: 47 (WebCore::SelectorQueryCache::add): 48 1 49 2012-11-06 Shinya Kawanaka <shinyak@chromium.org> 2 50 -
trunk/Source/WebCore/css/CSSGrammar.y.in
r133084 r133577 1308 1308 $$->setValue($3); 1309 1309 // FIXME: This call is needed to force selector to compute the pseudoType early enough. 1310 $$->pseudoType(); 1310 CSSSelector::PseudoType type = $$->pseudoType(); 1311 if (type == CSSSelector::PseudoUnknown) 1312 $$ = 0; 1311 1313 } 1312 1314 // use by :-webkit-any. -
trunk/Source/WebCore/css/CSSParser.cpp
r133545 r133577 10258 10258 AtomicString determinedNamespace = namespacePrefix != nullAtom && m_styleSheet ? m_styleSheet->determineNamespace(namespacePrefix) : m_defaultNamespace; 10259 10259 QualifiedName tag = QualifiedName(namespacePrefix, elementName, determinedNamespace); 10260 if (!specifiers->is UnknownPseudoElement()) {10260 if (!specifiers->isCustomPseudoElement()) { 10261 10261 specifiers->setTag(tag); 10262 10262 return; … … 10267 10267 while (history->tagHistory()) { 10268 10268 history = history->tagHistory(); 10269 if (history->is UnknownPseudoElement() || history->hasShadowDescendant())10269 if (history->isCustomPseudoElement() || history->hasShadowDescendant()) 10270 10270 lastShadowDescendant = history; 10271 10271 } … … 10286 10286 CSSParserSelector* CSSParser::updateSpecifiers(CSSParserSelector* specifiers, CSSParserSelector* newSpecifier) 10287 10287 { 10288 if (newSpecifier->is UnknownPseudoElement()) {10288 if (newSpecifier->isCustomPseudoElement()) { 10289 10289 // Unknown pseudo element always goes at the top of selector chain. 10290 10290 newSpecifier->appendTagHistory(CSSSelector::ShadowDescendant, sinkFloatingSelector(specifiers)); 10291 10291 return newSpecifier; 10292 10292 } 10293 if (specifiers->is UnknownPseudoElement()) {10293 if (specifiers->isCustomPseudoElement()) { 10294 10294 // Specifiers for unknown pseudo element go right behind it in the chain. 10295 10295 specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier), CSSSelector::ShadowDescendant); -
trunk/Source/WebCore/css/CSSParserValues.h
r131313 r133577 192 192 193 193 CSSSelector::PseudoType pseudoType() const { return m_selector->pseudoType(); } 194 bool isUnknownPseudoElement() const { return m_selector->isUnknownPseudoElement(); } 194 bool isCustomPseudoElement() const { return m_selector->isCustomPseudoElement(); } 195 195 196 bool isSimple() const { return !m_tagHistory && m_selector->isSimple(); } 196 197 bool hasShadowDescendant() const; -
trunk/Source/WebCore/css/CSSSelector.cpp
r133561 r133577 219 219 case PseudoInRange: 220 220 case PseudoOutOfRange: 221 case PseudoUserAgentCustomElement: 222 case PseudoWebKitCustomElement: 221 223 return NOPSEUDO; 222 224 case PseudoNotParsed: … … 388 390 HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = nameToPseudoTypeMap(); 389 391 HashMap<AtomicStringImpl*, CSSSelector::PseudoType>::iterator slot = nameToPseudoType->find(name.impl()); 390 return slot == nameToPseudoType->end() ? PseudoUnknown : slot->value; 391 } 392 393 bool CSSSelector::isUnknownPseudoType(const AtomicString& name) 394 { 395 return parsePseudoType(name) == PseudoUnknown; 392 393 if (slot != nameToPseudoType->end()) 394 return slot->value; 395 396 if (name.startsWith("-webkit-")) 397 return PseudoWebKitCustomElement; 398 if (name.startsWith("x-")) 399 return PseudoUserAgentCustomElement; 400 401 return PseudoUnknown; 402 } 403 404 bool CSSSelector::isCustomPseudoType(const AtomicString& name) 405 { 406 CSSSelector::PseudoType type = parsePseudoType(name); 407 return type == PseudoUserAgentCustomElement || type == PseudoWebKitCustomElement; 396 408 } 397 409 … … 421 433 case PseudoScrollbarTrackPiece: 422 434 case PseudoSelection: 435 case PseudoUserAgentCustomElement: 436 case PseudoWebKitCustomElement: 423 437 element = true; 424 438 break; -
trunk/Source/WebCore/css/CSSSelector.h
r129408 r133577 155 155 PseudoInRange, 156 156 PseudoOutOfRange, 157 PseudoUserAgentCustomElement, 158 PseudoWebKitCustomElement, 157 159 }; 158 160 … … 184 186 185 187 static PseudoType parsePseudoType(const AtomicString&); 186 static bool is UnknownPseudoType(const AtomicString&);188 static bool isCustomPseudoType(const AtomicString&); 187 189 static PseudoId pseudoId(PseudoType); 188 190 … … 212 214 bool matchesPseudoElement() const; 213 215 bool isUnknownPseudoElement() const; 216 bool isCustomPseudoElement() const; 214 217 bool isSiblingSelector() const; 215 218 bool isAttributeSelector() const; … … 290 293 { 291 294 return m_match == PseudoElement && m_pseudoType == PseudoUnknown; 295 } 296 297 inline bool CSSSelector::isCustomPseudoElement() const 298 { 299 return m_match == PseudoElement && (m_pseudoType == PseudoUserAgentCustomElement || m_pseudoType == PseudoWebKitCustomElement); 292 300 } 293 301 -
trunk/Source/WebCore/css/CSSSelectorList.cpp
r127869 r133577 198 198 } 199 199 200 class SelectorHas UnknownPseudoElementFunctor {200 class SelectorHasInvalidSelectorFunctor { 201 201 public: 202 202 bool operator()(CSSSelector* selector) 203 203 { 204 return selector->isUnknownPseudoElement() ;204 return selector->isUnknownPseudoElement() || selector->isCustomPseudoElement(); 205 205 } 206 206 }; 207 207 208 bool CSSSelectorList::has UnknownPseudoElements() const209 { 210 SelectorHas UnknownPseudoElementFunctor functor;208 bool CSSSelectorList::hasInvalidSelector() const 209 { 210 SelectorHasInvalidSelectorFunctor functor; 211 211 return forEachSelector(functor, this); 212 212 } -
trunk/Source/WebCore/css/CSSSelectorList.h
r128418 r133577 60 60 61 61 bool selectorsNeedNamespaceResolution(); 62 bool has UnknownPseudoElements() const;62 bool hasInvalidSelector() const; 63 63 64 64 String selectorsText() const; -
trunk/Source/WebCore/css/RuleSet.cpp
r132941 r133577 230 230 return; 231 231 } 232 if (selector->is UnknownPseudoElement()) {232 if (selector->isCustomPseudoElement()) { 233 233 addToRuleSet(selector->value().impl(), m_shadowPseudoElementRules, ruleData); 234 234 return; -
trunk/Source/WebCore/css/SelectorChecker.cpp
r132754 r133577 447 447 448 448 if (context.selector->m_match == CSSSelector::PseudoElement) { 449 if (context.selector->is UnknownPseudoElement()) {449 if (context.selector->isCustomPseudoElement()) { 450 450 if (context.element->shadowPseudoId() != context.selector->value()) 451 451 return SelectorFailsLocally; -
trunk/Source/WebCore/dom/Element.cpp
r133492 r133577 1360 1360 void Element::setShadowPseudoId(const AtomicString& id, ExceptionCode& ec) 1361 1361 { 1362 if (!CSSSelector::is UnknownPseudoType(id)) {1362 if (!CSSSelector::isCustomPseudoType(id)) { 1363 1363 ec = SYNTAX_ERR; 1364 1364 return; -
trunk/Source/WebCore/dom/SelectorQuery.cpp
r131209 r133577 181 181 parser.parseSelector(selectors, selectorList); 182 182 183 if (!selectorList.first() || selectorList.has UnknownPseudoElements()) {183 if (!selectorList.first() || selectorList.hasInvalidSelector()) { 184 184 ec = SYNTAX_ERR; 185 185 return 0;
Note: See TracChangeset
for help on using the changeset viewer.