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

Side by Side Diff: Source/core/dom/SelectorQuery.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | Source/core/dom/Text.cpp » ('j') | 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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 PassRefPtr<NodeList> SelectorQuery::queryAll(Node& rootNode) const 489 PassRefPtr<NodeList> SelectorQuery::queryAll(Node& rootNode) const
490 { 490 {
491 return m_selectors.queryAll(rootNode); 491 return m_selectors.queryAll(rootNode);
492 } 492 }
493 493
494 PassRefPtr<Element> SelectorQuery::queryFirst(Node& rootNode) const 494 PassRefPtr<Element> SelectorQuery::queryFirst(Node& rootNode) const
495 { 495 {
496 return m_selectors.queryFirst(rootNode); 496 return m_selectors.queryFirst(rootNode);
497 } 497 }
498 498
499 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu ment& document, ExceptionState& es) 499 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu ment& document, ExceptionState& exceptionState)
500 { 500 {
501 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find( selectors); 501 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find( selectors);
502 if (it != m_entries.end()) 502 if (it != m_entries.end())
503 return it->value.get(); 503 return it->value.get();
504 504
505 CSSParser parser(document); 505 CSSParser parser(document);
506 CSSSelectorList selectorList; 506 CSSSelectorList selectorList;
507 parser.parseSelector(selectors, selectorList); 507 parser.parseSelector(selectors, selectorList);
508 508
509 if (!selectorList.first()) { 509 if (!selectorList.first()) {
510 es.throwDOMException(SyntaxError, "Failed to execute query: '" + selecto rs + "' is not a valid selector."); 510 exceptionState.throwDOMException(SyntaxError, "Failed to execute query: '" + selectors + "' is not a valid selector.");
511 return 0; 511 return 0;
512 } 512 }
513 513
514 // throw a NamespaceError if the selector includes any namespace prefixes. 514 // throw a NamespaceError if the selector includes any namespace prefixes.
515 if (selectorList.selectorsNeedNamespaceResolution()) { 515 if (selectorList.selectorsNeedNamespaceResolution()) {
516 es.throwDOMException(NamespaceError, "Failed to execute query: '" + sele ctors + "' contains namespaces, which are not supported."); 516 exceptionState.throwDOMException(NamespaceError, "Failed to execute quer y: '" + selectors + "' contains namespaces, which are not supported.");
517 return 0; 517 return 0;
518 } 518 }
519 519
520 const int maximumSelectorQueryCacheSize = 256; 520 const int maximumSelectorQueryCacheSize = 256;
521 if (m_entries.size() == maximumSelectorQueryCacheSize) 521 if (m_entries.size() == maximumSelectorQueryCacheSize)
522 m_entries.remove(m_entries.begin()); 522 m_entries.remove(m_entries.begin());
523 523
524 OwnPtr<SelectorQuery> selectorQuery = adoptPtr(new SelectorQuery(selectorLis t)); 524 OwnPtr<SelectorQuery> selectorQuery = adoptPtr(new SelectorQuery(selectorLis t));
525 SelectorQuery* rawSelectorQuery = selectorQuery.get(); 525 SelectorQuery* rawSelectorQuery = selectorQuery.get();
526 m_entries.add(selectors, selectorQuery.release()); 526 m_entries.add(selectors, selectorQuery.release());
527 return rawSelectorQuery; 527 return rawSelectorQuery;
528 } 528 }
529 529
530 void SelectorQueryCache::invalidate() 530 void SelectorQueryCache::invalidate()
531 { 531 {
532 m_entries.clear(); 532 m_entries.clear();
533 } 533 }
534 534
535 } 535 }
OLDNEW
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698