[iOS] Fix unresponsive NTP scrolling with container [chromium/src : main]

3 views
Skip to first unread message

Adam Arcaro (Gerrit)

unread,
Nov 22, 2023, 12:42:27 PM11/22/23
to Scott Yoder, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

Attention is currently required from: Scott Yoder.

Adam Arcaro would like Scott Yoder to review this change.

View Change

[iOS] Fix unresponsive NTP scrolling with container

Feed container constraints would lock when the header reached the
bottom of the NTP, preventing the NTP from being scrollable. This was
because the container had an anchor to the top of the header and to the
bottom of the view, which would eventually overlap and break.

Instead of anchoring the container to the bottom of the view, we use
a height anchor with max value to ensure it covers the remaidner of the
NTP.

Fixed: 1503675
Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
---
M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
index 82c91d4c..3188b1a 100644
--- a/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
+++ b/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
@@ -430,7 +430,6 @@
// Reduce the zPosition so that the container appears behind the feed
// content.
_feedContainer.layer.zPosition = -1;
- _feedContainer.userInteractionEnabled = NO;

// Add corner radius to the top border.
_feedContainer.clipsToBounds = YES;
@@ -1480,8 +1479,7 @@
constraintEqualToAnchor:self.collectionView.centerXAnchor],
[_feedContainer.topAnchor
constraintEqualToAnchor:self.feedHeaderViewController.view.topAnchor],
- [_feedContainer.bottomAnchor
- constraintEqualToAnchor:self.view.bottomAnchor],
+ [_feedContainer.heightAnchor constraintEqualToConstant:CGFLOAT_MAX],
]];
}


To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
Gerrit-Change-Number: 5054382
Gerrit-PatchSet: 1
Gerrit-Owner: Adam Arcaro <ada...@google.com>
Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
Gerrit-Reviewer: Scott Yoder <scott...@google.com>
Gerrit-Attention: Scott Yoder <scott...@google.com>

Adam Arcaro (Gerrit)

unread,
Nov 22, 2023, 12:42:31 PM11/22/23
to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Scott Yoder, chromium...@chromium.org

Attention is currently required from: Scott Yoder.

Patch set 1:Commit-Queue +1

View Change

2 comments:

To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
Gerrit-Change-Number: 5054382
Gerrit-PatchSet: 1
Gerrit-Owner: Adam Arcaro <ada...@google.com>
Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
Gerrit-Reviewer: Scott Yoder <scott...@google.com>
Gerrit-Attention: Scott Yoder <scott...@google.com>
Gerrit-Comment-Date: Wed, 22 Nov 2023 17:42:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

findit-for-me@appspot.gserviceaccount.com (Gerrit)

unread,
Nov 22, 2023, 2:02:11 PM11/22/23
to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Chromium LUCI CQ, Scott Yoder, chromium...@chromium.org

Attention is currently required from: Scott Yoder.

This change meets the code coverage requirements.

Patch set 1:Code-Coverage +1

