mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Derive Serialize and Deserialize traits for font styles for #[cfg_attr(feature = "servo")]
This commit is contained in:
parent
6c86429082
commit
8372cf1bd8
5 changed files with 8 additions and 23 deletions
|
@ -409,7 +409,6 @@ pub struct CanvasData<'a> {
|
||||||
/// An old webrender image key that can be deleted when the current epoch ends.
|
/// An old webrender image key that can be deleted when the current epoch ends.
|
||||||
very_old_image_key: Option<webrender_api::ImageKey>,
|
very_old_image_key: Option<webrender_api::ImageKey>,
|
||||||
font_cache_thread: Mutex<FontCacheThread>,
|
font_cache_thread: Mutex<FontCacheThread>,
|
||||||
_canvas_id: CanvasId,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_backend() -> Box<dyn Backend> {
|
fn create_backend() -> Box<dyn Backend> {
|
||||||
|
@ -421,7 +420,6 @@ impl<'a> CanvasData<'a> {
|
||||||
size: Size2D<u64>,
|
size: Size2D<u64>,
|
||||||
webrender_api: Box<dyn WebrenderApi>,
|
webrender_api: Box<dyn WebrenderApi>,
|
||||||
antialias: AntialiasMode,
|
antialias: AntialiasMode,
|
||||||
canvas_id: CanvasId,
|
|
||||||
font_cache_thread: FontCacheThread,
|
font_cache_thread: FontCacheThread,
|
||||||
) -> CanvasData<'a> {
|
) -> CanvasData<'a> {
|
||||||
let backend = create_backend();
|
let backend = create_backend();
|
||||||
|
@ -437,7 +435,6 @@ impl<'a> CanvasData<'a> {
|
||||||
old_image_key: None,
|
old_image_key: None,
|
||||||
very_old_image_key: None,
|
very_old_image_key: None,
|
||||||
font_cache_thread: Mutex::new(font_cache_thread),
|
font_cache_thread: Mutex::new(font_cache_thread),
|
||||||
_canvas_id: canvas_id,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,6 +492,7 @@ impl<'a> CanvasData<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#text-preparation-algorithm
|
||||||
pub fn fill_text(
|
pub fn fill_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
text: String,
|
text: String,
|
||||||
|
|
|
@ -134,7 +134,6 @@ impl<'a> CanvasPaintThread<'a> {
|
||||||
size,
|
size,
|
||||||
self.webrender_api.clone(),
|
self.webrender_api.clone(),
|
||||||
antialias,
|
antialias,
|
||||||
canvas_id.clone(),
|
|
||||||
font_cache_thread,
|
font_cache_thread,
|
||||||
);
|
);
|
||||||
self.canvases.insert(canvas_id.clone(), canvas_data);
|
self.canvases.insert(canvas_id.clone(), canvas_data);
|
||||||
|
|
|
@ -2601,7 +2601,8 @@ pub mod style_structs {
|
||||||
|
|
||||||
% for style_struct in data.active_style_structs():
|
% for style_struct in data.active_style_structs():
|
||||||
% if style_struct.name == "Font":
|
% if style_struct.name == "Font":
|
||||||
#[derive(Clone, Debug, MallocSizeOf, Serialize, Deserialize)]
|
#[derive(Clone, Debug, MallocSizeOf)]
|
||||||
|
#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
|
||||||
% else:
|
% else:
|
||||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||||
% endif
|
% endif
|
||||||
|
|
|
@ -93,9 +93,8 @@ impl From<FontWeight> for FontKitFontWeight {
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToCss,
|
ToCss,
|
||||||
ToResolvedValue,
|
ToResolvedValue,
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
|
||||||
/// The computed value of font-size
|
/// The computed value of font-size
|
||||||
pub struct FontSize {
|
pub struct FontSize {
|
||||||
/// The size.
|
/// The size.
|
||||||
|
@ -478,20 +477,10 @@ impl From<&SingleFontFamily> for FontKitFamilyName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem,
|
||||||
Debug,
|
|
||||||
Eq,
|
|
||||||
Hash,
|
|
||||||
MallocSizeOf,
|
|
||||||
PartialEq,
|
|
||||||
ToComputedValue,
|
|
||||||
ToResolvedValue,
|
|
||||||
ToShmem,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
|
||||||
/// A list of SingleFontFamily
|
/// A list of SingleFontFamily
|
||||||
pub struct FontFamilyList(Box<[SingleFontFamily]>);
|
pub struct FontFamilyList(Box<[SingleFontFamily]>);
|
||||||
|
|
||||||
|
|
|
@ -496,9 +496,8 @@ impl ToComputedValue for FontStretch {
|
||||||
ToCss,
|
ToCss,
|
||||||
ToResolvedValue,
|
ToResolvedValue,
|
||||||
ToShmem,
|
ToShmem,
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum KeywordSize {
|
pub enum KeywordSize {
|
||||||
#[css(keyword = "xx-small")]
|
#[css(keyword = "xx-small")]
|
||||||
|
@ -542,9 +541,8 @@ impl Default for KeywordSize {
|
||||||
ToCss,
|
ToCss,
|
||||||
ToResolvedValue,
|
ToResolvedValue,
|
||||||
ToShmem,
|
ToShmem,
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
|
||||||
/// Additional information for keyword-derived font sizes.
|
/// Additional information for keyword-derived font sizes.
|
||||||
pub struct KeywordInfo {
|
pub struct KeywordInfo {
|
||||||
/// The keyword used
|
/// The keyword used
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue