-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] replace browser-related conditional logic with BrowserEnvironment #27084
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. 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. |
mdebbar
left a comment
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 love this new structure. Makes much sense!
lib/web_ui/dev/browser.dart
Outdated
| /// | ||
| /// Example file names: | ||
| /// - Chrome, no-suffix: backdrop_filter_clip_moved.actual.png | ||
| /// - iOS Safari: backdrop_filter_clip_moved.actual.iOS_Safari.png |
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.
nit: it should be *.iOS_Safari.actual.png
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.
lib/web_ui/dev/safari_ios.dart
Outdated
| } | ||
|
|
||
| return screenshot; | ||
| /// A class for running an instance of Safari for iOS (i.e. mobile Safari). |
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.
(as you always suggest to me 😁): "A class for" is unnecessary, we already know it's a class. Maybe: "Runs an instance of ..."?
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.
Thanks for rereading the comments. I didn't read the comments for code that I copied (although I should have). Fixed here and a few other places.
lib/web_ui/dev/safari_ios.dart
Outdated
| 'simctl', | ||
| 'openurl', // Opens the url on Safari installed on the simulator. | ||
| 'booted', // The simulator is already booted. | ||
| '${url.toString()}' |
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.
nit: trailing comma.
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.
* e94ed1c [web] skip overlay test on Safari (flutter/engine#27114) * 6b92842 Roll Skia from 1c467774e56e to e9ab391765c7 (1 revision) (flutter/engine#27143) * 0977906 Update goldens test for Thai. (flutter/engine#27144) * 4ec5781 [web] replace browser-related conditional logic with BrowserEnvironment (flutter/engine#27084) * 05ce70e enable DisplayList by default (flutter/engine#27130) * e3357d2 Roll Fuchsia Mac SDK from jzKy-rCeR... to oiyYFMOd3... (flutter/engine#27145) * cb1c312 Support right-clicking on iPadOS (flutter/engine#27019) * 4ac4e5c Roll Fuchsia Linux SDK from 4MLcvcjCH... to QbIpQIqxK... (flutter/engine#27146) * e6250f7 Roll Skia from e9ab391765c7 to 04d79fc59488 (1 revision) (flutter/engine#27148) * 2dacffa Revert "enable DisplayList by default (#27130)" (flutter/engine#27153)
…nt (flutter#27084) * [web] replace browser-related conditional logic with BrowserEnvironment
…nt (flutter#27084) * [web] replace browser-related conditional logic with BrowserEnvironment
In order to deal with browser differences we have relied on conditional logic (
ifblocks) and map look-ups scattered throughout the felt codebase. For example, there would be chunks of code like this:As well as listings and mapping like this.
This PR introduces
BrowserEnvironmentinterface that provides the functionality needed by the test runner. A singleswitchblock at the root (intest_runner.dart) is used to determine a concrete implementation of this interface. The rest of the code no longer needs to deal with browser differences. It just requests the needed functionality fromBrowserEnvironment.As a result all the routing logic from
supported_browsers.dartis gone and the file deleted. Browser-specific implementations ofScreenshotManagerare moved to their respective browser files (chrome.dart,firefox.dart, etc), and thescreenshot_manager.dartfile deleted.The logic in
safari.dartthat attempted to support desktop and mobile Safari visif/elseblocks has been split up intosafari_ios.dartandsafari_macos.dart.The rest of the code was updated to use the
BrowserEnvironmentAPI.Bonus:
do-fetch-goldens-repohas been changed toskip-goldens-repo-fetchto better reflect the default (you opt-in to skip the fetch rather than ask it to fetch).