chromium/third_party/blink/renderer/core/speculation_rules/document_rule_predicate.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/speculation_rules/document_rule_predicate.h"

#include "base/containers/contains.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_urlpatterninit_usvstring.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_url_pattern_init.h"
#include "third_party/blink/renderer/core/css/parser/css_parser.h"
#include "third_party/blink/renderer/core/css/style_rule.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/html_anchor_element.h"
#include "third_party/blink/renderer/core/url_pattern/url_pattern.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/json/json_values.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace blink {

namespace {

// Represents a document rule conjunction:
// https://wicg.github.io/nav-speculation/speculation-rules.html#document-rule-conjunction.
class Conjunction : public DocumentRulePredicate {};

// Represents a document rule disjunction:
// https://wicg.github.io/nav-speculation/speculation-rules.html#document-rule-disjunction.
class Disjunction : public DocumentRulePredicate {};

// Represents a document rule negation:
// https://wicg.github.io/nav-speculation/speculation-rules.html#document-rule-negation.
class Negation : public DocumentRulePredicate {};

}  // namespace

// Represents a document rule URL pattern predicate:
// https://wicg.github.io/nav-speculation/speculation-rules.html#document-rule-url-pattern-predicate
class URLPatternPredicate : public DocumentRulePredicate {};

// Represents a document rule CSS selector predicate:
// https://wicg.github.io/nav-speculation/speculation-rules.html#document-rule-css-selector-predicate
class CSSSelectorPredicate : public DocumentRulePredicate {};

namespace {
// If `out_error` is provided and hasn't already had a message set, sets it to
// `message`.
void SetParseErrorMessage(String* out_error, String message) {}

URLPattern* ParseRawPattern(v8::Isolate* isolate,
                            JSONValue* raw_pattern,
                            const KURL& base_url,
                            ExceptionState& exception_state,
                            String* out_error) {}

String GetPredicateType(JSONObject* input, String* out_error) {}
}  // namespace

// static
DocumentRulePredicate* DocumentRulePredicate::Parse(
    JSONObject* input,
    const KURL& ruleset_base_url,
    ExecutionContext* execution_context,
    ExceptionState& exception_state,
    String* out_error) {}

// static
DocumentRulePredicate* DocumentRulePredicate::MakeDefaultPredicate() {}

HeapVector<Member<DocumentRulePredicate>>
DocumentRulePredicate::GetSubPredicatesForTesting() const {}

HeapVector<Member<URLPattern>> DocumentRulePredicate::GetURLPatternsForTesting()
    const {}

HeapVector<Member<StyleRule>> DocumentRulePredicate::GetStyleRulesForTesting()
    const {}

void DocumentRulePredicate::Trace(Visitor*) const {}

}  // namespace blink