Title: [291431] trunk/Source/WebKit
- Revision
- 291431
- Author
- grao...@webkit.org
- Date
- 2022-03-17 13:09:16 -0700 (Thu, 17 Mar 2022)
Log Message
[model] loading spinner doesn't show on iOS
https://bugs.webkit.org/show_bug.cgi?id=238029
rdar://89698998
Reviewed by Dean Jackson.
We must wait until a WKModelView has non-zero bounds to create the backing ASVInlinePreview
so that the ARQL views are all sized to display the loading spinner correctly.
* UIProcess/ios/WKModelView.mm:
(-[WKModelView initWithModel:]):
(-[WKModelView createPreview]):
(-[WKModelView layoutSubviews]):
(-[WKModelView updateBounds]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (291430 => 291431)
--- trunk/Source/WebKit/ChangeLog 2022-03-17 20:08:36 UTC (rev 291430)
+++ trunk/Source/WebKit/ChangeLog 2022-03-17 20:09:16 UTC (rev 291431)
@@ -1,3 +1,20 @@
+2022-03-17 Antoine Quint <grao...@webkit.org>
+
+ [model] loading spinner doesn't show on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=238029
+ rdar://89698998
+
+ Reviewed by Dean Jackson.
+
+ We must wait until a WKModelView has non-zero bounds to create the backing ASVInlinePreview
+ so that the ARQL views are all sized to display the loading spinner correctly.
+
+ * UIProcess/ios/WKModelView.mm:
+ (-[WKModelView initWithModel:]):
+ (-[WKModelView createPreview]):
+ (-[WKModelView layoutSubviews]):
+ (-[WKModelView updateBounds]):
+
2022-03-17 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r291352.
Modified: trunk/Source/WebKit/UIProcess/ios/WKModelView.mm (291430 => 291431)
--- trunk/Source/WebKit/UIProcess/ios/WKModelView.mm 2022-03-17 20:08:36 UTC (rev 291430)
+++ trunk/Source/WebKit/UIProcess/ios/WKModelView.mm 2022-03-17 20:09:16 UTC (rev 291431)
@@ -68,38 +68,14 @@
- (instancetype)initWithModel:(WebCore::Model&)model
{
- self = [super initWithFrame:CGRectZero];
+ _lastBounds = CGRectZero;
+ self = [super initWithFrame:_lastBounds];
if (!self)
return nil;
- if (![self createFileForModel:model])
- return self;
+ [self createFileForModel:model];
+ [self updateBounds];
- _preview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:self.bounds]);
- [self.layer addSublayer:[_preview layer]];
-
- auto url = "" alloc] initFileURLWithPath:_filePath]);
-
- [_preview setupRemoteConnectionWithCompletionHandler:^(NSError *contextError) {
- if (contextError) {
- LOG(ModelElement, "Unable to create remote connection, error: %@", [contextError localizedDescription]);
- return;
- }
-
- [_preview preparePreviewOfFileAtURL:url.get() completionHandler:^(NSError *loadError) {
- if (loadError) {
- LOG(ModelElement, "Unable to load file, error: %@", [loadError localizedDescription]);
- return;
- }
-
- LOG(ModelElement, "File loaded successfully.");
- [self updateBounds];
- }];
- }];
-
- _modelInteractionGestureRecognizer = adoptNS([[WKModelInteractionGestureRecognizer alloc] init]);
- [self addGestureRecognizer:_modelInteractionGestureRecognizer.get()];
-
return self;
}
@@ -134,11 +110,43 @@
return YES;
}
+- (void)createPreview
+{
+ if (!_filePath)
+ return;
+
+ auto bounds = self.bounds;
+ ASSERT(!CGRectEqualToRect(bounds, CGRectZero));
+
+ _preview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:bounds]);
+ [self.layer addSublayer:[_preview layer]];
+
+ auto url = "" alloc] initFileURLWithPath:_filePath]);
+
+ [_preview setupRemoteConnectionWithCompletionHandler:^(NSError *contextError) {
+ if (contextError) {
+ LOG(ModelElement, "Unable to create remote connection, error: %@", [contextError localizedDescription]);
+ return;
+ }
+
+ [_preview preparePreviewOfFileAtURL:url.get() completionHandler:^(NSError *loadError) {
+ if (loadError) {
+ LOG(ModelElement, "Unable to load file, error: %@", [loadError localizedDescription]);
+ return;
+ }
+
+ LOG(ModelElement, "File loaded successfully.");
+ }];
+ }];
+
+ _modelInteractionGestureRecognizer = adoptNS([[WKModelInteractionGestureRecognizer alloc] init]);
+ [self addGestureRecognizer:_modelInteractionGestureRecognizer.get()];
+}
+
- (void)layoutSubviews
{
[super layoutSubviews];
- if (!CGRectEqualToRect(_lastBounds, CGRectZero))
- [self updateBounds];
+ [self updateBounds];
}
- (void)updateBounds
@@ -149,6 +157,11 @@
_lastBounds = bounds;
+ if (!_preview) {
+ [self createPreview];
+ return;
+ }
+
[_preview updateFrame:bounds completionHandler:^(CAFenceHandle *fenceHandle, NSError *error) {
if (error) {
LOG(ModelElement, "Unable to update frame, error: %@", [error localizedDescription]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes