Skip to content

[iOS] Fix bug with padding on ScrollViewer - #2735

Merged
carldebilly merged 4 commits into
masterfrom
dev/cdb/bugs/layout-remaining-bugs
Mar 4, 2020
Merged

carldebilly merged 4 commits into
masterfrom
dev/cdb/bugs/layout-remaining-bugs

Conversation

@carldebilly

Copy link
Copy Markdown
Member

GitHub Issue (If applicable): #2703

Bugfix

What is the current behavior?

If the generic.xaml of Uno, the <ScrollViewer> control template will convert the Padding into a Margin applied to the inner <ScrollContentPresenter>:

Margin="{TemplateBinding Padding}"

But this Margin is not getting included in the DesiredSize as the output of the Measure phase. This happend because <ScrollContentPresenter> is NOT a FrameworkElement, on iOS, it's a UIScrollView (native control). So there's no layouter in it and the desired size must be calculated by the parent element's layouter.

What is the new behavior?

After calling .SizeThatFits() on a native, non-FrameworkElement control, the .Margin is applied and stored as the desired size for the control.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

@carldebilly
carldebilly requested a review from jeromelaban March 3, 2020 17:01
@gitpod-io

gitpod-io Bot commented Mar 3, 2020 •

Copy link
Copy Markdown

@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform labels Mar 3, 2020

@davidjohnoliver davidjohnoliver left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be ideal to have a runtime unit test verifying the correct numbers.

