Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[housekeeping] Move from term "laid out" to "arranged" #25250

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/design/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `Orientation` property of `IScrollView` can be one of four values (in the `S
- `Both` - the content scrolls horizontally if it's wider than the viewport, and vertically if it's taller than the viewport
- `Neither` - scrolling is disabled in both directions

The `Orientation` value affects how the ScrollView's `Content` is measured and laid out. If the value is `Vertical`, the measurement height is unconstrained (i.e., `Double.Infinity`). If the value is `Horizontal`, the measurement width is unconstrained. `Both` results in measurement being unconstrained in all directions, and `Neither` constrains the measurement to the width and height of the viewport.
The `Orientation` value affects how the ScrollView's `Content` is measured and arranged. If the value is `Vertical`, the measurement height is unconstrained (i.e., `Double.Infinity`). If the value is `Horizontal`, the measurement width is unconstrained. `Both` results in measurement being unconstrained in all directions, and `Neither` constrains the measurement to the width and height of the viewport.

## ContentSize

Expand Down Expand Up @@ -72,7 +72,7 @@ Our Android implementation of ScrollView is backed by MauiScrollView, which is a
- Android treats `Padding` as space around the scrollable area, rather than inside of it.
- Android's native measurements will not account for our virtual `Margin` when measuring ScrollView content.

So again, we insert an intermediate `ContentViewGroup` to handle these problems. The `ContentViewGroup` is laid out at (0, 0) in the MauiScrollView; it handles the `Padding` and `Margin` behaviors for us, and initiates `CrossPlatformMeasure()` and `CrossPlatformArrange()` for its `Content`.
So again, we insert an intermediate `ContentViewGroup` to handle these problems. The `ContentViewGroup` is arranged at (0, 0) in the MauiScrollView; it handles the `Padding` and `Margin` behaviors for us, and initiates `CrossPlatformMeasure()` and `CrossPlatformArrange()` for its `Content`.

Another note: the content of an Android ScrollView does not stretch to fill the viewport by default. That is, if you have a ScrollView which fills the screen and the content of the ScrollView is smaller than the screen, by default that content will not expand to take up the entire viewport (the behavior we expect for .NET MAUI). On Android, we can achieve the behavior we expect by setting the `FillViewport` property to `true` for the native ScrollView. This is all handled automatically by the Android ScrollViewHandler; I note it here because this causes an extra measure pass when the content is smaller than the ScrollView's viewport and the virtual ScrollView has layout alignment set to `Fill`. This is all explained in the comments for the ScrollViewHandler's `GetDesiredSize()` override, but I'm calling it out here as well in case anyone is investigating the number of measure calls being made.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void Init()
Content = new StackLayout
{
Children = {
new Label { Text = "The following list contains cells with and without context actions, but all of the cells should be laid out identically. If the cells do not look identical, this test has failed." },
new Label { Text = "The following list contains cells with and without context actions, but all of the cells should be arranged identically. If the cells do not look identical, this test has failed." },
list }
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ protected override void OnLayout(bool changed, int l, int t, int r, int b)
renderer?.UpdateLayout();

// If we're using a PageContainer (i.e., we've wrapped our contents in a Fragment),
// Make sure that it gets laid out
// Make sure that it gets arranged
if (_pageContainer != null)
{
if (_isFlyout)
{
var controller = (IFlyoutPageController)_parent;
var width = (int)Context.ToPixels(controller.FlyoutBounds.Width);
// When the base class computes the size of the Flyout container, it starts at the top of the
// When the base carrangedss computes the size of the Flyout container, it starts at the top of the
// screen and adds padding (_parent.FlyoutBounds.Top) to leave room for the status bar
// When this container is laid out, it's already starting from the adjusted y value of the parent,
// When this container is arranged, it's already starting from the adjusted y value of the parent,
// so we subtract _parent.FlyoutBounds.Top from our starting point (to get 0) and add it to the
// bottom (so the flyout page stretches to the bottom of the screen)
var height = (int)Context.ToPixels(controller.FlyoutBounds.Height + controller.FlyoutBounds.Top);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ protected override void OnLayout(bool changed, int l, int t, int r, int b)
toolbarLayoutCompleted = true;
}

// Making the layout of the toolbar dependant on having a child Page could potentially mean that the toolbar is not laid out.
// Making the layout of the toolbar dependant on having a child Page could potentially mean that the toolbar is not arranged.
// We'll do one more check to make sure it isn't missed.
if (!toolbarLayoutCompleted)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected override void OnLayout(bool changed, int l, int t, int r, int b)

protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// we need to make sure we are big enough to be laid out at 0,0
// we need to make sure we are big enough to be arranged at 0,0
if (_childView != null)
{
SetMeasuredDimension((int)Context.ToPixels(_childView.Bounds.Right + _parent.Padding.Right), (int)Context.ToPixels(_childView.Bounds.Bottom + _parent.Padding.Bottom));
Expand Down
2 changes: 1 addition & 1 deletion src/Compatibility/Core/src/Windows/ScrollViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async void OnScrollToRequested(object sender, ScrollToRequestedEventArgs e)
ClearRtlScrollCheck();

// Adding items into the view while scrolling to the end can cause it to fail, as
// the items have not actually been laid out and return incorrect scroll position
// the items have not actually been arranged and return incorrect scroll position
// values. The ScrollViewRenderer for Android does something similar by waiting up
// to 10ms for layout to occur.
int cycle = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ event EventHandler IVisualNativeElementRenderer.ControlChanged
if (ArrangeNativeChildren)
{
// in the event that a custom renderer has added native controls,
// we need to be sure to arrange them so that they are laid out.
// we need to be sure to arrange them so that they are arranged.
var nativeChildren = Children;
for (int i = 0; i < nativeChildren.Count; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void MeasureInvalidated(object sender, EventArgs args)
// Cache the size for next time
_size = toSize;

// Let the controller know that things need to be laid out again
// Let the controller know that things need to be arranged again
OnContentSizeChanged();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Controls/Foldable/src/TwoPaneView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,15 @@ bool UpdateMode(double width, double height, bool invalidateLayout = true)
{
if (_twoPaneViewLayoutGuide.Mode == TwoPaneViewMode.Wide)
{
// Regions are laid out horizontally
// Regions are arranged horizontally
if (WideModeConfiguration != TwoPaneViewWideModeConfiguration.SinglePane)
{
newMode = (WideModeConfiguration == TwoPaneViewWideModeConfiguration.LeftRight) ? ViewMode.LeftRight : ViewMode.RightLeft;
}
}
else if (_twoPaneViewLayoutGuide.Mode == TwoPaneViewMode.Tall)
{
// Regions are laid out vertically
// Regions are arranged vertically
if (TallModeConfiguration != TwoPaneViewTallModeConfiguration.SinglePane)
{
newMode = (TallModeConfiguration == TwoPaneViewTallModeConfiguration.TopBottom) ? ViewMode.TopBottom : ViewMode.BottomTop;
Expand Down
6 changes: 3 additions & 3 deletions src/Controls/docs/Microsoft.Maui.Controls/FlexLayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<summary>A Flexbox-like layout that lays out child elements in optionally wrappable rows or columns of child elements.</summary>
<remarks>
<para>FlexLayout is a <see cref="T:Microsoft.Maui.Controls.Layout" /> that efficiently lays out it's <see cref="P:Microsoft.Maui.Controls.Layout.Children" /> in a manner similar to that of <format type="text/html"><a href="https://www.w3.org/TR/css-flexbox-1/">CSS Flexbox</a></format>.</para>
<para>The <see cref="P:Microsoft.Maui.Controls.FlexLayout.Direction" /> property determines the primary axis of the layout. The <see cref="P:Microsoft.Maui.Controls.FlexLayout.JustifyContent" /> property determines how <see cref="P:Microsoft.Maui.Controls.Layout.Children" /> are laid out along the primary axis. The <see cref="P:Microsoft.Maui.Controls.FlexLayout.AlignItems" /> property specifies how <see cref="P:Microsoft.Maui.Controls.Layout.Children" /> are laid out along the cross axis; the <see cref="P:Microsoft.Maui.Controls.FlexLayout.AlignContent" /> property works similarly, but applies to entire rows or columns, not individual elements.</para>
<para>The <see cref="P:Microsoft.Maui.Controls.FlexLayout.Direction" /> property determines the primary axis of the layout. The <see cref="P:Microsoft.Maui.Controls.FlexLayout.JustifyContent" /> property determines how <see cref="P:Microsoft.Maui.Controls.Layout.Children" /> are arranged along the primary axis. The <see cref="P:Microsoft.Maui.Controls.FlexLayout.AlignItems" /> property specifies how <see cref="P:Microsoft.Maui.Controls.Layout.Children" /> are arranged along the cross axis; the <see cref="P:Microsoft.Maui.Controls.FlexLayout.AlignContent" /> property works similarly, but applies to entire rows or columns, not individual elements.</para>
<para>The initial size of a child element is set with <see cref="M:Microsoft.Maui.Controls.FlexLayout.SetBasis(Microsoft.Maui.Controls.BindableObject,Microsoft.Maui.Layouts.FlexBasis)" /> and its resizing behavior is set with <see cref="M:Microsoft.Maui.Controls.FlexLayout.SetGrow(Microsoft.Maui.Controls.BindableObject,System.Single)" /> and <see cref="M:Microsoft.Maui.Controls.FlexLayout.SetShrink(Microsoft.Maui.Controls.BindableObject,System.Single)" />.</para>
</remarks>
<related type="article" href="https://learn.microsoft.com/dotnet/maui/user-interface/layouts/flexlayout">The .NET MAUI FlexLayout</related>
Expand Down Expand Up @@ -100,8 +100,8 @@
<ReturnType>Microsoft.Maui.Layouts.FlexAlignItems</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that controls how child elements are laid out within their row or column.</summary>
<value>A value that controls how child elements are laid out within their row or column.</value>
<summary>Gets or sets a value that controls how child elements are arranged within their row or column.</summary>
<value>A value that controls how child elements are arranged within their row or column.</value>
<remarks>
<para>The following image shows the options for <see cref="P:Microsoft.Maui.Controls.FlexLayout.AlignItems" /> with <see cref="P:Microsoft.Maui.Controls.FlexLayout.Direction" /> set to <see cref="F:Microsoft.Maui.Layouts.FlexDirection.Column" /> and <see cref="P:Microsoft.Maui.Controls.FlexLayout.JustifyContent" /> set to <see cref="F:Microsoft.Maui.Layouts.FlexJustify.Start" />:</para>
<para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void UpdateLayout(ItemsViewLayout newLayout)

if (_initialized)
{
// Reload the data so the currently visible cells get laid out according to the new layout
// Reload the data so the currently visible cells get arranged according to the new layout
CollectionView.ReloadData();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void MeasureInvalidated(object sender, EventArgs args)
// Cache the size for next time
_size = toSize;

// Let the controller know that things need to be laid out again
// Let the controller know that things need to be arranged again
OnContentSizeChanged();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Controls/src/Core/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ internal virtual double WidthForPathComputation
{
var width = Width;

// If the shape has never been laid out, then Width won't actually have a value;
// If the shape has never been arranged, then Width won't actually have a value;
// use the fallback value instead.
return width == -1 ? _fallbackWidth : width;
}
Expand All @@ -461,7 +461,7 @@ internal virtual double HeightForPathComputation
{
var height = Height;

// If the shape has never been laid out, then Height won't actually have a value;
// If the shape has never been arranged, then Height won't actually have a value;
// use the fallback value instead.
return height == -1 ? _fallbackHeight : height;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controls/src/Core/View/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ public virtual IList<GestureElement> GetChildElements(Point point)
}

/// <summary>
/// Gets or sets the <see cref="LayoutOptions" /> that define how the element gets laid out in a layout cycle. This is a bindable property.
/// Gets or sets the <see cref="LayoutOptions" /> that define how the element gets arranged in a layout cycle. This is a bindable property.
/// </summary>
/// <remarks>
/// Assigning <see cref="HorizontalOptions"/> modifies how the element is laid out when there is excess space available along the X axis from the parent layout.
/// Assigning <see cref="HorizontalOptions"/> modifies how the element is arranged when there is excess space available along the X axis from the parent layout.
/// If multiple elements inside a layout are set to expand, the extra space is distributed proportionally.
/// </remarks>
public LayoutOptions HorizontalOptions
Expand All @@ -241,10 +241,10 @@ public Thickness Margin
}

/// <summary>
/// Gets or sets the <see cref="LayoutOptions" /> that define how the element gets laid out in a layout cycle. This is a bindable property.
/// Gets or sets the <see cref="LayoutOptions" /> that define how the element gets arrange in a layout cycle. This is a bindable property.
/// </summary>
/// <remarks>
/// Assigning <see cref="VerticalOptions"/> modifies how the element is laid out when there is excess space available along the Y axis from the parent layout.
/// Assigning <see cref="VerticalOptions"/> modifies how the element is arrange when there is excess space available along the Y axis from the parent layout.
/// If multiple elements inside a layout are set to expand, the extra space is distributed proportionally.
/// </remarks>
public LayoutOptions VerticalOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ await CreateHandlerAndAddToWindow<IWindowHandler>(contentPage,
{
await WaitForUIUpdate(frame, collectionView);

Assert.True(emptyView.Height > 0, "EmptyView should be laid out");
Assert.True(header.Height > 0, "Header should be laid out");
Assert.True(footer.Height > 0, "Footer should be laid out");
Assert.True(emptyView.Height > 0, "EmptyView should be arranged");
Assert.True(header.Height > 0, "Header should be arranged");
Assert.True(footer.Height > 0, "Footer should be arranged");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Issue22306_1(TestDevice device) : base(device) { }
[Category(UITestCategories.Button)]
public async Task ButtonMeasuresLargerThanDefault()
{
// seems possible in CI that the iOS Button is not laid out before the height evaluation
// seems possible in CI that the iOS Button is not arranged before the height evaluation
await Task.Delay(100);
var rotateButtonRect = App.WaitForElement("RotateButton").GetRect();
var button3Rect = App.WaitForElement("Button3").GetRect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void requestLayoutIfNeeded(View view) {
binding the width of a child control to the ActualWidth of its parent.

If we simply call `requestLayout()` again right now, it will set a flag which will be cleared at the end
of the current layout pass, and the view will not be laid out with the updated values.
of the current layout pass, and the view will not be arranged with the updated values.

Instead, we post the layout request to the UI thread's queue, ensuring that it will happen after the current
layout pass has finished. Layout will happen again with the updated values.
Expand Down
4 changes: 2 additions & 2 deletions src/Core/docs/Microsoft.Maui/FlowDirection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>Indicates that view will be laid out left to right. This is the default when the view has no parent.</summary>
<summary>Indicates that view will be arranged left to right. This is the default when the view has no parent.</summary>
</Docs>
</Member>
<Member MemberName="MatchParent">
Expand Down Expand Up @@ -79,7 +79,7 @@
</ReturnValue>
<MemberValue>2</MemberValue>
<Docs>
<summary>Indicates that view will be laid out right to left.</summary>
<summary>Indicates that view will be arranged right to left.</summary>
</Docs>
</Member>
</Members>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/docs/Microsoft.Maui/GridUnitType.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>Interpret the <see cref="P:Microsoft.Maui.GridLength.Value" /> property value as a proportional weight, to be laid out after rows and columns with <see cref="F:Microsoft.Maui.GridUnitType.Absolute" /> or <see cref="F:Microsoft.Maui.GridUnitType.Auto" /> are accounted for.</summary>
<remarks>After all the rows and columns of type <see cref="F:Microsoft.Maui.GridUnitType.Absolute" /> and <see cref="F:Microsoft.Maui.GridUnitType.Auto" /> are laid out, each of the corresponding remaining rows or columns, which are of type <see cref="F:Microsoft.Maui.GridUnitType.Star" />, receive a fraction of the remaining available space. This fraction is determined by dividing each row's or column's <see cref="P:Microsoft.Maui.GridLength.Value" /> property value by the sum of all the row or column <see cref="P:Microsoft.Maui.GridLength.Value" /> property values, correspondingly, including its own.</remarks>
<summary>Interpret the <see cref="P:Microsoft.Maui.GridLength.Value" /> property value as a proportional weight, to be arranged after rows and columns with <see cref="F:Microsoft.Maui.GridUnitType.Absolute" /> or <see cref="F:Microsoft.Maui.GridUnitType.Auto" /> are accounted for.</summary>
<remarks>After all the rows and columns of type <see cref="F:Microsoft.Maui.GridUnitType.Absolute" /> and <see cref="F:Microsoft.Maui.GridUnitType.Auto" /> are arranged, each of the corresponding remaining rows or columns, which are of type <see cref="F:Microsoft.Maui.GridUnitType.Star" />, receive a fraction of the remaining available space. This fraction is determined by dividing each row's or column's <see cref="P:Microsoft.Maui.GridLength.Value" /> property value by the sum of all the row or column <see cref="P:Microsoft.Maui.GridLength.Value" /> property values, correspondingly, including its own.</remarks>
</Docs>
</Member>
</Members>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Core/IFlexLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface IFlexLayout : ILayout
FlexAlignContent AlignContent { get; }

/// <summary>
/// Gets a value that controls how child elements are laid out within their row or column.
/// Gets a value that controls how child elements are arranged within their row or column.
/// </summary>
FlexAlignItems AlignItems { get; }

Expand Down
Loading
Loading