Bug 550426 - Add support for {background,mask}-position-{x,y}, computed style additions. r=dbaron
authorMarkus Stange <mstange@themasta.com>
Thu, 21 Apr 2016 20:23:02 -0400
changeset 295564 79beeb3fc21d87c0a54adc189c0e2e9315ac3a89
parent 295563 4f8b919097f6af3c40e447dee83632e3a3b9d589
child 295565 1cf4349a48ca1fb08930160a4fad1f71e6b9b403
push id30226
push usercbook@mozilla.com
push dateMon, 02 May 2016 09:26:03 +0000
treeherdermozilla-central@77cead2cd203 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs550426
milestone49.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 550426 - Add support for {background,mask}-position-{x,y}, computed style additions. r=dbaron MozReview-Commit-ID: 5GSsS7EYwfB
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsComputedDOMStylePropertyList.h
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -2172,16 +2172,42 @@ nsComputedDOMStyle::DoGetImageLayerPosit
     SetValueToPosition(aLayers.mLayers[i].mPosition, itemList);
     valueList->AppendCSSValue(itemList.forget());
   }
 
   return valueList.forget();
 }
 
 already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetImageLayerPositionX(const nsStyleImageLayers& aLayers)
+{
+  RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
+  for (uint32_t i = 0, i_end = aLayers.mPositionXCount; i < i_end; ++i) {
+    RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
+    SetValueToPositionCoord(aLayers.mLayers[i].mPosition.mXPosition, val);
+    valueList->AppendCSSValue(val.forget());
+  }
+
+  return valueList.forget();
+}
+
+already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetImageLayerPositionY(const nsStyleImageLayers& aLayers)
+{
+  RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
+  for (uint32_t i = 0, i_end = aLayers.mPositionYCount; i < i_end; ++i) {
+    RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
+    SetValueToPositionCoord(aLayers.mLayers[i].mPosition.mYPosition, val);
+    valueList->AppendCSSValue(val.forget());
+  }
+
+  return valueList.forget();
+}
+
+already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers)
 {
   RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
 
   for (uint32_t i = 0, i_end = aLayers.mRepeatCount; i < i_end; ++i) {
     RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
     RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
 
@@ -2361,16 +2387,30 @@ nsComputedDOMStyle::SetValueToPosition(
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBackgroundPosition()
 {
   const nsStyleImageLayers& layers = StyleBackground()->mImage;
   return DoGetImageLayerPosition(layers);
 }
 
 already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetBackgroundPositionX()
+{
+  const nsStyleImageLayers& layers = StyleBackground()->mImage;
+  return DoGetImageLayerPositionX(layers);
+}
+
+already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetBackgroundPositionY()
+{
+  const nsStyleImageLayers& layers = StyleBackground()->mImage;
+  return DoGetImageLayerPositionY(layers);
+}
+
+already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBackgroundRepeat()
 {
   const nsStyleImageLayers& layers = StyleBackground()->mImage;
   return DoGetImageLayerRepeat(layers);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBackgroundSize()
@@ -6119,16 +6159,30 @@ nsComputedDOMStyle::DoGetMaskOrigin()
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetMaskPosition()
 {
   const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
   return DoGetImageLayerPosition(layers);
 }
 
 already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetMaskPositionX()
+{
+  const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
+  return DoGetImageLayerPositionX(layers);
+}
+
+already_AddRefed<CSSValue>
+nsComputedDOMStyle::DoGetMaskPositionY()
+{
+  const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
+  return DoGetImageLayerPositionY(layers);
+}
+
+already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetMaskRepeat()
 {
   const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
   return DoGetImageLayerRepeat(layers);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetMaskSize()
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -283,35 +283,41 @@ private:
   already_AddRefed<CSSValue> DoGetGridRowStart();
   already_AddRefed<CSSValue> DoGetGridRowEnd();
   already_AddRefed<CSSValue> DoGetGridColumnGap();
   already_AddRefed<CSSValue> DoGetGridRowGap();
 
   /* StyleImageLayer properties */
   already_AddRefed<CSSValue> DoGetImageLayerImage(const nsStyleImageLayers& aLayers);
   already_AddRefed<CSSValue> DoGetImageLayerPosition(const nsStyleImageLayers& aLayers);
+  already_AddRefed<CSSValue> DoGetImageLayerPositionX(const nsStyleImageLayers& aLayers);
+  already_AddRefed<CSSValue> DoGetImageLayerPositionY(const nsStyleImageLayers& aLayers);
   already_AddRefed<CSSValue> DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers);
   already_AddRefed<CSSValue> DoGetImageLayerSize(const nsStyleImageLayers& aLayers);
 
   /* Background properties */
   already_AddRefed<CSSValue> DoGetBackgroundAttachment();
   already_AddRefed<CSSValue> DoGetBackgroundColor();
   already_AddRefed<CSSValue> DoGetBackgroundImage();
   already_AddRefed<CSSValue> DoGetBackgroundPosition();
+  already_AddRefed<CSSValue> DoGetBackgroundPositionX();
+  already_AddRefed<CSSValue> DoGetBackgroundPositionY();
   already_AddRefed<CSSValue> DoGetBackgroundRepeat();
   already_AddRefed<CSSValue> DoGetBackgroundClip();
   already_AddRefed<CSSValue> DoGetBackgroundBlendMode();
   already_AddRefed<CSSValue> DoGetBackgroundOrigin();
   already_AddRefed<CSSValue> DoGetBackgroundSize();
 
   /* Mask properties */
   already_AddRefed<CSSValue> DoGetMask();
 #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
   already_AddRefed<CSSValue> DoGetMaskImage();
   already_AddRefed<CSSValue> DoGetMaskPosition();
+  already_AddRefed<CSSValue> DoGetMaskPositionX();
+  already_AddRefed<CSSValue> DoGetMaskPositionY();
   already_AddRefed<CSSValue> DoGetMaskRepeat();
   already_AddRefed<CSSValue> DoGetMaskClip();
   already_AddRefed<CSSValue> DoGetMaskOrigin();
   already_AddRefed<CSSValue> DoGetMaskSize();
   already_AddRefed<CSSValue> DoGetMaskMode();
   already_AddRefed<CSSValue> DoGetMaskComposite();
 #endif
   /* Padding properties */
--- a/layout/style/nsComputedDOMStylePropertyList.h
+++ b/layout/style/nsComputedDOMStylePropertyList.h
@@ -55,16 +55,18 @@ COMPUTED_STYLE_PROP(backface_visibility,
 //// COMPUTED_STYLE_PROP(background,               Background)
 COMPUTED_STYLE_PROP(background_attachment,         BackgroundAttachment)
 COMPUTED_STYLE_PROP(background_blend_mode,         BackgroundBlendMode)
 COMPUTED_STYLE_PROP(background_clip,               BackgroundClip)
 COMPUTED_STYLE_PROP(background_color,              BackgroundColor)
 COMPUTED_STYLE_PROP(background_image,              BackgroundImage)
 COMPUTED_STYLE_PROP(background_origin,             BackgroundOrigin)
 COMPUTED_STYLE_PROP(background_position,           BackgroundPosition)
+COMPUTED_STYLE_PROP(background_position_x,         BackgroundPositionX)
+COMPUTED_STYLE_PROP(background_position_y,         BackgroundPositionY)
 COMPUTED_STYLE_PROP(background_repeat,             BackgroundRepeat)
 COMPUTED_STYLE_PROP(background_size,               BackgroundSize)
 //// COMPUTED_STYLE_PROP(border,                   Border)
 //// COMPUTED_STYLE_PROP(border_bottom,            BorderBottom)
 COMPUTED_STYLE_PROP(border_bottom_color,           BorderBottomColor)
 COMPUTED_STYLE_PROP(border_bottom_left_radius,     BorderBottomLeftRadius)
 COMPUTED_STYLE_PROP(border_bottom_right_radius,    BorderBottomRightRadius)
 COMPUTED_STYLE_PROP(border_bottom_style,           BorderBottomStyle)
@@ -330,16 +332,18 @@ COMPUTED_STYLE_PROP(marker_start,       
 COMPUTED_STYLE_PROP(mask,                          Mask)
 #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
 COMPUTED_STYLE_PROP(mask_clip,                     MaskClip)
 COMPUTED_STYLE_PROP(mask_composite,                MaskComposite)
 COMPUTED_STYLE_PROP(mask_image,                    MaskImage)
 COMPUTED_STYLE_PROP(mask_mode,                     MaskMode)
 COMPUTED_STYLE_PROP(mask_origin,                   MaskOrigin)
 COMPUTED_STYLE_PROP(mask_position,                 MaskPosition)
+COMPUTED_STYLE_PROP(mask_position_x,               MaskPositionX)
+COMPUTED_STYLE_PROP(mask_position_y,               MaskPositionY)
 COMPUTED_STYLE_PROP(mask_repeat,                   MaskRepeat)
 COMPUTED_STYLE_PROP(mask_size,                     MaskSize)
 #endif
 COMPUTED_STYLE_PROP(mask_type,                     MaskType)
 COMPUTED_STYLE_PROP(paint_order,                   PaintOrder)
 COMPUTED_STYLE_PROP(shape_rendering,               ShapeRendering)
 COMPUTED_STYLE_PROP(stop_color,                    StopColor)
 COMPUTED_STYLE_PROP(stop_opacity,                  StopOpacity)