mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #14394 - jcdyer:jcdyer/either-column-width, r=Wafflespeanut
Convert column-width to use Either <!-- Please describe your changes on the following line: --> * Converted column-width to use `Either<Length, Auto>` * Added gecko glue code * Cleaned up old column-width glue code --- <!-- 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 #14350 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because tests already surround the refactored code. <!-- 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/14394) <!-- Reviewable:end -->
This commit is contained in:
commit
a913815a4d
8 changed files with 38 additions and 97 deletions
|
@ -10,7 +10,7 @@ use gecko_bindings::structs::{NS_RADIUS_CLOSEST_SIDE, NS_RADIUS_FARTHEST_SIDE};
|
|||
use gecko_bindings::structs::nsStyleCoord;
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use std::cmp::max;
|
||||
use values::Either;
|
||||
use values::{Auto, Either};
|
||||
use values::computed::{Angle, LengthOrPercentageOrNone, Number};
|
||||
use values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use values::computed::basic_shape::ShapeRadius;
|
||||
|
@ -187,6 +187,20 @@ impl GeckoStyleCoordConvertible for Angle {
|
|||
}
|
||||
}
|
||||
|
||||
impl GeckoStyleCoordConvertible for Auto {
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
coord.set_value(CoordDataValue::Auto)
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
if let CoordDataValue::Auto = coord.as_value() {
|
||||
Some(Auto)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 {
|
||||
(((rgba.alpha * 255.0).round() as u32) << 24) |
|
||||
(((rgba.blue * 255.0).round() as u32) << 16) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue