Over the past two years, the AMP Project has been working with Igalia to identify bugs and missing features within iOS WebKit and then fix them. We create repro cases, write web platform tests, perform debugging and analysis, and, of course, write patches to actually fix things. We think this is particular rewarding work, because it helps ourselves achieve our goals faster, but also makes the web more predictable for developers overall.
In this blog post, we provide an overview of the work done in 2018 with hints about when improvements will be available in iOS releases or when they will have to be handled by Apple. Some of this work is still in progress and we keep proposing new ideas and reporting bugs.
iOS 12.1
We submitted patches for the following bugs which are now fixed in the latest iOS 12.1 releases:
- Ensuring that the highlighted text of the Find UI is revealed at the middle of the page
- Allowing to use JavaScript to unset CSS transition properties that have an !important rule
- Various fixes for the animation code, including bug 170784 and bug 186129.
Additionally, Igalia assisted Apple with improvements to custom elements. This one is fixed in the latest iOS 12.1.1 beta:
- Not calling connectedCallback when a custom element is disconnected. For other similar use cases such as bug 183586 or issue 760, WebKit’s behavior was actually correct.
iOS 11
We have been watching some improvements and verified that they are included in the latest iOS 11 releases. These two items were handled by Igalia in 2017 thanks to support from the AMP project:
- Improving frame sandboxing, including implementations of new sandbox attribute values such as allow-popup-to-escape-sandbox, allow-top-navigation-without-user-activation and allow-modals flags.
This allows apps to more securely sandbox ads from doing bad things. - Fixing flickering for fixed positioned elements in iframes when touch scrolling is on. See bug 175135
These bugs triaged by us were fixed by other WebKit developers:
- Ensuring that iframe are properly resized on orientation change.
- Fixing a regression that led to unpainted content for overflow node with touch scrolling enabled.
- Making the “speak selection” feature work in iframes.
- Addressing various issues with scroll snapping. In particular, see bug 160622, bug 158821 and bug 170560
- Preventing swipe gestures on the “play” icon to launch a video.
- Adding support for link preload. See bug 158720.
WebKit trunk
We have collaborated with Igalia’s and Google’s Web Platform engineers to make the following features available in WebKit trunk. Apple does not comment on future releases but we keep watching them to verify when these improvements arrive in iOS releases.
- Making overflow nodes with touch scrolling enabled scrollable when their content is dynamically resized to overflow.
- Preventing jumps of fixed positioned elements in iframes when touch scrolling is on.
- Implementing standard behavior for scroll* APIs on the document root/body so that WebKit matches the behavior of Firefox, Chromium and Edge. This is currently under a preference flag but Apple is happy to enable it in Safari in the future.
- Supporting Intersection Observer currently well advanced but under a preference flag. See bug 159475.
To be handled by Apple
Apple has been working on two big features that are interesting for AMP:
- Web Animations, currently under a preference flag which is disabled by default on current iOS releases.
- Fullscreen API, currently under a preference flag which is already enabled for iPad
After analysis and discussions we concluded that it will be up to Apple to fix the following issues:
- Redirecting window.top to itunes URLs or better handling of the download attribute both of them involving proprietary code in Safari to decide the application to open the link.
- Preserving transformation matrix when pausing an animation which likely requires change in the proprietary CALayer’s addAnimation.
- Supporting for contentInset by the WKWebView which requires change in WKWebView.
Work in progress
We are working with Igalia on the following improvements and some patches are already available:
- Support smooth ScrollBehavior for scrollIntoView/scrollTo/scrollBy. You can watch this video for a quick demo.
- Allowing to pass user gesture via MessageChannel.
- iOS frame scrolling. We are still coordinating with Apple to get the current patch reviewed. You can check the video we made early this year.
- Working on web compatibility fixes in the areas of DOM, XMLHttpRequest and fetch.
Conclusion
We are thrilled to continue collaboration with Igalia and other browser developers in order to keep improving WebKit’s web platform implementations. Next year, we plan to continue the effort on the current tasks but we also have various other ideas related to networking, UI and more. Stay tuned!
Posted by Frédéric Wang, browser engineer at Igalia