Title: [107589] trunk
Revision
107589
Author
[email protected]
Date
2012-02-13 11:30:52 -0800 (Mon, 13 Feb 2012)

Log Message

AX: <mark> element should be exposed through attributes
https://bugs.webkit.org/show_bug.cgi?id=75727

Reviewed by Beth Dakin.

Source/WebCore: 

Exposes an attribute indicating that an element has highlighting through attributedStringForRange.
Also allows the search mechanism to find elements with this style.

Test: platform/mac/accessibility/attributed-string-includes-highlighting.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatch):
(WebCore::AccessibilityObject::hasHighlighting):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(createAccessibilitySearchKeyMap):
(AXAttributeStringSetStyle):

LayoutTests: 

* platform/mac/accessibility/attributed-string-includes-highlighting-expected.txt: Added.
* platform/mac/accessibility/attributed-string-includes-highlighting.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107588 => 107589)


--- trunk/LayoutTests/ChangeLog	2012-02-13 19:23:52 UTC (rev 107588)
+++ trunk/LayoutTests/ChangeLog	2012-02-13 19:30:52 UTC (rev 107589)
@@ -1,5 +1,15 @@
 2012-02-13  Chris Fleizach  <[email protected]>
 
+        AX: <mark> element should be exposed through attributes
+        https://bugs.webkit.org/show_bug.cgi?id=75727
+
+        Reviewed by Beth Dakin.
+
+        * platform/mac/accessibility/attributed-string-includes-highlighting-expected.txt: Added.
+        * platform/mac/accessibility/attributed-string-includes-highlighting.html: Added.
+
+2012-02-13  Chris Fleizach  <[email protected]>
+
         AX: the web area should report that focus can be set to itself
         https://bugs.webkit.org/show_bug.cgi?id=78272
 

Added: trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting-expected.txt (0 => 107589)


--- trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting-expected.txt	2012-02-13 19:30:52 UTC (rev 107589)
@@ -0,0 +1,15 @@
+item0
+item 1
+item2
+This verifies that using the mark tag will add the appropriate attribute to the attributed string and that we can find elements with highlighting using searching.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS item1.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange) is true
+PASS item2.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange) is false
+PASS resultElement.isEqual(item1.childAtIndex(0)) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting.html (0 => 107589)


--- trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/attributed-string-includes-highlighting.html	2012-02-13 19:30:52 UTC (rev 107589)
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<script src=""
+<body id="body" tabindex="0">
+
+<div tabindex="0" id="item0">item0</div>
+<div tabindex="0" id="item1"><mark>item 1</mark></div>
+<div tabindex="0" id="item2">item2</div>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This verifies that using the mark tag will add the appropriate attribute to the attributed string and that we can find elements with highlighting using searching.");
+
+    if (window.accessibilityController) {
+        document.getElementById("item1").focus();
+        var item1 = accessibilityController.focusedElement;
+        var markerRange = item1.textMarkerRangeForElement(item1);
+        shouldBeTrue("item1.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange)");
+
+        document.getElementById("item2").focus();
+        var item2 = accessibilityController.focusedElement;
+        markerRange = item2.textMarkerRangeForElement(item2);
+        shouldBeFalse("item2.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange)");
+
+        // Search for a highlighted element from the top of the webpage.
+        document.getElementById("body").focus();
+        var body = accessibilityController.focusedElement;
+        var resultElement = body.uiElementForSearchPredicate("", true, "AXHighlightedSearchKey", "");
+        shouldBeTrue("resultElement.isEqual(item1.childAtIndex(0))");
+    }
+
+</script>
+
+<script src=""
+
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (107588 => 107589)


--- trunk/Source/WebCore/ChangeLog	2012-02-13 19:23:52 UTC (rev 107588)
+++ trunk/Source/WebCore/ChangeLog	2012-02-13 19:30:52 UTC (rev 107589)
@@ -1,5 +1,25 @@
 2012-02-13  Chris Fleizach  <[email protected]>
 
