8228554: Accessibility errors in jdwp-protocol.html

Reviewed-by: dholmes, sspitsyn
This commit is contained in:
Alex Menkov 2019-08-28 13:34:15 -07:00
parent 7b6b6702e3
commit 3ac8462ead
10 changed files with 76 additions and 58 deletions

View File

@ -40,20 +40,21 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
void document(PrintWriter writer) {
writer.println("<dt>" + name() + " Data");
writer.println("<dd>");
if (components.isEmpty()) {
writer.println("<dd>(None)");
writer.println("(None)");
} else {
writer.println("<dd><table><tr>");
for (int i = maxStructIndent; i > 0; --i) {
writer.print("<th style=\"width: 4%\">");
}
writer.println("<th style=\"width: 15%\"><th style=\"width: 65%\">");
writer.println("");
writer.println("<table><tr>");
writer.println("<th class=\"bold\" style=\"width: 20%\" scope=\"col\">Type");
writer.println("<th class=\"bold\" style=\"width: 15%\" scope=\"col\">Name");
writer.println("<th class=\"bold\" style=\"width: 65%\" scope=\"col\">Description");
writer.println("</tr>");
for (Node node : components) {
node.document(writer);
}
writer.println("</table>");
}
writer.println("</dd>");
}
void genJavaClassBodyComponents(PrintWriter writer, int depth) {

View File

@ -40,11 +40,11 @@ abstract class AbstractTypeNode extends AbstractNamedNode
abstract String javaRead();
void document(PrintWriter writer) {
docRowStart(writer);
writer.println("<td colspan=" +
(maxStructIndent - structIndent) + ">");
writer.println(docType() + "<td><i>" + name() +
"</i><td>" + comment() + "&nbsp;");
writer.println("<tr>");
writer.println("<td>" + indentElement(structIndent, docType()));
writer.println("<th scope=\"row\"><i>" + name() + "</i>");
writer.println("<td>" + comment() + "&nbsp;");
writer.println("</tr>");
}
String javaType() {

View File

@ -46,13 +46,15 @@ class AltNode extends AbstractGroupNode implements TypeNode {
}
void document(PrintWriter writer) {
docRowStart(writer);
writer.println("<td colspan=" +
(maxStructIndent - structIndent + 1) + ">");
writer.println("Case " + nameNode.name + " - if <i>" +
((SelectNode)parent).typeNode.name +
"</i> is " + nameNode.value() + ":");
writer.println("<tr>");
writer.println("<th colspan=\"2\" scope=\"row\">"
+ indentElement(structIndent,
"Case " + nameNode.name
+ " - if <i>" + ((SelectNode)parent).typeNode.name + "</i>" +
" is " + nameNode.value() + ":"));
writer.println("<td>" + comment() + "&nbsp;");
writer.println("</tr>");
++structIndent;
super.document(writer);
--structIndent;

View File

@ -54,10 +54,12 @@ class ConstantNode extends AbstractCommandNode {
}
void document(PrintWriter writer) {
//Add anchor to each constant with format <constant table name>_<constant name>
writer.println("<tr><td>" + name + "<td>" + nameNode.value() +
"<td>" + comment() + " &nbsp;");
writer.println("<tr>"
+ "<th scope=\"row\">" + name
+ "<td class=\"centered\">" + nameNode.value()
+ "<td>" + comment() + "&nbsp;"
+ "</tr>");
}
public String getName(){

View File

@ -54,14 +54,15 @@ class ConstantSetNode extends AbstractNamedNode {
}
void document(PrintWriter writer) {
writer.println("<h2 id=\"" + context.whereC + "\">" + name +
" Constants</h2>");
writer.println("<h2 id=\"" + context.whereC + "\">" + name + " Constants</h2>");
writer.println(comment());
writer.println("<table><tr>");
writer.println("<th style=\"width: 20%\"><th style=\"width: 5%\"><th style=\"width: 65%\">");
ConstantNode n;
writer.println("<th class=\"bold\" style=\"width: 30%\" scope=\"col\">Name");
writer.println("<th class=\"centered bold\" style=\"width: 5%\" scope=\"col\">Value");
writer.println("<th class=\"bold\" style=\"width: 65%\" scope=\"col\">Description");
writer.println("</tr>");
for (Node node : components) {
n = (ConstantNode)node;
ConstantNode n = (ConstantNode)node;
writer.println("<span id=\"" + name + "_" + n.name + "\"></span>");
n.document(writer);
}

View File

@ -55,9 +55,10 @@ class ErrorNode extends AbstractCommandNode {
if (com == null || com.length() == 0) {
com = ConstantSetNode.getConstant("Error_" + name);
}
writer.println("<tr><td>" + "<a href=\"#" + NAME_OF_ERROR_TABLE + "_" + name + "\">"
+ name + "</a></td>" +
"<td>" + com + "&nbsp;</td></tr>");
writer.println("<tr>"
+ "<th scope=\"row\">" + "<a href=\"#" + NAME_OF_ERROR_TABLE + "_" + name + "\">" + name + "</a>"
+ "<td>" + com + "&nbsp;"
+ "</tr>");
}
void genJavaComment(PrintWriter writer, int depth) {}

View File

@ -38,17 +38,21 @@ class ErrorSetNode extends AbstractSimpleNode {
}
void document(PrintWriter writer) {
writer.println("<dt>" + "Error Data");
writer.println("<dt>Error Data</dt>");
writer.print("<dd>");
if (components.isEmpty()) {
writer.println("<dd>(None)");
writer.println("(None)");
} else {
writer.println("<dd><table>");
for (Node node : components) {
node.document(writer);
}
writer.println("</table>");
writer.println("<table><tr>");
writer.println("<th class=\"bold\" style=\"width: 20%\" scope=\"col\">Value");
writer.println("<th class=\"bold\" scope=\"col\">Description");
writer.println("</tr>");
for (Node node : components) {
node.document(writer);
}
writer.println("</table>");
}
writer.print("</dd>");
}
void genJavaComment(PrintWriter writer, int depth) {}

View File

@ -88,11 +88,10 @@ abstract class Node {
void documentIndex(PrintWriter writer) {
}
void docRowStart(PrintWriter writer) {
writer.println("<tr>");
if (structIndent > 0) {
writer.println("<td colspan=" + structIndent + ">");
}
String indentElement(int depth, String content) {
return depth > 0
? "<div class=\"indent" + depth + "\">" + content + "</div>"
: content;
}
String comment() {

View File

@ -44,15 +44,17 @@ class RepeatNode extends AbstractTypeNode {
}
void document(PrintWriter writer) {
docRowStart(writer);
writer.println("<td colspan=" +
(maxStructIndent - structIndent) + ">");
writer.println("int<td><i>" + name + "</i><td>" +
comment() + "&nbsp;");
docRowStart(writer);
writer.println("<td colspan=" +
(maxStructIndent - structIndent + 2) + ">");
writer.println("Repeated <i>" + name + "</i> times:");
writer.println("<tr>");
writer.println("<td>" + indentElement(structIndent, "int"));
writer.println("<th scope=\"row\"><i>" + name() + "</i>");
writer.println("<td>" + comment() + "&nbsp;");
writer.println("</tr>");
writer.println("<tr>");
writer.println("<th colspan=\"3\" scope=\"rowgroup\">"
+ indentElement(structIndent, "Repeated <i>" + name() + "</i> times:"));
writer.println("</tr>");
++structIndent;
member.document(writer);
--structIndent;

View File

@ -46,15 +46,21 @@ class RootNode extends AbstractNamedNode {
writer.println("<meta charset=\"utf-8\"/>");
writer.println("<title>" + comment() + "</title>");
writer.println("<style>");
writer.println("body {background-color:white;}");
writer.println("table {border: 1px solid grey; border-spacing:0px; border-collapse: separate; width: 90%;}");
writer.println("td, th {padding: 3px; border: 1px solid black;}");
writer.println("body { background-color:white; }");
writer.println("table { border: 1px solid grey; border-spacing:0px; border-collapse: separate; width: 90%; }");
writer.println("td, th { padding: 3px; border: 1px solid black; font-weight: normal; text-align: left; }");
writer.println(".bold { font-weight: bold; }");
writer.println(".centered { text-align: center; }");
for (int i = 0; i < maxStructIndent; i++) {
// each level is 40px
writer.println(".indent" + i + " { padding-left: " + (i * 40) + "px; }");
}
writer.println("</style>");
writer.println("</head>");
writer.println("<body>");
writer.println("<div class=\"centered\" role=\"banner\">");
writer.println("<header>");
writer.println("<h1 id=\"Protocol_Details\">Java Debug Wire Protocol Details</h1>");
writer.println("</div>");
writer.println("</header>");
writer.println("<nav>");
writer.println("<ul>");
for (Node node : components) {
@ -62,11 +68,11 @@ class RootNode extends AbstractNamedNode {
}
writer.println("</ul>");
writer.println("</nav>");
writer.println("<div role=\"main\">");
writer.println("<main>");
for (Node node : components) {
node.document(writer);
}
writer.println("</div>");
writer.println("</main>");
writer.println("</body></html>");
}