Bug 815030. Invalidate cached background images in when a frame gets a visual style change. r=mattwoodrow

--HG--
extra : rebase_source : eef4784ea2d4ef0f88d6dfdbf3258d1b8416f443
This commit is contained in:
Robert O'Callahan 2012-11-27 22:05:10 +13:00
parent 5e6daf4c32
commit 8868e9761e
5 changed files with 25 additions and 14 deletions

View File

@ -402,9 +402,9 @@ nsCanvasFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
NS_IMETHODIMP
nsCanvasFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsCanvasFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);

View File

@ -273,15 +273,6 @@ nsIFrame::MarkAsNotAbsoluteContainingBlock()
Properties().Delete(AbsoluteContainingBlockProperty());
}
void
nsIFrame::ClearDisplayItemCache()
{
if (GetStateBits() & NS_FRAME_HAS_CACHED_BACKGROUND) {
Properties().Delete(CachedBackgroundImage());
RemoveStateBits(NS_FRAME_HAS_CACHED_BACKGROUND);
}
}
bool
nsIFrame::CheckAndClearPaintedState()
{
@ -4876,6 +4867,10 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru
aFrame->Properties().Delete(nsIFrame::InvalidationRect());
aFrame->RemoveStateBits(NS_FRAME_HAS_INVALID_RECT);
}
if (aFrame->HasAnyStateBits(NS_FRAME_HAS_CACHED_BACKGROUND)) {
aFrame->Properties().Delete(nsIFrame::CachedBackgroundImage());
aFrame->RemoveStateBits(NS_FRAME_HAS_CACHED_BACKGROUND);
}
}
void

View File

@ -2676,8 +2676,6 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
*/
virtual bool IsFocusable(int32_t *aTabIndex = nullptr, bool aWithMouse = false);
void ClearDisplayItemCache();
// BOX LAYOUT METHODS
// These methods have been migrated from nsIBox and are in the process of
// being refactored. DO NOT USE OUTSIDE OF XUL.

View File

@ -0,0 +1,5 @@
<!DOCTYPE HTML>
<html>
<body style="background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyAQMAAACQ%2B%2Bz9AAAAA1BMVEUA%2FwA0XsCoAAAAD0lEQVQoFWNgGAWjYGgCAAK8AAEb3eOQAAAAAElFTkSuQmCC);">
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body style="background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs%2B9AAAAAXNSR0IArs4c6QAAADdJREFUGNNjZGD4%2F5%2BBCMDCwMDAwNDQiF9VQz0DEwORgPoKGRkY%2Fv9fe%2BM5XkXBGpID7kZiFAIAEbULDl5w%2F68AAAAASUVORK5CYII%3D); background-attachment:fixed">
<script>
function doTest() {
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyAQMAAACQ%2B%2Bz9AAAAA1BMVEUA%2FwA0XsCoAAAAD0lEQVQoFWNgGAWjYGgCAAK8AAEb3eOQAAAAAElFTkSuQmCC";
document.body.style.backgroundImage = "url(" + img + ")";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>