Started setting the FlutterOverlayView's bounds when it gets added to its superview. (flutter/engine#14018)

This commit is contained in:
gaaclarke
2019-12-05 13:53:07 -08:00
committed by GitHub
parent ba5f9acf1e
commit e479d6ad89
8 changed files with 39 additions and 9 deletions

View File

@@ -370,10 +370,13 @@ bool FlutterPlatformViewsController::SubmitFrame(GrContext* gr_context,
for (int64_t view_id : composition_order_) {
EnsureOverlayInitialized(view_id, gl_context, gr_context);
auto frame = overlays_[view_id]->surface->AcquireFrame(frame_size_);
SkCanvas* canvas = frame->SkiaCanvas();
canvas->drawPicture(picture_recorders_[view_id]->finishRecordingAsPicture());
canvas->flush();
did_submit &= frame->Submit();
// If frame is null, AcquireFrame already printed out an error message.
if (frame) {
SkCanvas* canvas = frame->SkiaCanvas();
canvas->drawPicture(picture_recorders_[view_id]->finishRecordingAsPicture());
canvas->flush();
did_submit &= frame->Submit();
}
}
picture_recorders_.clear();
if (composition_order_ == active_composition_order_) {
@@ -398,6 +401,7 @@ bool FlutterPlatformViewsController::SubmitFrame(GrContext* gr_context,
} else {
[flutter_view addSubview:platform_view_root];
[flutter_view addSubview:overlay];
overlay.frame = flutter_view.bounds;
}
active_composition_order_.push_back(view_id);

View File

@@ -10,6 +10,7 @@
0A57B3BD2323C4BD00DD9521 /* ScreenBeforeFlutter.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A57B3BC2323C4BD00DD9521 /* ScreenBeforeFlutter.m */; };
0A57B3BF2323C74200DD9521 /* FlutterEngine+ScenariosTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A57B3BE2323C74200DD9521 /* FlutterEngine+ScenariosTest.m */; };
0A57B3C22323D2D700DD9521 /* AppLifecycleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A57B3C12323D2D700DD9521 /* AppLifecycleTests.m */; };
0D14A3FE239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png in Resources */ = {isa = PBXBuildFile; fileRef = 0D14A3FD239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png */; };
0DB781EF22E931BE00E9B371 /* Flutter.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 246B4E4522E3B61000073EBF /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0DB781F122E933E800E9B371 /* Flutter.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 246B4E4522E3B61000073EBF /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0DB781FE22EA2C6D00E9B371 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 246B4E4522E3B61000073EBF /* Flutter.framework */; };
@@ -102,6 +103,7 @@
0A57B3BE2323C74200DD9521 /* FlutterEngine+ScenariosTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FlutterEngine+ScenariosTest.m"; sourceTree = "<group>"; };
0A57B3C02323C74D00DD9521 /* FlutterEngine+ScenariosTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FlutterEngine+ScenariosTest.h"; sourceTree = "<group>"; };
0A57B3C12323D2D700DD9521 /* AppLifecycleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppLifecycleTests.m; sourceTree = "<group>"; };
0D14A3FD239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "golden_platform_view_rotate_iPhone SE_simulator.png"; sourceTree = "<group>"; };
0DB781FC22EA2C0300E9B371 /* FlutterViewControllerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlutterViewControllerTest.m; sourceTree = "<group>"; };
244EA6CF230DBE8900B2D26E /* golden_platform_view_D21AP.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = golden_platform_view_D21AP.png; sourceTree = "<group>"; };
246B4E4122E3B5F700073EBF /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = App.framework; sourceTree = "<group>"; };
@@ -220,6 +222,7 @@
248D76ED22E388380012F0C1 /* ScenariosUITests */ = {
isa = PBXGroup;
children = (
0D14A3FD239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png */,
59A97FD9236B984300B4C066 /* golden_platform_view_multiple_background_foreground_iPhone SE_simulator.png */,
59A97FD7236A49D300B4C066 /* golden_platform_view_multiple_iPhone SE_simulator.png */,
244EA6CF230DBE8900B2D26E /* golden_platform_view_D21AP.png */,
@@ -377,6 +380,7 @@
buildActionMask = 2147483647;
files = (
6816DBAE2318696600A51400 /* golden_platform_view_cliprrect_iPhone SE_simulator.png in Resources */,
0D14A3FE239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png in Resources */,
6816DBAB2318696600A51400 /* golden_platform_view_transform_iPhone SE_simulator.png in Resources */,
59A97FDA236B984300B4C066 /* golden_platform_view_multiple_background_foreground_iPhone SE_simulator.png in Resources */,
6816DBAA2318696600A51400 /* golden_platform_view_clippath_iPhone SE_simulator.png in Resources */,

View File

@@ -36,6 +36,7 @@
@"--platform-view-clippath" : @"platform_view_clippath",
@"--platform-view-transform" : @"platform_view_transform",
@"--platform-view-opacity" : @"platform_view_opacity",
@"--platform-view-rotate" : @"platform_view_rotate",
};
__block NSString* goldenTestName = nil;
[launchArgsMap

View File

@@ -67,11 +67,8 @@
CGContextDrawImage(contextB, CGRectMake(0, 0, widthA, heightA), imageRefB);
CGContextRelease(contextB);
if (memcmp(rawA.mutableBytes, rawB.mutableBytes, size)) {
return NO;
}
return YES;
BOOL isSame = memcmp(rawA.mutableBytes, rawB.mutableBytes, size) == 0;
return isSame;
}
NS_INLINE NSString* _platformName() {

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
#import "PlatformViewGoldenTestManager.h"
#import <XCTest/XCTest.h>
@interface PlatformViewGoldenTestManager ()
@@ -31,6 +32,7 @@ NSDictionary* launchArgsMap;
@"--platform-view-clippath" : @"platform_view_clippath",
@"--platform-view-transform" : @"platform_view_transform",
@"--platform-view-opacity" : @"platform_view_opacity",
@"--platform-view-rotate" : @"platform_view_rotate",
};
});
_identifier = launchArgsMap[launchArg];

View File

@@ -150,3 +150,24 @@
}
@end
@interface PlatformViewRotation : GoldenPlatformViewTests
@end
@implementation PlatformViewRotation
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-rotate"];
return [super initWithManager:manager invocation:invocation];
}
- (void)tearDown {
XCUIDevice.sharedDevice.orientation = UIDeviceOrientationPortrait;
[super tearDown];
}
- (void)testPlatformView {
XCUIDevice.sharedDevice.orientation = UIDeviceOrientationLandscapeLeft;
[self checkGolden];
}
@end

View File

@@ -25,6 +25,7 @@ Map<String, Scenario> _scenarios = <String, Scenario>{
'platform_view_multiple': MultiPlatformViewScenario(window, firstId: 6, secondId: 7),
'platform_view_multiple_background_foreground': MultiPlatformViewBackgroundForegroundScenario(window, firstId: 8, secondId: 9),
'poppable_screen': PoppableScreenScenario(window),
'platform_view_rotate': PlatformViewScenario(window, 'Rotate Platform View', id: 10),
};
Scenario _currentScenario = _scenarios['animated_color_square'];