Bug 539356 - Part 18 - Mark frames with only invalid children as an optimization to use when invalidating further frames. r=roc

This commit is contained in:
Matt Woodrow 2012-08-29 17:48:43 +12:00
Родитель 57198c4af7
Коммит 5542e52aa1
2 изменённых файлов: 22 добавлений и 1 удалений

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

@ -4754,6 +4754,12 @@ void
nsIFrame::InvalidateFrameSubtree(uint32_t aFlags)
{
InvalidateFrame(aFlags);
if (HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
return;
}
AddStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT);
nsAutoTArray<nsIFrame::ChildList,4> childListArray;
GetCrossDocChildLists(&childListArray);
@ -4784,7 +4790,9 @@ nsIFrame::ClearInvalidationStateBits()
}
}
RemoveStateBits(NS_FRAME_NEEDS_PAINT | NS_FRAME_DESCENDANT_NEEDS_PAINT);
RemoveStateBits(NS_FRAME_NEEDS_PAINT |
NS_FRAME_DESCENDANT_NEEDS_PAINT |
NS_FRAME_ALL_DESCENDANTS_NEED_PAINT);
}
void
@ -7991,6 +7999,13 @@ nsFrame::SetParent(nsIFrame* aParent)
} else {
RemoveInPopupStateBitFromDescendants(this);
}
// If our new parent only has invalid children, then we just invalidate
// ourselves too. This is probably faster than clearing the flag all
// the way up the frame tree.
if (aParent->HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
InvalidateFrame(INVALIDATE_DONT_SCHEDULE_PAINT);
}
}
void

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

@ -313,6 +313,12 @@ typedef uint64_t nsFrameState;
// Frame is a descendant of a popup
#define NS_FRAME_IN_POPUP NS_FRAME_STATE_BIT(50)
// Frame has only descendant frames that needs painting - This includes
// cross-doc children. This guarantees that all descendents have
// NS_FRAME_NEEDS_PAINT and NS_FRAME_ALL_DESCENDANTS_NEED_PAINT, or they
// have no display items.
#define NS_FRAME_ALL_DESCENDANTS_NEED_PAINT NS_FRAME_STATE_BIT(51)
// Box layout bits
#define NS_STATE_IS_HORIZONTAL NS_FRAME_STATE_BIT(22)
#define NS_STATE_IS_DIRECTION_NORMAL NS_FRAME_STATE_BIT(31)