#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/lcp_critical_path_predictor/element_locator.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/html/parser/html_token.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink::element_locator {
ElementLocator OfElement(const Element& element) { … }
String ToStringForTesting(const ElementLocator& locator) { … }
void HTMLStackItem::IncrementChildrenCount(
const StringImpl* children_tag_name) { … }
namespace {
HashSet<const StringImpl*>& ClosePElementSet() { … }
HashSet<const StringImpl*>& ImmediatelyPopTheCurrentNodeTags() { … }
HashSet<const StringImpl*>& RestrictedTagSubset() { … }
}
void TokenStreamMatcher::InitSets() { … }
TokenStreamMatcher::TokenStreamMatcher(Vector<ElementLocator> locators)
: … { … }
TokenStreamMatcher::~TokenStreamMatcher() = default;
namespace {
bool MatchLocator(const ElementLocator& locator,
base::span<const HTMLStackItem> stack) { … }
}
void TokenStreamMatcher::ObserveEndTag(const StringImpl* tag_name) { … }
#ifndef NDEBUG
void TokenStreamMatcher::DumpHTMLStack() { … }
#endif
bool TokenStreamMatcher::ObserveStartTagAndReportMatch(
const StringImpl* tag_name,
const HTMLToken& token) { … }
}