Merge autoland to mozilla-central. a=merge
authorMolnar Sandor <smolnar@mozilla.com>
Sun, 22 May 2022 00:05:02 +0300
changeset 618427 f3d632ec453b7f9a80f47dc1edb53e4b7b97f10a
parent 618423 8ff91c87fb92efaedc3a852e862021ec7f0ec1f1 (current diff)
parent 618426 bd92b2280e0d168e49f42ae48a6a7cb7f949aa93 (diff)
child 618428 02019cddcd0b86244357342eda3a6a513c2b4a6b
child 618439 1e8e9ec260cf24f5b74f5a3b3ad9f73622ea942c
push id39728
push usersmolnar@mozilla.com
push dateSat, 21 May 2022 21:05:26 +0000
treeherdermozilla-central@f3d632ec453b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone102.0a1
first release with
nightly linux32
f3d632ec453b / 102.0a1 / 20220521210526 / files
nightly linux64
f3d632ec453b / 102.0a1 / 20220521210526 / files
nightly mac
f3d632ec453b / 102.0a1 / 20220521210526 / files
nightly win32
f3d632ec453b / 102.0a1 / 20220521210526 / files
nightly win64
f3d632ec453b / 102.0a1 / 20220521210526 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge autoland to mozilla-central. a=merge
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -406,26 +406,27 @@ void gfxContext::SetAntialiasMode(Antial
   CURRENTSTATE_CHANGED()
   CurrentState().aaMode = mode;
 }
 
 AntialiasMode gfxContext::CurrentAntialiasMode() const {
   return CurrentState().aaMode;
 }
 
