This patch replaces the handwritten MallocSizeOf implementation for PropertyDeclaration with a derived one, which gives much more thorough measurement. This requires (a) deriving MallocSizeOf for a *lot* of additional types (most of which already have `derive(HeapSizeOf)` in Servo builds), and (b) implementing MallocSizeOf for a few more types in the `malloc_size_of` crate. These changes would significantly improve the reporting coverage for gmail if it weren't for the fact that SpecifiedUrl isn't measured due to a lack of clarity about its fields; that can be fixed as a follow-up once bug 1397971 has landed. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because testing is on the Gecko side. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 097cea240fe9b1d96fa4ef5ffa984f09e0bd04f3
29 lines
1.0 KiB
Rust
29 lines
1.0 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//! Generic types for CSS handling of specified and computed values of
|
|
//! [`position`](https://drafts.csswg.org/css-backgrounds-3/#position)
|
|
|
|
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
|
|
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
|
#[derive(PartialEq, ToAnimatedZero, ToComputedValue)]
|
|
pub struct Position<H, V> {
|
|
/// The horizontal component of position.
|
|
pub horizontal: H,
|
|
/// The vertical component of position.
|
|
pub vertical: V,
|
|
}
|
|
|
|
impl<H, V> Position<H, V> {
|
|
/// Returns a new position.
|
|
pub fn new(horizontal: H, vertical: V) -> Self {
|
|
Self {
|
|
horizontal: horizontal,
|
|
vertical: vertical,
|
|
}
|
|
}
|
|
}
|