Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1532)

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 598093005: Simplify SelectRuleFeatureSet class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/shadow/SelectRuleFeatureSet.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName); 417 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName);
418 } 418 }
419 419
420 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& exceptionState) 420 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& exceptionState)
421 { 421 {
422 ASSERT(host); 422 ASSERT(host);
423 if (!host->shadow()) { 423 if (!host->shadow()) {
424 exceptionState.throwDOMException(InvalidAccessError, "The host element d oes not have a shadow."); 424 exceptionState.throwDOMException(InvalidAccessError, "The host element d oes not have a shadow.");
425 return 0; 425 return 0;
426 } 426 }
427 427 return host->shadow()->ensureSelectFeatureSet().hasSelectorForPseudoType(CSS Selector::parsePseudoType(AtomicString(pseudoClass), false));
428 const SelectRuleFeatureSet& featureSet = host->shadow()->ensureSelectFeature Set();
429 if (pseudoClass == "checked")
430 return featureSet.hasSelectorForChecked();
431 if (pseudoClass == "enabled")
432 return featureSet.hasSelectorForEnabled();
433 if (pseudoClass == "disabled")
434 return featureSet.hasSelectorForDisabled();
435 if (pseudoClass == "indeterminate")
436 return featureSet.hasSelectorForIndeterminate();
437 if (pseudoClass == "link")
438 return featureSet.hasSelectorForLink();
439 if (pseudoClass == "target")
440 return featureSet.hasSelectorForTarget();
441 if (pseudoClass == "visited")
442 return featureSet.hasSelectorForVisited();
443
444 ASSERT_NOT_REACHED();
445 return false;
446 } 428 }
447 429
448 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& exceptionState) const 430 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& exceptionState) const
449 { 431 {
450 ASSERT(node1 && node2); 432 ASSERT(node1 && node2);
451 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) : 433 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) :
452 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0; 434 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0;
453 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) : 435 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) :
454 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0; 436 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0;
455 if (!treeScope1 || !treeScope2) { 437 if (!treeScope1 || !treeScope2) {
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 2269
2288 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); 2270 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2289 } 2271 }
2290 2272
2291 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) 2273 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2292 { 2274 {
2293 return new InternalsIterator; 2275 return new InternalsIterator;
2294 } 2276 }
2295 2277
2296 } // namespace blink 2278 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/SelectRuleFeatureSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698