Changeset 228354 in webkit
- Timestamp:
- Feb 9, 2018 9:43:36 PM (6 years ago)
- Location:
- branches/safari-605-branch
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-605-branch/Source/WebKit/ChangeLog
r228233 r228354 1 2018-02-09 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r228253. rdar://problem/37408874 4 5 2018-02-07 Tim Horton <timothy_horton@apple.com> 6 7 Evernote device management web view sometimes displays at the wrong scale 8 https://bugs.webkit.org/show_bug.cgi?id=182590 9 <rdar://problem/36633687> 10 11 Reviewed by Simon Fraser. 12 13 Evernote implements the WKWebView's scroll view's delegate method 14 viewForZoomingInScrollView: and returns nil. This results in 15 WKScrollView's zoomScale always returning 1, no matter what the 16 WKContentView's actual scale is. This will result in us never updating 17 the WKContentView's scale to 1. When loading a page that has a few 18 scale changes during load but ends up at scale 1, we get stuck at whatever 19 intermediate scale immediately preceded settling on 1. 20 21 Fix this by not forwarding viewForZoomingInScrollView: to the external 22 WKScrollView delegate; we are in charge of the contents of the scroll 23 view (including which view scrollView's zoomScale should track), and 24 overriding viewForZoomingInScrollView: is only ever going to lead to 25 a broken WebKit. 26 27 * UIProcess/ios/WKScrollView.mm: 28 (shouldForwardScrollViewDelegateMethodToExternalDelegate): 29 (-[WKScrollViewDelegateForwarder forwardInvocation:]): 30 (-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]): 31 1 32 2018-02-07 Jason Marcell <jmarcell@apple.com> 2 33 -
branches/safari-605-branch/Source/WebKit/UIProcess/ios/WKScrollView.mm
r220506 r228354 76 76 } 77 77 78 static BOOL shouldForwardScrollViewDelegateMethodToExternalDelegate(SEL selector) 79 { 80 // We cannot forward viewForZoomingInScrollView: to the external delegate, because WebKit 81 // owns the content of the scroll view, and depends on viewForZoomingInScrollView being the 82 // content view. Any other view returned by the external delegate will break our behavior. 83 if (sel_isEqual(selector, @selector(viewForZoomingInScrollView:))) 84 return NO; 85 86 return YES; 87 } 88 78 89 - (void)forwardInvocation:(NSInvocation *)anInvocation 79 90 { … … 81 92 SEL aSelector = [anInvocation selector]; 82 93 BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector]; 83 BOOL externalDelegateWillRespond = [externalDelegate respondsToSelector:aSelector];94 BOOL externalDelegateWillRespond = shouldForwardScrollViewDelegateMethodToExternalDelegate(aSelector) && [externalDelegate respondsToSelector:aSelector]; 84 95 85 96 if (internalDelegateWillRespond && externalDelegateWillRespond) … … 101 112 { 102 113 BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector]; 103 BOOL externalDelegateWillRespond = [_externalDelegate.get() respondsToSelector:aSelector];114 BOOL externalDelegateWillRespond = shouldForwardScrollViewDelegateMethodToExternalDelegate(aSelector) && [_externalDelegate.get() respondsToSelector:aSelector]; 104 115 105 116 if (internalDelegateWillRespond && !externalDelegateWillRespond) -
branches/safari-605-branch/Tools/ChangeLog
r228353 r228354 1 2018-02-09 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r228253. rdar://problem/37408874 4 5 2018-02-07 Tim Horton <timothy_horton@apple.com> 6 7 Evernote device management web view sometimes displays at the wrong scale 8 https://bugs.webkit.org/show_bug.cgi?id=182590 9 <rdar://problem/36633687> 10 11 Reviewed by Simon Fraser. 12 13 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 14 * TestWebKitAPI/Tests/ios/WKScrollViewDelegate.mm: Renamed from Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegateCrash.mm. 15 (-[TestDelegateForScrollView dealloc]): 16 (TestWebKitAPI::TEST): 17 (-[WKScrollViewDelegateWithViewForZoomingOverridden viewForZoomingInScrollView:]): 18 Add a test that failed before the change that ensures that we don't 19 consult the external delegate for viewForZoomingInScrollView:, and that 20 we succesfully update the scale even if it matches that of the view 21 the external delegate returns for viewForZoomingInScrollView:. 22 1 23 2018-02-09 Jason Marcell <jmarcell@apple.com> 2 24 -
branches/safari-605-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r227774 r228354 264 264 5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */; }; 265 265 5CEAB5E11FA939F400A77FAA /* _WKInputDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */; }; 266 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate Crash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */; };266 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate.mm */; }; 267 267 631EFFF61E7B5E8D00D2EBB8 /* Geolocation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 631EFFF51E7B5E8D00D2EBB8 /* Geolocation.mm */; }; 268 268 634910E01E9D3FF300880309 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 634910DF1E9D3FF300880309 /* CoreLocation.framework */; }; … … 1431 1431 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; }; 1432 1432 5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInputDelegate.mm; sourceTree = "<group>"; }; 1433 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate Crash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegateCrash.mm; path = ../ios/WKScrollViewDelegateCrash.mm; sourceTree = "<group>"; };1433 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegate.mm; path = ../ios/WKScrollViewDelegate.mm; sourceTree = "<group>"; }; 1434 1434 631EFFF51E7B5E8D00D2EBB8 /* Geolocation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Geolocation.mm; sourceTree = "<group>"; }; 1435 1435 634910DF1E9D3FF300880309 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; … … 2165 2165 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */, 2166 2166 44817A2E1F0486BF00003810 /* WKRequestActivatedElementInfo.mm */, 2167 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate Crash.mm */,2167 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate.mm */, 2168 2168 51C683DD1EA134DB00650183 /* WKURLSchemeHandler-1.mm */, 2169 2169 5182C22D1F2BCB410059BA7C /* WKURLSchemeHandler-leaks.mm */, … … 3502 3502 7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */, 3503 3503 5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */, 3504 5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */, 3504 3505 A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */, 3505 3506 51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */, … … 3546 3547 4647B1261EBA3B850041D7EF /* ProcessDidTerminate.cpp in Sources */, 3547 3548 7C83E0C11D0A652F00FEBCF3 /* ProvisionalURLNotChange.mm in Sources */, 3548 5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */,3549 3549 7CCE7EC81A411A7E00447C4C /* PublicSuffix.mm in Sources */, 3550 3550 7C83E0C21D0A653500FEBCF3 /* QuickLook.mm in Sources */, … … 3666 3666 44817A2F1F0486BF00003810 /* WKRequestActivatedElementInfo.mm in Sources */, 3667 3667 7C83E0B51D0A649300FEBCF3 /* WKRetainPtr.cpp in Sources */, 3668 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate Crash.mm in Sources */,3668 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate.mm in Sources */, 3669 3669 7CCE7F221A411AE600447C4C /* WKString.cpp in Sources */, 3670 3670 7CCE7F1E1A411AE600447C4C /* WKStringJSString.cpp in Sources */, -
branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/WKScrollViewDelegate.mm
r228353 r228354 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #import "PlatformUtilities.h" 31 31 #import "Test.h" 32 #import "TestWKWebView.h" 32 33 #import <WebKit/WKWebView.h> 34 35 // WKScrollViewDelegateCrash 33 36 34 37 static bool delegateIsDeallocated; … … 66 69 } 67 70 71 // WKScrollViewDelegateCannotOverrideViewForZooming 72 73 static BOOL didCallViewForZoomingInScrollView; 74 75 @interface WKScrollViewDelegateWithViewForZoomingOverridden : NSObject <UIScrollViewDelegate> 76 @property (nonatomic, assign) CGFloat overrideScale; 77 @end 78 79 @implementation WKScrollViewDelegateWithViewForZoomingOverridden 80 81 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView 82 { 83 didCallViewForZoomingInScrollView = true; 84 85 UIView *fakeZoomingView = [[UIView alloc] init]; 86 fakeZoomingView.layer.affineTransform = CGAffineTransformMakeScale(_overrideScale, _overrideScale); 87 return fakeZoomingView; 88 } 89 90 @end 91 92 namespace TestWebKitAPI { 93 94 TEST(WKWebView, WKScrollViewDelegateCannotOverrideViewForZooming) 95 { 96 TestWKWebView *webView = [[TestWKWebView alloc] init]; 97 WKScrollViewDelegateWithViewForZoomingOverridden *delegateForScrollView = [[WKScrollViewDelegateWithViewForZoomingOverridden alloc] init]; 98 @autoreleasepool { 99 webView.scrollView.delegate = delegateForScrollView; 100 } 101 102 [webView synchronouslyLoadHTMLString:@"<meta name='viewport' content='initial-scale=1'>"]; 103 [webView waitForNextPresentationUpdate]; 104 105 // Have WKScrollView's external delegate return a view with scale=2 from viewForZoomingInScrollView. 106 delegateForScrollView.overrideScale = 2; 107 108 [webView synchronouslyLoadHTMLString:@"<meta name='viewport' content='initial-scale=2'>"]; 109 [webView waitForNextPresentationUpdate]; 110 111 @autoreleasepool { 112 webView.scrollView.delegate = nil; 113 } 114 115 EXPECT_FALSE(didCallViewForZoomingInScrollView); 116 EXPECT_EQ(2, [[webView scrollView] zoomScale]); 117 } 118 119 } 120 68 121 #endif
Note: See TracChangeset
for help on using the changeset viewer.