@carldebilly
carldebilly force-pushed the dev/cdb/bugs/layout-remaining-bugs branch from f53cf39 to 9abe29c Compare March 3, 2020 20:58
@carldebilly carldebilly added this to the 2.1 milestone Mar 3, 2020
@carldebilly carldebilly linked an issue Mar 3, 2020 that may be closed by this pull request
1 of 12 tasks
@carldebilly
carldebilly force-pushed the dev/cdb/bugs/layout-remaining-bugs branch from 9abe29c to d0f3942 Compare March 4, 2020 14:29
The "DesiredSize" must include the margins, it wasn't the case for those controls.
Fix #2703
@carldebilly
carldebilly force-pushed the dev/cdb/bugs/layout-remaining-bugs branch from d0f3942 to 2273a84 Compare March 4, 2020 14:36
@carldebilly carldebilly added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Mar 4, 2020
@unoplatform unoplatform deleted a comment from nventive-devops Mar 4, 2020
@unoplatform unoplatform deleted a comment from nventive-devops Mar 4, 2020
@unoplatform unoplatform deleted a comment from nventive-devops Mar 4, 2020
@unoplatform unoplatform deleted a comment from azure-pipelines Bot Mar 4, 2020
@carldebilly carldebilly removed the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Mar 4, 2020
@carldebilly
carldebilly force-pushed the dev/cdb/bugs/layout-remaining-bugs branch from 2273a84 to 080a17c Compare March 4, 2020 15:27
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 12776 found UI Test snapshots differences.

  • android-28: 5 changed over 315

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • PopupWithOverlay_After
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Simple_ContentDialog_01_PrimaryCommand_UITests_Shared_Windows_UI_Xaml_Controls_ContentDialogTests_ContentDialog_Simple
    • TestManipulation_Result
    • ToggleSwitch_TemplateReuseTest_UITests_Shared_Windows_UI_Xaml_Controls_ToggleSwitchControl_ToggleSwitch_TemplateReuse
  • android-28-Snap: 7 changed over 680

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Button_Custom_Button_With_ContentTemplate_Uno_UI_Samples_Content_UITests_ButtonTestsControl_Custom_Button_With_ContentTemplate
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds
    • Default_Uno_UI_Samples_UITests_Image_Image_UseTargetSize_Uno_UI_Samples_UITests_Image_Image_UseTargetSize
    • TextBlockControl_TextBoxSizeChanging_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBoxSizeChanging
    • TextBox_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll
    • WebView_WebView_NavigateToString_Uno_UI_Samples_Content_UITests_WebView_WebView_NavigateToString
  • ios: 9 changed over 166

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Keyboard_Textbox_InsideScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • MinMaxTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_MUX_Test
    • Keyboard_Textbox_NoScrollViewer_Validation_2_-_Remove_Focus_on_placeholderTextTextBox
    • Large_Image_With_Margin_Ready
    • Large_Image_With_Margin_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Margin_Large
    • TextBox_DeleteButton_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_DeleteButton_Automated
    • TextBox_RoundedCorners_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_RoundedCorners
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_MUX_Test
    • UpDownTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_MUX_Test
  • ios-Snap: 29 changed over 672

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonTestsControl_Button_Opacity_Automated_Uno_UI_Samples_Content_UITests_ButtonTestsControl_Button_Opacity_Automated
    • ChatBox_ChatBox_UITests_Shared_Windows_UI_Xaml_Controls_ChatBox_ChatBox
    • Default_Uno_UI_Samples_UITests_Image_Image_Margin_Uno_UI_Samples_UITests_Image_Image_Margin
    • FocusManager_FocusManagerTest_Uno_UI_Samples_Content_UITests_FocusManager_FocusManagerTest
    • FocusManager_GetFocus_Uno_UI_Samples_Content_UITests_FocusManager_FocusManager_GetFocus_Automated
    • Gesture_recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
    • GridTestsControl_CenteredGridinGridwiththreefixedsizechildren_Uno_UI_Samples_Content_UITests_GridTestsControl_CenteredGridinGridwiththreefixedsizechildren
    • Image_Image_Stretch_Full_Taller_Uno_UI_Samples_UITests_Image_Image_Stretch_Full_Taller
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Alignment_SizeOnControl
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Margin_Large_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Margin_Large
    • ListView_ListViewChangeViewArbitrary_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewChangeViewArbitrary
    • ListView_ListView_TextBox_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListView_TextBox
    • MediaPlayerElement_Using__3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • MediaPlayerElement_Using__flv_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Flv_Extension
    • MediaPlayerElement_Using__mkv_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mkv_Extension
    • NumberBox_MUX_Test_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_MUX_Test
    • TextBox_Input_Multiline_AutoHeight_Uno_UI_Samples_Content_UITests_TextBoxControl_Input_Multiline_AutoHeight
    • TextBox_PasswordBox_InputScope_NumericPin_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_InputScope_NumericPin
    • TextBox_TextBoxPadding_Uno_UI_Samples_Content_UITests_TextBoxControl_TextBoxPadding
    • TextBox_TextBox_DefaultTextBoxStyle_Uno_UI_Samples_Content_UITests_TextBoxControl_TextBox_DefaultTextBoxStyle
  • wasm: 2 changed over 680

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Uno.UI.Samples.Content.UITests.Transform.Image_With_RotateTransform
    • Uno.UI.Samples.UITests.Image.Image_Margin
  • wasm-automated: 2 changed over 352

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_Weird_Measure_During_Arrange_after_layout
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage

@unoplatform unoplatform deleted a comment from nventive-devops Mar 4, 2020
@carldebilly
carldebilly merged commit a70efd0 into master Mar 4, 2020
@carldebilly
carldebilly deleted the dev/cdb/bugs/layout-remaining-bugs branch March 4, 2020 20:18
@jeromelaban

Copy link
Copy Markdown
Member

@Mergifyio backport release/beta/2.1

@mergify

mergify Bot commented Mar 11, 2020

Copy link
Copy Markdown
Contributor

Command backport release/beta/2.1: success

Backports have been created

jeromelaban added a commit that referenced this pull request Mar 11, 2020
…/pr-2735

[iOS] Fix bug with padding on ScrollViewer (bp #2735)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Scrollviewer padding is incorrectly clipping content

4 participants