Skip to content

Commit 816c355

Browse files
authored
Let resolve_color() take its parameter by reference (#116)
This way the callers don't have to clone it if they don't have ownership or want to use the value later. Signed-off-by: Oriol Brufau <[email protected]>
1 parent 06e3f12 commit 816c355

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

style/properties/properties.mako.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1874,9 +1874,9 @@ impl ComputedValues {
18741874
///
18751875
/// Usage example:
18761876
/// let top_color =
1877-
/// style.resolve_color(style.get_border().clone_border_top_color());
1877+
/// style.resolve_color(&style.get_border().clone_border_top_color());
18781878
#[inline]
1879-
pub fn resolve_color(&self, color: computed::Color) -> crate::color::AbsoluteColor {
1879+
pub fn resolve_color(&self, color: &computed::Color) -> crate::color::AbsoluteColor {
18801880
let current_color = self.get_inherited_text().clone_color();
18811881
color.resolve_to_absolute(&current_color)
18821882
}

style/values/resolved/color.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl ToResolvedValue for computed::Color {
1616

1717
#[inline]
1818
fn to_resolved_value(self, context: &Context) -> Self::ResolvedValue {
19-
context.style.resolve_color(self)
19+
context.style.resolve_color(&self)
2020
}
2121

2222
#[inline]

0 commit comments

Comments
 (0)