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

This commit is contained in:
Robert O'Callahan 2012-11-27 22:05:10 +13:00
Родитель 34b45b6186
Коммит a5d000c938
5 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -403,9 +403,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);

Просмотреть файл

@ -257,15 +257,6 @@ nsIFrame::MarkAsAbsoluteContainingBlock() {
Properties().Set(AbsoluteContainingBlockProperty(), new nsAbsoluteContainingBlock(GetAbsoluteListID()));
}
void
nsIFrame::ClearDisplayItemCache()
{
if (GetStateBits() & NS_FRAME_HAS_CACHED_BACKGROUND) {
Properties().Delete(CachedBackgroundImage());
RemoveStateBits(NS_FRAME_HAS_CACHED_BACKGROUND);
}
}
bool
nsIFrame::CheckAndClearPaintedState()
{
@ -4807,6 +4798,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

Просмотреть файл

@ -2667,8 +2667,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.

Просмотреть файл

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

Просмотреть файл

@ -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>