Unreviewed changes
3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: third_party/blink/renderer/core/style/fit_text.h
Insertions: 3, Deletions: 3.
@@ -34,7 +34,7 @@
public:
FitText() = default;
- FitText(FitTextType type, FitTextTarget target, std::optional<double> limit)
+ FitText(FitTextType type, FitTextTarget target, std::optional<float> limit)
: type_(type), target_(target), scale_factor_limit_(limit) {}
bool operator==(const FitText& other) const {
@@ -46,7 +46,7 @@
FitTextTarget Target() const { return target_; }
FitTextMethod Method() const { return FitTextMethod::kScale; }
// This returns 1.0 for "100%".
- std::optional<double> ScaleFactorLimit() const { return scale_factor_limit_; }
+ std::optional<float> ScaleFactorLimit() const { return scale_factor_limit_; }
// A debug helper.
String ToString() const;
@@ -54,7 +54,7 @@
private:
FitTextType type_ = FitTextType::kNone;
FitTextTarget target_ = FitTextTarget::kConsistent;
- std::optional<double> scale_factor_limit_;
+ std::optional<float> scale_factor_limit_;
};
} // namespace blink
```
```
The name of the file: third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
Insertions: 4, Deletions: 2.
@@ -4212,8 +4212,10 @@
std::optional<double> limit;
if (list.length() > next_index) {
if (const auto* limit_value =
- DynamicTo<CSSNumericLiteralValue>(list.Item(next_index))) {
- limit.emplace(limit_value->ComputePercentage() / 100);
+ DynamicTo<CSSPrimitiveValue>(list.Item(next_index))) {
+ limit.emplace(limit_value->ComputePercentage<float>(
+ state.CssToLengthConversionData()) /
+ 100);
}
++next_index;
}
```
```
The name of the file: third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
Insertions: 0, Deletions: 1.
@@ -9512,7 +9512,6 @@
list->Append(*target);
}
- // TODO(crbug.com/417306102): This should be <percentage>.
if (CSSValue* percent =
ConsumePercent(stream, context, local_context,
CSSPrimitiveValue::ValueRange::kNonNegative)) {
```
```
The name of the file: third_party/blink/renderer/core/layout/inline/fit_text_utils.cc
Insertions: 2, Deletions: 3.
@@ -4,7 +4,6 @@
#include "third_party/blink/renderer/core/layout/inline/fit_text_utils.h"
-#include "base/numerics/safe_conversions.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
@@ -294,7 +293,7 @@
}
if (std::isfinite(minimum_scale)) {
if (fit_text.ScaleFactorLimit().has_value()) {
- float limit = base::saturated_cast<float>(*fit_text.ScaleFactorLimit());
+ float limit = *fit_text.ScaleFactorLimit();
minimum_scale = fit_text.Type() == FitTextType::kGrow
? std::min(minimum_scale, std::max(limit, 1.0f))
: std::max(minimum_scale, std::min(limit, 1.0f));
@@ -360,7 +359,7 @@
float scale_factor = (container_width - static_total_size).ToFloat() /
flexible_total_size.ToFloat();
if (fit_text.ScaleFactorLimit().has_value()) {
- float limit = base::saturated_cast<float>(*fit_text.ScaleFactorLimit());
+ float limit = *fit_text.ScaleFactorLimit();
return fit_text.Type() == FitTextType::kGrow
? std::min(scale_factor, std::max(limit, 1.0f))
: std::max(scale_factor, std::min(limit, 1.0f));
```
Change information
Commit message:
FitText: Update the last component of `text-fit` property
It should be <percentage>.
* Accept non-negative percentage values
* blink::FitText stores std::optional<double>
* It limits a scaling factor, not font-size.
Bug: 417306102
Change-Id: I4e9e539d6564f09b7c696c43b077f4c77ff4fde2
Cr-Commit-Position: refs/heads/main@{#1571434}
Files:
- M third_party/blink/renderer/core/css/properties/computed_style_utils.cc
- M third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
- M third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
- M third_party/blink/renderer/core/layout/inline/fit_text_utils.cc
- M third_party/blink/renderer/core/style/fit_text.cc
- M third_party/blink/renderer/core/style/fit_text.h
- M third_party/blink/web_tests/wpt_internal/css/fit-width-text/text-grow-computed.html
- M third_party/blink/web_tests/wpt_internal/css/fit-width-text/text-grow-invalid.html
- M third_party/blink/web_tests/wpt_internal/css/fit-width-text/text-grow-valid.html
- M third_party/blink/web_tests/wpt_internal/css/fit-width-text/text-shrink-per-line-scale-minimum-setting.html
- M third_party/blink/web_tests/wpt_internal/css/fit-width-text/text-shrink-per-line-scale.html
Change size: M
Delta: 11 files changed, 65 insertions(+), 55 deletions(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Koji Ishii