Changeset 15967 in webkit
- Timestamp:
- Aug 22, 2006, 10:28:07 AM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r15966 r15967 1 2006-08-22 David Harrison <harrison@apple.com> 2 3 Reviewed by John. 4 5 <rdar://problem/4523606> Represent heading elements in AXAttributedStringForTextMarkerRange 6 7 * bridge/mac/WebCoreAXObject.mm: 8 (headingLevel): 9 (-[WebCoreAXObject headingLevel]): 10 (-[WebCoreAXObject isHeading]): 11 New. Heading level is per the tag (h1 == 1, h2 == 2, etc.) 12 13 (-[WebCoreAXObject role]): 14 (-[WebCoreAXObject roleDescription]): 15 Add role and roleDescription for headings. 16 17 (-[WebCoreAXObject value]): 18 Value is the headingLevel. 19 20 (AXAttributeStringSetHeadingLevel): 21 (AXAttributedStringAppendText): 22 Put text's heading level (if applicable) in the attributes. 23 1 24 2006-08-22 David Harrison <harrison@apple.com> 2 25 -
trunk/WebCore/bridge/mac/WebCoreAXObject.mm
r15965 r15967 303 303 } 304 304 305 static int headingLevel(RenderObject* renderer) 306 { 307 if (!renderer->isBlockFlow()) 308 return 0; 309 310 Node* node = renderer->element(); 311 if (!node) 312 return 0; 313 314 if (node->hasTagName(h1Tag)) 315 return 1; 316 317 if (node->hasTagName(h2Tag)) 318 return 2; 319 320 if (node->hasTagName(h3Tag)) 321 return 3; 322 323 if (node->hasTagName(h4Tag)) 324 return 4; 325 326 if (node->hasTagName(h5Tag)) 327 return 5; 328 329 if (node->hasTagName(h6Tag)) 330 return 6; 331 332 return 0; 333 } 334 335 -(int)headingLevel 336 { 337 return headingLevel(m_renderer); 338 } 339 340 -(BOOL)isHeading 341 { 342 return [self headingLevel] != 0; 343 } 344 305 345 -(NSString*)role 306 346 { … … 344 384 return NSAccessibilityPopUpButtonRole; 345 385 386 if ([self isHeading]) 387 return @"AXHeading"; 388 346 389 if (m_renderer->isBlockFlow()) 347 390 return NSAccessibilityGroupRole; … … 409 452 if ([role isEqualToString:@"AXImageMap"]) 410 453 return UI_STRING("image map", "accessibility role description for image map"); 454 455 if ([role isEqualToString:@"AXHeading"]) 456 return UI_STRING("heading", "accessibility role description for headings"); 411 457 412 458 return NSAccessibilityRoleDescription(NSAccessibilityUnknownRole, nil); … … 495 541 if ([self isAttachment]) 496 542 return [[self attachmentView] accessibilityAttributeValue:NSAccessibilityValueAttribute]; 543 544 if ([self isHeading]) 545 return [NSNumber numberWithInt:[self headingLevel]]; 497 546 498 547 if (m_renderer->element() && m_renderer->element()->hasTagName(inputTag)) { … … 1283 1332 } 1284 1333 1334 static void AXAttributeStringSetHeadingLevel(NSMutableAttributedString* attrString, RenderObject* renderer, NSRange range) 1335 { 1336 int parentHeadingLevel = headingLevel(renderer->parent()); 1337 1338 if (parentHeadingLevel) 1339 [attrString addAttribute:@"AXHeadingLevel" value:[NSNumber numberWithInt:parentHeadingLevel] range:range]; 1340 else 1341 [attrString removeAttribute:@"AXHeadingLevel" range:range]; 1342 } 1343 1285 1344 static void AXAttributeStringSetElement(NSMutableAttributedString* attrString, NSString* attribute, id element, NSRange range) 1286 1345 { … … 1361 1420 // set new attributes 1362 1421 AXAttributeStringSetStyle(attrString, node->renderer(), attrStringRange); 1422 AXAttributeStringSetHeadingLevel(attrString, node->renderer(), attrStringRange); 1363 1423 AXAttributeStringSetElement(attrString, NSAccessibilityLinkTextAttribute, AXLinkElementForNode(node), attrStringRange); 1364 1424
Note:
See TracChangeset
for help on using the changeset viewer.