View Change

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 19:02:03 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes

    Scott Yoder (Gerrit)

    unread,
    Nov 22, 2023, 2:59:24 PM11/22/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    View Change

    1 comment:

    • File ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm:

      • Patch Set #1, Line 1482: [_feedContainer.heightAnchor constraintEqualToConstant:CGFLOAT_MAX],

        Is this necessary to fix the issue? It seems like removing the `userInteractionEnabled = NO` above might be the fix.

        I don't know of any specific reason that constraining to CGFLOAT_MAX is bad, but I worry a little about it, and I'm not sure what it achieves here. Could you constrain the bottom to self.view.bottomAnchor + X pixels so that it looks like it extends forever?

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 19:59:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Adam Arcaro (Gerrit)

    unread,
    Nov 22, 2023, 3:09:42 PM11/22/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, Scott Yoder, chromium...@chromium.org

    Attention is currently required from: Scott Yoder.

    View Change

    1 comment:

      • Is this necessary to fix the issue? It seems like removing the `userInteractionEnabled = NO` above m […]

        Removing `userInteractionEnabled = NO` did not fix the issue, it's just something I found to be unnecessary while debugging this so I cleaned it out.

        If you try to repro this locally, you'll notice the scroll gets stuck at the point where the top of feed header meets the bottom of the screen. This is because the container is anchored to the top of the feed header and the bottom of `self.view`, which overlap as you scroll. The view won't allow the bottom anchor to be above the top anchor, causing the UI to becomes unresponsive.

        Since the top and bottom anchors alternate, I figured it would be best to avoid a bottom anchor in favor of a height anchor. I chose CGFLOAT_MAX to ensure that it always covers the remainder of the NTP height.

        Hopefully this clears things up, lmk what you think!

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 20:09:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Scott Yoder <scott...@google.com>

    Scott Yoder (Gerrit)

    unread,
    Nov 22, 2023, 3:15:25 PM11/22/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    View Change

    1 comment:

      • Removing `userInteractionEnabled = NO` did not fix the issue, it's just something I found to be unne […]

        I just worry about having a very very large view. For example, does iOS allocate any sort of rendering buffers that grow in relation to the size of the view? I have no idea, but it seems like it could.

        Would it be possible to constrain the height to the height of the view + X (rather than the bottom)? Something so the height isn't nearly infinite.

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 20:15:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Adam Arcaro <ada...@google.com>
    Comment-In-Reply-To: Scott Yoder <scott...@google.com>

    Adam Arcaro (Gerrit)

    unread,
    Nov 22, 2023, 3:23:06 PM11/22/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, Scott Yoder, chromium...@chromium.org

    Attention is currently required from: Scott Yoder.

    View Change

    1 comment:

      • I just worry about having a very very large view. […]

        Ahh I see what you mean, agreed that a view with CGFLOAT_MAX height can be concerning then. However we can't predict the height of the feed since the content is paginated on scroll, and setting the anchor to the view's height would only cover the first ~1000px or so. I can add some arbitrary high number that will always be larger than the feed height (like 30000), but that feels a bit hacky. Any thoughts?

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 20:23:01 +0000

    Scott Yoder (Gerrit)

    unread,
    Nov 22, 2023, 3:32:15 PM11/22/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    View Change

    1 comment:

      • Ahh I see what you mean, agreed that a view with CGFLOAT_MAX height can be concerning then. […]

        Could you constrain the height to the height of some view that is the feed + 1000px? Or could you constrain the bottom to self.view (like before) but use a lower priority, and then add a constraint greaterThanOrEqualTo on height to set a minimum height?

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Comment-Date: Wed, 22 Nov 2023 20:32:07 +0000

    Adam Arcaro (Gerrit)

    unread,
    Nov 23, 2023, 10:07:12 AM11/23/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro.

    Adam Arcaro uploaded patch set #2 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use
    a height anchor with max value to ensure it covers the remaidner of the
    NTP.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 24 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 2

    Adam Arcaro (Gerrit)

    unread,
    Nov 23, 2023, 10:11:53 AM11/23/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, Scott Yoder, chromium...@chromium.org

    Attention is currently required from: Scott Yoder.

    Patch set 2:Commit-Queue +1

    View Change

    1 comment:

      • Could you constrain the height to the height of some view that is the feed + 1000px? Or could you co […]

        I found a solution that's a little more complex than the original one, but I think is robust and will prevent any unnecessarily large container. I set a height constraint initially, and update it any time content is added to the feed (through the `feedLayoutDidEndUpdates` callback). The feed height changes dynamically on scroll, so just anchoring the container to the initial height + 1000px wouldn't cover the entire feed. Lmk what you think!

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 2
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>
    Gerrit-Comment-Date: Thu, 23 Nov 2023 15:11:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Adam Arcaro (Gerrit)

    unread,
    Nov 23, 2023, 10:13:25 AM11/23/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Scott Yoder.

    Adam Arcaro uploaded patch set #3 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.


    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 24 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 3

    Adam Arcaro (Gerrit)

    unread,
    Nov 23, 2023, 10:29:51 AM11/23/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro, Scott Yoder.

    Adam Arcaro uploaded patch set #4 to this change.

    View Change

    The following approvals got outdated and were removed: Commit-Queue+1 by Adam Arcaro

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 30 insertions(+), 5 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 4
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>

    Adam Arcaro (Gerrit)

    unread,
    Nov 23, 2023, 10:33:42 AM11/23/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro, Scott Yoder.

    Adam Arcaro uploaded patch set #5 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container


    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 26 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 5

    Adam Arcaro (Gerrit)

    unread,
    Nov 24, 2023, 9:18:18 AM11/24/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro, Scott Yoder.

    Adam Arcaro uploaded patch set #6 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 33 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 6

    Adam Arcaro (Gerrit)

    unread,
    Nov 24, 2023, 10:31:43 AM11/24/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro, Scott Yoder.

    Adam Arcaro uploaded patch set #7 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 33 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 7

    Scott Yoder (Gerrit)

    unread,
    Nov 28, 2023, 9:44:11 AM11/28/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    View Change

    2 comments:

    • File ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm:

      • Patch Set #7, Line 1617:

         if (self.feedContainerHeightConstraint) {
        [NSLayoutConstraint
        deactivateConstraints:@[ self.feedContainerHeightConstraint ]];
        }

        An alternative option: if you rewrite it like below you don't need to nil check it because the call to `setActive:` will just silently not happen when `self.feedContainerHeightConstraint` is nil.

        ```suggestion
        self.feedContainerHeightConstraint.active = NO;
        ```
      • Patch Set #7, Line 1629: [_feedContainer.heightAnchor constraintEqualToConstant:containerHeight];

        Is there any way to constrain to a height anchor that is the height of the content in collectionView? If you could do that and then add a constant that is greater than the size of the feed header and top section, then you could set the constraint once and never have to update it. When you constrain to a heightAnchor, the constraint updates as the view height updates.

        After looking around, I wonder if you could do something like:
        ```
        [_feedContainer.heightAnchor
        constraintEqualTo:self.collectionView.contentLayoutGuide.heightAnchor
        constant:kMaxFeedHeaderHeightPlusFeedTopSectionHeight];
        ```

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 7
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Comment-Date: Tue, 28 Nov 2023 14:44:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Adam Arcaro (Gerrit)

    unread,
    Nov 28, 2023, 10:55:23 AM11/28/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

    Attention is currently required from: Adam Arcaro.

    Adam Arcaro uploaded patch set #8 to this change.

    View Change

    [iOS] Fix unresponsive NTP scrolling with container

    Feed container constraints would lock when the header reached the
    bottom of the NTP, preventing the NTP from being scrollable. This was
    because the container had an anchor to the top of the header and to the
    bottom of the view, which would eventually overlap and break.

    Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

    Fixed: 1503675
    Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    ---
    M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
    1 file changed, 29 insertions(+), 3 deletions(-)

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 8

    Adam Arcaro (Gerrit)

    unread,
    Nov 28, 2023, 10:58:15 AM11/28/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, Scott Yoder, chromium...@chromium.org

    Attention is currently required from: Scott Yoder.

    View Change

    2 comments:

      • Patch Set #7, Line 1617:

         if (self.feedContainerHeightConstraint) {
        [NSLayoutConstraint
        deactivateConstraints:@[ self.feedContainerHeightConstraint ]];
        }

      • An alternative option: if you rewrite it like below you don't need to nil check it because the call […]

        That's much cleaner, thanks!

      • Is there any way to constrain to a height anchor that is the height of the content in collectionView […]

        I would love for this to work, but unfortunately anchoring to the collection view's height anchor doesn't update itself when content is added. Some online research suggests that matching a UICollectionView's `contentSize.height` needs to be done manually, through callbacks like `viewDidLayoutSubviews`, or in this case, `feedLayoutDidEndUpdates`.

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 8
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Scott Yoder <scott...@google.com>
    Gerrit-Comment-Date: Tue, 28 Nov 2023 15:58:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Scott Yoder <scott...@google.com>

    Scott Yoder (Gerrit)

    unread,
    Nov 28, 2023, 1:49:53 PM11/28/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    Patch set 8:Code-Review +1

    View Change

    1 comment:

    • File ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm:

      • Patch Set #7, Line 1629: [_feedContainer.heightAnchor constraintEqualToConstant:containerHeight];

        I would love for this to work, but unfortunately anchoring to the collection view's height anchor do […]

        Ack. I hate that we need this complication, but it seems like the feed somehow isn't playing nice with contentLayoutGuide on pagination.

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 8
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>
    Gerrit-Attention: Adam Arcaro <ada...@google.com>
    Gerrit-Comment-Date: Tue, 28 Nov 2023 18:49:46 +0000

    Adam Arcaro (Gerrit)

    unread,
    Nov 28, 2023, 2:57:30 PM11/28/23
    to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Scott Yoder, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

    Patch set 8:Commit-Queue +2

    View Change

    2 comments:

      • I found a solution that's a little more complex than the original one, but I think is robust and wil […]

        Done

    To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
    Gerrit-Change-Number: 5054382
    Gerrit-PatchSet: 8
    Gerrit-Owner: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
    Gerrit-Reviewer: Scott Yoder <scott...@google.com>

    findit-for-me@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 28, 2023, 3:52:04 PM11/28/23
    to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Scott Yoder, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Adam Arcaro.

    This change will be blocked from submission as there are files which do not meet the coverage criteria. Following files have incremental coverage(all tests) < 60%.

    Please add tests for uncovered lines, or add Low-Coverage-Reason:<reason> in the change description to bypass. See https://bit.ly/46jhjS9 to understand when it is okay to bypass. If you think coverage is underreported, file a bug at https://bit.ly/3ENM7Pe

    Patch set 8:Code-Coverage -1

    The change is no longer submittable: Code-Coverage is unsatisfied now.

    View Change

      To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
      Gerrit-Change-Number: 5054382
      Gerrit-PatchSet: 8
      Gerrit-Owner: Adam Arcaro <ada...@google.com>
      Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
      Gerrit-Reviewer: Scott Yoder <scott...@google.com>
      Gerrit-Attention: Adam Arcaro <ada...@google.com>
      Gerrit-Comment-Date: Tue, 28 Nov 2023 20:51:53 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes

      Adam Arcaro (Gerrit)

      unread,
      Nov 29, 2023, 12:47:53 PM11/29/23
      to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org

      Attention is currently required from: Adam Arcaro.

      Adam Arcaro uploaded patch set #9 to this change.

      View Change

      [iOS] Fix unresponsive NTP scrolling with container

      Feed container constraints would lock when the header reached the
      bottom of the NTP, preventing the NTP from being scrollable. This was
      because the container had an anchor to the top of the header and to the
      bottom of the view, which would eventually overlap and break.

      Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

      Low-Coverage-Reason:This logic relies on the feed content loading, which is not possible to cover in upstream tests.

      Fixed: 1503675
      Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
      ---
      M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
      1 file changed, 29 insertions(+), 3 deletions(-)

      To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: newpatchset
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
      Gerrit-Change-Number: 5054382
      Gerrit-PatchSet: 9

      Adam Arcaro (Gerrit)

      unread,
      Nov 29, 2023, 12:48:15 PM11/29/23
      to ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Scott Yoder, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org

      Patch set 9:Commit-Queue +2

      View Change

        To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
        Gerrit-Change-Number: 5054382
        Gerrit-PatchSet: 9
        Gerrit-Owner: Adam Arcaro <ada...@google.com>
        Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
        Gerrit-Reviewer: Scott Yoder <scott...@google.com>
        Gerrit-Comment-Date: Wed, 29 Nov 2023 17:48:03 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes

        Chromium LUCI CQ (Gerrit)

        unread,
        Nov 29, 2023, 1:14:44 PM11/29/23
        to Adam Arcaro, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, thegreenf...@chromium.org, Scott Yoder, findit...@appspot.gserviceaccount.com, chromium...@chromium.org

        Chromium LUCI CQ submitted this change.

        View Change



        8 is the latest approved patch-set.
        No files were changed between the latest approved patch-set and the submitted one.

        Approvals: Scott Yoder: Looks good to me Adam Arcaro: Commit Objections: findit...@appspot.gserviceaccount.com: Fails
        [iOS] Fix unresponsive NTP scrolling with container

        Feed container constraints would lock when the header reached the
        bottom of the NTP, preventing the NTP from being scrollable. This was
        because the container had an anchor to the top of the header and to the
        bottom of the view, which would eventually overlap and break.

        Instead of anchoring the container to the bottom of the view, we use a height anchor that's updated whenever the feed's content is changed.

        Low-Coverage-Reason: This logic relies on the feed content loading, which is not possible to cover in upstream tests.
        Fixed: 1503675
        Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
        Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5054382
        Reviewed-by: Scott Yoder <scott...@google.com>
        Commit-Queue: Adam Arcaro <ada...@google.com>
        Cr-Commit-Position: refs/heads/main@{#1230766}

        ---
        M ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
        1 file changed, 29 insertions(+), 3 deletions(-)


        To view, visit change 5054382. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iad24068a0ecf7eeb87de3b7ab6e834d233211037
        Gerrit-Change-Number: 5054382
        Gerrit-PatchSet: 10
        Gerrit-Owner: Adam Arcaro <ada...@google.com>
        Gerrit-Reviewer: Adam Arcaro <ada...@google.com>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Reply all
        Reply to author
        Forward
        0 new messages