BUILD FIX: Make AccessibilityUIElementIOS.mm build on iOS
[WebKit-https.git] / Tools / DumpRenderTree / ios / AccessibilityUIElementIOS.mm
index 81d7643ae6adfe514540f968e956606dc663a725..10a2ab9b1e40ca09dfd8a50e163f2e6a7617a38c 100644 (file)
@@ -79,6 +79,10 @@ AccessibilityUIElement::~AccessibilityUIElement()
 - (void)accessibilitySetPostedNotificationCallback:(AXPostedNotificationCallback)function withContext:(void*)context;
 @end
 
+@interface NSObject (WebAccessibilityObjectWrapperPrivate)
+- (CGPathRef)_accessibilityPath;
+@end
+
 static JSStringRef concatenateAttributeAndValue(NSString* attribute, NSString* value)
 {
     Vector<UniChar> buffer([attribute length]);
@@ -341,6 +345,42 @@ void AccessibilityUIElement::elementsForRange(unsigned location, unsigned length
     }
 }
 
+static void _CGPathEnumerationIteration(void *info, const CGPathElement *element)
+{
+    NSMutableString *result = (NSMutableString *)info;
+    switch (element->type) {
+    case kCGPathElementMoveToPoint:
+        [result appendString:@"\tMove to point\n"];
+        break;
+        
+    case kCGPathElementAddLineToPoint:
+        [result appendString:@"\tLine to\n"];
+        break;
+        
+    case kCGPathElementAddQuadCurveToPoint:
+        [result appendString:@"\tQuad curve to\n"];
+        break;
+        
+    case kCGPathElementAddCurveToPoint:
+        [result appendString:@"\tCurve to\n"];
+        break;
+        
+    case kCGPathElementCloseSubpath:
+        [result appendString:@"\tClose\n"];
+        break;
+    }
+}
+
+JSStringRef AccessibilityUIElement::pathDescription() const
+{
+    NSMutableString *result = [NSMutableString stringWithString:@"\nStart Path\n"];
+    CGPathRef pathRef = [m_element _accessibilityPath];
+    
+    CGPathApply(pathRef, result, _CGPathEnumerationIteration);
+    
+    return [result createJSStringRef];
+}
+
 #pragma mark Unused
 
 void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elementVector)