Changeset 252012 in webkit
- Timestamp:
- Nov 4, 2019 1:49:37 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r251996 r252012 1 2019-11-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Consolidate forEachViewInHierarchy and findAllViewsInHierarchyOfType into common helper file 4 https://bugs.webkit.org/show_bug.cgi?id=203777 5 6 Reviewed by Tim Horton. 7 8 * TestRunnerShared/cocoa/PlatformViewHelpers.h: Added. 9 * TestRunnerShared/cocoa/PlatformViewHelpers.mm: Added. 10 11 Add a new Cocoa helper file, PlatformViewHelpers, to make it easier to traverse platform view hierarchies 12 (NSView and UIView) for testing purposes. This is minor refactoring, before I try to create some new testing 13 primitives to make webkit.org/b/203116 testable. 14 15 (forEachViewInHierarchy): 16 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: 17 * WebKitTestRunner/ios/UIScriptControllerIOS.h: 18 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 19 (WTR::UIScriptControllerIOS::findEditableImageCanvas const): 20 (WTR::forEachViewInHierarchy): Deleted. 21 (WTR::findEditableImageCanvas): Deleted. 22 1 23 2019-11-04 Alex Christensen <achristensen@webkit.org> 2 24 -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r251279 r252012 86 86 2DFA98481D7F70CF00AFF2C9 /* SharedEventStreamsMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DFA98461D7F70CF00AFF2C9 /* SharedEventStreamsMac.h */; }; 87 87 2DFA98491D7F70CF00AFF2C9 /* SharedEventStreamsMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DFA98471D7F70CF00AFF2C9 /* SharedEventStreamsMac.mm */; }; 88 2E2A765D2370C8D1008F9FFE /* PlatformViewHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E2A765C2370C8A0008F9FFE /* PlatformViewHelpers.mm */; }; 88 89 2E34C90018B68808000067BB /* WebKitTestRunnerInjectedBundle.bundle in Copy Plug-Ins */ = {isa = PBXBuildFile; fileRef = BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 89 90 2E63ED8A1891AD7E002A7AFC /* AccessibilityControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */; }; … … 286 287 2DFA98461D7F70CF00AFF2C9 /* SharedEventStreamsMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedEventStreamsMac.h; path = mac/SharedEventStreamsMac.h; sourceTree = "<group>"; }; 287 288 2DFA98471D7F70CF00AFF2C9 /* SharedEventStreamsMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SharedEventStreamsMac.mm; path = mac/SharedEventStreamsMac.mm; sourceTree = "<group>"; }; 289 2E2A765B2370C8A0008F9FFE /* PlatformViewHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformViewHelpers.h; path = ../TestRunnerShared/cocoa/PlatformViewHelpers.h; sourceTree = "<group>"; }; 290 2E2A765C2370C8A0008F9FFE /* PlatformViewHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformViewHelpers.mm; path = ../TestRunnerShared/cocoa/PlatformViewHelpers.mm; sourceTree = "<group>"; }; 288 291 2E63ED751891ACE9002A7AFC /* AccessibilityControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityControllerIOS.mm; sourceTree = "<group>"; }; 289 292 2E63ED761891ACE9002A7AFC /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityNotificationHandler.h; sourceTree = "<group>"; }; … … 891 894 F4C3578B20E8444000FA0748 /* LayoutTestSpellChecker.h */, 892 895 F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */, 896 2E2A765B2370C8A0008F9FFE /* PlatformViewHelpers.h */, 897 2E2A765C2370C8A0008F9FFE /* PlatformViewHelpers.mm */, 893 898 ); 894 899 name = cocoa; … … 1182 1187 A185103C1B9AE0FE00744AEB /* Options.cpp in Sources */, 1183 1188 A18510401B9AE13100744AEB /* PixelDumpSupport.cpp in Sources */, 1189 2E2A765D2370C8D1008F9FFE /* PlatformViewHelpers.mm in Sources */, 1184 1190 2DFA98491D7F70CF00AFF2C9 /* SharedEventStreamsMac.mm in Sources */, 1185 1191 A18510411B9AE13800744AEB /* TestController.cpp in Sources */, -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
r251522 r252012 30 30 31 31 #if PLATFORM(IOS_FAMILY) 32 33 #if HAVE(PENCILKIT) 34 @class PKCanvasView; 35 #endif 32 36 33 37 namespace WebCore { … … 154 158 WebCore::FloatRect rectForMenuAction(CFStringRef) const; 155 159 void singleTapAtPointWithModifiers(WebCore::FloatPoint location, Vector<String>&& modifierFlags, BlockPtr<void()>&&); 160 #if HAVE(PENCILKIT) 161 PKCanvasView *findEditableImageCanvas() const; 162 #endif 156 163 }; 157 164 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r251522 r252012 31 31 #import "HIDEventGenerator.h" 32 32 #import "PencilKitTestSPI.h" 33 #import "PlatformViewHelpers.h" 33 34 #import "PlatformWebView.h" 34 35 #import "StringFunctions.h" … … 106 107 } 107 108 108 static BOOL forEachViewInHierarchy(UIView *view, void(^mapFunction)(UIView *subview, BOOL *stop))109 {110 BOOL stop = NO;111 mapFunction(view, &stop);112 if (stop)113 return YES;114 115 for (UIView *subview in view.subviews) {116 stop = forEachViewInHierarchy(subview, mapFunction);117 if (stop)118 break;119 }120 return stop;121 }122 123 static NSArray<UIView *> *findAllViewsInHierarchyOfType(UIView *view, Class viewClass)124 {125 __block RetainPtr<NSMutableArray> views = adoptNS([[NSMutableArray alloc] init]);126 forEachViewInHierarchy(view, ^(UIView *subview, BOOL *stop) {127 if ([subview isKindOfClass:viewClass])128 [views addObject:subview];129 });130 return views.autorelease();131 }132 133 109 Ref<UIScriptController> UIScriptController::create(UIScriptContext& context) 134 110 { … … 1082 1058 1083 1059 #if HAVE(PENCILKIT) 1084 static PKCanvasView *findEditableImageCanvas() 1060 1061 PKCanvasView *UIScriptControllerIOS::findEditableImageCanvas() const 1085 1062 { 1086 1063 Class pkCanvasViewClass = NSClassFromString(@"PKCanvasView"); … … 1095 1072 return canvasView; 1096 1073 } 1097 #endif 1074 1075 #endif // HAVE(PENCILKIT) 1098 1076 1099 1077 void UIScriptControllerIOS::drawSquareInEditableImage()
Note: See TracChangeset
for help on using the changeset viewer.