8221871: javadoc should not set role=region on <section> elements

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2019-04-05 15:57:33 -07:00
parent 8263b618ba
commit 0abdc381b7
5 changed files with 44 additions and 48 deletions

View File

@ -722,9 +722,7 @@ public class HtmlTree extends Content {
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION() {
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
htmltree.setRole(Role.REGION);
return htmltree;
return new HtmlTree(HtmlTag.SECTION);
}
/**
@ -734,9 +732,7 @@ public class HtmlTree extends Content {
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
htmltree.setRole(Role.REGION);
return htmltree;
return new HtmlTree(HtmlTag.SECTION, nullCheck(body));
}
/**

View File

@ -109,7 +109,7 @@ public class TestHtmlTag extends JavadocTester {
checkOutput("pkg3/package-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<section role=\"region\"><a id=\"package.description\">\n"
+ "<section><a id=\"package.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\"><p>This is the first line. Note the newlines before the &lt;p&gt; is relevant.</div>\n"

View File

@ -24,7 +24,7 @@
/*
* @test
* @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743 8169819 8183037 8182765 8196202
* 8202624 8210047 8184205
* 8202624 8210047 8184205 8221871
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../../lib
@ -100,7 +100,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\"><a id=\"package.description\">\n"
"<section><a id=\"package.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">Test package.</div>",
@ -129,13 +129,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -173,9 +173,9 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Contents\">Contents</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"pkg\">pkg.*</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -212,7 +212,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Package\">Package&nbsp;pkg</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -232,13 +232,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -280,11 +280,11 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2>Overview</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2>Package</h2>\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2>Class or Interface</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -303,46 +303,46 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"nested.class.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Nested Class Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"field.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Field Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Summary</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"field.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Field Detail</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Detail</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
+ "<!-- -->\n"
@ -365,7 +365,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"enum.constant.summary\">\n"
+ "<!-- -->\n"
@ -373,7 +373,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<h2>Enum Constant Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
@ -381,13 +381,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<h2>Method Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"enum.constant.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Enum Constant Detail</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
+ "<!-- -->\n"
@ -410,7 +410,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
@ -418,7 +418,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<h2>Method Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">\n",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
+ "<!-- -->\n"
@ -441,13 +441,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
@ -470,13 +470,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
@ -499,21 +499,21 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.required.element.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Required Element Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.optional.element.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Optional Element Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section role=\"region\">\n"
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.element.detail\">\n"
+ "<!-- -->\n"
@ -537,7 +537,7 @@ public class TestHtmlVersion extends JavadocTester {
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<div class=\"useSummary\">\n<table>",
"<section role=\"region\"><a id=\"pkg\">\n"
"<section><a id=\"pkg\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Uses of <a href=\"../RegClass.html\" title=\"class in pkg1\">RegClass</a> in <a href=\"../../pkg/package-summary.html\">pkg</a></h2>\n"
@ -568,7 +568,7 @@ public class TestHtmlVersion extends JavadocTester {
"<a name=\"navbar.top.firstrow\">\n"
+ "<!-- -->\n"
+ "</a>",
"<section role=\"region\">\n"
"<section>\n"
+ "<h2 title=\"Package pkg Description\">Package pkg Description</h2>\n",
"<div class=\"typeSummary\">\n<table summary=\"Interface Summary table, listing interfaces, and an explanation\">",
"<div class=\"typeSummary\">\n<table summary=\"Class Summary table, listing classes, and an explanation\">",

View File

@ -478,7 +478,7 @@ public class TestModules extends JavadocTester {
void checkHtml5Description(boolean found) {
checkOutput("moduleA/module-summary.html", found,
"<section role=\"region\">\n"
"<section>\n"
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ " This API element is subject to removal in a future version.</span>\n"
+ "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
@ -490,7 +490,7 @@ public class TestModules extends JavadocTester {
+ "<div class=\"block\">This is a test description for the moduleA module with a Search "
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
checkOutput("moduleB/module-summary.html", found,
"<section role=\"region\">\n"
"<section>\n"
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
+ "<a id=\"module.description\">\n"
+ "<!-- -->\n"

View File

@ -151,7 +151,7 @@ public class TestUseOption extends JavadocTester {
);
checkOutput("class-use/UsedInC.html", true,
"<li class=\"blockList\">\n"
+ "<section role=\"region\"><a id=\"unnamed.package\">"
+ "<section><a id=\"unnamed.package\">"
);
checkOutput("package-use.html", true,
"<th class=\"colFirst\" scope=\"row\">"