-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios] Fix hold and drag spacebar does not move cursor when obscureText is true. #40216
Conversation
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 (don't just cc him here, he won't see it! He's on Discord!). 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. |
@cyanglaz Can you take a look at this or redirect? |
@cbracken You mentioned potentially using updateConfig outside of web recently in another PR, right? What did you decide there? This PR is adding support for it on iOS in order to fix a similar bug with obscureText. Edit: This issue: flutter/flutter#122300 |
[config setValue:@"NO" forKey:@"obscureText"]; | ||
[self updateConfig:config]; | ||
|
||
XCTAssertFalse(inputView.isSecureTextEntry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also test if [inputView reloadInputViews];
is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// https://github.com/flutter/flutter/issues/122139 | ||
if (inputView.isSecureTextEntry != isSecureTextEntry) { | ||
inputView.secureTextEntry = isSecureTextEntry; | ||
[inputView reloadInputViews]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The document of reloadInputViews
this method says:
You can use this method to refresh the custom input view or input accessory view associated with the current object when it’s the first responder. The views are replaced immediately, without animating them into place. If the current object isn’t the first responder, this method has no effect.
(https://developer.apple.com/documentation/uikit/uiresponder/1621110-reloadinputviews?language=objc)
"The views are replaced immediately" sounds like the some view inside the inputView
is replaced? What are other side effects of replacing the view? Do we not need to restore any state of the view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find any relevant side effect descriptions, and there was no problem after testing, so I think that the reloadInputViews
method simply refreshes the keyboard view and does not cause other side effects. And when switching secureTextEntry
to true
, the keyboard will not have input accessory view, so there is no need to save the state.
In addition, I did a test in a native project, calling the reloadInputViews
method directly will not affect the state in input accessory view and caps lock state.
reloadInputViews1.mov
@justinmc I have the patch sitting in a branch as well as a framework patch. The framework patch only looks at Will send out the embedder side and we can discuss what we'd like to do for the framework end. |
@cbracken Does your work include or affect iOS? Do we need to hold off landing this for now? |
Code looks good to me, but need to confirm with @cbracken on his other PR mentioned in #40216 (comment) @justinmc Could you also provide some context? Maybe a link to the PR? |
Sorry, this is the referenced discussion about sending It seems like we might want something like this PR for all platforms and all configuration parameters in the long term. |
@justinmc Ok. Sounds like we could land this to fix iOS for now and introduce a long term solution for all the platforms later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
auto label is removed for flutter/engine, pr: 40216, due to This PR has not met approval requirements for merging. You have project association NONE and need 1 more review(s) in order to merge this PR.
|
auto label is removed for flutter/engine, pr: 40216, due to Validations Fail. |
auto label is removed for flutter/engine, pr: 40216, due to This PR has not met approval requirements for merging. You have project association NONE and need 1 more review(s) in order to merge this PR.
|
auto label is removed for flutter/engine, pr: 40216, due to Validations Fail. |
I don't understand why |
@LinXunFeng I'm not sure about why Mac Unopt timed out, I triggered a re-run. |
luci-engine is the current state of the engine tree with the signal being calculated from the last engine commit. Linux framework tests calculate the latest green commit from the framework to use for these tests. It can happen that the latest green commit from the framework does not work well with the engine ToT commit. This type of issue is usually identified when the engine is rolled to the framework, at that point a few reverts may happen in the engine and the pending PRs will need to get rebased to pick up the revert changes. |
I see |
@cyanglaz the milo dashboardd was deprecated a long time ago. The current source of truth is https://flutter-dashboard.appspot.com/#/build?taskFilter&authorFilter&messageFilter&hashFilter&showMac=true&showWindows=true&showiOS=true&showLinux=true&showAndroid=true&showStaging=false&repo=engine&branch=master |
@LinXunFeng The mac test failure also does not seem to be related. It is failing on an impeller unit test. Can you reproduce it locally?
|
yes, the error log is as follows ➜ host_debug_unopt git:(f24f62f) ✗ ./impeller_unittests --gtest_repeat=2 --gtest_shuffle
[INFO:test_timeout_listener.cc(76)] Test timeout of 120 seconds per test case will be enforced.
Repeating all tests (iteration 1) . . .
Note: Randomizing tests' orders with a seed of 32449 .
[==========] Running 698 tests from 22 test suites.
[----------] Global test environment set-up.
[----------] 1 test from PipelineDescriptorTest
[ RUN ] PipelineDescriptorTest.PrimitiveTypeHashEquality
[ OK ] PipelineDescriptorTest.PrimitiveTypeHashEquality (1 ms)
[----------] 1 test from PipelineDescriptorTest (1 ms total)
[----------] 8 tests from Compute/ComputeTest
[ RUN ] Compute/ComputeTest.HeartCubicsToStrokeVertices/Metal
[ERROR:flutter/fml/backtrace.cc(108)] Caught signal SIGSEGV during program execution.
Frame 0: 0x107255446 testing::internal::EqHelper::Compare<>()
Frame 1: 0x107254577 impeller::testing::ComputeTest_HeartCubicsToStrokeVertices_Test::TestBody()::$_0::operator()()
Frame 2: 0x1072543fd std::_LIBCPP_ABI_NAMESPACE::__invoke[abi:v15000]<>()
Frame 3: 0x10725435b std::_LIBCPP_ABI_NAMESPACE::__invoke_void_return_wrapper<>::__call<>()
Frame 4: 0x107254303 std::_LIBCPP_ABI_NAMESPACE::__function::__alloc_func<>::operator()[abi:v15000]()
Frame 5: 0x1072522cf std::_LIBCPP_ABI_NAMESPACE::__function::__func<>::operator()()
Frame 6: 0x109636dcf std::_LIBCPP_ABI_NAMESPACE::__function::__value_func<>::operator()[abi:v15000]()
Frame 7: 0x10963271a std::_LIBCPP_ABI_NAMESPACE::function<>::operator()()
Frame 8: 0x1097d5f3b ___ZN8impeller16CommandBufferMTL16OnSubmitCommandsENSt21_LIBCPP_ABI_NAMESPACE8functionIFvNS_13CommandBuffer6StatusEEEE_block_invoke
Frame 9: 0x7ff8192b5380 MTLDispatchListApply
Frame 10: 0x7ff8192b58a6 -[_MTLCommandBuffer didCompleteWithStartTime:endTime:error:]
Frame 11: 0x7ff8192b5646 -[MTLIOAccelCommandBuffer didCompleteWithStartTime:endTime:error:]
Frame 12: 0x7ff8192b5520 -[_MTLCommandQueue commandBufferDidComplete:startTime:completionTime:error:]
Frame 13: 0x7ff81928d0d0 ioAccelCommandQueueBlockFenceCallback
Frame 14: 0x7ff812e19981 IODispatchCalloutFromCFMessage
Frame 15: 0x7ff812e19802 _IODispatchCalloutWithDispatch
Frame 16: 0x7ff80fc10f40 dispatch_mig_server
Frame 17: 0x7ff80fbf5a44 _dispatch_client_callout
Frame 18: 0x7ff80fbf8500 _dispatch_continuation_pop
Frame 19: 0x7ff80fc09dff _dispatch_source_invoke
Frame 20: 0x7ff80fbfb964 _dispatch_lane_serial_drain
Frame 21: 0x7ff80fbfc5b4 _dispatch_lane_invoke
Frame 22: 0x7ff80fc06ad7 _dispatch_workloop_worker_thread
Frame 23: 0x7ff80fd71ce3 _pthread_wqthread
Frame 24: 0x7ff80fd70c67 start_wqthread
[1] 18218 segmentation fault ./impeller_unittests --gtest_repeat=2 --gtest_shuffle |
@cyanglaz I rebase changes onto |
auto label is removed for flutter/engine, pr: 40216, due to This PR has not met approval requirements for merging. You have project association NONE and need 1 more review(s) in order to merge this PR.
|
auto label is removed for flutter/engine, pr: 40216, due to Validations Fail. |
CC @moffatman this may be related to the floating cursor PR you have |
// The feature of holding and draging spacebar to move cursor is affected by | ||
// secureTextEntry, so when obscureText is updated, we need to update secureTextEntry | ||
// and call reloadInputViews. | ||
// https://github.com/flutter/flutter/issues/122139 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if i follow this. can you explain more why setting secrueTextEntry and the reload fixes the space bar cursor interaction? Or is it an undocumented behavior by apple here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, it is clear that when secureTextEntry
is true, the space bar cursor interaction is not allowed, otherwise it is allowed. This is the correct interaction behavior on iOS native, so we need to update secureTextEntry
in time when switching obscureText
. I did not find a description of whether this space bar cursor interaction is affected by secureTextEntry
in Apple's official documentation, this is just the conclusion obtained after testing.
Then, when the value of the secureTextEntry
is changed, the interaction and style of the keyboard are still before the secureTextEntry
is changed, so here I call the reloadInputViews
method to refresh keyboard.
@cyanglaz Hi, both have approved, please add |
We also need a secondary review on the framework PR (flutter/flutter#122383) if anyone has a minute. |
…obscureText is true. (flutter/engine#40216)
…125504) flutter/engine@60c4e61...0e23698 2023-04-25 linxunfeng@yeah.net [ios] Fix hold and drag spacebar does not move cursor when obscureText is true. (flutter/engine#40216) 2023-04-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 337365e42613 to 170137fc759b (2 revisions) (flutter/engine#41483) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes flutter/flutter#122139 with flutter pr flutter/flutter#122383