Commit 07eac0d6 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Remove two redundant UnderlyingValue wrapper class

Two classes became redundant wrappers after crrev.com/c/1769554,
so this patch removes them.

Bug: 991672
Change-Id: I69a0131036563d1e90820381c711de91bd63a455
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829783Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701168}
parent 6afccea4
......@@ -67,53 +67,6 @@ class CSSTextIndentNonInterpolableValue : public NonInterpolableValue {
DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSTextIndentNonInterpolableValue);
DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSTextIndentNonInterpolableValue);
// TODO(xiaochengh): Clean up. With |InterpolableLength| introduced and
// |LengthNonInterpolableValue| removed, the following no longer makes sense.
//
// A wrapper for the UnderlyingValue passed to
// CSSTextIndentInterpolationType::Composite which can be forwarded to
// LengthInterpolationFunctions::Composite.
//
// If LengthInterpolationFunctions::Composite calls SetNonInterpolableValue with
// a new NonInterpolableValue, this class wraps it in a new
// CSSTextIndentNonInterpolableValue before being set on the inner
// UnderlyingValue.
class UnderlyingTextIndentAsLengthValue : public UnderlyingValue {
STACK_ALLOCATED();
public:
UnderlyingTextIndentAsLengthValue(UnderlyingValue& inner_underlying_value,
IndentMode mode)
: inner_underlying_value_(inner_underlying_value), mode_(mode) {}
InterpolableValue& MutableInterpolableValue() final {
return inner_underlying_value_.MutableInterpolableValue();
}
void SetInterpolableValue(
std::unique_ptr<InterpolableValue> interpolable_value) final {
inner_underlying_value_.SetInterpolableValue(std::move(interpolable_value));
}
const NonInterpolableValue* GetNonInterpolableValue() const final {
const auto& text_indent_non_interpolable_value =
ToCSSTextIndentNonInterpolableValue(
*inner_underlying_value_.GetNonInterpolableValue());
return text_indent_non_interpolable_value.LengthNonInterpolableValue();
}
void SetNonInterpolableValue(
scoped_refptr<const NonInterpolableValue> non_interpolable_value) final {
inner_underlying_value_.SetNonInterpolableValue(
CSSTextIndentNonInterpolableValue::Create(
std::move(non_interpolable_value), mode_));
}
private:
UnderlyingValue& inner_underlying_value_;
const IndentMode mode_;
};
namespace {
class UnderlyingIndentModeChecker
......@@ -266,9 +219,7 @@ void CSSTextIndentInterpolationType::Composite(
return;
}
UnderlyingTextIndentAsLengthValue underlying_text_indent_as_length(
underlying_value_owner, mode);
underlying_text_indent_as_length.MutableInterpolableValue().ScaleAndAdd(
underlying_value_owner.MutableInterpolableValue().ScaleAndAdd(
underlying_fraction, *value.interpolable_value);
}
......
......@@ -56,48 +56,6 @@ class CSSSizeNonInterpolableValue : public NonInterpolableValue {
DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSSizeNonInterpolableValue);
DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSSizeNonInterpolableValue);
// TODO(xiaochengh): Clean up. With |InterpolableLength| introduced and
// |LengthNonInterpolableValue| removed, the following no longer makes sense.
//
// A wrapper for the UnderlyingValue passed to
// SizeInterpolationFunctions::Composite which can be forwarded to
// LengthInterpolationFunctions::Composite.
//
// If LengthInterpolationFunctions::Composite calls SetNonInterpolableValue with
// a new NonInterpolableValue, this class wraps it in a new
// CSSSizeNonInterpolableValue before being set on the inner UnderlyingValue.
class UnderlyingSizeAsLengthValue : public UnderlyingValue {
STACK_ALLOCATED();
public:
UnderlyingSizeAsLengthValue(UnderlyingValue& inner_underlying_value)
: inner_underlying_value_(inner_underlying_value) {}
InterpolableValue& MutableInterpolableValue() final {
return inner_underlying_value_.MutableInterpolableValue();
}
void SetInterpolableValue(
std::unique_ptr<InterpolableValue> interpolable_value) final {
inner_underlying_value_.SetInterpolableValue(std::move(interpolable_value));
}
const NonInterpolableValue* GetNonInterpolableValue() const final {
const auto& size_non_interpolable_value = ToCSSSizeNonInterpolableValue(
*inner_underlying_value_.GetNonInterpolableValue());
return size_non_interpolable_value.LengthNonInterpolableValue();
}
void SetNonInterpolableValue(
scoped_refptr<const NonInterpolableValue> non_interpolable_value) final {
inner_underlying_value_.SetNonInterpolableValue(
CSSSizeNonInterpolableValue::Create(std::move(non_interpolable_value)));
}
private:
UnderlyingValue& inner_underlying_value_;
};
static InterpolationValue ConvertKeyword(CSSValueID keyword) {
return InterpolationValue(std::make_unique<InterpolableList>(0),
CSSSizeNonInterpolableValue::Create(keyword));
......@@ -204,9 +162,8 @@ void SizeInterpolationFunctions::Composite(
ToCSSSizeNonInterpolableValue(*non_interpolable_value);
if (size_non_interpolable_value.IsKeyword())
return;
UnderlyingSizeAsLengthValue underlying_size_as_length(underlying_value);
underlying_size_as_length.MutableInterpolableValue().ScaleAndAdd(
underlying_fraction, interpolable_value);
underlying_value.MutableInterpolableValue().ScaleAndAdd(underlying_fraction,
interpolable_value);
}
static Length CreateLength(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment