Regression: AX: <table><caption> no longer exposed as AXTitle.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 23:29:25 +0000 (23:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 23:29:25 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121977

Patch by Samuel White <samuel_white@apple.com> on 2013-10-03
Reviewed by Darin Adler.

Source/WebCore:

Some cleanup of accessibilityText. Notably, subclasses were unnecessarily redeclaring this method as both private and
protected. Added OVERRIDE keyword to these subclasses as needed. Moved titleElementText to virtual so we can do subclass
overrides in cases like this bug. That is, AccessibilityTable can leverage the existing machinery for alternativeText,
visibleText, and helpText, but we do some custom work ONLY in titleElementText.

Test: accessibility/table-title.html

* accessibility/AccessibilityImageMapLink.h:
* accessibility/AccessibilityMediaControls.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::titleElementText):
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::titleElementText):
* accessibility/AccessibilityTable.h:

LayoutTests:

Added test to verify that table elements correctly derive their AXTitle from their associated caption element.

* accessibility/table-title-expected.txt: Added.
* accessibility/table-title.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/table-title-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/table-title.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityImageMapLink.h
Source/WebCore/accessibility/AccessibilityMediaControls.h
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.h
Source/WebCore/accessibility/AccessibilityTable.cpp
Source/WebCore/accessibility/AccessibilityTable.h

index 7234f37..6b21d7a 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-03  Samuel White  <samuel_white@apple.com>
+
+        Regression: AX: <table><caption> no longer exposed as AXTitle.
+        https://bugs.webkit.org/show_bug.cgi?id=121977
+
+        Reviewed by Darin Adler.
+
+        Added test to verify that table elements correctly derive their AXTitle from their associated caption element.
+
+        * accessibility/table-title-expected.txt: Added.
+        * accessibility/table-title.html: Added.
+
 2013-10-03  Nadav Rotem  <nrotem@apple.com>
 
         Add a testcase for a bug that I had during the development. This code uses the asm.js style.
diff --git a/LayoutTests/accessibility/table-title-expected.txt b/LayoutTests/accessibility/table-title-expected.txt
new file mode 100644 (file)
index 0000000..fc9ef27
--- /dev/null
@@ -0,0 +1,14 @@
+High Scores
+Score  Name
+9999   Bill
+9998   Ted
+This tests that table AXTitle is exposed correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS table.title is 'AXTitle: High Scores'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/table-title.html b/LayoutTests/accessibility/table-title.html
new file mode 100644 (file)
index 0000000..425c9b6
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<title>Table Title</title>
+</head>
+<body>
+
+<table border="1" id="table">
+<caption>High Scores</caption>
+<tr>
+<th>Score</th>
+<th>Name</th>
+</tr>
+<tr>
+<td>9999</td>
+<td>Bill</td>
+</tr>
+<tr>
+<td>9998</td>
+<td>Ted</td>
+</tr>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that table AXTitle is exposed correctly.");
+    
+    if (window.accessibilityController) {
+        var table = accessibilityController.accessibleElementById("table");
+        
+        shouldBe("table.title", "'AXTitle: High Scores'");
+    }
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index fc6043a..c043df7 100644 (file)
@@ -1,3 +1,26 @@
+2013-10-03  Samuel White  <samuel_white@apple.com>
+
+        Regression: AX: <table><caption> no longer exposed as AXTitle.
+        https://bugs.webkit.org/show_bug.cgi?id=121977
+
+        Reviewed by Darin Adler.
+
+        Some cleanup of accessibilityText. Notably, subclasses were unnecessarily redeclaring this method as both private and
+        protected. Added OVERRIDE keyword to these subclasses as needed. Moved titleElementText to virtual so we can do subclass
+        overrides in cases like this bug. That is, AccessibilityTable can leverage the existing machinery for alternativeText,
+        visibleText, and helpText, but we do some custom work ONLY in titleElementText.
+
+        Test: accessibility/table-title.html
+
+        * accessibility/AccessibilityImageMapLink.h:
+        * accessibility/AccessibilityMediaControls.h:
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::titleElementText):
+        * accessibility/AccessibilityNodeObject.h:
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::titleElementText):
+        * accessibility/AccessibilityTable.h:
+
 2013-10-03  Anders Carlsson  <andersca@apple.com>
 
         Ignore deprecation warnings
index 4600e3c..af17eed 100644 (file)
@@ -76,7 +76,7 @@ private:
 
     virtual Path elementPath() const;
     RenderElement* imageMapLinkRenderer() const;
-    virtual void accessibilityText(Vector<AccessibilityText>&);
+    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
     virtual bool isImageMapLink() const { return true; }
     virtual bool supportsPath() const { return true; }
 };
index 337ec5c..798afe6 100644 (file)
@@ -53,8 +53,10 @@ protected:
     explicit AccessibilityMediaControl(RenderObject*);
     MediaControlElementType controlType() const;
     String controlTypeName() const;
-    virtual void accessibilityText(Vector<AccessibilityText>&);
     virtual bool computeAccessibilityIsIgnored() const;
+
+private:
+    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
 };
 
 
index 7469f22..7d96faa 100644 (file)
@@ -1181,7 +1181,7 @@ AccessibilityObject* AccessibilityNodeObject::menuButtonForMenu() const
     return 0;
 }
 
-void AccessibilityNodeObject::titleElementText(Vector<AccessibilityText>& textOrder)
+void AccessibilityNodeObject::titleElementText(Vector<AccessibilityText>& textOrder) const
 {
     Node* node = this->node();
     if (!node)
index 3ca54d4..2be27e6 100644 (file)
@@ -192,8 +192,8 @@ protected:
 private:
     Node* m_node;
 
-    virtual void accessibilityText(Vector<AccessibilityText>&);
-    void titleElementText(Vector<AccessibilityText>&);
+    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
+    virtual void titleElementText(Vector<AccessibilityText>&) const;
     void alternativeText(Vector<AccessibilityText>&) const;
     void visibleText(Vector<AccessibilityText>&) const;
     void helpText(Vector<AccessibilityText>&) const;
index 8528658..20bdca7 100644 (file)
@@ -550,7 +550,14 @@ bool AccessibilityTable::computeAccessibilityIsIgnored() const
         
     return false;
 }
-    
+
+void AccessibilityTable::titleElementText(Vector<AccessibilityText>& textOrder) const
+{
+    String title = this->title();
+    if (!title.isEmpty())
+        textOrder.append(AccessibilityText(title, LabelByElementText));
+}
+
 String AccessibilityTable::title() const
 {
     if (!isAccessibilityTable())
index f1945e8..e3ce3b0 100644 (file)
@@ -92,6 +92,9 @@ protected:
 
     virtual bool isTableExposableThroughAccessibility() const;
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
+
+private:
+    virtual void titleElementText(Vector<AccessibilityText>&) const OVERRIDE;
 };
     
 inline AccessibilityTable* toAccessibilityTable(AccessibilityObject* object)