Commit f4d1365e authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Remove unused CSSPropertyPriority values

With StyleCascade, we don't need most of the priorities. This CL
removes everything except kHighPropertyPriority, which is still
needed.

A follow-up CL will remove css_property_priority.h/cc completely,
in favor of generating something simple directly in
css_property_names.h.

Change-Id: I579d57a2322a120a69405244d31dd99299553359
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2385355Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803507}
parent 3ed81fec
...@@ -142,7 +142,7 @@ class CSSProperties(object): ...@@ -142,7 +142,7 @@ class CSSProperties(object):
self.expand_parameters(property_) self.expand_parameters(property_)
validate_property(property_) validate_property(property_)
# This order must match the order in CSSPropertyPriority.h. # This order must match the order in CSSPropertyPriority.h.
priority_numbers = {'Animation': 0, 'High': 1, 'Low': 2} priority_numbers = {'High': 0, 'Low': 1}
priority = priority_numbers[property_['priority']] priority = priority_numbers[property_['priority']]
name_without_leading_dash = property_['name'].original name_without_leading_dash = property_['name'].original
if name_without_leading_dash.startswith('-'): if name_without_leading_dash.startswith('-'):
......
...@@ -413,13 +413,11 @@ ...@@ -413,13 +413,11 @@
}, },
// - priority: "High" // - priority: "High"
// The priority level for computing the property. Valid values are // The priority level for computing the property. Properties with the same
// "Animation" (highest), "High" and "Low". Properties with the same // priority level are grouped and computed in alphabetical order.
// priority level are grouped and computed in alphabetical order. The
// default value is "Low".
priority: { priority: {
default: "Low", default: "Low",
valid_values: ["Animation", "High", "Low"], valid_values: ["High", "Low"],
}, },
// - layout_dependent // - layout_dependent
...@@ -511,7 +509,6 @@ ...@@ -511,7 +509,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Delay", attribute: "Delay",
}, },
priority: "Animation",
typedom_types: ["Time"], typedom_types: ["Time"],
separator: ",", separator: ",",
valid_for_marker: true, valid_for_marker: true,
...@@ -526,7 +523,6 @@ ...@@ -526,7 +523,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Direction", attribute: "Direction",
}, },
priority: "Animation",
separator: ",", separator: ",",
valid_for_marker: true, valid_for_marker: true,
}, },
...@@ -538,7 +534,6 @@ ...@@ -538,7 +534,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Duration", attribute: "Duration",
}, },
priority: "Animation",
typedom_types: ["Time"], typedom_types: ["Time"],
separator: ",", separator: ",",
valid_for_marker: true, valid_for_marker: true,
...@@ -550,7 +545,6 @@ ...@@ -550,7 +545,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "FillMode", attribute: "FillMode",
}, },
priority: "Animation",
keywords: ["none", "forwards", "backwards", "both"], keywords: ["none", "forwards", "backwards", "both"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
separator: ",", separator: ",",
...@@ -565,7 +559,6 @@ ...@@ -565,7 +559,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "IterationCount", attribute: "IterationCount",
}, },
priority: "Animation",
keywords: ["infinite"], keywords: ["infinite"],
typedom_types: ["Keyword", "Number"], typedom_types: ["Keyword", "Number"],
separator: ",", separator: ",",
...@@ -578,7 +571,6 @@ ...@@ -578,7 +571,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Name", attribute: "Name",
}, },
priority: "Animation",
keywords: ["none"], keywords: ["none"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
separator: ",", separator: ",",
...@@ -591,7 +583,6 @@ ...@@ -591,7 +583,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "PlayState", attribute: "PlayState",
}, },
priority: "Animation",
keywords: ["running", "paused"], keywords: ["running", "paused"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
separator: ",", separator: ",",
...@@ -604,7 +595,6 @@ ...@@ -604,7 +595,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Timeline", attribute: "Timeline",
}, },
priority: "Animation",
keywords: ["none", "auto"], keywords: ["none", "auto"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
separator: ",", separator: ",",
...@@ -618,7 +608,6 @@ ...@@ -618,7 +608,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "TimingFunction", attribute: "TimingFunction",
}, },
priority: "Animation",
keywords: [ keywords: [
"linear", "linear",
"ease", "ease",
...@@ -643,7 +632,6 @@ ...@@ -643,7 +632,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Delay", attribute: "Delay",
}, },
priority: "Animation",
typedom_types: ["Time"], typedom_types: ["Time"],
separator: ",", separator: ",",
valid_for_marker: true, valid_for_marker: true,
...@@ -657,7 +645,6 @@ ...@@ -657,7 +645,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Duration", attribute: "Duration",
}, },
priority: "Animation",
valid_for_marker: true, valid_for_marker: true,
}, },
{ {
...@@ -667,7 +654,6 @@ ...@@ -667,7 +654,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "Property", attribute: "Property",
}, },
priority: "Animation",
keywords: ["none"], keywords: ["none"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_marker: true, valid_for_marker: true,
...@@ -679,7 +665,6 @@ ...@@ -679,7 +665,6 @@
style_builder_template_args: { style_builder_template_args: {
attribute: "TimingFunction", attribute: "TimingFunction",
}, },
priority: "Animation",
keywords: [ keywords: [
"linear", "linear",
"ease", "ease",
......
...@@ -17,11 +17,7 @@ namespace blink { ...@@ -17,11 +17,7 @@ namespace blink {
// TODO(sashab): Generate the methods in this file. // TODO(sashab): Generate the methods in this file.
enum CSSPropertyPriority { enum CSSPropertyPriority {
kResolveVariables = 0,
kAnimationPropertyPriority,
kHighPropertyPriority, kHighPropertyPriority,
kLowPropertyPriority,
kPropertyPriorityCount,
}; };
template <CSSPropertyPriority priority> template <CSSPropertyPriority priority>
...@@ -36,51 +32,11 @@ class CSSPropertyPriorityData { ...@@ -36,51 +32,11 @@ class CSSPropertyPriorityData {
} }
}; };
template <>
constexpr CSSPropertyID CSSPropertyPriorityData<kResolveVariables>::First() {
static_assert(
static_cast<int>(CSSPropertyID::kVariable) == kIntFirstCSSProperty - 1,
"CSSPropertyID::kVariable should be directly before the first CSS "
"property.");
return CSSPropertyID::kVariable;
}
template <>
constexpr CSSPropertyID CSSPropertyPriorityData<kResolveVariables>::Last() {
return CSSPropertyID::kVariable;
}
template <>
constexpr CSSPropertyID
CSSPropertyPriorityData<kAnimationPropertyPriority>::First() {
static_assert(CSSPropertyID::kAnimationDelay == firstCSSProperty,
"CSSPropertyID::kAnimationDelay should be the first animation "
"priority property");
return CSSPropertyID::kAnimationDelay;
}
template <>
constexpr CSSPropertyID
CSSPropertyPriorityData<kAnimationPropertyPriority>::Last() {
static_assert(
static_cast<int>(CSSPropertyID::kTransitionTimingFunction) ==
static_cast<int>(CSSPropertyID::kAnimationDelay) + 12,
"CSSPropertyID::kTransitionTimingFunction should be the end of the high "
"priority property range");
static_assert(
static_cast<int>(CSSPropertyID::kColor) ==
static_cast<int>(CSSPropertyID::kTransitionTimingFunction) + 1,
"CSSPropertyID::kTransitionTimingFunction should be immediately before "
"CSSPropertyID::kColor");
return CSSPropertyID::kTransitionTimingFunction;
}
template <> template <>
constexpr CSSPropertyID constexpr CSSPropertyID
CSSPropertyPriorityData<kHighPropertyPriority>::First() { CSSPropertyPriorityData<kHighPropertyPriority>::First() {
static_assert( static_assert(
static_cast<int>(CSSPropertyID::kColor) == CSSPropertyID::kColor == firstCSSProperty,
static_cast<int>(CSSPropertyID::kTransitionTimingFunction) + 1,
"CSSPropertyID::kColor should be the first high priority property"); "CSSPropertyID::kColor should be the first high priority property");
return CSSPropertyID::kColor; return CSSPropertyID::kColor;
} }
...@@ -98,38 +54,6 @@ constexpr CSSPropertyID CSSPropertyPriorityData<kHighPropertyPriority>::Last() { ...@@ -98,38 +54,6 @@ constexpr CSSPropertyID CSSPropertyPriorityData<kHighPropertyPriority>::Last() {
return CSSPropertyID::kZoom; return CSSPropertyID::kZoom;
} }
template <>
constexpr CSSPropertyID CSSPropertyPriorityData<kLowPropertyPriority>::First() {
static_assert(static_cast<int>(CSSPropertyID::kAdvanceOverride) ==
static_cast<int>(CSSPropertyID::kZoom) + 1,
"CSSPropertyID::kAdvanceOverride should be the first low "
"priority property");
return CSSPropertyID::kAdvanceOverride;
}
template <>
constexpr CSSPropertyID CSSPropertyPriorityData<kLowPropertyPriority>::Last() {
return static_cast<CSSPropertyID>(lastCSSProperty);
}
constexpr CSSPropertyPriority PriorityForProperty(CSSPropertyID property) {
if (CSSPropertyPriorityData<kLowPropertyPriority>::PropertyHasPriority(
property)) {
return kLowPropertyPriority;
}
if (CSSPropertyPriorityData<kHighPropertyPriority>::PropertyHasPriority(
property)) {
return kHighPropertyPriority;
}
if (CSSPropertyPriorityData<kAnimationPropertyPriority>::PropertyHasPriority(
property)) {
return kAnimationPropertyPriority;
}
DCHECK(CSSPropertyPriorityData<kResolveVariables>::PropertyHasPriority(
property));
return kResolveVariables;
}
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_PROPERTY_PRIORITY_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_PROPERTY_PRIORITY_H_
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