mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 23:52:57 +00:00
This patch implements `Range::getClientRects` and `Range::getBoundingClientRect`. Since the rects returned by invoking getClientRects can be accessed without adding them to the Selection, `ViewportPaintable::recompute_selection_states` has been updated to accept a Range as a parameter, rather than acquiring it through the Document's Selection. With this change, the following tests now pass: - wpt[css/cssom-view/range-bounding-client-rect-with-nested-text.html] - wpt[css/cssom-view/DOMRectList.html] Note: The test "css/cssom-view/range-bounding-client-rect-with-display-contents.html" still fails due to an issue with Element::getClientRects, which will be addressed in a future commit.
19 lines
548 B
HTML
19 lines
548 B
HTML
<!--refer to https://wpt.live/css/cssom-view/DOMRectList.html -->
|
|
<body>
|
|
<div id="x">x</div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
function print_class_string(object) {
|
|
println({}.toString.call(object));
|
|
}
|
|
test(() => {
|
|
const x = document.getElementById("x");
|
|
const range = document.createRange();
|
|
range.selectNodeContents(x);
|
|
const domRectList = range.getClientRects();
|
|
print_class_string(domRectList);
|
|
print_class_string(domRectList.item(0));
|
|
});
|
|
</script>
|
|
|
|
</body>
|