Changeset 190260 in webkit
- Timestamp:
- Sep 25, 2015, 5:17:27 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190256 r190260 1 2015-09-25 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Add viewport tests and fix runUIScript() timing issues 4 https://bugs.webkit.org/show_bug.cgi?id=149577 5 6 Reviewed by Tim Horton. 7 8 New viewport tests which read the scale etc. in the UI process. 9 10 * TestExpectations: 11 * fast/viewport/ios/resources/viewport-test-utils.js: Added. 12 (getUIScript): 13 (tableFromJSON): 14 (getViewport): 15 (runTest): 16 * fast/viewport/ios/width-is-device-width-expected.txt: Added. 17 * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Added. 18 * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html: Added. 19 * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html: Added. 20 * fast/viewport/ios/width-is-device-width-overflowing-expected.txt: Added. 21 * fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit-expected.txt: Added. 22 * fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html: Added. 23 * fast/viewport/ios/width-is-device-width-overflowing.html: Added. 24 * fast/viewport/ios/width-is-device-width.html: Added. 25 * platform/ios-simulator-wk2/TestExpectations: 26 1 27 2015-09-25 Antti Koivisto <antti@apple.com> 2 28 -
trunk/LayoutTests/TestExpectations
r190150 r190260 16 16 swipe [ Skip ] 17 17 fast/zooming/ios [ Skip ] 18 fast/viewport/ios [ Skip ] 18 19 19 20 fast/forms/attributed-strings.html [ Skip ] -
trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations
r190100 r190260 10 10 fast/harness/concurrent-ui-side-scripts.html [ Pass ] 11 11 fast/zooming/ios [ Pass ] 12 fast/viewport/ios [ Pass ] 12 13 13 14 #////////////////////////////////////////////////////////////////////////////////////////// -
trunk/Source/WebKit2/ChangeLog
r190257 r190260 1 2015-09-25 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Add viewport tests and fix runUIScript() timing issues 4 https://bugs.webkit.org/show_bug.cgi?id=149577 5 6 Reviewed by Tim Horton. 7 8 When calling testRunner.runUIScript() from a page load event, the script could run 9 in the UI process before the current remote layer tree transaction had been handled 10 there. This meant that runUIScript() could query state which was about to change. 11 12 Fix by delaying the execution of the UI script until a layer tree transaction has 13 been handled by the UI process, leveraging the existing DrawingAreaProxy::dispatchAfterEnsuringDrawing(). 14 15 This is done using a new C SPI function WKPageCallAfterNextPresentationUpdate(), 16 which is mirrored in the Obj-C SPI as -_doAfterNextPresentationUpdate:. 17 18 Move WKWebView SPI which is testing-related into a WKTesting category. It is expected 19 that this will grow significantly. 20 21 * UIProcess/API/C/WKPage.cpp: 22 (WKPageCallAfterNextPresentationUpdate): 23 * UIProcess/API/C/WKPagePrivate.h: 24 * UIProcess/API/Cocoa/WKWebView.mm: 25 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 26 * UIProcess/WebPageProxy.cpp: 27 (WebKit::WebPageProxy::callAfterNextPresentationUpdate): 28 * UIProcess/WebPageProxy.h: 29 * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: 30 * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: 31 (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): 32 1 33 2015-09-25 Alexey Proskuryakov <ap@apple.com> 2 34 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r190064 r190260 2470 2470 } 2471 2471 2472 void WKPageCallAfterNextPresentationUpdate(WKPageRef pageRef, void* context, WKPagePostPresentationUpdateFunction callback) 2473 { 2474 toImpl(pageRef)->callAfterNextPresentationUpdate([context, callback](WebKit::CallbackBase::Error error) { 2475 callback(error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context); 2476 }); 2477 } 2472 2478 2473 2479 #if ENABLE(NETSCAPE_PLUGIN_API) -
trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
r188793 r190260 122 122 WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs); 123 123 124 typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*); 125 WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function); 126 124 127 #ifdef __cplusplus 125 128 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r190065 r190260 3021 3021 } 3022 3022 3023 - (CGRect)_contentVisibleRect3024 {3025 return [self convertRect:[self bounds] toView:self._currentContentView];3026 }3027 3028 - (CGPoint)_convertPointFromContentsToView:(CGPoint)point3029 {3030 return [self convertPoint:point fromView:self._currentContentView];3031 }3032 3033 - (CGPoint)_convertPointFromViewToContents:(CGPoint)point3034 {3035 return [self convertPoint:point toView:self._currentContentView];3036 }3037 3038 3023 - (_WKWebViewPrintFormatter *)_webViewPrintFormatter 3039 3024 { … … 3108 3093 } 3109 3094 3110 #endif 3095 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 3111 3096 3112 3097 #endif … … 3114 3099 @end 3115 3100 3116 #if !TARGET_OS_IPHONE 3101 3102 @implementation WKWebView (WKTesting) 3103 3104 #if PLATFORM(IOS) 3105 3106 - (CGRect)_contentVisibleRect 3107 { 3108 return [self convertRect:[self bounds] toView:self._currentContentView]; 3109 } 3110 3111 - (CGPoint)_convertPointFromContentsToView:(CGPoint)point 3112 { 3113 return [self convertPoint:point fromView:self._currentContentView]; 3114 } 3115 3116 - (CGPoint)_convertPointFromViewToContents:(CGPoint)point 3117 { 3118 return [self convertPoint:point toView:self._currentContentView]; 3119 } 3120 3121 #endif // PLATFORM(IOS) 3122 3123 // Execute the supplied block after the next transaction from the WebProcess. 3124 - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock 3125 { 3126 typeof(updateBlock) updateBlockCopy = nil; 3127 if (updateBlock) 3128 updateBlockCopy = Block_copy(updateBlock); 3129 3130 _page->callAfterNextPresentationUpdate([updateBlockCopy](WebKit::CallbackBase::Error error) { 3131 updateBlockCopy(); 3132 Block_release(updateBlockCopy); 3133 }); 3134 } 3135 3136 @end 3137 3138 3139 #if PLATFORM(MAC) 3117 3140 3118 3141 @implementation WKWebView (WKIBActions) … … 3168 3191 @end 3169 3192 3170 #endif 3193 #endif // PLATFORM(MAC) 3171 3194 3172 3195 #if PLATFORM(IOS) -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r190065 r190260 126 126 @property (nonatomic, readonly) CGFloat _viewportMetaTagWidth; 127 127 128 @property (nonatomic, readonly) CGRect _contentVisibleRect;129 130 128 @property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter; 131 132 - (CGPoint)_convertPointFromContentsToView:(CGPoint)point;133 - (CGPoint)_convertPointFromViewToContents:(CGPoint)point;134 129 135 130 - (void)_beginInteractiveObscuredInsetsChange; … … 218 213 @end 219 214 220 #endif 215 216 @interface WKWebView (WKTesting) 217 218 #if TARGET_OS_IPHONE 219 @property (nonatomic, readonly) CGRect _contentVisibleRect WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 220 - (CGPoint)_convertPointFromContentsToView:(CGPoint)point WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 221 - (CGPoint)_convertPointFromViewToContents:(CGPoint)point WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 222 #endif 223 224 - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 225 226 @end 227 228 229 #endif -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r190064 r190260 6085 6085 } 6086 6086 6087 void WebPageProxy::callAfterNextPresentationUpdate(std::function<void (CallbackBase::Error)> callback) 6088 { 6089 m_drawingArea->dispatchAfterEnsuringDrawing(callback); 6090 } 6091 6087 6092 void WebPageProxy::setShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocument) 6088 6093 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r190064 r190260 1058 1058 void didLayoutForCustomContentProvider(); 1059 1059 1060 // For testing 1060 1061 void clearWheelEventTestTrigger(); 1062 void callAfterNextPresentationUpdate(std::function<void (CallbackBase::Error)>); 1061 1063 1062 1064 void didLayout(uint32_t layoutMilestones); -
trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h
r186662 r190260 54 54 55 55 virtual void waitForDidUpdateViewState() override; 56 virtual void dispatchAfterEnsuringDrawing(std::function<void (CallbackBase::Error)>) override; 56 57 57 58 virtual void willSendUpdateGeometry() override; -
trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
r186693 r190260 207 207 } 208 208 209 void TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing(std::function<void (CallbackBase::Error)> callback) 210 { 211 // This callback is primarily used for testing in RemoteLayerTreeDrawingArea. We could in theory wait for a CA commit here. 212 dispatch_async(dispatch_get_main_queue(), ^{ 213 callback(CallbackBase::Error::None); 214 }); 215 } 216 209 217 } // namespace WebKit 210 218 -
trunk/Tools/ChangeLog
r190257 r190260 1 2015-09-25 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Add viewport tests and fix runUIScript() timing issues 4 https://bugs.webkit.org/show_bug.cgi?id=149577 5 6 Reviewed by Tim Horton. 7 8 When calling testRunner.runUIScript() from a page load event, the script could run 9 in the UI process before the current remote layer tree transaction had been handled 10 there. This meant that runUIScript() could query state which was about to change. 11 12 Fix by delaying the execution of the UI script until a layer tree transaction has 13 been handled by the UI process, leveraging the existing DrawingAreaProxy::dispatchAfterEnsuringDrawing(). 14 15 * WebKitTestRunner/TestInvocation.cpp: 16 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): 17 (WTR::TestInvocation::runUISideScriptAfterUpdateCallback): 18 * WebKitTestRunner/TestInvocation.h: 19 1 20 2015-09-25 Alexey Proskuryakov <ap@apple.com> 2 21 -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r190065 r190260 669 669 WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID")); 670 670 671 unsigned callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get()))); 672 WKStringRef scriptString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, scriptKey.get())); 673 674 runUISideScript(scriptString, callbackID); 671 UIScriptInvocationData* invocationData = new UIScriptInvocationData(); 672 invocationData->testInvocation = this; 673 invocationData->callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get()))); 674 invocationData->scriptString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, scriptKey.get())); 675 WKPageCallAfterNextPresentationUpdate(TestController::singleton().mainWebView()->page(), invocationData, runUISideScriptAfterUpdateCallback); 675 676 return; 676 677 } … … 721 722 } 722 723 724 void TestInvocation::runUISideScriptAfterUpdateCallback(WKErrorRef, void* context) 725 { 726 UIScriptInvocationData* data = static_cast<UIScriptInvocationData*>(context); 727 data->testInvocation->runUISideScript(data->scriptString.get(), data->callbackID); 728 delete data; 729 } 730 723 731 void TestInvocation::runUISideScript(WKStringRef script, unsigned scriptCallbackID) 724 732 { -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r190065 r190260 75 75 76 76 static void forceRepaintDoneCallback(WKErrorRef, void* context); 77 78 struct UIScriptInvocationData { 79 unsigned callbackID; 80 WebKit::WKRetainPtr<WKStringRef> scriptString; 81 TestInvocation* testInvocation; 82 }; 83 static void runUISideScriptAfterUpdateCallback(WKErrorRef, void* context); 77 84 78 85 bool shouldLogFrameLoadDelegates() const;
Note:
See TracChangeset
for help on using the changeset viewer.