/// <remarks>
        /// If the provided area is large enough, the lower part of the area is partitioned to host the row and the
        /// lower bound of the area moves upwards. When the area becomes empty, it is removed from the chain of
        /// unpartitioned areas to avoid spending time on it during future allocations.
        /// </remarks>
        private bool TryPartitionArea(AreaNode areaNode, int rowIndex, int rowHeight, int minWidth)
        {
            RectInt area = areaNode.rect;

            if (area.height < rowHeight || area.width < minWidth)
            {
                return(false);
            }

            var row = m_OpenRows[rowIndex];

            if (row != null)
            {
                row.Release();
            }
            row = Row.Acquire(area.x, area.y, area.width, rowHeight);
            m_OpenRows[rowIndex] = row;
            area.y      += rowHeight;
            area.height -= rowHeight;

            if (area.height == 0)
            {
                if (areaNode == m_FirstUnpartitionedArea)
                {
                    m_FirstUnpartitionedArea = areaNode.next;
                }
                areaNode.RemoveFromChain();
                areaNode.Release();
            }
            else
            {
                areaNode.rect = area;
            }
            return(true);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                for (int i = 0; i < m_OpenRows.Length; ++i)
                {
                    Row row = m_OpenRows[i];
                    if (row != null)
                    {
                        row.Release();
                    }
                }
                m_OpenRows = null;

                AreaNode area = m_FirstUnpartitionedArea;
                while (area != null)
                {
                    AreaNode temp = area.next;
                    area.Release();
                    area = temp;
                }
                m_FirstUnpartitionedArea = null;
            }
            else
            {
                UnityEngine.UIElements.DisposeHelper.NotifyMissingDispose(this);
            }

            disposed = true;
        }