mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 442715. Invalidate the whole border-box when an element's size changes and its background is being clipped by a border-radius. r=dbaron
--HG-- extra : rebase_source : b9e738ebd64cbcc871a7d1a7178e1eccf64e66f1
This commit is contained in:
parent
32bcb4af4e
commit
64435aeacc
@ -3947,8 +3947,7 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
|
||||
const nsRect& aOldOverflowRect,
|
||||
const nsSize& aNewDesiredSize)
|
||||
{
|
||||
if (aNewDesiredSize.width == aOldRect.width &&
|
||||
aNewDesiredSize.height == aOldRect.height)
|
||||
if (aNewDesiredSize == aOldRect.Size())
|
||||
return;
|
||||
|
||||
// Below, we invalidate the old frame area (or, in the case of
|
||||
@ -3992,13 +3991,25 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the old frame background if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
const nsStyleBackground *bg = GetStyleBackground();
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
const nsStyleBackground::Layer &layer = bg->mLayers[i];
|
||||
if (!layer.mImage.IsEmpty() &&
|
||||
(layer.mPosition.mXIsPercent || layer.mPosition.mYIsPercent)) {
|
||||
if (!bg->IsTransparent()) {
|
||||
// Invalidate the old frame background if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
const nsStyleBackground::Layer &layer = bg->mLayers[i];
|
||||
if (!layer.mImage.IsEmpty() &&
|
||||
(layer.mPosition.mXIsPercent || layer.mPosition.mYIsPercent)) {
|
||||
Invalidate(nsRect(0, 0, aOldRect.width, aOldRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the old frame background if the frame has a background
|
||||
// that is being clipped by border-radius, since the old or new area
|
||||
// clipped off by the radius is not necessarily in the area that has
|
||||
// already been invalidated (even if only the top-left corner has a
|
||||
// border radius).
|
||||
if (nsLayoutUtils::HasNonZeroCorner(border->mBorderRadius)) {
|
||||
Invalidate(nsRect(0, 0, aOldRect.width, aOldRect.height));
|
||||
return;
|
||||
}
|
||||
|
7
layout/reftests/border-radius/invalidate-1-ref.html
Normal file
7
layout/reftests/border-radius/invalidate-1-ref.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<div id="d" style="background:blue; -moz-border-radius:50px; width:200px; height:200px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
15
layout/reftests/border-radius/invalidate-1a.html
Normal file
15
layout/reftests/border-radius/invalidate-1a.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body>
|
||||
<div id="d" style="background:blue; -moz-border-radius:50px; width:200px; height:100px;">
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
var d = document.getElementById("d");
|
||||
d.style.height = "200px";
|
||||
document.documentElement.className = "";
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
15
layout/reftests/border-radius/invalidate-1b.html
Normal file
15
layout/reftests/border-radius/invalidate-1b.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body>
|
||||
<div id="d" style="background:blue; -moz-border-radius:50px; width:100px; height:200px;">
|
||||
</div>
|
||||
<script>
|
||||
function doTest() {
|
||||
var d = document.getElementById("d");
|
||||
d.style.width = "200px";
|
||||
document.documentElement.className = "";
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -16,3 +16,6 @@
|
||||
|
||||
# more serious tests, using SVG reference
|
||||
== border-circle-2.html border-circle-2-ref.xhtml
|
||||
|
||||
== invalidate-1a.html invalidate-1-ref.html
|
||||
== invalidate-1b.html invalidate-1-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user