OLD | NEW |
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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 PassRefPtr<NodeList> SelectorQuery::queryAll(Node* rootNode) const | 473 PassRefPtr<NodeList> SelectorQuery::queryAll(Node* rootNode) const |
474 { | 474 { |
475 return m_selectors.queryAll(rootNode); | 475 return m_selectors.queryAll(rootNode); |
476 } | 476 } |
477 | 477 |
478 PassRefPtr<Element> SelectorQuery::queryFirst(Node* rootNode) const | 478 PassRefPtr<Element> SelectorQuery::queryFirst(Node* rootNode) const |
479 { | 479 { |
480 return m_selectors.queryFirst(rootNode); | 480 return m_selectors.queryFirst(rootNode); |
481 } | 481 } |
482 | 482 |
483 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, Document*
document, ExceptionState& es) | 483 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu
ment& document, ExceptionState& es) |
484 { | 484 { |
485 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find(
selectors); | 485 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find(
selectors); |
486 if (it != m_entries.end()) | 486 if (it != m_entries.end()) |
487 return it->value.get(); | 487 return it->value.get(); |
488 | 488 |
489 CSSParser parser(document); | 489 CSSParser parser(document); |
490 CSSSelectorList selectorList; | 490 CSSSelectorList selectorList; |
491 parser.parseSelector(selectors, selectorList); | 491 parser.parseSelector(selectors, selectorList); |
492 | 492 |
493 if (!selectorList.first()) { | 493 if (!selectorList.first()) { |
(...skipping 16 matching lines...) Expand all Loading... |
510 m_entries.add(selectors, selectorQuery.release()); | 510 m_entries.add(selectors, selectorQuery.release()); |
511 return rawSelectorQuery; | 511 return rawSelectorQuery; |
512 } | 512 } |
513 | 513 |
514 void SelectorQueryCache::invalidate() | 514 void SelectorQueryCache::invalidate() |
515 { | 515 { |
516 m_entries.clear(); | 516 m_entries.clear(); |
517 } | 517 } |
518 | 518 |
519 } | 519 } |
OLD | NEW |