   // it between the limits accepted by `mix`.
   float colorMix = min(max(distanceFromMixLine / pixelsPerFragment, -0.5), 0.5) + 0.5;
   return mix(vHorizontalColor, vVerticalColor, colorMix);
+}
+
+float alpha_for_solid_border(float distance_from_ref,
+                             float inner_radius,
+                             float outer_radius,
+                             float pixels_per_fragment) {
+  // We want to start anti-aliasing one pixel in from the border.
+  float nudge = 1 * pixels_per_fragment;
+  inner_radius += nudge;
+  outer_radius -= nudge;
+
+  if ((distance_from_ref < outer_radius && distance_from_ref > inner_radius)) {
+    return 1.0;
+  }
+
+  float distance_from_border = max(distance_from_ref - outer_radius,
+                                   inner_radius - distance_from_ref);
+
+  // Move the distance back into pixels.
+  distance_from_border /= pixels_per_fragment;
+
+  // Apply a more gradual fade out to transparent.
+  distance_from_border -= 0.5;
+
+  return smoothstep(1.0, 0, distance_from_border);
+}
+
+float alpha_for_solid_border_corner(vec2 local_pos,
+                                    float inner_radius,
+                                    float outer_radius,
+                                    float pixels_per_fragment) {
+  float distance_from_ref = distance(vRefPoint, local_pos);
+  return alpha_for_solid_border(distance_from_ref, inner_radius, outer_radius, pixels_per_fragment);
 }
 
 #ifdef WR_FEATURE_TRANSFORM

    case PST_BOTTOM_LEFT:
    case PST_BOTTOM_RIGHT:
    {
      oFragColor = draw_double_edge_corner();
      break;
    }
    case PST_BOTTOM:
    case PST_TOP:
    {
      oFragColor = draw_double_edge_horizontal();
      break;
    }
    case PST_LEFT:
    case PST_RIGHT:
    {
      oFragColor = draw_double_edge_vertical();
      break;
    }
  }
}

#endif

void draw_antialiased_solid_border_corner(vec2 local_pos, float pixelsPerFragment) {
  if (vRadii.x <= 0.0) {
    return;
  }

  float distanceFromRef = distance(vRefPoint, local_pos);

  // We want to start anti-aliasing one pixel in from the border.
  float nudge = 1 * pixelsPerFragment;
  float innerRadius = vRadii.z + nudge;
  float outerRadius = vRadii.x - nudge;

  if (vRadii.x > 0.0 && (distanceFromRef > outerRadius || distanceFromRef < innerRadius)) {
    float distanceFromBorder = max(distanceFromRef - outerRadius,
                                   innerRadius - distanceFromRef);
    // Move the distance back into pixels.
    distanceFromBorder /= pixelsPerFragment;

    // Apply a more gradual fade out to transparent.
    distanceFromBorder -= 0.5;

    oFragColor = oFragColor * vec4(1, 1, 1, smoothstep(1.0, 0, distanceFromBorder));
  }
}

void draw_solid_border(float distanceFromMixLine, vec2 localPos) {
  switch (vBorderPart) {

  }
}

void draw_double_border(vec2 localPos) {
  float pixelsPerFragment = length(fwidth(localPos.xy));
  switch (vBorderPart) {
    // These are the layer tile part PrimitivePart as uploaded by the tiling.rs
    case PST_TOP_LEFT:
