#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include <limits>
#include "base/containers/adapters.h"
#include "build/build_config.h"
#include "cc/input/scroll_snap_data.h"
#include "partition_alloc/partition_alloc.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/animation/scroll_timeline.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/style_request.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/anchor_position_scroll_data.h"
#include "third_party/blink/renderer/core/layout/fragmentainer_iterator.h"
#include "third_party/blink/renderer/core/layout/fragmentation_utils.h"
#include "third_party/blink/renderer/core/layout/geometry/transform_state.h"
#include "third_party/blink/renderer/core/layout/hit_test_location.h"
#include "third_party/blink/renderer/core/layout/hit_test_request.h"
#include "third_party/blink/renderer/core/layout/hit_test_result.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_flow_thread.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_tree_as_text.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h"
#include "third_party/blink/renderer/core/paint/box_fragment_painter.h"
#include "third_party/blink/renderer/core/paint/box_reflection_utils.h"
#include "third_party/blink/renderer/core/paint/clip_path_clipper.h"
#include "third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.h"
#include "third_party/blink/renderer/core/paint/cull_rect_updater.h"
#include "third_party/blink/renderer/core/paint/filter_effect_builder.h"
#include "third_party/blink/renderer/core/paint/fragment_data_iterator.h"
#include "third_party/blink/renderer/core/paint/hit_testing_transform_state.h"
#include "third_party/blink/renderer/core/paint/object_paint_invalidator.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer_paint_order_iterator.h"
#include "third_party/blink/renderer/core/paint/paint_layer_painter.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/paint/paint_property_tree_builder.h"
#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h"
#include "third_party/blink/renderer/core/paint/transform_utils.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/reference_clip_path_operation.h"
#include "third_party/blink/renderer/core/style/reference_offset_path_operation.h"
#include "third_party/blink/renderer/core/view_transition/view_transition.h"
#include "third_party/blink/renderer/core/view_transition/view_transition_utils.h"
#include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h"
#include "third_party/blink/renderer/platform/geometry/length_functions.h"
#include "third_party/blink/renderer/platform/graphics/compositor_filter_operations.h"
#include "third_party/blink/renderer/platform/graphics/filters/filter.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h"
#include "third_party/blink/renderer/platform/wtf/size_assertions.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/transform.h"
namespace blink {
namespace …
PaintLayer::PaintLayer(LayoutBoxModelObject* layout_object)
: … { … }
PaintLayer::~PaintLayer() { … }
void PaintLayer::Destroy() { … }
String PaintLayer::DebugName() const { … }
DOMNodeId PaintLayer::OwnerNodeId() const { … }
bool PaintLayer::PaintsWithFilters() const { … }
const PaintLayer* PaintLayer::ContainingScrollContainerLayer(
bool* is_fixed_to_view) const { … }
void PaintLayer::UpdateTransform() { … }
void PaintLayer::UpdateTransformAfterStyleChange(
StyleDifference diff,
const ComputedStyle* old_style,
const ComputedStyle& new_style) { … }
gfx::Transform PaintLayer::CurrentTransform() const { … }
void PaintLayer::DirtyVisibleContentStatus() { … }
void PaintLayer::MarkAncestorChainForFlagsUpdate(
DescendantDependentFlagsUpdateFlag flag) { … }
void PaintLayer::SetNeedsDescendantDependentFlagsUpdate() { … }
void PaintLayer::UpdateDescendantDependentFlags() { … }
void PaintLayer::Update3DTransformedDescendantStatus() { … }
void PaintLayer::UpdateScrollingAfterLayout() { … }
PaintLayer* PaintLayer::ContainingLayer() const { … }
PaintLayer* PaintLayer::CompositingContainer() const { … }
PaintLayer* PaintLayer::AncestorStackingContext() const { … }
void PaintLayer::SetNeedsCompositingInputsUpdate() { … }
void PaintLayer::ScrollContainerStatusChanged() { … }
void PaintLayer::SetNeedsVisualOverflowRecalc() { … }
bool PaintLayer::HasNonIsolatedDescendantWithBlendMode() const { … }
void PaintLayer::AddChild(PaintLayer* child, PaintLayer* before_child) { … }
void PaintLayer::RemoveChild(PaintLayer* old_child) { … }
void PaintLayer::RemoveOnlyThisLayerAfterStyleChange(
const ComputedStyle* old_style) { … }
void PaintLayer::InsertOnlyThisLayerAfterStyleChange() { … }
void PaintLayer::DidUpdateScrollsOverflow() { … }
void PaintLayer::UpdateStackingNode() { … }
bool PaintLayer::RequiresScrollableArea() const { … }
void PaintLayer::UpdateScrollableArea() { … }
void PaintLayer::AppendSingleFragmentForHitTesting(
PaintLayerFragments& fragments,
const PaintLayerFragment* container_fragment,
ShouldRespectOverflowClipType respect_overflow_clip) const { … }
const LayoutBox* PaintLayer::GetLayoutBoxWithBlockFragments() const { … }
void PaintLayer::CollectFragments(
PaintLayerFragments& fragments,
const PaintLayer* root_layer,
ShouldRespectOverflowClipType respect_overflow_clip,
const FragmentData* root_fragment_arg) const { … }
PaintLayer::HitTestRecursionData::HitTestRecursionData(
const PhysicalRect& rect_arg,
const HitTestLocation& location_arg,
const HitTestLocation& original_location_arg)
: … { … }
bool PaintLayer::HitTest(const HitTestLocation& hit_test_location,
HitTestResult& result,
const PhysicalRect& hit_test_area) { … }
Node* PaintLayer::EnclosingNode() const { … }
bool PaintLayer::IsInTopOrViewTransitionLayer() const { … }
static double ComputeZOffset(const HitTestingTransformState& transform_state) { … }
HitTestingTransformState PaintLayer::CreateLocalTransformState(
const PaintLayer& transform_container,
const FragmentData& transform_container_fragment,
const FragmentData& local_fragment,
const HitTestRecursionData& recursion_data,
const HitTestingTransformState* container_transform_state) const { … }
static bool IsHitCandidateForDepthOrder(
const PaintLayer* hit_layer,
bool can_depth_sort,
double* z_offset,
const HitTestingTransformState* transform_state) { … }
static bool IsHitCandidateForStopNode(const LayoutObject& candidate,
const LayoutObject* stop_node) { … }
PaintLayer* PaintLayer::HitTestLayer(
const PaintLayer& transform_container,
const PaintLayerFragment* container_fragment,
HitTestResult& result,
const HitTestRecursionData& recursion_data,
bool applied_transform,
HitTestingTransformState* container_transform_state,
double* z_offset,
bool overflow_controls_only) { … }
bool PaintLayer::HitTestForegroundForFragments(
const PaintLayerFragments& layer_fragments,
HitTestResult& result,
const HitTestLocation& hit_test_location,
bool& inside_clip_rect) const { … }
bool PaintLayer::HitTestFragmentsWithPhase(
const PaintLayerFragments& layer_fragments,
HitTestResult& result,
const HitTestLocation& hit_test_location,
HitTestPhase phase,
bool& inside_clip_rect) const { … }
PaintLayer* PaintLayer::HitTestTransformedLayerInFragments(
const PaintLayer& transform_container,
const PaintLayerFragment* container_fragment,
HitTestResult& result,
const HitTestRecursionData& recursion_data,
HitTestingTransformState* container_transform_state,
double* z_offset,
bool overflow_controls_only,
ShouldRespectOverflowClipType clip_behavior) { … }
PaintLayer* PaintLayer::HitTestLayerByApplyingTransform(
const PaintLayer& transform_container,
const PaintLayerFragment* container_fragment,
const PaintLayerFragment& local_fragment,
HitTestResult& result,
const HitTestRecursionData& recursion_data,
HitTestingTransformState* root_transform_state,
double* z_offset,
bool overflow_controls_only,
const PhysicalOffset& translation_offset) { … }
bool PaintLayer::HitTestFragmentWithPhase(
HitTestResult& result,
const PhysicalBoxFragment* physical_fragment,
const PhysicalOffset& fragment_offset,
const HitTestLocation& hit_test_location,
HitTestPhase phase) const { … }
bool PaintLayer::IsReplacedNormalFlowStacking() const { … }
PaintLayer* PaintLayer::HitTestChildren(
PaintLayerIteration children_to_visit,
const PaintLayer& transform_container,
const PaintLayerFragment* container_fragment,
HitTestResult& result,
const HitTestRecursionData& recursion_data,
HitTestingTransformState* container_transform_state,
double* z_offset_for_descendants,
double* z_offset,
HitTestingTransformState* local_transform_state,
bool depth_sort_descendants) { … }
void PaintLayer::UpdateFilterReferenceBox() { … }
gfx::RectF PaintLayer::FilterReferenceBox() const { … }
std::optional<gfx::SizeF> PaintLayer::FilterViewport() const { … }
gfx::RectF PaintLayer::BackdropFilterReferenceBox() const { … }
gfx::RRectF PaintLayer::BackdropFilterBounds() const { … }
bool PaintLayer::HitTestClippedOutByClipPath(
const PaintLayer& root_layer,
const HitTestLocation& hit_test_location) const { … }
PhysicalRect PaintLayer::LocalBoundingBox() const { … }
void PaintLayer::ExpandRectForSelfPaintingDescendants(
PhysicalRect& result) const { … }
bool PaintLayer::KnownToClipSubtreeToPaddingBox() const { … }
PhysicalRect PaintLayer::LocalBoundingBoxIncludingSelfPaintingDescendants()
const { … }
bool PaintLayer::SupportsSubsequenceCaching() const { … }
bool PaintLayer::ShouldBeSelfPaintingLayer() const { … }
void PaintLayer::UpdateSelfPaintingLayer() { … }
PaintLayer* PaintLayer::EnclosingSelfPaintingLayer() { … }
void PaintLayer::UpdateFilters(StyleDifference diff,
const ComputedStyle* old_style,
const ComputedStyle& new_style) { … }
void PaintLayer::UpdateBackdropFilters(const ComputedStyle* old_style,
const ComputedStyle& new_style) { … }
void PaintLayer::UpdateClipPath(const ComputedStyle* old_style,
const ComputedStyle& new_style) { … }
void PaintLayer::UpdateOffsetPath(const ComputedStyle* old_style,
const ComputedStyle& new_style) { … }
void PaintLayer::StyleDidChange(StyleDifference diff,
const ComputedStyle* old_style) { … }
gfx::Vector2d PaintLayer::PixelSnappedScrolledContentOffset() const { … }
PaintLayerClipper PaintLayer::Clipper() const { … }
bool PaintLayer::ScrollsOverflow() const { … }
FilterOperations PaintLayer::FilterOperationsIncludingReflection() const { … }
void PaintLayer::UpdateCompositorFilterOperationsForFilter(
CompositorFilterOperations& operations) { … }
void PaintLayer::UpdateCompositorFilterOperationsForBackdropFilter(
CompositorFilterOperations& operations,
gfx::RRectF& backdrop_filter_bounds) { … }
PaintLayerResourceInfo& PaintLayer::EnsureResourceInfo() { … }
void PaintLayer::SetNeedsReorderOverlayOverflowControls(bool b) { … }
gfx::RectF PaintLayer::MapRectForFilter(const gfx::RectF& rect) const { … }
PhysicalRect PaintLayer::MapRectForFilter(const PhysicalRect& rect) const { … }
bool PaintLayer::ComputeHasFilterThatMovesPixels() const { … }
void PaintLayer::SetNeedsRepaint() { … }
void PaintLayer::SetDescendantNeedsRepaint() { … }
void PaintLayer::MarkCompositingContainerChainForNeedsRepaint() { … }
void PaintLayer::ClearNeedsRepaintRecursively() { … }
void PaintLayer::SetNeedsCullRectUpdate() { … }
void PaintLayer::SetForcesChildrenCullRectUpdate() { … }
void PaintLayer::SetDescendantNeedsCullRectUpdate() { … }
void PaintLayer::DirtyStackingContextZOrderLists() { … }
void PaintLayer::SetPreviousPaintResult(PaintResult result) { … }
void PaintLayer::SetInvisibleForPositionVisibility(
LayerPositionVisibility visibility,
bool invisible) { … }
bool PaintLayer::HasAncestorInvisibleForPositionVisibility() const { … }
void PaintLayer::Trace(Visitor* visitor) const { … }
bool CheckAncestorPositionVisibilityScope::should_check_ = …;
}
#if DCHECK_IS_ON()
void ShowLayerTree(const blink::PaintLayer* layer) { … }
void ShowLayerTree(const blink::LayoutObject* layoutObject) { … }
#endif