chromium/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc

// Copyright 2020 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/mobile_metrics/mobile_friendliness_checker.h"

#include <cmath>
#include <optional>

#include "base/metrics/histogram_functions.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_get_root_node_options.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/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/page_scale_constraints_set.h"
#include "third_party/blink/renderer/core/frame/root_frame_viewport.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/viewport_data.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
#include "third_party/blink/renderer/core/html/html_anchor_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_offset.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_size.h"
#include "third_party/blink/renderer/core/layout/layout_image.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/page/viewport_description.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "ui/display/screen_info.h"

namespace blink {

namespace {

int32_t BucketWithOffsetAndUnit(int32_t num, int32_t offset, int32_t unit) {}

// Viewport initial scale x10 metrics is exponentially bucketed by offset of 10
// (most common initial-scale=1.0 is the center) to preserve user's privacy.
int32_t GetBucketedViewportInitialScale(int32_t initial_scale_x10) {}

// Viewport hardcoded width metrics is exponentially bucketed by offset of 500
// to preserve user's privacy.
int32_t GetBucketedViewportHardcodedWidth(int32_t hardcoded_width) {}

}  // namespace

static constexpr int kSmallFontThresholdInDips =;

// Values of maximum-scale smaller than this threshold will be considered to
// prevent the user from scaling the page as if user-scalable=no was set.
static constexpr double kMaximumScalePreventsZoomingThreshold =;

static constexpr base::TimeDelta kEvaluationInterval =;
static constexpr base::TimeDelta kEvaluationDelay =;

// Basically MF evaluation invoked every |kEvaluationInterval|, but its first
// evaluation invoked |kEvaluationDelay| after initialization of this module.
// Time offsetting with their difference simplifies these requirements.
static constexpr base::TimeDelta kFirstEvaluationOffsetTime =;

MobileFriendlinessChecker::MobileFriendlinessChecker(LocalFrameView& frame_view)
    :{}

MobileFriendlinessChecker::~MobileFriendlinessChecker() = default;

void MobileFriendlinessChecker::NotifyPaintBegin() {}

void MobileFriendlinessChecker::NotifyPaintEnd() {}

MobileFriendlinessChecker* MobileFriendlinessChecker::Create(
    LocalFrameView& frame_view) {}

MobileFriendlinessChecker* MobileFriendlinessChecker::From(
    const Document& document) {}

void MobileFriendlinessChecker::MaybeRecompute() {}

void MobileFriendlinessChecker::ComputeNow() {}

int MobileFriendlinessChecker::AreaSizes::SmallTextRatio() const {}

int MobileFriendlinessChecker::AreaSizes::TextContentsOutsideViewportPercentage(
    double viewport_area) const {}

void MobileFriendlinessChecker::UpdateTextAreaSizes(
    const PhysicalRect& text_rect,
    int font_size) {}

void MobileFriendlinessChecker::UpdateBeyondViewportAreaSizes(
    const PhysicalRect& paint_rect,
    const TransformPaintPropertyNodeOrAlias& current_transform) {}

void MobileFriendlinessChecker::NotifyPaintTextFragment(
    const PhysicalRect& paint_rect,
    int font_size,
    const TransformPaintPropertyNodeOrAlias& current_transform) {}

void MobileFriendlinessChecker::NotifyPaintReplaced(
    const PhysicalRect& paint_rect,
    const TransformPaintPropertyNodeOrAlias& current_transform) {}

void MobileFriendlinessChecker::Trace(Visitor* visitor) const {}

}  // namespace blink