Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] svg: support <circle> element #17681

Closed
wants to merge 10 commits into from
Next

style: Supoort "fill", "x", "y", and "r" svg properties

Implement "fill", "x", "y", and "r" svg properties in servo.
  • Loading branch information
stshine committed Sep 11, 2017
commit 61067f49f349e66421e8b4c0ebba3d7bd2bd94af
@@ -440,4 +440,10 @@ partial interface CSSStyleDeclaration {
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString animationFillMode;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString animation-delay;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString animationDelay;

[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString cx;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString cy;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString r;
[CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString fill;

};
@@ -34,7 +34,6 @@ ${helpers.single_keyword("color-interpolation-filters", "linearrgb auto srgb",
${helpers.predefined_type(
"fill", "SVGPaint",
"::values::computed::SVGPaint::black()",
products="gecko",
animation_value_type="IntermediateSVGPaint",
boxed=True,
spec="https://www.w3.org/TR/SVG2/painting.html#SpecifyingFillPaint")}
@@ -169,3 +169,27 @@ ${helpers.predefined_type("mask-image", "ImageLayer",
animation_value_type="discrete",
flags="CREATES_STACKING_CONTEXT",
has_uncacheable_values="True" if product == "gecko" else "False")}

${helpers.predefined_type(

This comment has been minimized.

Copy link
@emilio

emilio Jul 12, 2017

Member

Are these actual CSS properties? This will allow them to be parsed from style attributes, which may not be what you want.

This comment has been minimized.

Copy link
@stshine

stshine Jul 18, 2017

Author Contributor

Yes they are, according the SVG2 spec every SVG presentation attribute is a css property. For example, you can do this in Chrome.

"cx", "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_numbers_are_pixels_non_negative",
products="servo",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#CxProperty")}

${helpers.predefined_type(
"cy", "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_numbers_are_pixels_non_negative",
products="servo",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#CyProperty")}

${helpers.predefined_type(
"r", "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_numbers_are_pixels_non_negative",
products="servo",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#R")}
@@ -212,7 +212,8 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
get_inheritedbox.direction, get_inheritedbox.writing_mode,
get_text.text_decoration_line, get_text.unicode_bidi,
get_inheritedtable.empty_cells, get_inheritedtable.caption_side,
get_column.column_width, get_column.column_count
get_column.column_width, get_column.column_count,
get_inheritedsvg.fill, get_svg.cx, get_svg.cy, get_svg.r

This comment has been minimized.

Copy link
@emilio

emilio Jul 12, 2017

Member

Ok, so you actually want a style struct field, but not exposing it as a CSS property... So at least you need to use internal="True" on the property definition, and document that it's not web-exposed.

This comment has been minimized.

Copy link
@emilio

emilio Jul 12, 2017

Member

Also, are you sure you want changes to fill to fully reflow the element? Why is that needed?

This comment has been minimized.

Copy link
@stshine

stshine Jul 18, 2017

Author Contributor

To be honest I am not really familiar with the incremental reflow infrastructure, will try to resolve this.

]) || (new.get_box().display == display::T::inline &&
add_if_not_equal!(old, new, damage,
[REPAINT, REPOSITION, STORE_OVERFLOW, BUBBLE_ISIZES,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.