Bug 1289011 - Part 4. Handle stroke-box. r=heycam
authorcku <cku@mozilla.com>
Sun, 28 Aug 2016 02:36:20 +0800
changeset 312830 b803d96ab1a52fc23dc3c150fed268803ebb5cc0
parent 312829 8eacb8a7c6cfd89b18c82bde40b5f00db19bb9ef
child 312831 72136b9b75329a08c5b209b412ffc5b5779e902f
push id30661
push userkwierso@gmail.com
push dateWed, 07 Sep 2016 00:28:11 +0000
treeherdermozilla-central@3ba67e3bb588 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1289011
milestone51.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 1289011 - Part 4. Handle stroke-box. r=heycam MozReview-Commit-ID: BImaXBGds6l
layout/svg/nsCSSClipPathInstance.cpp
--- a/layout/svg/nsCSSClipPathInstance.cpp
+++ b/layout/svg/nsCSSClipPathInstance.cpp
@@ -66,16 +66,26 @@ nsRect
 nsCSSClipPathInstance::ComputeSVGReferenceRect()
 {
   MOZ_ASSERT(mTargetFrame->GetContent()->IsSVGElement());
   nsRect r;
 
   // For SVG elements without associated CSS layout box, the used value for
   // content-box, padding-box, border-box and margin-box is fill-box.
   switch (mClipPathStyle.GetReferenceBox()) {
+    case StyleClipPathGeometryBox::Stroke: {
+      // XXX Bug 1299876
+      // The size of srtoke-box is not correct if this graphic element has
+      // specific stroke-linejoin or stroke-linecap.
+      gfxRect bbox = nsSVGUtils::GetBBox(mTargetFrame,
+                nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeStroke);
+      r = nsLayoutUtils::RoundGfxRectToAppRect(bbox,
+                                         nsPresContext::AppUnitsPerCSSPixel());
+      break;
+    }
     case StyleClipPathGeometryBox::View: {
       nsIContent* content = mTargetFrame->GetContent();
       nsSVGElement* element = static_cast<nsSVGElement*>(content);
       SVGSVGElement* svgElement = element->GetCtx();
       MOZ_ASSERT(svgElement);
 
       if (svgElement && svgElement->HasViewBoxRect()) {
         // If a ‘viewBox‘ attribute is specified for the SVG viewport creating