@@ -246,7 +246,7 @@ public void InvalidateScrollInfo()
246246 // We also don't invalidate measure if we are in the middle of the
247247 // measure pass, as the ScrollViewer will already be updating the
248248 // visibility of the autoscrollbars.
249- if ( ! MeasureInProgress &&
249+ if ( ! MeasureInProgress &&
250250 ( ! ArrangeInProgress || ! InvalidatedMeasureFromArrange ) )
251251 {
252252 //
@@ -892,7 +892,7 @@ public event ScrollChangedEventHandler ScrollChanged
892892 protected override void OnStylusSystemGesture ( StylusSystemGestureEventArgs e )
893893 {
894894 // DevDiv:1139804
895- // Keep track of seeing a tap gesture so that we can use this information to
895+ // Keep track of seeing a tap gesture so that we can use this information to
896896 // make decisions about panning.
897897 _seenTapGesture = e . SystemGesture == SystemGesture . Tap ;
898898 }
@@ -1175,7 +1175,7 @@ protected override Size MeasureOverride(Size constraint)
11751175 ScrollBarVisibility vsbv = VerticalScrollBarVisibility ;
11761176 ScrollBarVisibility hsbv = HorizontalScrollBarVisibility ;
11771177 Size desiredSize = new Size ( ) ;
1178-
1178+
11791179 if ( child != null )
11801180 {
11811181 bool etwTracingEnabled = EventTrace . IsEnabled ( EventTrace . Keyword . KeywordGeneral , EventTrace . Level . Info ) ;
@@ -1511,7 +1511,7 @@ private void OnPanningModeChanged()
15111511 PanningMode mode = PanningMode ;
15121512
15131513 // Call InvalidateProperty for IsManipulationEnabledProperty
1514- // to reset previous SetCurrentValueInternal if any.
1514+ // to reset previous SetCurrentValueInternal if any.
15151515 // Then call SetCurrentValueInternal to
15161516 // set the value of these properties if needed.
15171517 InvalidateProperty ( IsManipulationEnabledProperty ) ;
@@ -1742,7 +1742,7 @@ protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
17421742 // High precision touch devices can trigger a panning manipulation
17431743 // due to the low threshold we set for pan initiation. This may be
17441744 // undesirable since we may enter pan for what the system considers a
1745- // tap. Panning should be contingent on a drag gesture as that is the
1745+ // tap. Panning should be contingent on a drag gesture as that is the
17461746 // most consistent with the system at large. So if we have seen a tap
17471747 // on our main input, we should cancel any panning.
17481748 if ( _seenTapGesture )
@@ -1831,7 +1831,7 @@ private void ManipulateScroll(double delta, double cumulativeTranslation, bool i
18311831
18321832 if ( DoubleUtil . AreClose ( scrollableLength , 0 ) )
18331833 {
1834- // If the Scrollable length in this direction is 0,
1834+ // If the Scrollable length in this direction is 0,
18351835 // then we should neither scroll nor report the boundary feedback
18361836 unused = 0 ;
18371837 delta = 0 ;
@@ -1846,7 +1846,7 @@ private void ManipulateScroll(double delta, double cumulativeTranslation, bool i
18461846 }
18471847 else if ( DoubleUtil . LessThan ( delta , 0 ) && DoubleUtil . GreaterThan ( unused , 0 ) )
18481848 {
1849- // If we are past the boundary in positive direction
1849+ // If we are past the boundary in positive direction
18501850 // and the delta is in negative direction,
18511851 // then compensate the delta from unused vector.
18521852 double newUnused = Math . Max ( unused + delta , 0 ) ;
@@ -1855,7 +1855,7 @@ private void ManipulateScroll(double delta, double cumulativeTranslation, bool i
18551855 }
18561856 else if ( DoubleUtil . GreaterThan ( delta , 0 ) && DoubleUtil . LessThan ( unused , 0 ) )
18571857 {
1858- // If we are past the boundary in negative direction
1858+ // If we are past the boundary in negative direction
18591859 // and the delta is in positive direction,
18601860 // then compensate the delta from unused vector.
18611861 double newUnused = Math . Min ( unused + delta , 0 ) ;
@@ -1878,7 +1878,7 @@ private void ManipulateScroll(double delta, double cumulativeTranslation, bool i
18781878 if ( ! DoubleUtil . AreClose ( delta , 0 ) )
18791879 {
18801880 // if there is any delta left, then re-evalute the vertical offset
1881- ScrollToVerticalOffset ( _panningInfo . OriginalVerticalOffset -
1881+ ScrollToVerticalOffset ( _panningInfo . OriginalVerticalOffset -
18821882 Math . Round ( PanningRatio * cumulativeTranslation / _panningInfo . DeltaPerVerticalOffset ) ) ;
18831883 }
18841884 _panningInfo . UnusedTranslation = new Vector ( _panningInfo . UnusedTranslation . X , unused ) ;
@@ -1903,7 +1903,7 @@ private bool IsPastInertialLimit()
19031903
19041904 /// <summary>
19051905 /// Scrolling due to manipulation can start only if there is a considerable delta
1906- /// in the direction based on the mode. This method makes sure that the delta is
1906+ /// in the direction based on the mode. This method makes sure that the delta is
19071907 /// considerable.
19081908 /// </summary>
19091909 private bool CanStartScrollManipulation ( Vector translation , out bool cancelManipulation )
@@ -2312,6 +2312,15 @@ private bool ExecuteNextCommand()
23122312
23132313 if ( ! rcNew . IsEmpty )
23142314 {
2315+ // clip the new rect to isi's bounds, in case isi didn't.
2316+ // The ancestor's scroll should only depend on the visible
2317+ // portion of the new rect.
2318+ UIElement uie = visi as UIElement ;
2319+ if ( uie != null )
2320+ {
2321+ rcNew . Intersect ( new Rect ( uie . RenderSize ) ) ;
2322+ }
2323+
23152324 GeneralTransform t = visi . TransformToAncestor ( this ) ;
23162325 rcNew = t . TransformBounds ( rcNew ) ;
23172326 }
@@ -2609,7 +2618,7 @@ private static void OnScrollCommand(object target, ExecutedRoutedEventArgs args)
26092618 ScrollViewer sv = target as ScrollViewer ;
26102619 if ( sv != null )
26112620 {
2612- // If any of the ScrollBar scroll commands are raised while
2621+ // If any of the ScrollBar scroll commands are raised while
26132622 // scroll manipulation is in its inertia, then the manipualtion
26142623 // should be completed.
26152624 sv . CompleteScrollManipulation = true ;
@@ -2636,8 +2645,8 @@ private static void OnQueryScrollCommand(object target, CanExecuteRoutedEventArg
26362645 {
26372646 args . CanExecute = false ;
26382647 args . ContinueRouting = true ;
2639-
2640- // It is important to handle this event to prevent any
2648+
2649+ // It is important to handle this event to prevent any
26412650 // other ScrollViewers in the ancestry from claiming it.
26422651 args . Handled = true ;
26432652 }
@@ -2654,7 +2663,7 @@ private static void OnQueryScrollCommand(object target, CanExecuteRoutedEventArg
26542663 {
26552664 args . CanExecute = false ;
26562665
2657- // It is important to handle this event to prevent any
2666+ // It is important to handle this event to prevent any
26582667 // other ScrollViewers in the ancestry from claiming it.
26592668 args . Handled = true ;
26602669 }
@@ -2933,7 +2942,7 @@ internal bool InChildMeasurePass3
29332942
29342943 private PanningInfo _panningInfo = null ;
29352944 private Flags _flags = Flags . HandlesMouseWheelScrolling ;
2936-
2945+
29372946 #endregion
29382947
29392948 //-------------------------------------------------------------------
0 commit comments