/* * Copyright (C) 1999 Lars Knoll ([email protected]) * (C) 2004-2005 Allan Sandfeld Jensen ([email protected]) * Copyright (C) 2006, 2007 Nicholas Shanks ([email protected]) * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. * All rights reserved. * Copyright (C) 2007 Alexey Proskuryakov <[email protected]> * Copyright (C) 2007, 2008 Eric Seidel <[email protected]> * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. * (http://www.torchmobile.com/) * Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Copyright (C) Research In Motion Limited 2011. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SELECTOR_CHECKER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SELECTOR_CHECKER_H_ #include <limits> #include "base/dcheck_is_on.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_selector.h" #include "third_party/blink/renderer/core/css/resolver/match_flags.h" #include "third_party/blink/renderer/core/css/style_request.h" #include "third_party/blink/renderer/core/css/style_scope.h" #include "third_party/blink/renderer/core/css/style_scope_frame.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/heap/visitor.h" namespace blink { class CSSSelector; class ContainerNode; class CustomScrollbar; class Element; class PartNames; class CORE_EXPORT SelectorChecker { … }; // An accelerated selector checker that matches only selectors with a // certain set of restrictions, informally called “easy” selectors. // (Not to be confused with simple selectors, which is a standards-defined // term.) Easy selectors support only a very small subset of the full // CSS selector machinery, but does so much faster than SelectorChecker // (typically a bit over twice as fast), and that subset tends to be enough // for ~80% of actual selectors checks on a typical web page. (It is also // ree from the complexities of Shadow DOM and does not check whether // the query exceeds the scope, so it cannot be used for querySelector().) // // The set of supported selectors is formally given as “anything IsEasy() // returns true for”, but roughly encompasses the following: // // - Tag matches (e.g. div). // - ID matches (e.g. #id). // - Class matches (e.g. .c). // - Case-sensitive attribute is-set and exact matches ([foo] and [foo="bar"]). // - Subselector and descendant combinators. // - Anything that does not need further checking // (CSSSelector::IsCoveredByBucketing()). // // Given this, it does not need to set up any context, do recursion, // backtracking, have large switch/cases for pseudos, or the similar. // // You must include selector_checker-inl.h to use this class; // its functions are declared ALWAYS_INLINE because the call overhead // is so large compared to what the functions are actually doing. class CORE_EXPORT EasySelectorChecker { … }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SELECTOR_CHECKER_H_