Bug 22596: Some elements don't report AXBlockQuoteLevel
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2008 21:29:18 +0000 (21:29 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2008 21:29:18 +0000 (21:29 +0000)
Make sure all AX objects return a block quote level

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@38915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/document-links-expected.txt
LayoutTests/accessibility/image-map1-expected.txt
LayoutTests/accessibility/image-map2-expected.txt
WebCore/ChangeLog
WebCore/page/mac/AccessibilityObjectWrapper.mm

index 13cbcd1..46601ff 100644 (file)
@@ -1,3 +1,13 @@
+2008-12-02  Chris Fleizach  <cfleizach@apple.com>
+
+        Update tests for Bug 22596: Some elements don't report AXBlockQuoteLevel
+
+        Reviewed by John Sullivan.
+
+        * accessibility/document-links-expected.txt:
+        * accessibility/image-map1-expected.txt:
+        * accessibility/image-map2-expected.txt:
+
 2008-12-02  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Reviewed by Eric Seidel.
index f956217..8c93e47 100644 (file)
@@ -19,7 +19,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink: 'Link1'>
 
 ------------
@@ -42,7 +42,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink: 'Link2'>
 
 ------------
index f59d156..37439e7 100644 (file)
@@ -42,7 +42,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink: 'Link1'>
 
 ------------
@@ -65,7 +65,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink: 'Link2'>
 
 ------------
@@ -88,7 +88,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink: 'Link3'>
 
 ------------
index 4d6bd1f..f6d6aec 100644 (file)
@@ -42,7 +42,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink>
 
 ------------
@@ -65,7 +65,7 @@ AXEndTextMarker: (null)
 AXVisited: 0
 AXLinkedUIElements: (null)
 AXSelected: 0
-AXBlockQuoteLevel: (null)
+AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXLink>
 
 ------------
index 7571768..2dd3d2d 100644 (file)
@@ -1,3 +1,16 @@
+2008-12-02  Chris Fleizach  <cfleizach@apple.com>
+
+        Bug 22596: Some elements don't report AXBlockQuoteLevel
+        https://bugs.webkit.org/show_bug.cgi?id=22596
+        Reviewed by John Sullivan.
+
+        * page/mac/AccessibilityObjectWrapper.mm:
+        (blockquoteLevel):
+        (AXAttributeStringSetBlockquoteLevel):
+        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2008-12-02  Dean McNamee  <deanm@chromium.org>
 
         Reviewed by Eric Seidel.
index 1fd7665..961d674 100644 (file)
@@ -101,6 +101,11 @@ using namespace std;
 #define NSAccessibilityDefinitionListSubrole @"AXDefinitionList"
 #endif
 
+// Miscellaneous
+#ifndef NSAccessibilityBlockQuoteLevelAttribute
+#define NSAccessibilityBlockQuoteLevelAttribute @"AXBlockQuoteLevel"
+#endif
+
 #ifdef BUILDING_ON_TIGER
 typedef unsigned NSUInteger;
 #endif
@@ -359,6 +364,9 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren
 
 static int blockquoteLevel(RenderObject* renderer)
 {
+    if (!renderer)
+        return 0;
+    
     int result = 0;
     for (Node* node = renderer->element(); node; node = node->parent()) {
         if (node->hasTagName(blockquoteTag))
@@ -373,9 +381,9 @@ static void AXAttributeStringSetBlockquoteLevel(NSMutableAttributedString* attrS
     int quoteLevel = blockquoteLevel(renderer);
     
     if (quoteLevel)
-        [attrString addAttribute:@"AXBlockQuoteLevel" value:[NSNumber numberWithInt:quoteLevel] range:range];
+        [attrString addAttribute:NSAccessibilityBlockQuoteLevelAttribute value:[NSNumber numberWithInt:quoteLevel] range:range];
     else
-        [attrString removeAttribute:@"AXBlockQuoteLevel" range:range];
+        [attrString removeAttribute:NSAccessibilityBlockQuoteLevelAttribute range:range];
 }
 
 static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, Node* node, int offset, NSRange range)
@@ -626,7 +634,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
                       @"AXVisited",
                       NSAccessibilityLinkedUIElementsAttribute,
                       NSAccessibilitySelectedAttribute,
-                      @"AXBlockQuoteLevel",
+                      NSAccessibilityBlockQuoteLevelAttribute,
                       NSAccessibilityTopLevelUIElementAttribute,
                       nil];
     }
@@ -1344,8 +1352,15 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         if ([attributeName isEqualToString: @"AXEndTextMarker"])
             return textMarkerForVisiblePosition(endOfDocument(renderer->document()));
 
-        if ([attributeName isEqualToString: @"AXBlockQuoteLevel"])
+        if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute])
             return [NSNumber numberWithInt:blockquoteLevel(renderer)];
+    } else {
+        if ([attributeName isEqualToString:NSAccessibilityBlockQuoteLevelAttribute]) {
+            AccessibilityObject* parent = m_object->parentObjectUnignored();
+            if (!parent)
+                return [NSNumber numberWithInt:0];
+            return [parent->wrapper() accessibilityAttributeValue:NSAccessibilityBlockQuoteLevelAttribute];        
+        }
     }
     
     if ([attributeName isEqualToString: NSAccessibilityLinkedUIElementsAttribute]) {