Skip to content

Commit be902d5

Browse files
author
bors-servo
authored
Auto merge of #20073 - servo:keywordsize, r=emilio
Remove some useless manual layout optimisation for KeywordSize <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20073) <!-- Reviewable:end -->
2 parents 6afdf7c + e976955 commit be902d5

File tree

1 file changed

+6
-16
lines changed
  • components/style/values/generics

1 file changed

+6
-16
lines changed

components/style/values/generics/font.rs

+6-16
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,11 @@ where
197197
}
198198

199199
/// CSS font keywords
200-
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)]
201-
#[derive(Clone, Copy, Debug, PartialEq)]
200+
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
201+
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero)]
202202
#[allow(missing_docs)]
203203
pub enum KeywordSize {
204-
XXSmall = 1, // This is to enable the NonZero optimization
205-
// which simplifies the representation of Option<KeywordSize>
206-
// in bindgen
204+
XXSmall,
207205
XSmall,
208206
Small,
209207
Medium,
@@ -217,17 +215,9 @@ pub enum KeywordSize {
217215

218216
impl KeywordSize {
219217
/// Convert to an HTML <font size> value
220-
pub fn html_size(&self) -> u8 {
221-
match *self {
222-
KeywordSize::XXSmall => 0,
223-
KeywordSize::XSmall => 1,
224-
KeywordSize::Small => 2,
225-
KeywordSize::Medium => 3,
226-
KeywordSize::Large => 4,
227-
KeywordSize::XLarge => 5,
228-
KeywordSize::XXLarge => 6,
229-
KeywordSize::XXXLarge => 7,
230-
}
218+
#[inline]
219+
pub fn html_size(self) -> u8 {
220+
self as u8
231221
}
232222
}
233223

0 commit comments

Comments
 (0)