Bug 1413397 - Avoid empty border's fallback. r=kats draft
authorEthan Lin <ethlin@mozilla.com>
Wed, 01 Nov 2017 10:46:40 +0800
changeset 689881 489de632883deed3d4531a8bd6b638e6678c27fe
parent 689296 e6c5701336b7fd6343b02f069adee1fb635d47df
child 738410 cd5eb02628dc53881019f4428b9752619ea3358a
push id87128
push userbmo:ethlin@mozilla.com
push dateWed, 01 Nov 2017 02:52:09 +0000
reviewerskats
bugs1413397
milestone58.0a1
Bug 1413397 - Avoid empty border's fallback. r=kats MozReview-Commit-ID: 1DGBKE0FpXd
layout/forms/nsFieldSetFrame.cpp
layout/painting/nsCSSRendering.cpp
layout/painting/nsCSSRenderingBorders.cpp
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -155,20 +155,16 @@ nsDisplayFieldSetBorder::GetBounds(nsDis
 
 bool
 nsDisplayFieldSetBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
                                                  mozilla::wr::IpcResourceUpdateQueue& aResources,
                                                  const StackingContextHelper& aSc,
                                                  mozilla::layers::WebRenderLayerManager* aManager,
                                                  nsDisplayListBuilder* aDisplayListBuilder)
 {
-  if (!ShouldUseAdvancedLayer(aManager, gfxPrefs::LayersAllowBorderLayers)) {
-    return false;
-  }
-
   auto frame = static_cast<nsFieldSetFrame*>(mFrame);
   auto offset = ToReferenceFrame();
   nsRect rect;
 
   if (nsIFrame* legend = frame->GetLegend()) {
     rect = frame->VisualBorderRectRelativeToSelf() + offset;
 
     // Legends require a "negative" clip around the text, which WR doesn't support yet.
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -993,23 +993,16 @@ nsCSSRendering::CreateBorderRendererWith
       return Nothing();
     }
   }
 
   if (aStyleBorder.mBorderImageSource.GetType() != eStyleImageType_Null) {
     return Nothing();
   }
 
-  nsMargin border = aStyleBorder.GetComputedBorder();
-  if (0 == border.left && 0 == border.right &&
-      0 == border.top  && 0 == border.bottom) {
-    // Empty border area
-    return Nothing();
-  }
-
   bool needsClip = false;
   nsCSSBorderRenderer br = ConstructBorderRenderer(aPresContext,
                                                    aStyleContext,
                                                    aDrawTarget,
                                                    aForFrame,
                                                    aDirtyRect,
                                                    aBorderArea,
                                                    aStyleBorder,
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3602,16 +3602,21 @@ nsCSSBorderRenderer::CanCreateWebRenderC
 }
 
 void
 nsCSSBorderRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
                                              wr::DisplayListBuilder& aBuilder,
                                              wr::IpcResourceUpdateQueue& aResources,
                                              const layers::StackingContextHelper& aSc)
 {
+  if (mBorderWidths[0] == 0 && mBorderWidths[1] == 0 &&
+      mBorderWidths[2] == 0 && mBorderWidths[3] == 0) {
+    return;
+  }
+
   LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
   wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(outerRect);
   wr::BorderSide side[4];
   NS_FOR_CSS_SIDES(i) {
     side[i] = wr::ToBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
   }
 
   wr::BorderRadius borderRadius = wr::ToBorderRadius(LayoutDeviceSize::FromUnknownSize(mBorderRadii[0]),