Bug 1082098 - Part 1 - Return correct change hint when scroll-behavior CSS value changes. r=roc
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Tue, 28 Oct 2014 13:41:00 -0700
changeset 213168 07daf18bf013c5649eda03804e137ccb9a958ba2
parent 213167 b365ed0223370bc2562f1ef3fedd1936bcadcdad
child 213169 c13d91ae9f04451636b11910ae13d41568e6f62f
push id27742
push userryanvm@gmail.com
push dateThu, 30 Oct 2014 20:15:35 +0000
treeherdermozilla-central@e0b505a37b1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1082098
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1082098 - Part 1 - Return correct change hint when scroll-behavior CSS value changes. r=roc - When the scroll-behavior CSS value changed, the nsChangeHint_NeutralChange hint was returned by nsStyleDisplay::CalcDifference. It now returns nsChangeHint_ReconstructFrame to ensure that the change takes effect. - When scroll-behavior is changed, the nsChangeHint_NeutralChange was not sufficient to enter nsCSSFrameConstructor::PropagateScrollToViewport. By using the same hint 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.
layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2672,19 +2672,30 @@ nsChangeHint nsStyleDisplay::CalcDiffere
   nsChangeHint hint = nsChangeHint(0);
 
   if (!EqualURIs(mBinding, aOther.mBinding)
       || mPosition != aOther.mPosition
       || mDisplay != aOther.mDisplay
       || (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
       || mOverflowX != aOther.mOverflowX
       || mOverflowY != aOther.mOverflowY
+      || mScrollBehavior != aOther.mScrollBehavior
       || mResize != aOther.mResize)
     NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
 
+  /* Note: When mScrollBehavior is changed, the nsChangeHint_NeutralChange is
+   * not sufficient to enter nsCSSFrameConstructor::PropagateScrollToViewport.
+   * By using the same hint 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 &&
        aOther.mAppearance != NS_THEME_TEXTFIELD) ||
       (mAppearance != NS_THEME_TEXTFIELD &&
        aOther.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
@@ -2844,18 +2855,17 @@ nsChangeHint nsStyleDisplay::CalcDiffere
        mAnimations != aOther.mAnimations ||
        mAnimationTimingFunctionCount != aOther.mAnimationTimingFunctionCount ||
        mAnimationDurationCount != aOther.mAnimationDurationCount ||
        mAnimationDelayCount != aOther.mAnimationDelayCount ||
        mAnimationNameCount != aOther.mAnimationNameCount ||
        mAnimationDirectionCount != aOther.mAnimationDirectionCount ||
        mAnimationFillModeCount != aOther.mAnimationFillModeCount ||
        mAnimationPlayStateCount != aOther.mAnimationPlayStateCount ||
-       mAnimationIterationCountCount != aOther.mAnimationIterationCountCount ||
-       mScrollBehavior != aOther.mScrollBehavior)) {
+       mAnimationIterationCountCount != aOther.mAnimationIterationCountCount)) {
     NS_UpdateHint(hint, nsChangeHint_NeutralChange);
   }
 
   return hint;
 }
 
 // --------------------
 // nsStyleVisibility