#include "third_party/blink/renderer/core/layout/layout_shift_tracker.h"
#include "cc/layers/heads_up_display_layer.h"
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_pointer_event.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/location.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/geometry/dom_rect_read_only.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/timing/dom_window_performance.h"
#include "third_party/blink/renderer/core/timing/performance_entry.h"
#include "third_party/blink/renderer/core/timing/window_performance.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace blink {
ReattachHookScope;
ReattachHookScope* ReattachHookScope::top_ = …;
ContainingBlockScope;
ContainingBlockScope* ContainingBlockScope::top_ = …;
namespace {
constexpr base::TimeDelta kTimerDelay = …;
const float kMovementThreshold = …;
gfx::PointF StartingPoint(const PhysicalOffset& paint_offset,
const LayoutBox& box,
const PhysicalSize& size) { … }
PhysicalRect RectBelowStartingPoint(const PhysicalRect& rect,
const PhysicalOffset& starting_point,
LayoutUnit logical_height,
WritingDirectionMode writing_direction) { … }
float GetMoveDistance(const gfx::PointF& old_starting_point,
const gfx::PointF& new_starting_point) { … }
bool EqualWithinMovementThreshold(const gfx::PointF& a,
const gfx::PointF& b,
float threshold_physical_px) { … }
bool SmallerThanRegionGranularity(const PhysicalRect& rect) { … }
void RectToTracedValue(const gfx::Rect& rect,
TracedValue& value,
const char* key = nullptr) { … }
void RegionToTracedValue(const LayoutShiftRegion& region, TracedValue& value) { … }
bool ShouldLog(const LocalFrame& frame) { … }
}
LayoutShiftTracker::LayoutShiftTracker(LocalFrameView* frame_view)
: … { … }
bool LayoutShiftTracker::NeedsToTrack(const LayoutObject& object) const { … }
void LayoutShiftTracker::ObjectShifted(
const LayoutObject& object,
const PropertyTreeStateOrAlias& property_tree_state,
const PhysicalRect& old_rect,
const PhysicalRect& new_rect,
const gfx::PointF& old_starting_point,
const gfx::Vector2dF& translation_delta,
const gfx::Vector2dF& scroll_delta,
const gfx::Vector2dF& scroll_anchor_adjustment,
const gfx::PointF& new_starting_point) { … }
operator bool()
bool LayoutShiftTracker::Attribution::Encloses(const Attribution& other) const { … }
uint64_t LayoutShiftTracker::Attribution::Area() const { … }
bool LayoutShiftTracker::Attribution::MoreImpactfulThan(
const Attribution& other) const { … }
void LayoutShiftTracker::MaybeRecordAttribution(
const Attribution& attribution) { … }
void LayoutShiftTracker::NotifyBoxPrePaint(
const LayoutBox& box,
const PropertyTreeStateOrAlias& property_tree_state,
const PhysicalRect& old_rect,
const PhysicalRect& new_rect,
const PhysicalOffset& old_paint_offset,
const gfx::Vector2dF& translation_delta,
const gfx::Vector2dF& scroll_delta,
const gfx::Vector2dF& scroll_anchor_adjustment,
const PhysicalOffset& new_paint_offset) { … }
void LayoutShiftTracker::NotifyTextPrePaint(
const LayoutText& text,
const PropertyTreeStateOrAlias& property_tree_state,
const LogicalOffset& old_starting_point,
const LogicalOffset& new_starting_point,
const PhysicalOffset& old_paint_offset,
const gfx::Vector2dF& translation_delta,
const gfx::Vector2dF& scroll_delta,
const gfx::Vector2dF& scroll_anchor_adjustment,
const PhysicalOffset& new_paint_offset,
LayoutUnit logical_height) { … }
double LayoutShiftTracker::SubframeWeightingFactor() const { … }
void LayoutShiftTracker::NotifyPrePaintFinishedInternal() { … }
void LayoutShiftTracker::NotifyPrePaintFinished() { … }
LayoutShift::AttributionList LayoutShiftTracker::CreateAttributionList() const { … }
void LayoutShiftTracker::SubmitPerformanceEntry(double score_delta,
bool had_recent_input) const { … }
void LayoutShiftTracker::ReportShift(double score_delta,
double weighted_score_delta) { … }
void LayoutShiftTracker::NotifyInput(const WebInputEvent& event) { … }
void LayoutShiftTracker::UpdateInputTimestamp(base::TimeTicks timestamp) { … }
void LayoutShiftTracker::NotifyScroll(mojom::blink::ScrollType scroll_type,
ScrollOffset delta) { … }
void LayoutShiftTracker::NotifyViewportSizeChanged() { … }
void LayoutShiftTracker::NotifyFindInPageInput() { … }
void LayoutShiftTracker::NotifyChangeEvent() { … }
void LayoutShiftTracker::NotifyZoomLevelChanged() { … }
void LayoutShiftTracker::NotifyBrowserInitiatedSameDocumentNavigation() { … }
void LayoutShiftTracker::UpdateTimerAndInputTimestamp() { … }
double LayoutShiftTracker::LastInputTimestamp() const { … }
std::unique_ptr<TracedValue> LayoutShiftTracker::PerFrameTraceData(
double score_delta,
double weighted_score_delta,
bool input_detected) const { … }
void LayoutShiftTracker::AttributionsToTracedValue(TracedValue& value) const { … }
void LayoutShiftTracker::SendLayoutShiftRectsToHud(
const Vector<gfx::Rect>& int_rects) { … }
void LayoutShiftTracker::ResetTimerForTesting() { … }
void LayoutShiftTracker::Trace(Visitor* visitor) const { … }
ReattachHookScope::ReattachHookScope(const Node& node) : … { … }
ReattachHookScope::~ReattachHookScope() { … }
void ReattachHookScope::NotifyDetach(const Node& node) { … }
void ReattachHookScope::NotifyAttach(const Node& node) { … }
}