| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <svg xmlns="http://www.w3.org/2000/svg" |
| xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> |
| <rect id="rectWithCursorWithXYOnSVGOnly" style="cursor:url(#cursorWithXY), auto;" x="50" y="50" width="100" height="100" fill="green" /> |
| <rect id="rectWithCursorWithXYOnSVGAndCSS" style="cursor:url(#cursorWithXY) 30 40, auto;" x="200" y="50" width="100" height="100" fill="green" /> |
| <rect id="rectWithCursorWithXYInCSSOnly" style="cursor:url(#cursorWithNoXY) 30 40, auto;" x="350" y="50" width="100" height="100" fill="green" /> |
| <rect id="rectWithCursorWithNoXY" style="cursor:url(#cursorWithNoXY), auto;" x="500" y="50" width="100" height="100" fill="green" /> |
| <cursor id="cursorWithNoXY" xlink:href="file:///icon1.ico" /> |
| <cursor id="cursorWithXY" xlink:href="file:///icon1.ico" x="10" y="20" /> |
| </svg> |
| <script> |
| test(function() { |
| // From the CSS3 UI spec: |
| // If the values are unspecified, then the intrinsic hotspot defined inside the image resource itself is used. |
| assert_equals(rectWithCursorWithXYOnSVGOnly.style.cursor, 'url("#cursorWithXY"), auto'); |
| assert_equals(getComputedStyle(rectWithCursorWithXYOnSVGOnly).cursor, 'url("file:///icon1.ico") 10 20, auto'); |
| }, "Setting the hotspot on the SVG and not CSS"); |
| |
| test(function() { |
| assert_equals(rectWithCursorWithXYOnSVGAndCSS.style.cursor, 'url("#cursorWithXY") 30 40, auto'); |
| assert_equals(getComputedStyle(rectWithCursorWithXYOnSVGAndCSS).cursor, 'url("file:///icon1.ico") 30 40, auto'); |
| }, "Setting the hotspot in both CSS and SVG"); |
| |
| test(function() { |
| assert_equals(rectWithCursorWithXYInCSSOnly.style.cursor, 'url("#cursorWithNoXY") 30 40, auto'); |
| assert_equals(getComputedStyle(rectWithCursorWithXYInCSSOnly).cursor, 'url("file:///icon1.ico") 30 40, auto'); |
| }, "Setting the hotspot in CSS but not the SVG"); |
| |
| test(function() { |
| // From the CSS3 UI spec: |
| // If both the values are unspecific and the referenced cursor has no defined hotspot, the effect is as if a value of "0 0" were specified. |
| assert_equals(rectWithCursorWithNoXY.style.cursor, 'url("#cursorWithNoXY"), auto'); |
| assert_equals(getComputedStyle(rectWithCursorWithNoXY).cursor, 'url("file:///icon1.ico") 0 0, auto'); |
| }, "Not setting the hotspot"); |
| </script> |