blob: c6792075324952601e370ccbe00ecb8dfc4cd265 [file] [log] [blame]
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="200" height="400"
id="main_svg">
<!--
REGRESSION (r154769): Wrong <title> taken as a tooltip for SVG element.
https://bugs.webkit.org/show_bug.cgi?id=139690.
This test ensures that the tooltip text for SVG elements is calculated correctly.
It covers the stand-aline SVG case.
-->
<script xlink:href="resources/svg-tooltip.js"></script>
<script>
function log(message)
{
var element = document.getElementById("log");
element.textContent = element.textContent + message + "\n";
}
</script>
<!-- This title should only appear in the browser chrome and not as a tooltip -->
<title>outermost svg</title>
<defs>
<g id="shape">
<rect width="100" height="100" fill="yellow"/>
<circle cx="10" cy="10" r="10" fill="red">
<title>def small circle!</title>
</circle>
<circle cx="80" cy="80" r="20" fill="red">
<title>def big circle!</title>
</circle>
<g>
<rect x="20" y="20" width="40" height="40" fill="lime"/>
<circle cx="40" cy="40" r="10" fill="red">
<title>nested circle!</title>
</circle>
</g>
<title>def g element!</title>
</g>
</defs>
<g id="main_g">
<rect id="yellow_rect" width="100" height="100" fill="yellow"/>
<circle id="small_circle" cx="10" cy="10" r="10" fill="red">
<title>small circle!</title>
</circle>
<circle id="big_circle" cx="80" cy="80" r="20" fill="red">
<title>big circle!</title>
</circle>
<g id="sub_g">
<rect id="lime_rect" x="20" y="20" width="40" height="40" fill="lime"/>
<circle id="nested_circle" cx="40" cy="40" r="10" fill="red">
<title>nested circle!</title>
</circle>
</g>
<title>main g element</title>
</g>
<!-- <use> element should return the first <title> element child if it exists -->
<use id="use_with_title" xlink:href="#shape" x="0" y="120">
<title>use element!</title>
</use>
<use id="use_without_title" xlink:href="#shape" x="0" y="240"/>
<!-- For logging the test results -->
<foreignObject>
<pre id="log" xmlns="http://www.w3.org/1999/xhtml"></pre>
</foreignObject>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
log("Verifying the SVG document:");
log(verifyElementTreeToolTips(document.rootElement) ? "PASS" : "");
}
</script>
</svg>