mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:47:45 +00:00
LibWeb: Add SVGSVGElement.viewBox attribute
This attribute has some compatbility issues... - The spec says it should be an SVGAnimatedRect which contains a DOMRect and a DOMReadOnlyRect. - Blink gives you an SVGAnimatedRect with 2x SVGRect - Gecko gives you an SVGAnimatedRect with 2x SVGRect? (nullable) I ended up with something similar to Gecko, an SVGAnimatedRect with 2x DOMRect? (nullable) With this fixed, we can now load https://polar.sh/ :^)
This commit is contained in:
parent
2fd034d1df
commit
b12541b286
12 changed files with 228 additions and 2 deletions
39
Tests/LibWeb/Text/input/SVG/svg-viewBox-attribute.html
Normal file
39
Tests/LibWeb/Text/input/SVG/svg-viewBox-attribute.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<script src="../include.js"></script>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none" id="svg-element"></svg>
|
||||
<script>
|
||||
test(() => {
|
||||
const svgElement = document.getElementById("svg-element");
|
||||
println(svgElement);
|
||||
println(svgElement.viewBox);
|
||||
println(svgElement.viewBox.baseVal);
|
||||
println(svgElement.viewBox.animVal);
|
||||
|
||||
svgElement.setAttribute("viewBox", "1 2 3 4");
|
||||
println(svgElement.viewBox.baseVal);
|
||||
println(svgElement.viewBox.baseVal.x);
|
||||
println(svgElement.viewBox.baseVal.y);
|
||||
println(svgElement.viewBox.baseVal.width);
|
||||
println(svgElement.viewBox.baseVal.height);
|
||||
println(svgElement.viewBox.animVal);
|
||||
println(svgElement.viewBox.animVal.x);
|
||||
println(svgElement.viewBox.animVal.y);
|
||||
println(svgElement.viewBox.animVal.width);
|
||||
println(svgElement.viewBox.animVal.height);
|
||||
|
||||
svgElement.setAttribute("viewBox", "5 6 7 8");
|
||||
println(svgElement.viewBox.baseVal);
|
||||
println(svgElement.viewBox.baseVal.x);
|
||||
println(svgElement.viewBox.baseVal.y);
|
||||
println(svgElement.viewBox.baseVal.width);
|
||||
println(svgElement.viewBox.baseVal.height);
|
||||
println(svgElement.viewBox.animVal);
|
||||
println(svgElement.viewBox.animVal.x);
|
||||
println(svgElement.viewBox.animVal.y);
|
||||
println(svgElement.viewBox.animVal.width);
|
||||
println(svgElement.viewBox.animVal.height);
|
||||
|
||||
svgElement.removeAttribute("viewBox");
|
||||
println(svgElement.viewBox.baseVal);
|
||||
println(svgElement.viewBox.animVal);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue