Chrome 87下带曲线路径的SVG遮罩无法按预期裁剪滤镜效果
Chrome v87版本SVG遮罩与滤镜组合渲染异常问题
问题背景
自Chrome浏览器升级至v87版本后,当SVG遮罩包含曲线路径时,SVG内的遮罩与滤镜组合会出现不符合预期的渲染行为。
可复现示例代码
<svg width="226" height="226" viewBox="0 0 226 226" fill="none" xmlns="http://www.w3.org/2000/svg"> <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="38" y="39" width="148" height="148"> <path d="M112 187C152.869 187 186 153.869 186 113C186 72.1307 152.869 39 112 39C71.1307 39 38 72.1307 38 113C38 153.869 71.1307 187 112 187Z" fill="#F0F1F2"/> </mask> <g mask="url(#mask0)"> <g filter="url(#filter0_d)"> <rect x="12" y="67" width="202" height="92" fill="#4D9DE6"/> </g> </g> <defs> <filter id="filter0_d" x="2" y="59" width="222" height="112" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> <feFlood flood-opacity="0" result="BackgroundImageFix"/> <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/> <feOffset dy="2"/> <feGaussianBlur stdDeviation="5"/> <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/> <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/> <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/> </filter> </defs> </svg>
跨版本渲染差异
- 规范预期表现:在Chrome 86版本以及当时所有主流浏览器的正式版本中,渲染逻辑完全符合SVG规范——带有投影效果的蓝色矩形会被圆形遮罩正常裁剪,仅显示圆形遮罩范围内的内容。
- Chrome 87异常表现:新版本的渲染结果与预期存在明显偏差,遮罩对带滤镜元素的裁剪逻辑未按规范执行,不同版本的渲染效果存在可直观感知的差异。
- 核心咨询诉求:定位该跨版本渲染异常的产生原因。
内容的提问来源于stack exchange,提问作者Alek Mackie
相关产品推荐
相关产品推荐

