Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foreignObject tests from a few bugs #25630

Merged
merged 1 commit into from Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions svg/extensibility/foreignObject/getboundingclientrect.html
@@ -0,0 +1,33 @@
<!doctype html>
<title>foreignObject: Element.prototype.getBoundingClientRect()</title>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-ForeignObjectElement">
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#descendant {
width: 100px;
height: 60px;
margin: 6px 12px;
background-color: blue;
}
</style>
<svg>
<foreignObject x="20" y="10" width="200" height="100">
<div id="descendant"></div>
</foreignObject>
</svg>
<script>
function checkBoundingRect(element, bounds) {
let boundingRect = element.getBoundingClientRect();
for (let prop of ['left', 'top', 'width', 'height'])
assert_equals(boundingRect[prop], bounds[prop], prop);
}

test(function() {
checkBoundingRect(document.querySelector('foreignObject'),
{ left: 28, top: 18, width: 200, height: 100 });
checkBoundingRect(document.querySelector('foreignObject > div'),
{ left: 40, top: 24, width: 100, height: 60 });
});
</script>
@@ -0,0 +1,31 @@
<!doctype html>
<title>fO with positioned descendants overlapping a fO with 'will-change: transform' child</title>
<link rel="match" href="../../struct/reftests/reference/green-100x100.html">
<style>
#outer {
position: relative;
width: 50px;
margin: 0 25px;
background-color: red;
}
#inner {
position: relative;
width: 50px;
height: 100px;
background-color: green;
}
#willtransform {
will-change: transform;
width: 100px;
height: 100px;
background-color: green;
}
</style>
<svg>
<foreignObject width="100" height="100">
<div id="willtransform"></div>
</foreignObject>
<foreignObject width="100" height="100">
<div id="outer"><div id="inner"></div></div>
</foreignObject>
</svg>