这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[iOS] Fixes platform view clipped when FlutterView has non-zero offset #24893

Merged
merged 6 commits into from
Mar 23, 2021

Conversation

zhongwuzw
Copy link
Member

@zhongwuzw zhongwuzw commented Mar 9, 2021

Fixes flutter/flutter#66968

cc. @cyanglaz .

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.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

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

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla google-cla bot added the cla: yes label Mar 9, 2021
@chinmaygarde
Copy link
Member

cc @xster for review.

@xster xster requested a review from cyanglaz March 11, 2021 23:07
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

This will not handle when PlatformViews draw outside of the ChildClippingView.

Is flutter/flutter#66968 caused by flutter_view_ is nil?

I see, the FlutterView's offset is (50, 50). Are we trying to to display PlatformView outside of the flutter view?

@cyanglaz
Copy link
Contributor

I think the issue might not be with the maskView, but rather the frame of the platform view.

@zhongwuzw zhongwuzw changed the title [iOS] Fixes platform view clipped when FlutterView has non-zero offset x [iOS] Fixes platform view clipped when FlutterView has non-zero offset Mar 12, 2021
@zhongwuzw
Copy link
Member Author

I think the issue might not be with the maskView, but rather the frame of the platform view.

@cyanglaz Seems platform view's frame is correct, reverse offset of the maskView works for me.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

The change looks good. It seems to be that it should produce the same result as
CGRect maskViewFrame = [flutter_view_ convertRect:flutter_view_.get().frame toView:clipView];

Could you explain why in this add to app scenario, it is different?

Can we add a test for this? Possibly a scenario test.

@zhongwuzw
Copy link
Member Author

zhongwuzw commented Mar 22, 2021

The change looks good. It seems to be that it should produce the same result as
CGRect maskViewFrame = [flutter_view_ convertRect:flutter_view_.get().frame toView:clipView];

Could you explain why in this add to app scenario, it is different?

@cyanglaz I think the difference is we don't have to take flutter_view_'s frame origin x/y into account.

Can we add a test for this? Possibly a scenario test.

I saw the scenario test code, seems it should not depend on flutter framework https://github.com/flutter/engine/blob/5d9509ae05/testing/scenario_app/README.md#scenario-app . I may need your help for adding test :) (Seems we need Flutter framework to reproduce it, use dart:ui directly can't reproduce)

@cyanglaz
Copy link
Contributor

@zhongwuzw Thanks. The fix looks good to me.

As for the test, I don't think we need the framework to change the flutterView's frame. (If changing flutterView's frame is the way to reproduce the bug) Here we have access to the FlutterViewController: https://github.com/flutter/engine/blob/master/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m#L98-L105

@zhongwuzw
Copy link
Member Author

@cyanglaz Ahha, my mistake, I don't clean the Xcode Derived cache, think we should need Flutter framework wrongly, I added the scenario test. :)

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the PR!

@cyanglaz cyanglaz 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 Mar 23, 2021
@fluttergithubbot fluttergithubbot merged commit 480cfa4 into flutter:master Mar 23, 2021
chandarrengoog pushed a commit to chandarrengoog/engine that referenced this pull request Mar 30, 2021
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.

[add2app]platformview block issue; content of which is clipped though position is correct when used in a Flutter Module on iOS
4 participants