outer-svg-border-and-padding-01.svg 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="reftest-wait"
  6. style="border: 10px solid lime; padding: 10px; background: lime;">
  7. <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=490003 -->
  8. <title>Test that invalidation takes account of outer-&lt;svg&gt; border/padding</title>
  9. <desc>
  10. This test checks that SVG implementations take account of border and
  11. padding on outer &lt;svg&gt; when doing invalidation.
  12. </desc>
  13. <filter id="identity">
  14. <feColorMatrix type="saturate" in="SourceGraphic"/>
  15. </filter>
  16. <script type="text/javascript">//<![CDATA[
  17. function hide_red_rects()
  18. {
  19. var background = document.getElementById("background");
  20. document.getElementById('r').setAttribute('opacity','0');
  21. document.getElementById('f').setAttribute('opacity','0');
  22. <!-- top left -->
  23. document.elementFromPoint(121, 121).setAttribute('opacity','0');
  24. <!-- bottom right -->
  25. document.elementFromPoint(269, 169).setAttribute('opacity','0');
  26. <!-- outside top left -->
  27. if (document.elementFromPoint(119, 119) != background) {
  28. background.setAttribute("fill", "red");
  29. }
  30. <!-- outside bottom right -->
  31. if (document.elementFromPoint(271, 171) != background) {
  32. background.setAttribute("fill", "purple");
  33. }
  34. document.documentElement.removeAttribute('class');
  35. }
  36. document.addEventListener("MozReftestInvalidate", hide_red_rects, false);
  37. setTimeout(hide_red_rects, 4000); // fallback for running outside reftest
  38. //]]>
  39. </script>
  40. <!-- to catch misses-->
  41. <rect id="background" width="100%" height="100%" fill="lime"/>
  42. <rect id="r" width="50" height="50" fill="red"/>
  43. <rect id="f" y="100" width="50" height="50" fill="red"/>
  44. <rect x="100" y="100" width="50" height="50" fill="red"/>
  45. <rect x="200" y="100" width="50" height="50" fill="red"/>
  46. </svg>