From e6aafa63c06d51c721b3231068a4c150200e327e Mon Sep 17 00:00:00 2001 From: reunion-maestro-bot Date: Thu, 22 Aug 2024 19:58:38 +0000 Subject: [PATCH] Syncing content from committish 7a0b1f66408042405abb69cf4b1974cbb14997ff --- .../Generated/ScrollPresenter.properties.cpp | 33 +- .../Generated/ScrollPresenter.properties.h | 9 +- .../dev/Generated/ScrollView.properties.cpp | 33 +- .../dev/Generated/ScrollView.properties.h | 9 +- .../dev/NavigationView/NavigationView.cpp | 8 +- .../Repeater/TestUI/RepeaterTestUIPage.xaml | 1 + .../TestUI/RepeaterTestUIPage.xaml.cs | 5 + .../Repeater/TestUI/Repeater_TestUI.projitems | 27 +- .../TestUI/Samples/ObjectModelTestPage.xaml | 103 +++ .../Samples/ObjectModelTestPage.xaml.cs | 597 ++++++++++++++++++ .../ViewportManagerWithPlatformFeatures.cpp | 24 +- .../ViewportManagerWithPlatformFeatures.h | 10 +- .../ScrollPresenterViewChangeTests.cs | 212 +++++-- .../dev/ScrollPresenter/ScrollPresenter.cpp | 105 +-- .../dev/ScrollPresenter/ScrollPresenter.h | 14 +- .../dev/ScrollPresenter/ScrollPresenter.idl | 13 +- .../ScrollPresenter/ScrollPresenter.vcxitems | 6 +- .../ScrollPresenterAnchoring.cpp | 10 +- .../ScrollPresenterPrimitives.idl | 4 +- .../ScrollingScrollStartingEventArgs.cpp | 45 ++ ...s.h => ScrollingScrollStartingEventArgs.h} | 24 +- .../ScrollingViewChangingEventArgs.cpp | 47 -- .../ScrollingZoomStartingEventArgs.cpp | 45 ++ .../ScrollingZoomStartingEventArgs.h | 39 ++ .../TestUI/ScrollPresenterDynamicPage.xaml | 14 +- .../TestUI/ScrollPresenterDynamicPage.xaml.cs | 32 +- src/controls/dev/ScrollView/ScrollView.cpp | 44 +- src/controls/dev/ScrollView/ScrollView.h | 10 +- src/controls/dev/ScrollView/ScrollView.idl | 4 +- .../TestUI/ScrollViewBlankPage.xaml.cs | 41 +- .../TestUI/ScrollViewDynamicPage.xaml.cs | 50 +- src/controls/dev/WebView2/WebView2.cpp | 39 +- src/controls/dev/WebView2/WebView2.h | 2 + src/controls/dev/dll/packages.config | 2 +- .../test/MUXControlsTestApp/App.xaml.cs | 21 +- src/controls/test/TestAppCX/packages.config | 2 +- src/controls/tools/CustomTasksTool/Program.cs | 8 +- .../LoopingSelectorAutomationPeer_Partial.cpp | 2 +- ...SelectorItemDataAutomationPeer_Partial.cpp | 2 +- .../phone/lib/LoopingSelector_Partial.cpp | 2 +- src/dxaml/phone/lib/LoopingSelector_Partial.h | 2 +- src/dxaml/phone/lib/Pivot_Partial.cpp | 2 +- src/dxaml/xcp/components/CValue/CValue.cpp | 2 +- .../ContentRoot/PointerInputProcessor.cpp | 24 +- src/dxaml/xcp/components/base/inc/minerror.h | 58 +- .../brushes/LinearGradientBrush.cpp | 2 +- .../components/brushes/WUCBrushManager.cpp | 4 +- .../components/deferral/StyleCustomWriter.cpp | 4 +- ...pCollectionCustomRuntimeDataSerializer.cpp | 1 + .../elements/sharedstubs/SharedStubs.cpp | 2 +- .../gestures/inc/ElementGestureTracker.h | 2 +- .../graphics/EffectPolicyHelper.cpp | 2 +- .../graphics/ProjectedShadowManager.cpp | 2 +- .../components/imaging/AsyncImageDecoder.cpp | 10 +- .../components/imaging/ImageDecodeRequest.cpp | 4 +- .../lifetime/lib/ReferenceTrackerManager.cpp | 8 +- src/dxaml/xcp/components/math/inlined.cpp | 2 +- .../xcp/components/metadata/inc/EnumDefs.g.h | 1 + .../metadata/inc/EnumValueTable.g.h | 1 + .../components/text/inc/TextRangeCollection.h | 4 +- src/dxaml/xcp/control/download/download.cpp | 2 +- .../xcp/core/Parser/objectwriternodelist.cpp | 2 +- .../xcp/core/core/elements/AutomationPeer.cpp | 12 +- src/dxaml/xcp/core/core/elements/Glyphs.cpp | 2 +- src/dxaml/xcp/core/core/elements/Popup.cpp | 4 +- .../core/core/elements/TargetPropertyPath.cpp | 2 +- src/dxaml/xcp/core/core/elements/depends.cpp | 2 +- .../xcp/core/core/elements/imagesource.cpp | 6 +- src/dxaml/xcp/core/dll/VisualTree.cpp | 2 +- src/dxaml/xcp/core/dll/xcpcore.cpp | 2 +- .../ImagingProvider/LoadedImageSurface.cpp | 2 +- src/dxaml/xcp/core/inc/ObjectWriterNode.h | 2 +- src/dxaml/xcp/core/inc/Popup.h | 1 + src/dxaml/xcp/core/inc/RenderTargetBitmap.h | 2 +- src/dxaml/xcp/core/inc/XamlIslandRoot.h | 2 +- .../core/native/inc/MediaPlayerPresenter.h | 2 +- .../native/media/MediaPlayerPresenter.cpp | 2 +- .../text/Common/D2DTextDrawingContext.cpp | 7 +- .../Controls/PrivateTextInputSettings.cpp | 10 +- .../text/Controls/PrivateTextInputSettings.h | 6 +- .../core/native/text/Controls/TextBoxView.cpp | 12 +- .../core/native/text/Controls/TextBoxView.h | 6 +- .../native/text/Controls/TextServicesHost.h | 12 +- .../xcp/PALFontAndScriptServices.cpp | 40 +- .../xcp/core/text/shaping/inc/ShapingTypes.h | 4 +- .../core/microsoft.ui.xaml.coretypes.idl | 3 + src/dxaml/xcp/dxaml/lib/AppBar_Partial.cpp | 2 +- .../xcp/dxaml/lib/AutomationPeer_Partial.cpp | 4 +- .../xcp/dxaml/lib/CommandBar_Partial.cpp | 4 +- src/dxaml/xcp/dxaml/lib/CueStyler.cpp | 2 +- .../lib/CustomXamlResourceLoaderWrapper.cpp | 2 +- .../xcp/dxaml/lib/DropOperationTarget.cpp | 187 +++++- src/dxaml/xcp/dxaml/lib/DropOperationTarget.h | 34 +- ...FrameworkElementAutomationPeer_partial.cpp | 2 +- .../xcp/dxaml/lib/ListViewBase_Partial.cpp | 2 +- .../lib/MediaTransportControls_Partial.h | 2 +- .../lib/MediaTransportControls_partial.cpp | 6 +- .../xcp/dxaml/lib/StackPanel_Partial.cpp | 4 +- .../xcp/dxaml/lib/TextElement_Partial.cpp | 2 +- .../xcp/dxaml/lib/TimePicker_Partial.cpp | 2 +- src/dxaml/xcp/dxaml/lib/ToolTip_Partial.cpp | 4 +- .../lib/WindowedPopupInputSiteAdapter.cpp | 32 + .../dxaml/lib/WindowedPopupInputSiteAdapter.h | 13 +- ...mlSourceFocusNavigationRequest_Partial.cpp | 18 +- src/dxaml/xcp/inc/UIAEnums.g.h | 1 + src/dxaml/xcp/inc/cvalue.h | 2 +- src/dxaml/xcp/pal/inc/paltext.h | 5 + .../pal/win/DWriteFontAndScriptServices.cpp | 16 +- .../pal/win/inc/DWriteFontAndScriptServices.h | 2 + .../plat/win/browserdesktop/WinThreadPool.cpp | 4 +- .../Microsoft.UI.Xaml.Automation.Peers.cs | 4 + src/eng/Version.Details.xml | 16 +- src/eng/versions.props | 6 +- src/global.json | 5 +- src/packages.config | 10 +- .../CodeGenerators/CSharpAppPass1.cs | 13 +- .../CodeGenerators/CSharpAppPass1.tt | 10 - .../CppWinRT/CppWinRT_AppPass2.cs | 18 +- .../CppWinRT/CppWinRT_AppPass2.tt | 15 - .../CppWinRT/CppWinRT_PageBinding.cs | 11 +- .../CppWinRT/CppWinRT_PageBinding.tt | 6 +- src/src/projection/Directory.Build.props | 34 +- src/src/projection/WindowsUITypeForwarders.cs | 54 ++ 123 files changed, 1956 insertions(+), 582 deletions(-) create mode 100644 src/controls/dev/Repeater/TestUI/Samples/ObjectModelTestPage.xaml create mode 100644 src/controls/dev/Repeater/TestUI/Samples/ObjectModelTestPage.xaml.cs create mode 100644 src/controls/dev/ScrollPresenter/ScrollingScrollStartingEventArgs.cpp rename src/controls/dev/ScrollPresenter/{ScrollingViewChangingEventArgs.h => ScrollingScrollStartingEventArgs.h} (60%) delete mode 100644 src/controls/dev/ScrollPresenter/ScrollingViewChangingEventArgs.cpp create mode 100644 src/controls/dev/ScrollPresenter/ScrollingZoomStartingEventArgs.cpp create mode 100644 src/controls/dev/ScrollPresenter/ScrollingZoomStartingEventArgs.h create mode 100644 src/src/projection/WindowsUITypeForwarders.cs diff --git a/src/controls/dev/Generated/ScrollPresenter.properties.cpp b/src/controls/dev/Generated/ScrollPresenter.properties.cpp index 2cd699d9f0..36a30aafb5 100644 --- a/src/controls/dev/Generated/ScrollPresenter.properties.cpp +++ b/src/controls/dev/Generated/ScrollPresenter.properties.cpp @@ -38,11 +38,12 @@ ScrollPresenterProperties::ScrollPresenterProperties() , m_extentChangedEventSource{static_cast(this)} , m_scrollAnimationStartingEventSource{static_cast(this)} , m_scrollCompletedEventSource{static_cast(this)} + , m_scrollStartingEventSource{static_cast(this)} , m_stateChangedEventSource{static_cast(this)} , m_viewChangedEventSource{static_cast(this)} - , m_viewChangingEventSource{static_cast(this)} , m_zoomAnimationStartingEventSource{static_cast(this)} , m_zoomCompletedEventSource{static_cast(this)} + , m_zoomStartingEventSource{static_cast(this)} { EnsureProperties(); } @@ -747,6 +748,16 @@ void ScrollPresenterProperties::ScrollCompleted(winrt::event_token const& token) m_scrollCompletedEventSource.remove(token); } +winrt::event_token ScrollPresenterProperties::ScrollStarting(winrt::TypedEventHandler const& value) +{ + return m_scrollStartingEventSource.add(value); +} + +void ScrollPresenterProperties::ScrollStarting(winrt::event_token const& token) +{ + m_scrollStartingEventSource.remove(token); +} + winrt::event_token ScrollPresenterProperties::StateChanged(winrt::TypedEventHandler const& value) { return m_stateChangedEventSource.add(value); @@ -767,16 +778,6 @@ void ScrollPresenterProperties::ViewChanged(winrt::event_token const& token) m_viewChangedEventSource.remove(token); } -winrt::event_token ScrollPresenterProperties::ViewChanging(winrt::TypedEventHandler const& value) -{ - return m_viewChangingEventSource.add(value); -} - -void ScrollPresenterProperties::ViewChanging(winrt::event_token const& token) -{ - m_viewChangingEventSource.remove(token); -} - winrt::event_token ScrollPresenterProperties::ZoomAnimationStarting(winrt::TypedEventHandler const& value) { return m_zoomAnimationStartingEventSource.add(value); @@ -796,3 +797,13 @@ void ScrollPresenterProperties::ZoomCompleted(winrt::event_token const& token) { m_zoomCompletedEventSource.remove(token); } + +winrt::event_token ScrollPresenterProperties::ZoomStarting(winrt::TypedEventHandler const& value) +{ + return m_zoomStartingEventSource.add(value); +} + +void ScrollPresenterProperties::ZoomStarting(winrt::event_token const& token) +{ + m_zoomStartingEventSource.remove(token); +} diff --git a/src/controls/dev/Generated/ScrollPresenter.properties.h b/src/controls/dev/Generated/ScrollPresenter.properties.h index 9f5b265ad4..cfad166073 100644 --- a/src/controls/dev/Generated/ScrollPresenter.properties.h +++ b/src/controls/dev/Generated/ScrollPresenter.properties.h @@ -111,27 +111,30 @@ class ScrollPresenterProperties void ScrollAnimationStarting(winrt::event_token const& token); winrt::event_token ScrollCompleted(winrt::TypedEventHandler const& value); void ScrollCompleted(winrt::event_token const& token); + winrt::event_token ScrollStarting(winrt::TypedEventHandler const& value); + void ScrollStarting(winrt::event_token const& token); winrt::event_token StateChanged(winrt::TypedEventHandler const& value); void StateChanged(winrt::event_token const& token); winrt::event_token ViewChanged(winrt::TypedEventHandler const& value); void ViewChanged(winrt::event_token const& token); - winrt::event_token ViewChanging(winrt::TypedEventHandler const& value); - void ViewChanging(winrt::event_token const& token); winrt::event_token ZoomAnimationStarting(winrt::TypedEventHandler const& value); void ZoomAnimationStarting(winrt::event_token const& token); winrt::event_token ZoomCompleted(winrt::TypedEventHandler const& value); void ZoomCompleted(winrt::event_token const& token); + winrt::event_token ZoomStarting(winrt::TypedEventHandler const& value); + void ZoomStarting(winrt::event_token const& token); event_source> m_anchorRequestedEventSource; event_source> m_bringingIntoViewEventSource; event_source> m_extentChangedEventSource; event_source> m_scrollAnimationStartingEventSource; event_source> m_scrollCompletedEventSource; + event_source> m_scrollStartingEventSource; event_source> m_stateChangedEventSource; event_source> m_viewChangedEventSource; - event_source> m_viewChangingEventSource; event_source> m_zoomAnimationStartingEventSource; event_source> m_zoomCompletedEventSource; + event_source> m_zoomStartingEventSource; static void EnsureProperties(); static void ClearProperties(); diff --git a/src/controls/dev/Generated/ScrollView.properties.cpp b/src/controls/dev/Generated/ScrollView.properties.cpp index 8d3d11a9e7..61d3fa20f3 100644 --- a/src/controls/dev/Generated/ScrollView.properties.cpp +++ b/src/controls/dev/Generated/ScrollView.properties.cpp @@ -42,11 +42,12 @@ ScrollViewProperties::ScrollViewProperties() , m_extentChangedEventSource{static_cast(this)} , m_scrollAnimationStartingEventSource{static_cast(this)} , m_scrollCompletedEventSource{static_cast(this)} + , m_scrollStartingEventSource{static_cast(this)} , m_stateChangedEventSource{static_cast(this)} , m_viewChangedEventSource{static_cast(this)} - , m_viewChangingEventSource{static_cast(this)} , m_zoomAnimationStartingEventSource{static_cast(this)} , m_zoomCompletedEventSource{static_cast(this)} + , m_zoomStartingEventSource{static_cast(this)} { EnsureProperties(); } @@ -883,6 +884,16 @@ void ScrollViewProperties::ScrollCompleted(winrt::event_token const& token) m_scrollCompletedEventSource.remove(token); } +winrt::event_token ScrollViewProperties::ScrollStarting(winrt::TypedEventHandler const& value) +{ + return m_scrollStartingEventSource.add(value); +} + +void ScrollViewProperties::ScrollStarting(winrt::event_token const& token) +{ + m_scrollStartingEventSource.remove(token); +} + winrt::event_token ScrollViewProperties::StateChanged(winrt::TypedEventHandler const& value) { return m_stateChangedEventSource.add(value); @@ -903,16 +914,6 @@ void ScrollViewProperties::ViewChanged(winrt::event_token const& token) m_viewChangedEventSource.remove(token); } -winrt::event_token ScrollViewProperties::ViewChanging(winrt::TypedEventHandler const& value) -{ - return m_viewChangingEventSource.add(value); -} - -void ScrollViewProperties::ViewChanging(winrt::event_token const& token) -{ - m_viewChangingEventSource.remove(token); -} - winrt::event_token ScrollViewProperties::ZoomAnimationStarting(winrt::TypedEventHandler const& value) { return m_zoomAnimationStartingEventSource.add(value); @@ -932,3 +933,13 @@ void ScrollViewProperties::ZoomCompleted(winrt::event_token const& token) { m_zoomCompletedEventSource.remove(token); } + +winrt::event_token ScrollViewProperties::ZoomStarting(winrt::TypedEventHandler const& value) +{ + return m_zoomStartingEventSource.add(value); +} + +void ScrollViewProperties::ZoomStarting(winrt::event_token const& token) +{ + m_zoomStartingEventSource.remove(token); +} diff --git a/src/controls/dev/Generated/ScrollView.properties.h b/src/controls/dev/Generated/ScrollView.properties.h index 2c4c99c3e7..fcb82b5218 100644 --- a/src/controls/dev/Generated/ScrollView.properties.h +++ b/src/controls/dev/Generated/ScrollView.properties.h @@ -131,27 +131,30 @@ class ScrollViewProperties void ScrollAnimationStarting(winrt::event_token const& token); winrt::event_token ScrollCompleted(winrt::TypedEventHandler const& value); void ScrollCompleted(winrt::event_token const& token); + winrt::event_token ScrollStarting(winrt::TypedEventHandler const& value); + void ScrollStarting(winrt::event_token const& token); winrt::event_token StateChanged(winrt::TypedEventHandler const& value); void StateChanged(winrt::event_token const& token); winrt::event_token ViewChanged(winrt::TypedEventHandler const& value); void ViewChanged(winrt::event_token const& token); - winrt::event_token ViewChanging(winrt::TypedEventHandler const& value); - void ViewChanging(winrt::event_token const& token); winrt::event_token ZoomAnimationStarting(winrt::TypedEventHandler const& value); void ZoomAnimationStarting(winrt::event_token const& token); winrt::event_token ZoomCompleted(winrt::TypedEventHandler const& value); void ZoomCompleted(winrt::event_token const& token); + winrt::event_token ZoomStarting(winrt::TypedEventHandler const& value); + void ZoomStarting(winrt::event_token const& token); event_source> m_anchorRequestedEventSource; event_source> m_bringingIntoViewEventSource; event_source> m_extentChangedEventSource; event_source> m_scrollAnimationStartingEventSource; event_source> m_scrollCompletedEventSource; + event_source> m_scrollStartingEventSource; event_source> m_stateChangedEventSource; event_source> m_viewChangedEventSource; - event_source> m_viewChangingEventSource; event_source> m_zoomAnimationStartingEventSource; event_source> m_zoomCompletedEventSource; + event_source> m_zoomStartingEventSource; static void EnsureProperties(); static void ClearProperties(); diff --git a/src/controls/dev/NavigationView/NavigationView.cpp b/src/controls/dev/NavigationView/NavigationView.cpp index ea5f8a7a13..e2b9187650 100644 --- a/src/controls/dev/NavigationView/NavigationView.cpp +++ b/src/controls/dev/NavigationView/NavigationView.cpp @@ -2407,13 +2407,17 @@ void NavigationView::ChangeSelection(const winrt::IInspectable& prevItem, const m_pendingSelectionChangedItem = nextItem; m_pendingSelectionChangedDirection = recommendedDirection; + // Previously we used get_weak() here, but we hit a refcounting problem where + // in some scenarios the outer object gets an extra Release() in this process. + auto weakThis {winrt::make_weak(static_cast(*this))}; DispatcherQueue().TryEnqueue( winrt::DispatcherQueuePriority::Low, - winrt::DispatcherQueueHandler([weakThis{get_weak()}]() + winrt::DispatcherQueueHandler([weakThis]() { if(auto strongThis = weakThis.get()) { - strongThis->CompletePendingSelectionChange(); + NavigationView* rawThis = winrt::get_self(strongThis); + rawThis->CompletePendingSelectionChange(); } })); } diff --git a/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml b/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml index aa36ad9253..bbdf7507dc 100644 --- a/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml +++ b/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml @@ -83,6 +83,7 @@ + diff --git a/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml.cs b/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml.cs index 74a2257367..ddd2165d96 100644 --- a/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml.cs +++ b/src/controls/dev/Repeater/TestUI/RepeaterTestUIPage.xaml.cs @@ -19,6 +19,11 @@ public RepeaterTestUIPage() { this.InitializeComponent(); + objectModelTest.Click += delegate + { + Frame.NavigateWithoutAnimation(typeof(ObjectModelTestPage)); + }; + defaultDemo.Click += delegate { Frame.NavigateWithoutAnimation(typeof(Defaults)); diff --git a/src/controls/dev/Repeater/TestUI/Repeater_TestUI.projitems b/src/controls/dev/Repeater/TestUI/Repeater_TestUI.projitems index 460919a505..894c61591d 100644 --- a/src/controls/dev/Repeater/TestUI/Repeater_TestUI.projitems +++ b/src/controls/dev/Repeater/TestUI/Repeater_TestUI.projitems @@ -37,6 +37,10 @@ MSBuild:Compile false + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -145,6 +149,9 @@ AnimationsDemoPage.xaml + + ObjectModelTestPage.xaml + BasicDemo.xaml @@ -152,14 +159,18 @@ Defaults.xaml - + + ElementsInItemsSourcePage.xaml + FlowLayoutDemoPage.xaml ItemTemplateDemo.xaml - + + ScaleAnimatedVerticalListDemo.xaml + NonVirtualStackLayoutSamplePage.xaml @@ -233,16 +244,4 @@ Images\%(Filename)%(Extension) - - - ScaleAnimatedVerticalListDemo.xaml - - - ElementsInItemsSourcePage.xaml - - - - - - \ No newline at end of file diff --git a/src/controls/dev/Repeater/TestUI/Samples/ObjectModelTestPage.xaml b/src/controls/dev/Repeater/TestUI/Samples/ObjectModelTestPage.xaml new file mode 100644 index 0000000000..fe8f44f7be --- /dev/null +++ b/src/controls/dev/Repeater/TestUI/Samples/ObjectModelTestPage.xaml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + null + TextBlock + + + + + null + ObservableCollection<string> + + + + + null + StackLayout + UniformGridLayout + + + + +