+        AX: <mark> element should be exposed through attributes
+        https://bugs.webkit.org/show_bug.cgi?id=75727
+
+        Reviewed by Beth Dakin.
+
+        Exposes an attribute indicating that an element has highlighting through attributedStringForRange.
+        Also allows the search mechanism to find elements with this style.
+
+        Test: platform/mac/accessibility/attributed-string-includes-highlighting.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatch):
+        (WebCore::AccessibilityObject::hasHighlighting):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (createAccessibilitySearchKeyMap):
+        (AXAttributeStringSetStyle):
+
+2012-02-13  Chris Fleizach  <[email protected]>
+
         AX: the web area should report that focus can be set to itself
         https://bugs.webkit.org/show_bug.cgi?id=78272
 
@@ -2792,7 +2812,6 @@
         Always recompute the non-fast-scrollable region whenever a frame view's layout is updated,
         not just the main frame.
 
->>>>>>> .r107433
 2012-02-09  Chris Marrin  <[email protected]>
 
         Implement hardware animation of CSS filters

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (107588 => 107589)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-02-13 19:23:52 UTC (rev 107588)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-02-13 19:30:52 UTC (rev 107589)
@@ -163,7 +163,10 @@
         
     case HeadingSearchKey:
         return axObject->isHeading();
-        
+    
+    case HighlightedSearchKey:
+        return axObject->hasHighlighting();
+            
     case ItalicFontSearchKey:
         return axObject->hasItalicFont();
         
@@ -1414,6 +1417,16 @@
     return role;
 }
 
+bool AccessibilityObject::hasHighlighting() const
+{
+    for (Node* node = this->node(); node; node = node->parentNode()) {
+        if (node->hasTagName(markTag))
+            return true;
+    }
+    
+    return false;
+}
+
 const AtomicString& AccessibilityObject::placeholderValue() const
 {
     const AtomicString& placeholder = getAttribute(placeholderAttr);

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (107588 => 107589)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2012-02-13 19:23:52 UTC (rev 107588)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2012-02-13 19:30:52 UTC (rev 107589)
@@ -244,6 +244,7 @@
     HeadingLevel6SearchKey,
     HeadingSameLevelSearchKey,
     HeadingSearchKey,
+    HighlightedSearchKey,
     ItalicFontSearchKey,
     LandmarkSearchKey,
     LinkSearchKey,
@@ -409,6 +410,7 @@
     virtual bool hasSameStyle(RenderObject*) const { return false; }
     bool hasStaticText() const { return roleValue() == StaticTextRole; }
     virtual bool hasUnderline() const { return false; }
+    bool hasHighlighting() const;
 
     virtual bool canSetFocusAttribute() const { return false; }
     virtual bool canSetTextRangeAttributes() const { return false; }

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (107588 => 107589)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-02-13 19:23:52 UTC (rev 107588)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2012-02-13 19:30:52 UTC (rev 107589)
@@ -259,6 +259,10 @@
 #define NSAccessibilityHeadingSearchKey @"AXHeadingSearchKey"
 #endif
 
+#ifndef NSAccessibilityHighlightedSearchKey
+#define NSAccessibilityHighlightedSearchKey @"AXHighlightedSearchKey"
+#endif
+
 #ifndef NSAccessibilityItalicFontSearchKey
 #define NSAccessibilityItalicFontSearchKey @"AXItalicFontSearchKey"
 #endif
@@ -467,6 +471,7 @@
         { NSAccessibilityHeadingLevel6SearchKey, HeadingLevel6SearchKey },
         { NSAccessibilityHeadingSameLevelSearchKey, HeadingSameLevelSearchKey },
         { NSAccessibilityHeadingSearchKey, HeadingSearchKey },
+        { NSAccessibilityHighlightedSearchKey, HighlightedSearchKey },
         { NSAccessibilityItalicFontSearchKey, ItalicFontSearchKey },
         { NSAccessibilityLandmarkSearchKey, LandmarkSearchKey },
         { NSAccessibilityLinkSearchKey, LinkSearchKey },
@@ -676,6 +681,12 @@
             AXAttributeStringSetColor(attrString, NSAccessibilityStrikethroughColorTextAttribute, nsColor(linethrough), range);
         }
     }
+    
+    // Indicate background highlighting.
+    for (Node* node = renderer->node(); node; node = node->parentNode()) {
+        if (node->hasTagName(markTag))
+            AXAttributeStringSetNumber(attrString, @"AXHighlight", [NSNumber numberWithBool:YES], range);
+    }
 }
 
 static void AXAttributeStringSetBlockquoteLevel(NSMutableAttributedString* attrString, RenderObject* renderer, NSRange range)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to