Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Aug 16, 2021

fix b/194026347

The screen can be nil if the flutterview is covered by another view which causes the scale to be 0. This pr fixes it

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke
Copy link
Member

This sounds plausible. I'd add comments to the early outs in those methods. Also, it seems like you have an internal partner that is able to test fixes for you and has reproduction steps. I didn't see where they said this will fix there issues, did you have them try it out?

@chunhtai chunhtai force-pushed the scrollabl-crash branch 2 times, most recently from e106bb6 to b0023c3 Compare August 18, 2021 20:29
@chunhtai
Copy link
Contributor Author

@gaaclarke The root cause the the screen scale, I update this pr to include the real fix, I keep the hidden logic here as well because i think it is probably the right thing to do anyway

Comment on lines 57 to 59
UIScreen* screen = [[[reference bridge]->view() window] screen];
// Screen can be nil if the FlutterView is covered by another native view.
CGFloat scale = screen == nil ? 1 : screen.scale;
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch! I'd say if you can't get the screen I'd use [UIScreen mainScreen] instead of using 1.

Comment on lines 281 to 283
if ([_semanticsObject node].HasFlag(flutter::SemanticsFlags::kIsHidden)) {
return CGSizeZero;
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we still want to do this then if we don't think this was the actual problem?

CGPointMake(0, scrollPosition * effectivelyScale)));
}

- (void)testVerticalFlutterScrollableSemanticsObjectNoWindow {
Copy link
Member

Choose a reason for hiding this comment

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

lgtm

@chunhtai chunhtai requested a review from gaaclarke August 18, 2021 22:35
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM

@chunhtai chunhtai added waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. and removed waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. labels Aug 18, 2021
@chunhtai chunhtai changed the title Makes hidden scrollable to set zero content size and offset Makes scrollable to use main screen if the flutter view is not attached Aug 18, 2021
@chunhtai chunhtai added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Aug 18, 2021
@fluttergithubbot fluttergithubbot merged commit 5d08804 into flutter:master Aug 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 19, 2021
fluttergithubbot pushed a commit to flutter/flutter that referenced this pull request Aug 19, 2021
blasten pushed a commit to blasten/flutter that referenced this pull request Aug 19, 2021
chriscraws pushed a commit to chriscraws/engine that referenced this pull request Aug 23, 2021
christopherfujino added a commit that referenced this pull request Sep 2, 2021
)

* 'Update Dart SDK to aa7d19d'

* [web] Don't reset history on hot restart (#27872)

* Makes scrollable to use main screen if the flutter view is not attached to a screen (#28110)

* Fix regression in system UI colors (#28206)

* update licenses golden

Co-authored-by: Mouad Debbar <mouad.debbar@gmail.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Kate Lovett <katelovett@google.com>
tneotia pushed a commit to BlueBubblesApp/engine that referenced this pull request Dec 9, 2021
…tter#28415)

* 'Update Dart SDK to aa7d19d'

* [web] Don't reset history on hot restart (flutter#27872)

* Makes scrollable to use main screen if the flutter view is not attached to a screen (flutter#28110)

* Fix regression in system UI colors (flutter#28206)

* update licenses golden

Co-authored-by: Mouad Debbar <mouad.debbar@gmail.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Kate Lovett <katelovett@google.com>
filmil pushed a commit to filmil/engine that referenced this pull request Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants