Convert base::clamp() to std::clamp() in cc/
According to the instructions at crbug.com/1373621,
we should convert base::clamp() to std::clamp() in the code.
This is a continuation of the previous CLs
https://chromium-review.googlesource.com/c/chromium/src/+/4410943
https://chromium-review.googlesource.com/c/chromium/src/+/4461000
Bug: 1373621
Change-Id: Ifb408ee3fb84620f3e1b013f5fa3af2519f568af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4462333
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Auto-Submit: Ho Cheung <uioptt24@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1134245}
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index 742d45c..249d1ad 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -10,7 +10,6 @@
#include <utility>
#include <vector>
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "cc/animation/animation_delegate.h"
@@ -198,7 +197,7 @@
target_property_id);
break;
case TargetProperty::OPACITY: {
- float opacity = base::clamp(value, 0.0f, 1.0f);
+ float opacity = std::clamp(value, 0.0f, 1.0f);
if (KeyframeModelAffectsActiveElements(keyframe_model))
OnOpacityAnimated(ElementListType::ACTIVE, opacity, keyframe_model);
if (KeyframeModelAffectsPendingElements(keyframe_model))
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index df3ba72..e6a12c7e 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -10,7 +10,6 @@
#include <utility>
#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "ui/gfx/animation/keyframe/timing_function.h"
#include "ui/gfx/animation/tween.h"
@@ -57,7 +56,7 @@
static std::unique_ptr<TimingFunction> EaseInOutWithInitialSlope(double slope) {
// Clamp slope to a sane value.
- slope = base::clamp(slope, -1000.0, 1000.0);
+ slope = std::clamp(slope, -1000.0, 1000.0);
// Based on CubicBezierTimingFunction::EaseType::EASE_IN_OUT preset
// with first control point scaled.
@@ -191,8 +190,8 @@
case DurationBehavior::INVERSE_DELTA:
duration = kInverseDeltaOffset +
std::abs(MaximumDimension(delta)) * kInverseDeltaSlope;
- duration = base::clamp(duration, kInverseDeltaMinDuration,
- kInverseDeltaMaxDuration);
+ duration = std::clamp(duration, kInverseDeltaMinDuration,
+ kInverseDeltaMaxDuration);
break;
}
duration /= kDurationDivisor;
@@ -265,7 +264,7 @@
} else {
double duration_in_milliseconds =
kImpulseMillisecondsPerPixel * std::abs(MaximumDimension(delta));
- duration_in_milliseconds = base::clamp(
+ duration_in_milliseconds = std::clamp(
duration_in_milliseconds, kImpulseMinDurationMs, kImpulseMaxDurationMs);
duration = base::Milliseconds(duration_in_milliseconds);
}
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 53a2c6f..0cd0ad6 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -11,7 +11,6 @@
#include <xmmintrin.h>
#endif
-#include "base/cxx17_backports.h"
#include "base/trace_event/traced_value.h"
#include "base/values.h"
#include "ui/gfx/geometry/angle_conversions.h"
@@ -566,14 +565,14 @@
for (int i = 0; i < *num_vertices_in_clipped_quad; ++i) {
gfx::Point3F& point = clipped_quad[i];
point.set_x(
- base::clamp(point.x(), -HomogeneousCoordinate::kInfiniteCoordinate,
- float{HomogeneousCoordinate::kInfiniteCoordinate}));
+ std::clamp(point.x(), -HomogeneousCoordinate::kInfiniteCoordinate,
+ float{HomogeneousCoordinate::kInfiniteCoordinate}));
point.set_y(
- base::clamp(point.y(), -HomogeneousCoordinate::kInfiniteCoordinate,
- float{HomogeneousCoordinate::kInfiniteCoordinate}));
+ std::clamp(point.y(), -HomogeneousCoordinate::kInfiniteCoordinate,
+ float{HomogeneousCoordinate::kInfiniteCoordinate}));
point.set_z(
- base::clamp(point.z(), -HomogeneousCoordinate::kInfiniteCoordinate,
- float{HomogeneousCoordinate::kInfiniteCoordinate}));
+ std::clamp(point.z(), -HomogeneousCoordinate::kInfiniteCoordinate,
+ float{HomogeneousCoordinate::kInfiniteCoordinate}));
}
}
}
@@ -766,7 +765,7 @@
const gfx::Vector2dF& v2) {
double dot_product = gfx::DotProduct(v1, v2) / v1.Length() / v2.Length();
// Clamp to compensate for rounding errors.
- dot_product = base::clamp(dot_product, -1.0, 1.0);
+ dot_product = std::clamp(dot_product, -1.0, 1.0);
return static_cast<float>(gfx::RadToDeg(std::acos(dot_product)));
}
diff --git a/cc/base/math_util.h b/cc/base/math_util.h
index a0ec243..b188fe0 100644
--- a/cc/base/math_util.h
+++ b/cc/base/math_util.h
@@ -5,11 +5,11 @@
#ifndef CC_BASE_MATH_UTIL_H_
#define CC_BASE_MATH_UTIL_H_
+#include <algorithm>
#include <cmath>
#include <limits>
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "build/build_config.h"
#include "cc/base/base_export.h"
#include "third_party/skia/include/core/SkM44.h"
@@ -69,10 +69,10 @@
SkScalar inv_w = SK_Scalar1 / w();
// However, w may be close to 0 and we lose precision on our geometry
// calculations if we allow scaling to extremely large values.
- return gfx::PointF(base::clamp(x() * inv_w, -kInfiniteCoordinate,
- float{kInfiniteCoordinate}),
- base::clamp(y() * inv_w, -kInfiniteCoordinate,
- float{kInfiniteCoordinate}));
+ return gfx::PointF(std::clamp(x() * inv_w, -kInfiniteCoordinate,
+ float{kInfiniteCoordinate}),
+ std::clamp(y() * inv_w, -kInfiniteCoordinate,
+ float{kInfiniteCoordinate}));
}
gfx::Point3F CartesianPoint3d() const {
@@ -85,12 +85,12 @@
SkScalar inv_w = SK_Scalar1 / w();
// However, w may be close to 0 and we lose precision on our geometry
// calculations if we allow scaling to extremely large values.
- return gfx::Point3F(base::clamp(x() * inv_w, -kInfiniteCoordinate,
- float{kInfiniteCoordinate}),
- base::clamp(y() * inv_w, -kInfiniteCoordinate,
- float{kInfiniteCoordinate}),
- base::clamp(z() * inv_w, -kInfiniteCoordinate,
- float{kInfiniteCoordinate}));
+ return gfx::Point3F(std::clamp(x() * inv_w, -kInfiniteCoordinate,
+ float{kInfiniteCoordinate}),
+ std::clamp(y() * inv_w, -kInfiniteCoordinate,
+ float{kInfiniteCoordinate}),
+ std::clamp(z() * inv_w, -kInfiniteCoordinate,
+ float{kInfiniteCoordinate}));
}
gfx::Point3F CartesianPoint3dUnclamped() const {
diff --git a/cc/base/tiling_data.cc b/cc/base/tiling_data.cc
index 2db63ae..adfe48b 100644
--- a/cc/base/tiling_data.cc
+++ b/cc/base/tiling_data.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -82,7 +81,7 @@
DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
int x = (src_position - border_texels_) /
(max_texture_size_.width() - 2 * border_texels_);
- return base::clamp(x, 0, num_tiles_x_ - 1);
+ return std::clamp(x, 0, num_tiles_x_ - 1);
}
int TilingData::TileYIndexFromSrcCoord(int src_position) const {
@@ -92,7 +91,7 @@
DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
int y = (src_position - border_texels_) /
(max_texture_size_.height() - 2 * border_texels_);
- return base::clamp(y, 0, num_tiles_y_ - 1);
+ return std::clamp(y, 0, num_tiles_y_ - 1);
}
int TilingData::FirstBorderTileXIndexFromSrcCoord(int src_position) const {
@@ -102,7 +101,7 @@
DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
int inner_tile_size = max_texture_size_.width() - 2 * border_texels_;
int x = (src_position - 2 * border_texels_) / inner_tile_size;
- return base::clamp(x, 0, num_tiles_x_ - 1);
+ return std::clamp(x, 0, num_tiles_x_ - 1);
}
int TilingData::FirstBorderTileYIndexFromSrcCoord(int src_position) const {
@@ -112,7 +111,7 @@
DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
int inner_tile_size = max_texture_size_.height() - 2 * border_texels_;
int y = (src_position - 2 * border_texels_) / inner_tile_size;
- return base::clamp(y, 0, num_tiles_y_ - 1);
+ return std::clamp(y, 0, num_tiles_y_ - 1);
}
int TilingData::LastBorderTileXIndexFromSrcCoord(int src_position) const {
@@ -122,7 +121,7 @@
DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
int inner_tile_size = max_texture_size_.width() - 2 * border_texels_;
int x = src_position / inner_tile_size;
- return base::clamp(x, 0, num_tiles_x_ - 1);
+ return std::clamp(x, 0, num_tiles_x_ - 1);
}
int TilingData::LastBorderTileYIndexFromSrcCoord(int src_position) const {
@@ -132,7 +131,7 @@
DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
int inner_tile_size = max_texture_size_.height() - 2 * border_texels_;
int y = src_position / inner_tile_size;
- return base::clamp(y, 0, num_tiles_y_ - 1);
+ return std::clamp(y, 0, num_tiles_y_ - 1);
}
IndexRect TilingData::TileAroundIndexRect(const gfx::Rect& center_rect) const {
diff --git a/cc/input/browser_controls_offset_manager.cc b/cc/input/browser_controls_offset_manager.cc
index e9c36e7e..643aa105 100644
--- a/cc/input/browser_controls_offset_manager.cc
+++ b/cc/input/browser_controls_offset_manager.cc
@@ -10,7 +10,6 @@
#include <utility>
#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "cc/input/browser_controls_offset_manager_client.h"
#include "cc/trees/layer_tree_impl.h"
@@ -458,8 +457,7 @@
float min_ratio = base_on_top_controls ? TopControlsMinShownRatio()
: BottomControlsMinShownRatio();
float normalized_shown_ratio =
- (base::clamp(shown_ratio, min_ratio, 1.f) - min_ratio) /
- (1.f - min_ratio);
+ (std::clamp(shown_ratio, min_ratio, 1.f) - min_ratio) / (1.f - min_ratio);
// Even though the real shown ratios (shown height / total height) of the top
// and bottom controls can be different, they share the same
// relative/normalized ratio to keep them in sync.
@@ -544,9 +542,9 @@
// too low or too high |top_controls_min_height_offset_| values. So, we
// should clamp it to a valid range.
top_controls_min_height_offset_ =
- base::clamp(top_controls_min_height_offset_ + top_offset_delta,
- top_min_height_offset_animation_range_->first,
- top_min_height_offset_animation_range_->second);
+ std::clamp(top_controls_min_height_offset_ + top_offset_delta,
+ top_min_height_offset_animation_range_->first,
+ top_min_height_offset_animation_range_->second);
// Ticking the animation might reset it if it's at the final value.
top_min_height_change_in_progress_ =
top_controls_animation_.IsInitialized();
@@ -556,9 +554,9 @@
// in too low or too high |bottom_controls_min_height_offset_| values. So,
// we should clamp it to a valid range.
bottom_controls_min_height_offset_ =
- base::clamp(bottom_controls_min_height_offset_ + bottom_offset_delta,
- bottom_min_height_offset_animation_range_->first,
- bottom_min_height_offset_animation_range_->second);
+ std::clamp(bottom_controls_min_height_offset_ + bottom_offset_delta,
+ bottom_min_height_offset_animation_range_->first,
+ bottom_min_height_offset_animation_range_->second);
// Ticking the animation might reset it if it's at the final value.
bottom_min_height_change_in_progress_ =
bottom_controls_animation_.IsInitialized();
@@ -770,9 +768,10 @@
}
absl::optional<float> BrowserControlsOffsetManager::Animation::Reset() {
- auto ret = jump_to_end_on_reset_ ? absl::make_optional(base::clamp(
- stop_value_, min_value_, max_value_))
- : absl::nullopt;
+ auto ret =
+ jump_to_end_on_reset_
+ ? absl::make_optional(std::clamp(stop_value_, min_value_, max_value_))
+ : absl::nullopt;
started_ = false;
initialized_ = false;
@@ -797,7 +796,7 @@
}
float BrowserControlsOffsetManager::Animation::FinalValue() {
- return base::clamp(stop_value_, min_value_, max_value_);
+ return std::clamp(stop_value_, min_value_, max_value_);
}
} // namespace cc
diff --git a/cc/input/scroll_snap_data.cc b/cc/input/scroll_snap_data.cc
index 308099a..e73b5ce 100644
--- a/cc/input/scroll_snap_data.cc
+++ b/cc/input/scroll_snap_data.cc
@@ -10,7 +10,6 @@
#include <memory>
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "cc/input/snap_selection_strategy.h"
#include "ui/gfx/geometry/vector2d_f.h"
@@ -94,10 +93,10 @@
}
void SnapSearchResult::Clip(float max_snap, float max_visible) {
- snap_offset_ = base::clamp(snap_offset_, 0.0f, max_snap);
+ snap_offset_ = std::clamp(snap_offset_, 0.0f, max_snap);
visible_range_ =
- gfx::RangeF(base::clamp(visible_range_.start(), 0.0f, max_visible),
- base::clamp(visible_range_.end(), 0.0f, max_visible));
+ gfx::RangeF(std::clamp(visible_range_.start(), 0.0f, max_visible),
+ std::clamp(visible_range_.end(), 0.0f, max_visible));
}
void SnapSearchResult::Union(const SnapSearchResult& other) {
@@ -180,7 +179,7 @@
// we cannot always assume that the incoming value fits this criteria we
// clamp it to the bounds to ensure this variant.
SnapSearchResult initial_snap_position_y = {
- base::clamp(base_position.y(), 0.f, max_position_.y()),
+ std::clamp(base_position.y(), 0.f, max_position_.y()),
gfx::RangeF(0, max_position_.x())};
selected_x = FindClosestValidArea(
SearchAxis::kX, strategy, initial_snap_position_y, active_element_id);
@@ -192,7 +191,7 @@
}
if (!selected_y) {
SnapSearchResult initial_snap_position_x = {
- base::clamp(base_position.x(), 0.f, max_position_.x()),
+ std::clamp(base_position.x(), 0.f, max_position_.x()),
gfx::RangeF(0, max_position_.y())};
selected_y = FindClosestValidArea(
SearchAxis::kY, strategy, initial_snap_position_x, active_element_id);
diff --git a/cc/input/scrollbar_animation_controller.cc b/cc/input/scrollbar_animation_controller.cc
index 34f09dc..983bb957 100644
--- a/cc/input/scrollbar_animation_controller.cc
+++ b/cc/input/scrollbar_animation_controller.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <memory>
-#include "base/cxx17_backports.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
@@ -170,7 +169,7 @@
float ScrollbarAnimationController::AnimationProgressAtTime(
base::TimeTicks now) {
const base::TimeDelta delta = now - last_awaken_time_;
- return base::clamp(static_cast<float>(delta / fade_duration_), 0.0f, 1.0f);
+ return std::clamp(static_cast<float>(delta / fade_duration_), 0.0f, 1.0f);
}
void ScrollbarAnimationController::RunAnimationFrame(float progress) {
diff --git a/cc/input/single_scrollbar_animation_controller_thinning.cc b/cc/input/single_scrollbar_animation_controller_thinning.cc
index 1e456af..501a201 100644
--- a/cc/input/single_scrollbar_animation_controller_thinning.cc
+++ b/cc/input/single_scrollbar_animation_controller_thinning.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "cc/input/scrollbar_animation_controller.h"
@@ -99,8 +98,7 @@
return 1.0f;
const base::TimeDelta delta = now - last_awaken_time_;
- return base::clamp(static_cast<float>(delta / thinning_duration_), 0.0f,
- 1.0f);
+ return std::clamp(static_cast<float>(delta / thinning_duration_), 0.0f, 1.0f);
}
void SingleScrollbarAnimationControllerThinning::RunAnimationFrame(
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 64e1a14c..6456872 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -15,7 +15,6 @@
#include <utility>
#include "base/containers/contains.h"
-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/system/sys_info.h"
@@ -1189,7 +1188,7 @@
float min_scale = MinimumContentsScale();
float clamped_ideal_source_scale =
- base::clamp(ideal_source_scale_key(), min_scale, max_scale);
+ std::clamp(ideal_source_scale_key(), min_scale, max_scale);
// Use clamped_ideal_source_scale if adjusted_raster_scale is too far away.
constexpr float kFarAwayFactor = 32.f;
if (adjusted_raster_scale < clamped_ideal_source_scale / kFarAwayFactor) {
@@ -1211,7 +1210,7 @@
}
adjusted_raster_scale =
- base::clamp(adjusted_raster_scale, min_scale, max_scale);
+ std::clamp(adjusted_raster_scale, min_scale, max_scale);
return adjusted_raster_scale;
}
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc
index ff3a1e39..dc0a345 100644
--- a/cc/layers/scrollbar_layer_impl_base.cc
+++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "base/cxx17_backports.h"
#include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/scroll_node.h"
@@ -218,7 +217,7 @@
// DCHECK(scroll_layer_length() >= clip_layer_length());
// With the length known, we can compute the thumb's position.
- float clamped_current_pos = base::clamp(current_pos(), 0.0f, maximum);
+ float clamped_current_pos = std::clamp(current_pos(), 0.0f, maximum);
int thumb_offset = TrackStart();
if (maximum > 0) {
diff --git a/cc/metrics/video_playback_roughness_reporter.cc b/cc/metrics/video_playback_roughness_reporter.cc
index 2ce94ae..0bbf4d7 100644
--- a/cc/metrics/video_playback_roughness_reporter.cc
+++ b/cc/metrics/video_playback_roughness_reporter.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include "base/containers/adapters.h"
-#include "base/cxx17_backports.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
@@ -76,7 +75,7 @@
// Adjust frame window size to fit about 1 second of playback
const int win_size =
base::ClampRound(info.intended_duration.value().ToHz());
- frames_window_size_ = base::clamp(win_size, kMinWindowSize, kMaxWindowSize);
+ frames_window_size_ = std::clamp(win_size, kMinWindowSize, kMaxWindowSize);
}
frames_.push_back(info);
diff --git a/cc/paint/filter_operation.cc b/cc/paint/filter_operation.cc
index 5eb6354..7d984e9 100644
--- a/cc/paint/filter_operation.cc
+++ b/cc/paint/filter_operation.cc
@@ -9,7 +9,6 @@
#include "cc/paint/filter_operation.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/trace_event/traced_value.h"
#include "base/values.h"
@@ -206,7 +205,7 @@
case FilterOperation::INVERT:
case FilterOperation::OPACITY:
case FilterOperation::ALPHA_THRESHOLD:
- return base::clamp(amount, 0.f, 1.f);
+ return std::clamp(amount, 0.f, 1.f);
case FilterOperation::SATURATE:
case FilterOperation::BRIGHTNESS:
case FilterOperation::CONTRAST:
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index 7d5914a..753bd0b 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -12,7 +12,6 @@
#include <vector>
#include "base/bits.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
@@ -384,7 +383,7 @@
// If playback_settings.msaa_sample_count <= 0, the MSAA is not used. It is
// equivalent to MSAA sample count 1.
uint32_t sample_count =
- base::clamp(playback_settings.msaa_sample_count, 1, 64);
+ std::clamp(playback_settings.msaa_sample_count, 1, 64);
UMA_HISTOGRAM_CUSTOM_COUNTS("Gpu.Rasterization.Raster.MSAASampleCountLog2",
base::bits::Log2Floor(sample_count), 0, 7, 7);
// With Raw Draw, the framebuffer will be the rasterization target. It cannot
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index f4dbbfe..f9466be0 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -17,7 +17,6 @@
#include "base/containers/adapters.h"
#include "base/containers/contains.h"
-#include "base/cxx17_backports.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/json/json_writer.h"
@@ -120,8 +119,8 @@
const gfx::RectF& rect,
const gfx::PointF& top,
const gfx::PointF& bottom) {
- gfx::PointF start(base::clamp(top.x(), rect.x(), rect.right()),
- base::clamp(top.y(), rect.y(), rect.bottom()));
+ gfx::PointF start(std::clamp(top.x(), rect.x(), rect.right()),
+ std::clamp(top.y(), rect.y(), rect.bottom()));
gfx::PointF end = start + (bottom - top);
return {start, end};
}
@@ -1297,7 +1296,7 @@
host_impl_->browser_controls_manager()->TopControlsShownRatioRange();
}
return top_controls_shown_ratio_->SetCurrent(
- base::clamp(ratio, range.first, range.second));
+ std::clamp(ratio, range.first, range.second));
}
bool LayerTreeImpl::ClampBottomControlsShownRatio() {
@@ -1310,7 +1309,7 @@
host_impl_->browser_controls_manager()->BottomControlsShownRatioRange();
}
return bottom_controls_shown_ratio_->SetCurrent(
- base::clamp(ratio, range.first, range.second));
+ std::clamp(ratio, range.first, range.second));
}
bool LayerTreeImpl::SetCurrentBrowserControlsShownRatio(float top_ratio,
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 2f7ed539..cbe67c3 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -4,7 +4,8 @@
#include "cc/trees/layer_tree_impl.h"
-#include "base/cxx17_backports.h"
+#include <algorithm>
+
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "cc/layers/heads_up_display_layer_impl.h"
@@ -26,8 +27,8 @@
const gfx::RectF& rect,
const gfx::PointF& top,
const gfx::PointF& bottom) {
- gfx::PointF start(base::clamp(top.x(), rect.x(), rect.right()),
- base::clamp(top.y(), rect.y(), rect.bottom()));
+ gfx::PointF start(std::clamp(top.x(), rect.x(), rect.right()),
+ std::clamp(top.y(), rect.y(), rect.bottom()));
gfx::PointF end = start + (bottom - top);
return {start, end};
}