Bug 1346487 - Support border clip for webrender borders. r=ethlin
authorMason Chang <mchang@mozilla.com>
Thu, 20 Apr 2017 16:57:27 -0700
changeset 403283 1a304bffd9a34aa6f94a9944127d50a6ac3f21ac
parent 403282 c003db4fe3a4087ee0368541fd3d448b4637929c
child 403284 68b48ae09aedd2a291867c270b23f6aeac75fcdc
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin
bugs1346487
milestone55.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 1346487 - Support border clip for webrender borders. r=ethlin
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4848,17 +4848,23 @@ nsDisplayBorder::CreateWebRenderCommands
                                          nsTArray<WebRenderParentCommand>& aParentCommands,
                                          WebRenderDisplayItemLayer* aLayer)
 {
   MOZ_ASSERT(mBorderImageRenderer || mBorderRenderer);
 
   if (mBorderImageRenderer) {
     CreateBorderImageWebRenderCommands(aBuilder, aParentCommands, aLayer);
   } else if (mBorderRenderer) {
-    mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer);
+    gfx::Rect clip(0, 0, 0, 0);
+    if (GetClip().HasClip()) {
+      int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
+      clip = NSRectToRect(GetClip().GetClipRect(), appUnitsPerDevPixel);
+    }
+
+    mBorderRenderer->CreateWebRenderCommands(aBuilder, aLayer, clip);
   }
 }
 
 void
 nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
                        nsRenderingContext* aCtx) {
   nsPoint offset = ToReferenceFrame();