#include "third_party/blink/renderer/core/layout/anchor_evaluator_impl.h"
#include "third_party/blink/renderer/core/css/anchor_query.h"
#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/layout/anchor_query_map.h"
#include "third_party/blink/renderer/core/layout/geometry/writing_mode_converter.h"
#include "third_party/blink/renderer/core/layout/inline/inline_cursor.h"
#include "third_party/blink/renderer/core/layout/logical_fragment_link.h"
#include "third_party/blink/renderer/core/style/anchor_specifier_value.h"
#include "third_party/blink/renderer/core/style/position_area.h"
namespace blink {
namespace {
CSSAnchorValue PhysicalAnchorValueUsing(CSSAnchorValue x,
CSSAnchorValue flipped_x,
CSSAnchorValue y,
CSSAnchorValue flipped_y,
WritingDirectionMode writing_direction,
bool is_y_axis) { … }
CSSAnchorValue PhysicalAnchorValueFromLogicalOrAuto(
CSSAnchorValue anchor_value,
WritingDirectionMode writing_direction,
WritingDirectionMode self_writing_direction,
bool is_y_axis) { … }
CSSAnchorValue PhysicalAnchorValueFromInsideOutside(CSSAnchorValue anchor_value,
bool is_y_axis,
bool is_right_or_bottom) { … }
}
PhysicalAnchorReference::PhysicalAnchorReference(
const LogicalAnchorReference& logical_reference,
const WritingModeConverter& converter)
: … { … }
void LogicalAnchorReference::InsertInReverseTreeOrderInto(
Member<LogicalAnchorReference>* head_ptr) { … }
const LogicalAnchorQuery& LogicalAnchorQuery::Empty() { … }
const PhysicalAnchorReference* PhysicalAnchorQuery::AnchorReference(
const LayoutObject& query_object,
const AnchorKey& key) const { … }
const LayoutObject* PhysicalAnchorQuery::AnchorLayoutObject(
const LayoutObject& query_object,
const AnchorKey& key) const { … }
namespace {
bool IsScopedByElement(const ScopedCSSName* lookup_name,
const Element& element) { … }
bool InSameAnchorScope(const AnchorKey& key,
const LayoutObject& query_object,
const LayoutObject& anchor_object) { … }
}
const LogicalAnchorReference* LogicalAnchorQuery::AnchorReference(
const LayoutObject& query_object,
const AnchorKey& key) const { … }
void LogicalAnchorQuery::Set(const AnchorKey& key,
const LayoutObject& layout_object,
const LogicalRect& rect,
SetOptions options,
Element* element_for_display_lock) { … }
void LogicalAnchorQuery::Set(const AnchorKey& key,
LogicalAnchorReference* reference) { … }
void PhysicalAnchorQuery::SetFromLogical(
const LogicalAnchorQuery& logical_query,
const WritingModeConverter& converter) { … }
void LogicalAnchorQuery::SetFromPhysical(
const PhysicalAnchorQuery& physical_query,
const WritingModeConverter& converter,
const LogicalOffset& additional_offset,
SetOptions options,
Element* element_for_display_lock) { … }
std::optional<LayoutUnit> LogicalAnchorQuery::EvaluateAnchor(
const LogicalAnchorReference& reference,
CSSAnchorValue anchor_value,
float percentage,
LayoutUnit available_size,
const WritingModeConverter& container_converter,
WritingDirectionMode self_writing_direction,
const PhysicalOffset& offset_to_padding_box,
bool is_y_axis,
bool is_right_or_bottom) const { … }
LayoutUnit LogicalAnchorQuery::EvaluateSize(
const LogicalAnchorReference& reference,
CSSAnchorSizeValue anchor_size_value,
WritingMode container_writing_mode,
WritingMode self_writing_mode) const { … }
const LogicalAnchorQuery* AnchorEvaluatorImpl::AnchorQuery() const { … }
std::optional<LayoutUnit> AnchorEvaluatorImpl::Evaluate(
const class AnchorQuery& anchor_query,
const ScopedCSSName* position_anchor,
const std::optional<PositionAreaOffsets>& position_area_offsets) { … }
const LogicalAnchorReference* AnchorEvaluatorImpl::ResolveAnchorReference(
const AnchorSpecifierValue& anchor_specifier,
const ScopedCSSName* position_anchor) const { … }
const LayoutObject* AnchorEvaluatorImpl::DefaultAnchor(
const ScopedCSSName* position_anchor) const { … }
const PaintLayer* AnchorEvaluatorImpl::DefaultAnchorScrollContainerLayer(
const ScopedCSSName* position_anchor) const { … }
bool AnchorEvaluatorImpl::AllowAnchor() const { … }
bool AnchorEvaluatorImpl::AllowAnchorSize() const { … }
bool AnchorEvaluatorImpl::IsYAxis() const { … }
bool AnchorEvaluatorImpl::IsRightOrBottom() const { … }
bool AnchorEvaluatorImpl::ShouldUseScrollAdjustmentFor(
const LayoutObject* anchor,
const ScopedCSSName* position_anchor) const { … }
std::optional<LayoutUnit> AnchorEvaluatorImpl::EvaluateAnchor(
const AnchorSpecifierValue& anchor_specifier,
CSSAnchorValue anchor_value,
float percentage,
const ScopedCSSName* position_anchor,
const std::optional<PositionAreaOffsets>& position_area_offsets) const { … }
std::optional<LayoutUnit> AnchorEvaluatorImpl::EvaluateAnchorSize(
const AnchorSpecifierValue& anchor_specifier,
CSSAnchorSizeValue anchor_size_value,
const ScopedCSSName* position_anchor) const { … }
std::optional<PhysicalOffset> AnchorEvaluatorImpl::ComputeAnchorCenterOffsets(
const ComputedStyleBuilder& builder) { … }
std::optional<PositionAreaOffsets>
AnchorEvaluatorImpl::ComputePositionAreaOffsetsForLayout(
const ScopedCSSName* position_anchor,
PositionArea position_area) { … }
PhysicalRect AnchorEvaluatorImpl::PositionAreaModifiedContainingBlock(
const std::optional<PositionAreaOffsets>& position_area_offsets) const { … }
void LogicalAnchorReference::Trace(Visitor* visitor) const { … }
void PhysicalAnchorReference::Trace(Visitor* visitor) const { … }
}