Rename CSSProperty::ResolveDirectionAwareProperty to CSSProperty::ToPhysical
Change-Id: Ifef5b48ddcfc569849bd85e22fe645dada47d256
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6336216
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Munira Tursunova <moonira@google.com>
Cr-Commit-Position: refs/heads/main@{#1430209}
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl
index 11d7772..131a23ec 100644
--- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl
+++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl
@@ -91,10 +91,10 @@
{% if group.is_logical %}
const CSSProperty* {{class_name}}::SurrogateFor(
WritingDirectionMode writing_direction) const {
- return &ResolveDirectionAwarePropertyInternal(writing_direction);
+ return &ToPhysicalInternal(writing_direction);
}
-const CSSProperty& {{class_name}}::ResolveDirectionAwarePropertyInternal(
+const CSSProperty& {{class_name}}::ToPhysicalInternal(
WritingDirectionMode writing_direction) const {
return CSSDirectionAwareResolver::Resolve{{resolver_name}}(writing_direction,
CSSDirectionAwareResolver::Physical{{group_name}}Mapping());
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl
index 5b5ad7b..528cffa 100644
--- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl
+++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl
@@ -101,7 +101,7 @@
{% if property.logical_property_group %}
bool IsInSameLogicalPropertyGroupWithDifferentMappingLogic(CSSPropertyID) const override;
{% if property.logical_property_group.is_logical %}
- const CSSProperty& ResolveDirectionAwarePropertyInternal(
+ const CSSProperty& ToPhysicalInternal(
WritingDirectionMode) const override;
const CSSValue* CSSValueFromComputedStyleInternal(
const ComputedStyle&,
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc
index efacd544..1f82537 100644
--- a/third_party/blink/renderer/core/animation/css/css_animations.cc
+++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -396,7 +396,7 @@
} else if (!CSSAnimations::IsAnimationAffectingProperty(property)) {
// Map Logical to physical property name.
const CSSProperty& physical_property =
- property.ResolveDirectionAwareProperty(writing_direction);
+ property.ToPhysical(writing_direction);
const CSSPropertyName& name = physical_property.GetCSSPropertyName();
keyframe->SetCSSPropertyValue(name, property_reference.Value());
}
@@ -2544,8 +2544,7 @@
: resolved_id;
DCHECK_GE(longhand_id, kFirstCSSProperty);
const CSSProperty& property =
- CSSProperty::Get(longhand_id)
- .ResolveDirectionAwareProperty(writing_direction);
+ CSSProperty::Get(longhand_id).ToPhysical(writing_direction);
PropertyHandle property_handle = PropertyHandle(property);
CalculateTransitionUpdateForPropertyHandle(
diff --git a/third_party/blink/renderer/core/animation/string_keyframe.cc b/third_party/blink/renderer/core/animation/string_keyframe.cc
index fa209f0..70d0ec9 100644
--- a/third_party/blink/renderer/core/animation/string_keyframe.cc
+++ b/third_party/blink/renderer/core/animation/string_keyframe.cc
@@ -21,8 +21,8 @@
bool IsLogicalProperty(CSSPropertyID property_id) {
const CSSProperty& property = CSSProperty::Get(property_id);
- const CSSProperty& resolved_property = property.ResolveDirectionAwareProperty(
- {WritingMode::kHorizontalTb, TextDirection::kLtr});
+ const CSSProperty& resolved_property =
+ property.ToPhysical({WritingMode::kHorizontalTb, TextDirection::kLtr});
return resolved_property.PropertyID() != property_id;
}
@@ -456,8 +456,7 @@
const CSSValue& value,
WritingDirectionMode writing_direction) {
const CSSProperty& physical_property =
- CSSProperty::Get(property_id)
- .ResolveDirectionAwareProperty(writing_direction);
+ CSSProperty::Get(property_id).ToPhysical(writing_direction);
property_value_set->SetProperty(physical_property.PropertyID(), value);
}
diff --git a/third_party/blink/renderer/core/css/properties/css_property.cc b/third_party/blink/renderer/core/css/properties/css_property.cc
index 3ee1b4b..bf454bde 100644
--- a/third_party/blink/renderer/core/css/properties/css_property.cc
+++ b/third_party/blink/renderer/core/css/properties/css_property.cc
@@ -62,7 +62,7 @@
bool allow_visited_style,
CSSValuePhase value_phase) const {
const CSSProperty& resolved_property =
- ResolveDirectionAwareProperty(style.GetWritingDirection());
+ ToPhysical(style.GetWritingDirection());
return resolved_property.CSSValueFromComputedStyleInternal(
style, layout_object, allow_visited_style, value_phase);
}
diff --git a/third_party/blink/renderer/core/css/properties/css_property.h b/third_party/blink/renderer/core/css/properties/css_property.h
index a3d28281..04cd88b 100644
--- a/third_party/blink/renderer/core/css/properties/css_property.h
+++ b/third_party/blink/renderer/core/css/properties/css_property.h
@@ -142,18 +142,16 @@
bool allow_visited_style,
CSSValuePhase value_phase) const;
- const CSSProperty& ResolveDirectionAwareProperty(
- WritingDirectionMode writing_direction) const {
+ const CSSProperty& ToPhysical(WritingDirectionMode writing_direction) const {
if (!IsInLogicalPropertyGroup()) {
// Avoid the potentially expensive virtual function call.
return *this;
} else {
- return ResolveDirectionAwarePropertyInternal(writing_direction);
+ return ToPhysicalInternal(writing_direction);
}
}
- virtual const CSSProperty& ResolveDirectionAwarePropertyInternal(
- WritingDirectionMode) const {
+ virtual const CSSProperty& ToPhysicalInternal(WritingDirectionMode) const {
return *this;
}
diff --git a/third_party/blink/renderer/core/css/properties/css_property_test.cc b/third_party/blink/renderer/core/css/properties/css_property_test.cc
index 37dce16..d5ab83b 100644
--- a/third_party/blink/renderer/core/css/properties/css_property_test.cc
+++ b/third_party/blink/renderer/core/css/properties/css_property_test.cc
@@ -585,15 +585,13 @@
DirectionAwareConverterTest,
testing::ValuesIn(DirectionAwareConverterTestData));
-TEST_P(DirectionAwareConverterTest, ResolveDirectionAwareProperty) {
+TEST_P(DirectionAwareConverterTest, ToPhysical) {
DirectionAwarePropertyData property_data = GetParam();
const CSSProperty& property = CSSProperty::Get(property_data.logical);
- EXPECT_EQ(
- static_cast<int>(
- property.ResolveDirectionAwareProperty(property_data.writing_mode)
- .PropertyID()),
- static_cast<int>(property_data.physical));
+ EXPECT_EQ(static_cast<int>(
+ property.ToPhysical(property_data.writing_mode).PropertyID()),
+ static_cast<int>(property_data.physical));
}
TEST_P(DirectionAwareConverterTest, TestToLogical) {
@@ -611,11 +609,9 @@
EXPECT_EQ(static_cast<int>(
physical.ToLogical(property_data.writing_mode).PropertyID()),
static_cast<int>(logical.PropertyID()));
- EXPECT_EQ(
- static_cast<int>(physical.PropertyID()),
- static_cast<int>(
- logical.ResolveDirectionAwareProperty(property_data.writing_mode)
- .PropertyID()));
+ EXPECT_EQ(static_cast<int>(physical.PropertyID()),
+ static_cast<int>(
+ logical.ToPhysical(property_data.writing_mode).PropertyID()));
}
} // namespace blink