mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Add a pref for |clip-path:path()|.
Add a preference, layout.css.clip-path-path.enabled, for |clip-path:path()|. Differential Revision: https://phabricator.services.mozilla.com/D4965
This commit is contained in:
parent
3f08d2cc02
commit
cf6215c85f
1 changed files with 12 additions and 5 deletions
|
@ -49,17 +49,24 @@ pub type ShapeRadius = generic::ShapeRadius<LengthOrPercentage>;
|
|||
/// The specified value of `Polygon`
|
||||
pub type Polygon = generic::Polygon<LengthOrPercentage>;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
|
||||
use gecko_bindings::structs::mozilla;
|
||||
context.chrome_rules_enabled() ||
|
||||
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled }
|
||||
}
|
||||
#[cfg(feature = "servo")]
|
||||
fn is_clip_path_path_enabled(_: &ParserContext) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
impl Parse for ClippingShape {
|
||||
#[inline]
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
// |clip-path:path()| is a chrome-only property value support for now. `path()` is
|
||||
// defined in css-shape-2, but the spec is not stable enough, and we haven't decided
|
||||
// to make it public yet. However, it has some benefits for the front-end, so we
|
||||
// implement it.
|
||||
if context.chrome_rules_enabled() {
|
||||
if is_clip_path_path_enabled(context) {
|
||||
if let Ok(p) = input.try(|i| Path::parse(context, i)) {
|
||||
return Ok(ShapeSource::Path(p));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue