Bug 1227327 - Invalidate table parts and MathML frames when background-position changes on them. r=dbaron

Theoretically we should do the same for nsTreeBodyFrame, but that frame type is
harder to detect and I'm not sure it's worth adding code to support updating
background-position on XUL trees.

MozReview-Commit-ID: 8HPT53MX6bO

--HG--
extra : rebase_source : 1e84e83616832debe8f6da394630a5a2e014e7df
This commit is contained in:
Markus Stange 2016-04-28 13:01:22 -04:00
Родитель c30cae967e
Коммит 0aa0fa1e2b
4 изменённых файлов: 28 добавлений и 4 удалений

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

@ -886,6 +886,19 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
hint |= nsChangeHint_RepaintFrame;
}
if (hint & nsChangeHint_UpdateBackgroundPosition) {
// For most frame types, DLBI can detect background position changes,
// so we only need to schedule a paint.
hint |= nsChangeHint_SchedulePaint;
if (frame->IsFrameOfType(nsIFrame::eTablePart) ||
frame->IsFrameOfType(nsIFrame::eMathML)) {
// Table parts and MathML frames don't build display items for their
// backgrounds, so DLBI can't detect background-position changes for
// these frames. Repaint the whole frame.
hint |= nsChangeHint_RepaintFrame;
}
}
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {

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

@ -194,6 +194,15 @@ enum nsChangeHint {
*/
nsChangeHint_UpdateUsesOpacity = 1 << 25,
/**
* Indicates that the 'background-position' property changed.
* Regular frames can invalidate these changes using DLBI, but
* for some frame types we need to repaint the whole frame because
* the frame does not build individual background image display items
* for each background layer.
*/
nsChangeHint_UpdateBackgroundPosition = 1 << 26,
// IMPORTANT NOTE: When adding new hints, consider whether you need to
// add them to NS_HintsNotHandledForDescendantsIn() below. Please also
// add them to RestyleManager::ChangeHintToString.
@ -303,7 +312,8 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
nsChangeHint_ReflowChangesSizeOrPosition | \
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_UpdateComputedBSize | \
nsChangeHint_UpdateUsesOpacity)
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_UpdateBackgroundPosition)
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
nsChangeHint result = nsChangeHint(aChangeHint & (
@ -319,7 +329,8 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
nsChangeHint_UpdateContainingBlock |
nsChangeHint_BorderStyleNoneChange |
nsChangeHint_UpdateComputedBSize |
nsChangeHint_UpdateUsesOpacity));
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_UpdateBackgroundPosition));
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {

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

@ -2651,7 +2651,7 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aOthe
}
if (mPosition != aOther.mPosition) {
hint |= nsChangeHint_SchedulePaint;
hint |= nsChangeHint_UpdateBackgroundPosition;
}
return hint;

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

@ -801,7 +801,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
static nsChangeHint MaxDifference() {
return nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame |
nsChangeHint_SchedulePaint |
nsChangeHint_UpdateBackgroundPosition |
nsChangeHint_NeutralChange;
}
static nsChangeHint DifferenceAlwaysHandledForDescendants() {