clipPath-advanced-01.svg 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
  2. <title>Testcase for clipPath referencing other clipPaths</title>
  3. <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=534612 -->
  4. <defs>
  5. <clipPath id="clip1">
  6. <rect id="r1" x="20" y="-40" width="100" height="40" />
  7. </clipPath>
  8. <clipPath id="clip2">
  9. <rect x="20" y="20" width="100" height="100" clip-path="url(#clip1)" />
  10. </clipPath>
  11. <clipPath id="clip3">
  12. <rect x="140" y="-40" width="100" height="40" />
  13. </clipPath>
  14. <clipPath id="clip4" clip-path="url(#clip3)">
  15. <rect x="140" y="20" width="100" height="100" />
  16. </clipPath>
  17. <clipPath id="clip1">
  18. <rect x="20" y="-40" width="100" height="40" />
  19. </clipPath>
  20. <clipPath id="clip5">
  21. <rect id="r5" x="20" y="140" width="100" height="100" />
  22. </clipPath>
  23. <clipPath id="clip6">
  24. <use xlink:href="#r5" clip-path="url(#clip5)" />
  25. </clipPath>
  26. <clipPath id="clip7">
  27. <rect id="r7" x="140" y="140" width="100" height="100" />
  28. </clipPath>
  29. <clipPath id="clip8">
  30. <use xlink:href="#r7" fill="red" clip-path="url(#clip1)"/>
  31. </clipPath>
  32. <clipPath id="clip9">
  33. <rect x="20" y="260" width="100" height="100" />
  34. </clipPath>
  35. <clipPath id="clip10">
  36. <use xlink:href="#r1" fill="red" clip-path="url(#clip9)"/>
  37. </clipPath>
  38. <clipPath id="clip11">
  39. <rect id="r11" x="140" y="260" width="100" height="100" clip-path="url(#clip1)"/>
  40. </clipPath>
  41. <clipPath id="clip12">
  42. <use xlink:href="#r11" fill="red" clip-path="url(#clip11)"/>
  43. </clipPath>
  44. <clipPath id="clip12" clipPathUnits="objectBoundingBox">
  45. <rect width=".5" height=".5"/>
  46. </clipPath>
  47. <clipPath id="clip13" clip-path="url(#clip12)">
  48. <circle cx="100" cy="470" r="150"/>
  49. </clipPath>
  50. <clipPath id="clip14">
  51. <use xlink:href="#clip1"/>
  52. </clipPath>
  53. <clipPath id="clip15" clip-path="url(#clip14)">
  54. <text x="140" y="500" font-size="100px">CLIP</text>
  55. </clipPath>
  56. </defs>
  57. <rect width="100%" height="100%" fill="lime" />
  58. <!-- clip path where an object is itself clipped -->
  59. <rect x="20" y="20" width="100" height="100" fill="red" clip-path="url(#clip2)" />
  60. <!-- clip path referencing another clip-path -->
  61. <rect x="140" y="20" width="100" height="100" fill="red" clip-path="url(#clip4)" />
  62. <!-- clip paths where object has complex clipping -->
  63. <rect x="20" y="140" width="100" height="100" fill="red" />
  64. <rect x="20" y="140" width="100" height="100" fill="lime" clip-path="url(#clip6)" />
  65. <rect x="140" y="140" width="100" height="100" fill="red" clip-path="url(#clip8)" />
  66. <rect x="20" y="260" width="100" height="100" fill="red" clip-path="url(#clip10)" />
  67. <rect x="140" y="260" width="100" height="100" fill="red" clip-path="url(#clip12)" />
  68. <!-- clip paths with different clipPathUnits -->
  69. <rect x="20" y="400" height="300" width="300" fill="red" clip-path="url(#clip13)" />
  70. <rect x="20" y="400" width="100" height="100" fill="lime" />
  71. <!-- text clipping -->
  72. <rect x="140" y="400" height="300" width="300" fill="red" clip-path="url(#clip15)" />
  73. </svg>