mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #16623 - aacunningham:issue-16604-define-keyword-type-modification, r=Wafflespeanut
Move impl's into macro for macro-generated keyword types Three keyword types are created through a macro but have some of their impl's handled elsewhere. Since all impl's are the same, this commit moves them into the macro to have them auto generated, for more concise code. <!-- 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 - [X] These changes fix #16604 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because this doesn't add any new features, just alters `impl` locations <!-- 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. --> <!-- 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/16623) <!-- Reviewable:end -->
This commit is contained in:
commit
ad87d36a69
2 changed files with 17 additions and 52 deletions
|
@ -11,6 +11,7 @@
|
|||
use Atom;
|
||||
pub use cssparser::{RGBA, Token, Parser, serialize_identifier, serialize_string};
|
||||
use parser::{Parse, ParserContext};
|
||||
use properties::animated_properties::{ComputeDistance, Interpolate};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{self, Debug};
|
||||
|
@ -126,6 +127,20 @@ macro_rules! define_keyword_type {
|
|||
}
|
||||
}
|
||||
|
||||
impl Interpolate for $name {
|
||||
#[inline]
|
||||
fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
|
||||
Ok($name)
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputeDistance for $name {
|
||||
#[inline]
|
||||
fn compute_distance(&self, _other: &Self) -> Result<f64, ()> {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, $css)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue