Bug 1530584 - Correct placeholder overflow calculation. r=miko,mattwoodrow

The calculation of aOverflow rect for a placeholder contained in a transformed
stacking context didn't take the transform into account, leading to an incorrect
rect which artificially inflated the calculated rebuild region.

Differential Revision: https://phabricator.services.mozilla.com/D21168

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dan Glastonbury 2019-03-04 12:26:49 +00:00
parent 46602dc8b0
commit ff5c70a292
4 changed files with 50 additions and 4 deletions

View File

@ -844,10 +844,12 @@ static bool ProcessFrameInternal(nsIFrame* aFrame,
: nullptr;
if (placeholder) {
// The rect aOverflow is in the coordinate space of the containing block.
// Convert it to a coordinate space of the placeholder frame.
nsRect placeholderOverflow =
aOverflow + currentFrame->GetOffsetTo(placeholder);
nsRect placeholderOverflow = aOverflow;
auto rv = nsLayoutUtils::TransformRect(currentFrame, placeholder,
placeholderOverflow);
if (rv != nsLayoutUtils::TRANSFORM_SUCCEEDED) {
placeholderOverflow = nsRect();
}
CRR_LOG("Processing placeholder %p for OOF frame %p\n", placeholder,
currentFrame);

View File

@ -2,6 +2,7 @@ skip-if(!retainedDisplayList) == retained-dl-style-change-1.html retained-dl-sty
skip-if(!retainedDisplayList) == retained-dl-frame-deleted-1.html retained-dl-style-change-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-frame-created-1.html retained-dl-style-change-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-style-change-stacking-context-1.html retained-dl-style-change-stacking-context-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-style-change-stacking-context-2.html retained-dl-style-change-stacking-context-2-ref.html
skip-if(!retainedDisplayList||!asyncPan) == retained-dl-async-scrolled-1.html retained-dl-async-scrolled-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-remove-for-ancestor-change-1.html retained-dl-remove-for-ancestor-change-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-scroll-out-of-view-1.html retained-dl-scroll-out-of-view-1-ref.html

View File

@ -0,0 +1,20 @@
<html>
<head>
<style>
body {
margin: 0px;
}
div {
left: 50px;
width:100px;
height:100px;
display: inline-block;
position: absolute;
background-color: green;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -0,0 +1,23 @@
<html class="reftest-wait">
<head>
<style>
body {
margin: 0px;
}
</style>
</head>
<body>
<div style="transform-origin: left top 0px; transform: translate(50px, 0px) scale(0.5);">
<div id="first" style="width: 100px; height: 200px; background-color: green; float: left;" class="reftest-no-display-list"></div>
<div id="second" style="width: 100px; height: 200px; position: absolute; transform: translate(100px, 0px); background-color: red;"></div>
</div>
</body>
<script>
function doTest() {
document.getElementById("second").style.backgroundColor = "green";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</html>