Convert base::clamp() to std::clamp() in pdf/
According to the instructions at crbug.com/1373621, we should convert base::clamp() to std::clamp() in the code. Bug: 1373621 Change-Id: I84b3083ba3836f67896491c84c870876f783a3ad Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4461779 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Auto-Submit: Ho Cheung <uioptt24@gmail.com> Cr-Commit-Position: refs/heads/main@{#1134800}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e33fd28d2f
commit
e569f4a088
@ -17,7 +17,6 @@
|
||||
#include "base/check_op.h"
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
#include "base/containers/queue.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/debug/crash_logging.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
@ -503,8 +502,8 @@ void PdfViewWebPlugin::UpdateScroll(const gfx::PointF& scroll_position) {
|
||||
0.0f);
|
||||
|
||||
gfx::PointF scaled_scroll_position(
|
||||
base::clamp(scroll_position.x(), 0.0f, max_x),
|
||||
base::clamp(scroll_position.y(), 0.0f, max_y));
|
||||
std::clamp(scroll_position.x(), 0.0f, max_x),
|
||||
std::clamp(scroll_position.y(), 0.0f, max_y));
|
||||
scaled_scroll_position.Scale(device_scale_);
|
||||
|
||||
engine_->ScrolledToXPosition(scaled_scroll_position.x());
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "pdf/pdfium/pdfium_font_linux.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/files/file.h"
|
||||
#include "base/i18n/encoding_detection.h"
|
||||
#include "base/i18n/icu_string_conversions.h"
|
||||
@ -115,7 +115,7 @@ blink::WebFontDescription::Weight WeightToBlinkWeight(int weight) {
|
||||
static_assert(blink::WebFontDescription::kWeight900 == 8, "Blink Weight max");
|
||||
constexpr int kMinimumWeight = 100;
|
||||
constexpr int kMaximumWeight = 900;
|
||||
int normalized_weight = base::clamp(weight, kMinimumWeight, kMaximumWeight);
|
||||
int normalized_weight = std::clamp(weight, kMinimumWeight, kMaximumWeight);
|
||||
normalized_weight = (normalized_weight / 100) - 1;
|
||||
return static_cast<blink::WebFontDescription::Weight>(normalized_weight);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
@ -1040,7 +1039,7 @@ float PDFiumPage::PreProcessAndTransformInPageCoordX(float x) {
|
||||
// If `x` < 0, scroll to the left side of the page.
|
||||
// If `x` > page width, scroll to the right side of the page.
|
||||
return TransformPageToScreenX(
|
||||
base::clamp(x, 0.0f, FPDF_GetPageWidthF(GetPage())));
|
||||
std::clamp(x, 0.0f, FPDF_GetPageWidthF(GetPage())));
|
||||
}
|
||||
|
||||
float PDFiumPage::PreProcessAndTransformInPageCoordY(float y) {
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/values.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
@ -109,9 +108,9 @@ size_t CalculateImageDataSize(int stride, int height) {
|
||||
} // namespace
|
||||
|
||||
Thumbnail::Thumbnail(const gfx::Size& page_size, float device_pixel_ratio)
|
||||
: device_pixel_ratio_(base::clamp(device_pixel_ratio,
|
||||
kMinDevicePixelRatio,
|
||||
kMaxDevicePixelRatio)),
|
||||
: device_pixel_ratio_(std::clamp(device_pixel_ratio,
|
||||
kMinDevicePixelRatio,
|
||||
kMaxDevicePixelRatio)),
|
||||
image_size_(CalculateBestFitSize(page_size, device_pixel_ratio_)),
|
||||
stride_(CalculateStride(image_size_.width())),
|
||||
image_data_(CalculateImageDataSize(stride(), image_size().height())) {
|
||||
|
Reference in New Issue
Block a user