#include "cc/input/browser_controls_offset_manager.h"
#include <stdint.h>
#include <algorithm>
#include <utility>
#include "base/check_op.h"
#include "base/memory/ptr_util.h"
#include "base/types/optional_ref.h"
#include "cc/input/browser_controls_offset_manager_client.h"
#include "cc/input/browser_controls_offset_tags_info.h"
#include "cc/trees/layer_tree_impl.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/quads/offset_tag.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/geometry/vector2d_f.h"
namespace cc {
namespace {
const int64_t kShowHideMaxDurationMs = …;
const int64_t kHeightChangeDurationMs = …;
}
std::unique_ptr<BrowserControlsOffsetManager>
BrowserControlsOffsetManager::Create(BrowserControlsOffsetManagerClient* client,
float controls_show_threshold,
float controls_hide_threshold) { … }
BrowserControlsOffsetManager::BrowserControlsOffsetManager(
BrowserControlsOffsetManagerClient* client,
float controls_show_threshold,
float controls_hide_threshold)
: … { … }
BrowserControlsOffsetManager::~BrowserControlsOffsetManager() = default;
float BrowserControlsOffsetManager::ControlsTopOffset() const { … }
float BrowserControlsOffsetManager::ContentTopOffset() const { … }
float BrowserControlsOffsetManager::TopControlsShownRatio() const { … }
float BrowserControlsOffsetManager::TopControlsHeight() const { … }
float BrowserControlsOffsetManager::TopControlsMinHeight() const { … }
viz::OffsetTag BrowserControlsOffsetManager::TopControlsOffsetTag() const { … }
float BrowserControlsOffsetManager::TopControlsMinShownRatio() const { … }
float BrowserControlsOffsetManager::BottomControlsHeight() const { … }
float BrowserControlsOffsetManager::BottomControlsMinHeight() const { … }
float BrowserControlsOffsetManager::BottomControlsMinShownRatio() const { … }
float BrowserControlsOffsetManager::ContentBottomOffset() const { … }
float BrowserControlsOffsetManager::BottomControlsShownRatio() const { … }
float BrowserControlsOffsetManager::TopControlsMinHeightOffset() const { … }
float BrowserControlsOffsetManager::BottomControlsMinHeightOffset() const { … }
std::pair<float, float>
BrowserControlsOffsetManager::TopControlsShownRatioRange() { … }
std::pair<float, float>
BrowserControlsOffsetManager::BottomControlsShownRatioRange() { … }
void BrowserControlsOffsetManager::UpdateBrowserControlsState(
BrowserControlsState constraints,
BrowserControlsState current,
bool animate,
base::optional_ref<const BrowserControlsOffsetTagsInfo> offset_tags_info) { … }
BrowserControlsState BrowserControlsOffsetManager::PullConstraintForMainThread(
bool* out_changed_since_commit) { … }
void BrowserControlsOffsetManager::NotifyConstraintSyncedToMainThread() { … }
void BrowserControlsOffsetManager::OnBrowserControlsParamsChanged(
bool animate_changes) { … }
void BrowserControlsOffsetManager::ScrollBegin() { … }
gfx::Vector2dF BrowserControlsOffsetManager::ScrollBy(
const gfx::Vector2dF& pending_delta) { … }
void BrowserControlsOffsetManager::ScrollEnd() { … }
void BrowserControlsOffsetManager::PinchBegin() { … }
void BrowserControlsOffsetManager::PinchEnd() { … }
gfx::Vector2dF BrowserControlsOffsetManager::Animate(
base::TimeTicks monotonic_time) { … }
bool BrowserControlsOffsetManager::HasAnimation() { … }
void BrowserControlsOffsetManager::ResetAnimations() { … }
void BrowserControlsOffsetManager::SetupAnimation(
AnimationDirection direction) { … }
void BrowserControlsOffsetManager::StartAnimationIfNecessary() { … }
void BrowserControlsOffsetManager::ResetBaseline() { … }
void BrowserControlsOffsetManager::InitAnimationForHeightChange(
Animation* animation,
float start_ratio,
float stop_ratio) { … }
float BrowserControlsOffsetManager::OldTopControlsMinShownRatio() { … }
float BrowserControlsOffsetManager::OldBottomControlsMinShownRatio() { … }
void BrowserControlsOffsetManager::UpdateOldBrowserControlsParams() { … }
void BrowserControlsOffsetManager::SetTopMinHeightOffsetAnimationRange(
float from,
float to) { … }
void BrowserControlsOffsetManager::SetBottomMinHeightOffsetAnimationRange(
float from,
float to) { … }
double BrowserControlsOffsetManager::PredictViewportBoundsDelta(
double current_bounds_delta,
gfx::Vector2dF scroll_distance) { … }
BrowserControlsOffsetManager::Animation::Animation() { … }
void BrowserControlsOffsetManager::Animation::Initialize(
AnimationDirection direction,
float start_value,
float stop_value,
int64_t duration,
bool jump_to_end_on_reset) { … }
std::optional<float> BrowserControlsOffsetManager::Animation::Tick(
base::TimeTicks monotonic_time) { … }
void BrowserControlsOffsetManager::Animation::SetBounds(float min, float max) { … }
std::optional<float> BrowserControlsOffsetManager::Animation::Reset() { … }
bool BrowserControlsOffsetManager::Animation::IsComplete(float value) { … }
float BrowserControlsOffsetManager::Animation::FinalValue() { … }
}