mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #17964 - dadaa:bug1386963, r=hiro
Make 'image-orientation' and 'paint-order' animatable <!-- 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 <!-- Either: --> - [ ] There are tests for these changes. The test code is patch 3 in https://bugzilla.mozilla.org/show_bug.cgi?id=1386963 <!-- 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/17964) <!-- Reviewable:end -->
This commit is contained in:
commit
50c9797ddd
3 changed files with 51 additions and 2 deletions
|
@ -4546,6 +4546,31 @@ fn static_assert() {
|
|||
pub fn reset_image_orientation(&mut self, other: &Self) {
|
||||
self.copy_image_orientation_from(other)
|
||||
}
|
||||
|
||||
pub fn clone_image_orientation(&self) -> longhands::image_orientation::computed_value::T {
|
||||
use gecko_bindings::structs::{nsStyleImageOrientation_Bits, nsStyleImageOrientation_Angles};
|
||||
use properties::longhands::image_orientation::computed_value::{Orientation, T};
|
||||
|
||||
let gecko_orientation = self.gecko.mImageOrientation.mOrientation;
|
||||
if gecko_orientation & nsStyleImageOrientation_Bits::FROM_IMAGE_MASK as u8 != 0 {
|
||||
T::FromImage
|
||||
} else {
|
||||
const ANGLE0: u8 = nsStyleImageOrientation_Angles::ANGLE_0 as u8;
|
||||
const ANGLE90: u8 = nsStyleImageOrientation_Angles::ANGLE_90 as u8;
|
||||
const ANGLE180: u8 = nsStyleImageOrientation_Angles::ANGLE_180 as u8;
|
||||
const ANGLE270: u8 = nsStyleImageOrientation_Angles::ANGLE_270 as u8;
|
||||
|
||||
let flip = gecko_orientation & nsStyleImageOrientation_Bits::FLIP_MASK as u8 != 0;
|
||||
let orientation = match gecko_orientation & nsStyleImageOrientation_Bits::ORIENTATION_MASK as u8 {
|
||||
ANGLE0 => Orientation::Angle0,
|
||||
ANGLE90 => Orientation::Angle90,
|
||||
ANGLE180 => Orientation::Angle180,
|
||||
ANGLE270 => Orientation::Angle270,
|
||||
_ => unreachable!()
|
||||
};
|
||||
T::AngleWithFlipped(orientation, flip)
|
||||
}
|
||||
}
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="InheritedTable"
|
||||
|
@ -5082,6 +5107,30 @@ clip-path
|
|||
|
||||
${impl_simple_copy('paint_order', 'mPaintOrder')}
|
||||
|
||||
pub fn clone_paint_order(&self) -> longhands::paint_order::computed_value::T {
|
||||
use self::longhands::paint_order::{COUNT, FILL, MARKERS, NORMAL, SHIFT, STROKE};
|
||||
use self::longhands::paint_order::computed_value::T;
|
||||
|
||||
if self.gecko.mPaintOrder == structs::NS_STYLE_PAINT_ORDER_NORMAL as u8 {
|
||||
return T(NORMAL);
|
||||
}
|
||||
|
||||
const PAINT_ORDER_BITWIDTH: u8 = structs::NS_STYLE_PAINT_ORDER_BITWIDTH as u8;
|
||||
let mask = (1 << PAINT_ORDER_BITWIDTH) - 1;
|
||||
let mut order = 0;
|
||||
for pos in 0..COUNT {
|
||||
let value =
|
||||
match (self.gecko.mPaintOrder >> pos * PAINT_ORDER_BITWIDTH & mask) as u32 {
|
||||
structs::NS_STYLE_PAINT_ORDER_FILL => FILL,
|
||||
structs::NS_STYLE_PAINT_ORDER_STROKE => STROKE,
|
||||
structs::NS_STYLE_PAINT_ORDER_MARKERS => MARKERS,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
order |= value << (pos * SHIFT);
|
||||
};
|
||||
T(order)
|
||||
}
|
||||
|
||||
pub fn set_stroke_dasharray(&mut self, v: longhands::stroke_dasharray::computed_value::T) {
|
||||
use gecko_bindings::structs::nsStyleSVG_STROKE_DASHARRAY_CONTEXT as CONTEXT_VALUE;
|
||||
use values::generics::svg::SVGStrokeDashArray;
|
||||
|
|
|
@ -59,7 +59,7 @@ ${helpers.single_keyword("image-rendering",
|
|||
// Image Orientation
|
||||
<%helpers:longhand name="image-orientation"
|
||||
products="gecko"
|
||||
animation_value_type="none"
|
||||
animation_value_type="discrete"
|
||||
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \
|
||||
/// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation">
|
||||
use std::fmt;
|
||||
|
|
|
@ -133,7 +133,7 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
|
|||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
|
||||
|
||||
<%helpers:longhand name="paint-order"
|
||||
animation_value_type="none"
|
||||
animation_value_type="discrete"
|
||||
products="gecko"
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue