#include "third_party/blink/renderer/core/css/counters_attachment_context.h"
#include "base/containers/adapters.h"
#include "base/not_fatal_until.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h"
#include "third_party/blink/renderer/core/html/html_directory_element.h"
#include "third_party/blink/renderer/core/html/html_li_element.h"
#include "third_party/blink/renderer/core/html/html_menu_element.h"
#include "third_party/blink/renderer/core/html/html_olist_element.h"
#include "third_party/blink/renderer/core/html/html_ulist_element.h"
#include "third_party/blink/renderer/core/html/list_item_ordinal.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink {
namespace {
bool IsAncestorOf(const Element& ancestor, const Element& descendant) { … }
std::optional<std::pair<unsigned, int>> DetermineCounterTypeAndValue(
const LayoutObject& layout_object,
const CounterDirectives& directives) { … }
inline bool IsReset(unsigned counter_type) { … }
inline bool IsSetOrReset(unsigned counter_type) { … }
int CalculateCounterValue(unsigned counter_type,
int counter_value,
int counter_current_value) { … }
}
CountersAttachmentContext::CountersAttachmentContext()
: … { … }
bool CountersAttachmentContext::ElementGeneratesListItemCounter(
const Element& element) { … }
void CountersAttachmentContext::EnterElement(const Element& element) { … }
void CountersAttachmentContext::LeaveElement(const Element& element) { … }
void CountersAttachmentContext::MaybeCreateListItemCounter(
const Element& element) { … }
Vector<int> CountersAttachmentContext::GetCounterValues(
const Element& element,
const AtomicString& counter_name,
bool only_last) { … }
void CountersAttachmentContext::CreateCounter(const Element& element,
const AtomicString& counter_name,
int value) { … }
void CountersAttachmentContext::RemoveStaleCounters(
const Element& element,
const AtomicString& counter_name) { … }
void CountersAttachmentContext::RemoveCounterIfAncestorExists(
const Element& element,
const AtomicString& counter_name) { … }
void CountersAttachmentContext::SetCounterValue(
const Element& element,
const AtomicString& counter_name,
int value) { … }
int CountersAttachmentContext::GetCounterValue(
const Element& element,
const AtomicString& counter_name) { … }
void CountersAttachmentContext::UpdateCounterValue(
const Element& element,
const AtomicString& counter_name,
unsigned counter_type,
int counter_value) { … }
void CountersAttachmentContext::EnterStyleContainmentScope() { … }
void CountersAttachmentContext::LeaveStyleContainmentScope() { … }
}