mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Derive HeapSizeOf for GradientDisplayItem
This commit is contained in:
parent
55dcee94be
commit
966da85791
1 changed files with 1 additions and 16 deletions
|
@ -1238,7 +1238,7 @@ pub struct ImageDisplayItem {
|
||||||
|
|
||||||
|
|
||||||
/// Paints a gradient.
|
/// Paints a gradient.
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct GradientDisplayItem {
|
pub struct GradientDisplayItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
@ -1253,21 +1253,6 @@ pub struct GradientDisplayItem {
|
||||||
pub stops: Vec<GradientStop>,
|
pub stops: Vec<GradientStop>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl HeapSizeOf for GradientDisplayItem {
|
|
||||||
fn heap_size_of_children(&self) -> usize {
|
|
||||||
use heapsize::heap_size_of;
|
|
||||||
use std::os::raw::c_void;
|
|
||||||
|
|
||||||
// We can't measure `stops` via Vec's HeapSizeOf implementation because GradientStop isn't
|
|
||||||
// defined in this module, and we don't want to import GradientStop into util::mem where
|
|
||||||
// the HeapSizeOf trait is defined. So we measure the elements directly.
|
|
||||||
self.base.heap_size_of_children() +
|
|
||||||
heap_size_of(self.stops.as_ptr() as *const c_void)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Paints a border.
|
/// Paints a border.
|
||||||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||||
pub struct BorderDisplayItem {
|
pub struct BorderDisplayItem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue