mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests Fix offsetTop/offsetLeft for new offsetParent behavior While going up the flat tree to find an offsetParent, HTMLElement.offsetParent now skips elements which are closed shadow hidden from the element behind the OffsetParentNewSpecBehavior flag. However, there is additional correction needed in offsetTop and offsetLeft. They are supposed to be corresponding to the offsetParent, but I didn't implement this correction when I first implemented OffsetParentNewSpecBehavior. This patch makes offsetTop and offsetLeft add up all of the intermediate values skipped by the new offsetParent logic. It is similar to the WebKit implementation: https://trac.webkit.org/changeset/239313/webkit This patch also re-enables the flag now that all known issues are fixed. Bug: 1330819, 920069 Change-Id: I6183909a4dfa763f2f3e178edd0541866cd5bbf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3766138 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1066306} -- wpt-commits: 4b4f9151a001e032f7f2c6a308dee7fff84886d3 wpt-pr: 35250
41 lines
932 B
HTML
41 lines
932 B
HTML
<!DOCTYPE html>
|
|
<link rel=author href="mailto:[email protected]">
|
|
<link rel=help href="https://drafts.csswg.org/cssom-view-1/#dom-htmlelement-offsettop">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
|
|
<style>
|
|
.square {
|
|
width: 10px;
|
|
height: 10px;
|
|
background-color: red;
|
|
}
|
|
#one {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 10px;
|
|
}
|
|
#two {
|
|
position: absolute;
|
|
top: 50px;
|
|
left: 50px;
|
|
}
|
|
span.square {
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
|
|
<div id=one class=square>
|
|
<div id=two class=square>
|
|
<div class=square></div>
|
|
<span class=square></span><span id=target></span>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
test(() => {
|
|
assert_equals(target.offsetTop, 10, 'target.offsetTop');
|
|
assert_equals(target.offsetLeft, 10, 'target.offsetLeft');
|
|
}, 'Verifies that offsetTop and offsetLeft only go up one offsetParent when there are multiple nested offsetParents.');
|
|
</script>
|