mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
stylo: Support marker
shorthand; update boxing
MozReview-Commit-ID: 7B6h4IDZD67
This commit is contained in:
parent
895fcb222b
commit
66a28a4f5a
2 changed files with 44 additions and 8 deletions
|
@ -72,7 +72,6 @@ ${helpers.predefined_type(
|
|||
products="gecko",
|
||||
animatable=True,
|
||||
needs_context=False,
|
||||
boxed=True,
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth")}
|
||||
|
||||
${helpers.single_keyword("stroke-linecap", "butt round square",
|
||||
|
@ -107,7 +106,6 @@ ${helpers.predefined_type(
|
|||
"parse_numbers_are_pixels",
|
||||
products="gecko",
|
||||
animatable=True,
|
||||
boxed=True,
|
||||
needs_context=False,
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")}
|
||||
|
||||
|
@ -122,20 +120,17 @@ ${helpers.single_keyword("clip-rule", "nonzero evenodd",
|
|||
${helpers.predefined_type("marker-start", "UrlOrNone", "Either::Second(None_)",
|
||||
products="gecko",
|
||||
animatable="False",
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties",
|
||||
boxed=True)}
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
|
||||
|
||||
${helpers.predefined_type("marker-mid", "UrlOrNone", "Either::Second(None_)",
|
||||
products="gecko",
|
||||
animatable="False",
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties",
|
||||
boxed=True)}
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
|
||||
|
||||
${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
|
||||
products="gecko",
|
||||
animatable="False",
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties",
|
||||
boxed=True)}
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
|
||||
|
||||
<%helpers:longhand name="paint-order"
|
||||
animatable="False"
|
||||
|
@ -171,12 +166,17 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
|
|||
/// Higher priority values, i.e. the values specified first,
|
||||
/// will be painted first (and may be covered by paintings of lower priority)
|
||||
#[derive(PartialEq, Clone, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct SpecifiedValue(pub u8);
|
||||
|
||||
pub mod computed_value {
|
||||
pub use super::SpecifiedValue as T;
|
||||
}
|
||||
|
||||
pub fn get_initial_value() -> SpecifiedValue {
|
||||
SpecifiedValue(NORMAL)
|
||||
}
|
||||
|
||||
impl SpecifiedValue {
|
||||
pub fn bits_at(&self, pos: u8) -> u8 {
|
||||
(self.0 >> pos * SHIFT) & MASK
|
||||
|
|
36
components/style/properties/shorthand/inherited_svg.mako.rs
Normal file
36
components/style/properties/shorthand/inherited_svg.mako.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||
|
||||
<%helpers:shorthand name="marker" products="gecko"
|
||||
sub_properties="marker-start marker-end marker-mid"
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#MarkerShorthand">
|
||||
use values::specified::UrlOrNone;
|
||||
|
||||
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||
let url = UrlOrNone::parse(context, input)?;
|
||||
|
||||
Ok(Longhands {
|
||||
marker_start: url.clone(),
|
||||
marker_mid: url.clone(),
|
||||
marker_end: url,
|
||||
})
|
||||
}
|
||||
|
||||
impl<'a> LonghandsToSerialize<'a> {
|
||||
fn to_css_declared<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
if let DeclaredValue::Value(ref start) = *self.marker_start {
|
||||
if let DeclaredValue::Value(ref mid) = *self.marker_mid {
|
||||
if let DeclaredValue::Value(ref end) = *self.marker_end {
|
||||
if start == mid && mid == end {
|
||||
start.to_css(dest)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
Loading…
Add table
Add a link
Reference in a new issue