Bug 1337291 - Part1. Pass the border style to BorderLayer. r=mattwoodrow
authorEthan Lin <ethlin@mozilla.com>
Wed, 08 Feb 2017 23:20:29 -0500
changeset 341553 a736bb1b9524421c8caa21902390dda1d73a8729
parent 341552 3525deba71e9461fddeb887038c2df4d9ed409d4
child 341554 85905c454c0553c12ef3db1f12415229b9c980c5
push id86734
push userkgupta@mozilla.com
push dateThu, 09 Feb 2017 04:21:18 +0000
treeherdermozilla-inbound@a736bb1b9524 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1337291
milestone54.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 1337291 - Part1. Pass the border style to BorderLayer. r=mattwoodrow MozReview-Commit-ID: 59rB9sDilYW
gfx/layers/Layers.h
gfx/layers/LayersTypes.h
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2422,16 +2422,23 @@ public:
 
   virtual void SetWidths(const BorderWidths& aWidths)
   {
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Widths", this));
     PodCopy(&mWidths[0], &aWidths[0], 4);
     Mutated();
   }
 
+  virtual void SetStyles(const BorderStyles& aBorderStyles)
+  {
+    MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Widths", this));
+    PodCopy(&mBorderStyles[0], &aBorderStyles[0], 4);
+    Mutated();
+  }
+
   MOZ_LAYER_DECL_NAME("BorderLayer", TYPE_BORDER)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
   {
     gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
     mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
     ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
   }
@@ -2449,16 +2456,17 @@ protected:
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
 
   virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
 
   BorderColors mColors;
   LayerRect mRect;
   BorderCorners mCorners;
   BorderWidths mWidths;
+  BorderStyles mBorderStyles;
 };
 
 /**
  * A Layer for HTML Canvas elements.  It's backed by either a
  * gfxASurface or a GLContext (for WebGL layers), and has some control
  * for intelligent updating from the source if necessary (for example,
  * if hardware compositing is not available, for reading from the GL
  * buffer into an image surface that we can layer composite.)
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -244,16 +244,17 @@ typedef gfx::Matrix4x4Typed<LayerPixel, 
 // matrices, a ViewAs operation is needed. A MultipleAsyncTransforms
 // PixelCastJustification is provided for this purpose.
 typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
 typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
 
 typedef Array<gfx::Color, 4> BorderColors;
 typedef Array<LayerSize, 4> BorderCorners;
 typedef Array<LayerCoord, 4> BorderWidths;
+typedef Array<uint8_t, 4> BorderStyles;
 
 // This is used to communicate Layers across IPC channels. The Handle is valid
 // for layers in the same PLayerTransaction. Handles are created by ClientLayerManager,
 // and are cached in LayerTransactionParent on first use.
 class LayerHandle
 {
   friend struct IPC::ParamTraits<mozilla::layers::LayerHandle>;
 public:
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4429,16 +4429,17 @@ nsDisplayBorder::GetLayerState(nsDisplay
       !br->AllBordersSameWidth()) {
     return LAYER_NONE;
   }
 
   NS_FOR_CSS_SIDES(i) {
     if (br->mBorderStyles[i] == NS_STYLE_BORDER_STYLE_SOLID) {
       mColors[i] = ToDeviceColor(br->mBorderColors[i]);
       mWidths[i] = br->mBorderWidths[i];
+      mBorderStyles[i] = br->mBorderStyles[i];
     } else {
       mWidths[i] = 0;
     }
   }
 
   mRect = ViewAs<LayerPixel>(br->mOuterRect);
   return LAYER_ACTIVE;
 }
@@ -4454,16 +4455,17 @@ nsDisplayBorder::BuildLayer(nsDisplayLis
     layer = aManager->CreateBorderLayer();
     if (!layer)
       return nullptr;
   }
   layer->SetRect(mRect);
   layer->SetCornerRadii({ LayerSize(), LayerSize(), LayerSize(), LayerSize() });
   layer->SetColors(mColors);
   layer->SetWidths(mWidths);
+  layer->SetStyles(mBorderStyles);
   layer->SetBaseTransform(gfx::Matrix4x4::Translation(aContainerParameters.mOffset.x,
                                                       aContainerParameters.mOffset.y, 0));
   return layer.forget();
 }
 
 void
 nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
                        nsRenderingContext* aCtx) {
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2841,16 +2841,17 @@ public:
     return CalculateBounds(*mFrame->StyleBorder());
   }
 
 protected:
   nsRegion CalculateBounds(const nsStyleBorder& aStyleBorder);
 
   mozilla::Array<mozilla::gfx::Color, 4> mColors;
   mozilla::Array<mozilla::LayerCoord, 4> mWidths;
+  mozilla::Array<uint8_t, 4> mBorderStyles;
   mozilla::LayerRect mRect;
 
   nsRect mBounds;
 };
 
 /**
  * A simple display item that just renders a solid color across the
  * specified bounds. For canvas frames (in the CSS sense) we split off the