Bug 1532856 - Serialize radii with servo. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 06 Mar 2019 04:47:47 +0000
changeset 520481 6a337f6390227e9903c436e125a1d198c0d01781
parent 520480 020e9abe510a885e1ce61db806fc5f65b0568014
child 520482 a52bca8b0dd5027e116400b9dfa69a3d53ba8cb6
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1532856
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532856 - Serialize radii with servo. r=heycam Differential Revision: https://phabricator.services.mozilla.com/D22231
layout/style/ServoCSSPropList.mako.py
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/test/test_transitions_per_property.html
--- a/layout/style/ServoCSSPropList.mako.py
+++ b/layout/style/ServoCSSPropList.mako.py
@@ -61,26 +61,18 @@ def method(prop):
     return prop.camel_case
 
 # TODO(emilio): Get this to zero.
 LONGHANDS_NOT_SERIALIZED_WITH_SERVO = [
     "animation-delay",
     "animation-duration",
     "animation-iteration-count",
     "animation-name",
-    "border-bottom-left-radius",
-    "border-bottom-right-radius",
-    "border-end-end-radius",
-    "border-end-start-radius",
     "border-image-width",
     "border-spacing",
-    "border-start-end-radius",
-    "border-start-start-radius",
-    "border-top-left-radius",
-    "border-top-right-radius",
     "border-image-width",
     "border-spacing",
     "box-shadow",
     "caret-color",
     "color",
     "column-count",
     "column-gap",
     "column-rule-width",
@@ -111,20 +103,16 @@ LONGHANDS_NOT_SERIALIZED_WITH_SERVO = [
     "min-block-size",
     "min-height",
     "min-inline-size",
     "min-width",
     "-moz-binding",
     "-moz-box-flex",
     "-moz-force-broken-image-icon",
     "-moz-osx-font-smoothing",
-    "-moz-outline-radius-bottomleft",
-    "-moz-outline-radius-bottomright",
-    "-moz-outline-radius-topleft",
-    "-moz-outline-radius-topright",
     "outline-width",
     "paint-order",
     "row-gap",
     "scrollbar-color",
     "scroll-snap-points-x",
     "scroll-snap-points-y",
     "stroke",
     "text-decoration-line",
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -1780,32 +1780,16 @@ already_AddRefed<CSSValue> nsComputedDOM
   ySpacing->SetAppUnits(border->mBorderSpacingRow);
 
   valueList->AppendCSSValue(xSpacing.forget());
   valueList->AppendCSSValue(ySpacing.forget());
 
   return valueList.forget();
 }
 
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderBottomLeftRadius() {
-  return GetEllipseRadii(StyleBorder()->mBorderRadius, eCornerBottomLeft);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderBottomRightRadius() {
-  return GetEllipseRadii(StyleBorder()->mBorderRadius, eCornerBottomRight);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderTopLeftRadius() {
-  return GetEllipseRadii(StyleBorder()->mBorderRadius, eCornerTopLeft);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderTopRightRadius() {
-  return GetEllipseRadii(StyleBorder()->mBorderRadius, eCornerTopRight);
-}
-
 already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderTopWidth() {
   return GetBorderWidthFor(eSideTop);
 }
 
 already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBorderBottomWidth() {
   return GetBorderWidthFor(eSideBottom);
 }
 
@@ -1882,58 +1866,16 @@ already_AddRefed<CSSValue> nsComputedDOM
 }
 
 already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOutlineWidth() {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetAppUnits(StyleOutline()->GetOutlineWidth());
   return val.forget();
 }
 
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOutlineRadiusBottomLeft() {
-  return GetEllipseRadii(StyleOutline()->mOutlineRadius, eCornerBottomLeft);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOutlineRadiusBottomRight() {
-  return GetEllipseRadii(StyleOutline()->mOutlineRadius, eCornerBottomRight);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOutlineRadiusTopLeft() {
-  return GetEllipseRadii(StyleOutline()->mOutlineRadius, eCornerTopLeft);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOutlineRadiusTopRight() {
-  return GetEllipseRadii(StyleOutline()->mOutlineRadius, eCornerTopRight);
-}
-
-already_AddRefed<CSSValue> nsComputedDOMStyle::GetEllipseRadii(
-    const BorderRadius& aRadius, Corner aFullCorner) {
-  const auto& radiusX = aRadius.Get(FullToHalfCorner(aFullCorner, false));
-  const auto& radiusY = aRadius.Get(FullToHalfCorner(aFullCorner, true));
-
-  // for compatibility, return a single value if X and Y are equal
-  if (radiusX == radiusY) {
-    RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-    SetValueToLengthPercentage(val, radiusX, true);
-    return val.forget();
-  }
-
-  RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
-
-  RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
-  RefPtr<nsROCSSPrimitiveValue> valY = new nsROCSSPrimitiveValue;
-
-  SetValueToLengthPercentage(valX, radiusX, true);
-  SetValueToLengthPercentage(valY, radiusY, true);
-
-  valueList->AppendCSSValue(valX.forget());
-  valueList->AppendCSSValue(valY.forget());
-
-  return valueList.forget();
-}
-
 already_AddRefed<CSSValue> nsComputedDOMStyle::GetCSSShadowArray(
     nsCSSShadowArray* aArray, bool aIsBoxShadow) {
   if (!aArray) {
     RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
     val->SetIdent(eCSSKeyword_none);
     return val.forget();
   }
 
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -164,19 +164,16 @@ class nsComputedDOMStyle final : public 
 #undef STYLE_STRUCT
 
   /**
    * A method to get a percentage base for a percentage value.  Returns true
    * if a percentage base value was determined, false otherwise.
    */
   typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
 
-  already_AddRefed<CSSValue> GetEllipseRadii(const mozilla::BorderRadius&,
-                                             mozilla::Corner aFullCorner);
-
   already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side);
   already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::Side);
   nscoord GetUsedAbsoluteOffset(mozilla::Side);
   already_AddRefed<CSSValue> GetNonStaticPositionOffset(
       mozilla::Side aSide, bool aResolveAuto, PercentageBaseGetter aWidthGetter,
       PercentageBaseGetter aHeightGetter);
 
   already_AddRefed<CSSValue> GetStaticOffset(mozilla::Side aSide);
@@ -284,39 +281,31 @@ class nsComputedDOMStyle final : public 
   already_AddRefed<CSSValue> DoGetBorderSpacing();
   already_AddRefed<CSSValue> DoGetVerticalAlign();
 
   /* Border Properties */
   already_AddRefed<CSSValue> DoGetBorderTopWidth();
   already_AddRefed<CSSValue> DoGetBorderBottomWidth();
   already_AddRefed<CSSValue> DoGetBorderLeftWidth();
   already_AddRefed<CSSValue> DoGetBorderRightWidth();
-  already_AddRefed<CSSValue> DoGetBorderBottomLeftRadius();
-  already_AddRefed<CSSValue> DoGetBorderBottomRightRadius();
-  already_AddRefed<CSSValue> DoGetBorderTopLeftRadius();
-  already_AddRefed<CSSValue> DoGetBorderTopRightRadius();
 
   /* Border Image */
   already_AddRefed<CSSValue> DoGetBorderImageWidth();
 
   /* Box Shadow */
   already_AddRefed<CSSValue> DoGetBoxShadow();
 
   /* Margin Properties */
   already_AddRefed<CSSValue> DoGetMarginTopWidth();
   already_AddRefed<CSSValue> DoGetMarginBottomWidth();
   already_AddRefed<CSSValue> DoGetMarginLeftWidth();
   already_AddRefed<CSSValue> DoGetMarginRightWidth();
 
   /* Outline Properties */
   already_AddRefed<CSSValue> DoGetOutlineWidth();
-  already_AddRefed<CSSValue> DoGetOutlineRadiusBottomLeft();
-  already_AddRefed<CSSValue> DoGetOutlineRadiusBottomRight();
-  already_AddRefed<CSSValue> DoGetOutlineRadiusTopLeft();
-  already_AddRefed<CSSValue> DoGetOutlineRadiusTopRight();
 
   /* Text Properties */
   already_AddRefed<CSSValue> DoGetInitialLetter();
   already_AddRefed<CSSValue> DoGetLineHeight();
   already_AddRefed<CSSValue> DoGetTextDecoration();
   already_AddRefed<CSSValue> DoGetTextDecorationColor();
   already_AddRefed<CSSValue> DoGetTextDecorationLine();
   already_AddRefed<CSSValue> DoGetTextDecorationStyle();
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -2133,20 +2133,20 @@ function test_radius_transition(prop) {
      "radius-valued property " + prop + ": interpolation of radius");
   check_distance(prop, "12.5% 6.25%", "15.625% 10.9375%", "25%");
   div.style.setProperty("transition-property", "none", "");
   div.style.setProperty(prop, "6.25% 12.5%", "");
   is(cs.getPropertyValue(prop), "6.25% 12.5%",
      "radius-valued property " + prop + ": computed value before transition");
   div.style.setProperty("transition-property", prop, "");
   div.style.setProperty(prop, "64px 16px", "");
-  is(cs.getPropertyValue(prop), "calc(16px + 4.6875%) calc(4px + 9.375%)",
+  is(cs.getPropertyValue(prop), "calc(4.6875% + 16px) calc(9.375% + 4px)",
      "radius-valued property " + prop + ": interpolation of radius with mixed units");
   check_distance(prop, "6.25% 12.5%",
-                 "calc(16px + 4.6875%) calc(4px + 9.375%)",
+                 "calc(4.6875% + 16px) calc(9.375% + 4px)",
                  "64px 16px");
 
   div.style.setProperty("transition-property", "none", "");
   div.style.setProperty(prop, "calc(5px) 10px", "");
   is(cs.getPropertyValue(prop), "5px 10px",
      "radius-valued property " + prop + ": computed value before transition");
   div.style.setProperty("transition-property", prop, "");
   div.style.setProperty(prop, "calc(25px) calc(50px)", "");