changeset 4086:0e63023ff978

8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation. 8178078: jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java failed due to some subtests failed 8178079: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed Reviewed-by: jjg, ksrini
author bpatel
date Tue, 04 Apr 2017 23:04:39 -0700
parents 838ccb5763e1
children 3a05346a30cd
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java test/jdk/javadoc/doclet/testModules/TestModules.java test/jdk/javadoc/doclet/testSearch/TestSearch.java test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java
diffstat 8 files changed, 58 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Apr 04 23:04:39 2017 -0700
@@ -106,7 +106,7 @@
         String desc = ch.getText(itt.getDescription());
 
         String anchorName = htmlWriter.getName(tagText);
-        Content result = HtmlTree.A_ID(anchorName, new StringContent(tagText));
+        Content result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
         if (configuration.createindex && !tagText.isEmpty()) {
             SearchIndexItem si = new SearchIndexItem();
             si.setLabel(tagText);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Tue Apr 04 23:04:39 2017 -0700
@@ -99,6 +99,7 @@
     rightIframe,
     rowColor,
     searchTagLink,
+    searchTagResult,
     seeLabel,
     serializedFormContainer,
     simpleTagLabel,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Tue Apr 04 23:04:39 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -265,6 +265,21 @@
     }
 
     /**
+     * Generates an HTML anchor tag with a style class, id attribute and a body.
+     *
+     * @param styleClass stylesheet class for the tag
+     * @param id id for the anchor tag
+     * @param body body for the anchor tag
+     * @return an HtmlTree object
+     */
+    public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) {
+        HtmlTree htmltree = A_ID(id, body);
+        if (styleClass != null)
+            htmltree.addStyle(styleClass);
+        return htmltree;
+    }
+
+    /**
      * Generates a CAPTION tag with some content.
      *
      * @param body content for the tag
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Tue Apr 04 15:15:59 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Tue Apr 04 23:04:39 2017 -0700
@@ -42,15 +42,14 @@
     text-decoration:none;
     color:#353833;
 }
-a[name]:before, a[name]:target {
+a[name]:before, a[name]:target, a[id]:before, a[id]:target {
     content:"";
-    display:block;
-    height:120px;
-    margin:-120px 0 0;
-}
-a[id]:before, a[id]:target {
+    display:inline-block;
+    position:relative;
     padding-top:129px;
     margin-top:-129px;
+}
+.searchTagResult:before, .searchTagResult:target {
     color:red;
 }
 pre {
--- a/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java	Tue Apr 04 23:04:39 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4927552 8026567 8071982 8162674 8175200
+ * @bug      4927552 8026567 8071982 8162674 8175200 8175218
  * @summary  <DESC>
  * @author   jamieh
  * @library  ../lib
@@ -81,16 +81,16 @@
                 + "extends java.lang.Object</pre>",
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "public&nbsp;int field</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;</div>",
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;</div>",
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "public&nbsp;DeprecatedClassByAnnotation&#8203;()</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;</div>",
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;</div>",
                 "<pre>@Deprecated\n"
                 + "public&nbsp;void&nbsp;method&#8203;()</pre>\n"
                 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>");
 
         checkOutput("pkg/TestAnnotationType.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
@@ -100,16 +100,16 @@
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "static final&nbsp;int&nbsp;field</pre>\n"
                 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
-                + "API element is subject to removal in a future version. </span>&nbsp;<span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
+                + "API element is subject to removal in a future version.</span>&nbsp;<span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "int&nbsp;required</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;"
                 + "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>",
                 "<pre>java.lang.String&nbsp;optional</pre>\n"
                 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;<span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
 
         checkOutput("pkg/TestClass.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
@@ -118,11 +118,11 @@
                 + "extends java.lang.Object</pre>",
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "public&nbsp;TestClass&#8203;()</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;"
                 + "<span class=\"deprecationComment\">class_test3 passes.</span></div>");
 
         checkOutput("pkg/TestEnum.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
@@ -131,11 +131,11 @@
                 + "extends java.lang.Enum&lt;<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>&gt;</pre>",
                 "<pre>@Deprecated(forRemoval=true)\n"
                 + "public static final&nbsp;<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
-                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;"
                 + "<span class=\"deprecationComment\">enum_test3 passes.</span></div>");
 
         checkOutput("pkg/TestError.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
@@ -144,7 +144,7 @@
                 + "extends java.lang.Error</pre>");
 
         checkOutput("pkg/TestException.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
@@ -153,7 +153,7 @@
                 + "extends java.lang.Exception</pre>");
 
         checkOutput("pkg/TestInterface.html", true,
-                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span>&nbsp;\n"
+                "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>&nbsp;\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n"
                 + "</div>\n"
                 + "<br>\n"
--- a/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue Apr 04 23:04:39 2017 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
- *      8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562
+ *      8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -277,14 +277,14 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<div class=\"block\">This is a test description for the moduleA module. Search "
-                + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
+                + "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
         checkOutput("moduleB-summary.html", found,
                 "<!-- ============ MODULE DESCRIPTION =========== -->\n"
                 + "<a name=\"module.description\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
-                + "word <a id=\"search_word\">search_word</a> with no description.</div>");
+                + "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
         checkOutput("overview-summary.html", found,
                 "</script>\n"
                 + "<div class=\"contentContainer\">\n"
@@ -325,7 +325,7 @@
         checkOutput("moduleA-summary.html", found,
                 "<section role=\"region\">\n"
                 + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
-                + " This API element is subject to removal in a future version. </span>\n"
+                + " This API element is subject to removal in a future version.</span>\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
                 + "</div>\n"
                 + "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -333,7 +333,7 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<div class=\"block\">This is a test description for the moduleA module. Search "
-                + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
+                + "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
         checkOutput("moduleB-summary.html", found,
                 "<section role=\"region\">\n"
                 + "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -341,7 +341,7 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
-                + "word <a id=\"search_word\">search_word</a> with no description.</div>");
+                + "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
         checkOutput("overview-summary.html", found,
                 "</nav>\n"
                 + "</header>\n"
@@ -618,7 +618,7 @@
                 + "<h1 title=\"Module\" class=\"title\">Module&nbsp;moduleT</h1>\n"
                 + "</div>",
                 "<div class=\"block\">This is a test description for the moduleT module. "
-                + "Search phrase <a id=\"searchphrase\">search phrase</a>. "
+                + "Search phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>. "
                 + "Make sure there are no exported packages.</div>",
                 "<tbody>\n"
                 + "<tr class=\"altColor\">\n"
@@ -867,7 +867,7 @@
     void checkModuleDeprecation(boolean found) {
         checkOutput("moduleA-summary.html", found,
                 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
-                + " This API element is subject to removal in a future version. </span>\n"
+                + " This API element is subject to removal in a future version.</span>\n"
                 + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
                 + "</div>");
         checkOutput("deprecated-list.html", found,
--- a/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Tue Apr 04 23:04:39 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218
  * @summary Test the search feature of javadoc.
  * @author bpatel
  * @library ../lib
@@ -321,9 +321,9 @@
                 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
         checkOutput("index-all.html", true,
                 "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
-                + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>",
+                + " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></span></div>",
                 "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
-                + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>");
+                + " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></span></div>");
     }
 
     void checkSplitIndex() {
--- a/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Tue Apr 04 15:15:59 2017 -0700
+++ b/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Tue Apr 04 23:04:39 2017 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
+ *           8175218
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -162,6 +163,16 @@
                 "@import url('resources/fonts/dejavu.css');",
                 ".navPadding {\n"
                 + "    padding-top: 107px;\n"
+                + "}",
+                "a[name]:before, a[name]:target, a[id]:before, a[id]:target {\n"
+                + "    content:\"\";\n"
+                + "    display:inline-block;\n"
+                + "    position:relative;\n"
+                + "    padding-top:129px;\n"
+                + "    margin-top:-129px;\n"
+                + "}\n"
+                + ".searchTagResult:before, .searchTagResult:target {\n"
+                + "    color:red;\n"
                 + "}");
 
         // Test whether a link to the stylesheet file is inserted properly