Bug 1359834 Part 1: Change nsStyleDisplay::CalcDifference to early exit when hinting nsChangeHint_ReconstructFrame.
If we'll be reconstructing frames for the subtree in question, then we'll also
be reflowing and repainting that whole subtree. So all of this function's
other changehints become unnecessary and redundant.
MozReview-Commit-ID: 7R9lARBU7vZ
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3488,17 +3488,30 @@ nsStyleDisplay::CalcDifference(const nsS
|| mScrollBehavior != aNewData.mScrollBehavior
|| mScrollSnapTypeX != aNewData.mScrollSnapTypeX
|| mScrollSnapTypeY != aNewData.mScrollSnapTypeY
|| mScrollSnapPointsX != aNewData.mScrollSnapPointsX
|| mScrollSnapPointsY != aNewData.mScrollSnapPointsY
|| mScrollSnapDestination != aNewData.mScrollSnapDestination
|| mTopLayer != aNewData.mTopLayer
|| mResize != aNewData.mResize) {
- hint |= nsChangeHint_ReconstructFrame;
+ return nsChangeHint_ReconstructFrame;
+ }
+
+ if ((mAppearance == NS_THEME_TEXTFIELD &&
+ aNewData.mAppearance != NS_THEME_TEXTFIELD) ||
+ (mAppearance != NS_THEME_TEXTFIELD &&
+ aNewData.mAppearance == NS_THEME_TEXTFIELD)) {
+ // This is for <input type=number> where we allow authors to specify a
+ // |-moz-appearance:textfield| to get a control without a spinner. (The
+ // spinner is present for |-moz-appearance:number-input| but also other
+ // values such as 'none'.) We need to reframe since we want to use
+ // nsTextControlFrame instead of nsNumberControlFrame if the author
+ // specifies 'textfield'.
+ return nsChangeHint_ReconstructFrame;
}
if (mOverflowX != aNewData.mOverflowX
|| mOverflowY != aNewData.mOverflowY) {
hint |= nsChangeHint_CSSOverflowChange;
}
/* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY,
@@ -3508,29 +3521,16 @@ nsStyleDisplay::CalcDifference(const nsS
* as used when the overflow css property changes,
* nsChangeHint_ReconstructFrame, PropagateScrollToViewport will be called.
*
* The scroll-behavior css property is not expected to change often (the
* CSSOM-View DOM methods are likely to be used in those cases); however,
* if this does become common perhaps a faster-path might be worth while.
*/
- if ((mAppearance == NS_THEME_TEXTFIELD &&
- aNewData.mAppearance != NS_THEME_TEXTFIELD) ||
- (mAppearance != NS_THEME_TEXTFIELD &&
- aNewData.mAppearance == NS_THEME_TEXTFIELD)) {
- // This is for <input type=number> where we allow authors to specify a
- // |-moz-appearance:textfield| to get a control without a spinner. (The
- // spinner is present for |-moz-appearance:number-input| but also other
- // values such as 'none'.) We need to reframe since we want to use
- // nsTextControlFrame instead of nsNumberControlFrame if the author
- // specifies 'textfield'.
- return nsChangeHint_ReconstructFrame;
- }
-
if (mFloat != aNewData.mFloat) {
// Changing which side we float on doesn't affect descendants directly
hint |= nsChangeHint_AllReflowHints &
~(nsChangeHint_ClearDescendantIntrinsics |
nsChangeHint_NeedDirtyReflow);
}
if (mVerticalAlign != aNewData.mVerticalAlign) {