-void gfxContext::SetDash(const Float* dashes, int ndash, Float offset) {
+void gfxContext::SetDash(const Float* dashes, int ndash, Float offset,
+                         Float devPxScale) {
   CURRENTSTATE_CHANGED()
   AzureState& state = CurrentState();
 
   state.dashPattern.SetLength(ndash);
   for (int i = 0; i < ndash; i++) {
-    state.dashPattern[i] = dashes[i];
+    state.dashPattern[i] = dashes[i] * devPxScale;
   }
   state.strokeOptions.mDashLength = ndash;
-  state.strokeOptions.mDashOffset = offset;
+  state.strokeOptions.mDashOffset = offset * devPxScale;
   state.strokeOptions.mDashPattern =
       ndash ? state.dashPattern.Elements() : nullptr;
 }
 
 bool gfxContext::CurrentDash(FallibleTArray<Float>& dashes,
                              Float* offset) const {
   const AzureState& state = CurrentState();
   int count = state.strokeOptions.mDashLength;
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -304,17 +304,21 @@ class gfxContext final {
   }
   void Mask(mozilla::gfx::SourceSurface* surface, float alpha = 1.0f,
             const mozilla::gfx::Point& offset = mozilla::gfx::Point());
 
   /**
    ** Line Properties
    **/
 
-  void SetDash(const Float* dashes, int ndash, Float offset);
+  // Set the dash pattern, applying devPxScale to convert passed-in lengths
+  // to device pixels (used by the SVGUtils::SetupStrokeGeometry caller,
+  // which has the desired dash pattern in CSS px).
+  void SetDash(const Float* dashes, int ndash, Float offset, Float devPxScale);
+
   // Return true if dashing is set, false if it's not enabled or the
   // context is in an error state.  |offset| can be nullptr to mean
   // "don't care".
   bool CurrentDash(FallibleTArray<Float>& dashes, Float* offset) const;
 
   /**
    * Sets the line width that's used for line drawing.
    */
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -274,42 +274,49 @@ void gfxPlatformGtk::InitVAAPIConfig() {
 void gfxPlatformGtk::InitWebRenderConfig() {
   gfxPlatform::InitWebRenderConfig();
 
   if (!XRE_IsParentProcess()) {
     return;
   }
 
   FeatureState& feature = gfxConfig::GetFeature(Feature::WEBRENDER_COMPOSITOR);
+#ifdef RELEASE_OR_BETA
+  feature.ForceDisable(FeatureStatus::Blocked,
+                       "Cannot be enabled in release or beta",
+                       "FEATURE_FAILURE_DISABLE_RELEASE_OR_BETA"_ns);
+#else
   if (feature.IsEnabled()) {
     if (!(gfxConfig::IsEnabled(Feature::WEBRENDER) ||
           gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE))) {
       feature.ForceDisable(FeatureStatus::Unavailable, "WebRender disabled",
                            "FEATURE_FAILURE_WR_DISABLED"_ns);
     } else if (!IsWaylandDisplay()) {
       feature.ForceDisable(FeatureStatus::Unavailable,
                            "Wayland support missing",
                            "FEATURE_FAILURE_NO_WAYLAND"_ns);
     }
-#ifdef MOZ_WAYLAND
+#  ifdef MOZ_WAYLAND
     else if (gfxConfig::IsEnabled(Feature::WEBRENDER) &&
              !gfxConfig::IsEnabled(Feature::DMABUF)) {
       // We use zwp_linux_dmabuf_v1 and GBM directly to manage FBOs. In theory
       // this is also possible vie EGLstreams, but we don't bother to implement
       // it as recent NVidia drivers support GBM and DMABuf as well.
       feature.ForceDisable(FeatureStatus::Unavailable,
                            "Hardware Webrender requires DMAbuf support",
                            "FEATURE_FAILURE_NO_DMABUF"_ns);
     } else if (!widget::WaylandDisplayGet()->GetViewporter()) {
       feature.ForceDisable(FeatureStatus::Unavailable,
                            "Requires wp_viewporter protocol support",
                            "FEATURE_FAILURE_REQUIRES_WPVIEWPORTER"_ns);
     }
-#endif
+#  endif  // MOZ_WAYLAND
   }
+#endif    // RELEASE_OR_BETA
+
   gfxVars::SetUseWebRenderCompositor(feature.IsEnabled());
 }
 
 void gfxPlatformGtk::InitPlatformGPUProcessPrefs() {
 #ifdef MOZ_WAYLAND
   if (IsWaylandDisplay()) {
     FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
     gpuProc.ForceDisable(FeatureStatus::Blocked,
--- a/layout/reftests/text-svgglyphs/reftest.list
+++ b/layout/reftests/text-svgglyphs/reftest.list
@@ -13,17 +13,20 @@ fuzzy(0-2,0-200) == svg-glyph-objectstro
 fuzzy(0-1,0-300) == svg-glyph-objectgradient.svg svg-glyph-objectgradient-ref.svg # see bug 871961#c5
 fuzzy(0-1,0-250) == svg-glyph-objectgradient-zoom.svg svg-glyph-objectgradient-zoom-ref.svg
 fuzzy(0-14,0-13000) == svg-glyph-objectpattern.svg svg-glyph-objectpattern-ref.svg
 == clip.html clip-ref.html
 fuzzy(0-1,0-350) == svg-glyph-objectopacity.svg svg-glyph-objectopacity-ref.svg # see bug 871961#c5
 fuzzy(0-8,0-13000) == svg-glyph-objectopacity2.svg svg-glyph-objectopacity2-ref.svg
 fuzzy(0-2,0-200) == svg-glyph-paintnone.svg svg-glyph-paintnone-ref.svg
 fuzzy(0-2,0-200) == svg-glyph-cachedopacity.svg svg-glyph-cachedopacity-ref.svg
-fuzzy-if(cocoaWidget,0-255,0-100) == svg-glyph-objectvalue.svg svg-glyph-objectvalue-ref.svg
+== svg-glyph-objectvalue.svg svg-glyph-objectvalue-ref.svg
+fails-if(useDrawSnapshot) != svg-glyph-objectvalue.svg svg-glyph-objectvalue-75.svg
+== svg-glyph-objectvalue-75.svg svg-glyph-objectvalue-75-ref.svg
+== svg-glyph-objectvalue-150.svg svg-glyph-objectvalue-150-ref.svg
 fuzzy(0-15,0-152) == svg-glyph-mask.svg svg-glyph-mask-ref.svg
 == svg-glyph-paint-server.svg svg-glyph-paint-server-ref.svg
 == svg-glyph-transform.svg svg-glyph-transform-ref.svg
 == svg-glyph-extents.html svg-glyph-extents-ref.html
 == svg-glyph-compressed.html svg-glyph-compressed-ref.html
 fuzzy-if(cocoaWidget,0-1,0-33) == bug1320197-1.html bug1320197-1-ref.html
 fuzzy-if(winWidget,0-137,0-198) fuzzy-if(Android,0-81,0-96) == svg-in-ot-bitmap-1.html svg-in-ot-bitmap-1-ref.html
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-150-ref.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="1.5">
+  <style type="text/css"><![CDATA[
+    rect {
+      stroke-width: 10;
+      stroke-dasharray: 10 10;
+      stroke-dashoffset: 7;
+    }
+  ]]></style>
+  <rect x="20" y="20" width="160" height="160" stroke="powderblue" />
+  <rect x="220" y="20" width="160" height="160" stroke="chartreuse" />
+  <rect x="20" y="220" width="160" height="160" stroke="sienna" />
+  <rect x="220" y="220" width="160" height="160" stroke="olivedrab" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-150.svg
@@ -0,0 +1,21 @@
+<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="1.5">
+  <style type="text/css"><![CDATA[
+    @font-face {
+      font-family: svgwoff;
+      src: url(resources/svg.woff);
+    }
+
+    text {
+      font-family: svgwoff;
+      font-size: 200px;
+      stroke-width: 10;
+      stroke-dasharray: 10 10;
+      stroke-dashoffset: 7;
+      stroke: black;
+    }
+  ]]></style>
+  <text x="0" y="200">a</text>
+  <text x="200" y="200">b</text>
+  <text x="0" y="400">c</text>
+  <text x="200" y="400">d</text>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-75-ref.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.75">
+  <style type="text/css"><![CDATA[
+    rect {
+      stroke-width: 10;
+      stroke-dasharray: 10 10;
+      stroke-dashoffset: 7;
+    }
+  ]]></style>
+  <rect x="20" y="20" width="160" height="160" stroke="powderblue" />
+  <rect x="220" y="20" width="160" height="160" stroke="chartreuse" />
+  <rect x="20" y="220" width="160" height="160" stroke="sienna" />
+  <rect x="220" y="220" width="160" height="160" stroke="olivedrab" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-75.svg
@@ -0,0 +1,21 @@
+<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.75">
+  <style type="text/css"><![CDATA[
+    @font-face {
+      font-family: svgwoff;
+      src: url(resources/svg.woff);
+    }
+
+    text {
+      font-family: svgwoff;
+      font-size: 200px;
+      stroke-width: 10;
+      stroke-dasharray: 10 10;
+      stroke-dashoffset: 7;
+      stroke: black;
+    }
+  ]]></style>
+  <text x="0" y="200">a</text>
+  <text x="200" y="200">b</text>
+  <text x="0" y="400">c</text>
+  <text x="200" y="400">d</text>
+</svg>
--- a/layout/svg/SVGUtils.cpp
+++ b/layout/svg/SVGUtils.cpp
@@ -1519,22 +1519,26 @@ void SVGUtils::SetupStrokeGeometry(nsIFr
   SVGContentUtils::GetStrokeOptions(
       &strokeOptions, static_cast<SVGElement*>(aFrame->GetContent()),
       aFrame->Style(), aContextPaint);
 
   if (strokeOptions.mLineWidth <= 0) {
     return;
   }
 
-  aContext->SetLineWidth(strokeOptions.mLineWidth);
+  // SVGContentUtils::GetStrokeOptions gets the stroke options in CSS px;
+  // convert to device pixels for gfxContext.
+  float devPxPerCSSPx = aFrame->PresContext()->CSSToDevPixelScale().scale;
+
+  aContext->SetLineWidth(strokeOptions.mLineWidth * devPxPerCSSPx);
   aContext->SetLineCap(strokeOptions.mLineCap);
   aContext->SetMiterLimit(strokeOptions.mMiterLimit);
   aContext->SetLineJoin(strokeOptions.mLineJoin);
   aContext->SetDash(strokeOptions.mDashPattern, strokeOptions.mDashLength,
-                    strokeOptions.mDashOffset);
+                    strokeOptions.mDashOffset, devPxPerCSSPx);
 }
 
 uint16_t SVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame) {
   uint16_t flags = 0;
 
   switch (aFrame->Style()->PointerEvents()) {
     case StylePointerEvents::None:
       break;
@@ -1642,20 +1646,17 @@ nsRect SVGUtils::ToCanvasBounds(const gf
                                 const gfxMatrix& aToCanvas,
                                 const nsPresContext* presContext) {
   return nsLayoutUtils::RoundGfxRectToAppRect(
       aToCanvas.TransformBounds(aUserspaceRect),
       presContext->AppUnitsPerDevPixel());
 }
 
 gfxMatrix SVGUtils::GetCSSPxToDevPxMatrix(nsIFrame* aNonSVGFrame) {
-  int32_t appUnitsPerDevPixel =
-      aNonSVGFrame->PresContext()->AppUnitsPerDevPixel();
-  float devPxPerCSSPx =
-      1 / nsPresContext::AppUnitsToFloatCSSPixels(appUnitsPerDevPixel);
+  float devPxPerCSSPx = aNonSVGFrame->PresContext()->CSSToDevPixelScale().scale;
 
   return gfxMatrix(devPxPerCSSPx, 0.0, 0.0, devPxPerCSSPx, 0.0, 0.0);
 }
 
 gfxMatrix SVGUtils::GetTransformMatrixInUserSpace(const nsIFrame* aFrame) {
   // We check element instead of aFrame directly because SVG element
   // may have non-SVG frame, <tspan> for example.
   MOZ_ASSERT(aFrame->GetContent() && aFrame->GetContent()->IsSVGElement(),