diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-12-15 20:15:29 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-12-16 14:23:56 +0100 |
commit | 789ddd9dc12fa9a54dc4acf6a80298ebf5e728ee (patch) | |
tree | 663c1bcce541a9dc450551cb06c0a8ad897da51f /components/style/logical_geometry.rs | |
parent | a541046147e5713b0c8fb5ac3c016635515dce18 (diff) | |
download | servo-789ddd9dc12fa9a54dc4acf6a80298ebf5e728ee.tar.gz servo-789ddd9dc12fa9a54dc4acf6a80298ebf5e728ee.zip |
style: Make LengthPercentage not copy.
This is needed to support min() / max() / clamp(), etc.
Differential Revision: https://phabricator.services.mozilla.com/D57249
Diffstat (limited to 'components/style/logical_geometry.rs')
-rw-r--r-- | components/style/logical_geometry.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index cb45544146b..fc3d5c95d12 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -468,7 +468,7 @@ impl<T: Zero> LogicalSize<T> { } } -impl<T: Copy> LogicalSize<T> { +impl<T> LogicalSize<T> { #[inline] pub fn new(mode: WritingMode, inline: T, block: T) -> LogicalSize<T> { LogicalSize { @@ -486,7 +486,9 @@ impl<T: Copy> LogicalSize<T> { LogicalSize::new(mode, size.width, size.height) } } +} +impl<T: Copy> LogicalSize<T> { #[inline] pub fn width(&self, mode: WritingMode) -> T { self.debug_writing_mode.check(mode); @@ -860,7 +862,7 @@ impl<T: Zero> LogicalMargin<T> { } } -impl<T: Copy> LogicalMargin<T> { +impl<T> LogicalMargin<T> { #[inline] pub fn new( mode: WritingMode, @@ -879,11 +881,6 @@ impl<T: Copy> LogicalMargin<T> { } #[inline] - pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin<T> { - LogicalMargin::new(mode, value, value, value, value) - } - - #[inline] pub fn from_physical(mode: WritingMode, offsets: SideOffsets2D<T>) -> LogicalMargin<T> { let block_start; let inline_end; @@ -917,6 +914,14 @@ impl<T: Copy> LogicalMargin<T> { } LogicalMargin::new(mode, block_start, inline_end, block_end, inline_start) } +} + + +impl<T: Copy> LogicalMargin<T> { + #[inline] + pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin<T> { + LogicalMargin::new(mode, value, value, value, value) + } #[inline] pub fn top(&self, mode: WritingMode) -> T { |