# HG changeset patch # User bpatel # Date 1491372279 25200 # Node ID 126285be00b9cb75ee8d0fa3204046fcccdbdf35 # Parent db270eef83ae1a0cf8cb52c034305d70327695f4 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 diff -r db270eef83ae -r 126285be00b9 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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); diff -r db270eef83ae -r 126285be00b9 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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, diff -r db270eef83ae -r 126285be00b9 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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 diff -r db270eef83ae -r 126285be00b9 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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 { diff -r db270eef83ae -r 126285be00b9 langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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 * @author jamieh * @library ../lib @@ -81,16 +81,16 @@ + "extends java.lang.Object", "
@Deprecated(forRemoval=true)\n"
                 + "public int field
\n" - + "
Deprecated, for removal: This API element is subject to removal in a future version.  
", + + "
Deprecated, for removal: This API element is subject to removal in a future version. 
", "
@Deprecated(forRemoval=true)\n"
                 + "public DeprecatedClassByAnnotation​()
\n" - + "
Deprecated, for removal: This API element is subject to removal in a future version.  
", + + "
Deprecated, for removal: This API element is subject to removal in a future version. 
", "
@Deprecated\n"
                 + "public void method​()
\n" + "
Deprecated. 
"); checkOutput("pkg/TestAnnotationType.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
annotation_test1 passes.
\n" + "
\n" + "
\n" @@ -100,16 +100,16 @@ "
@Deprecated(forRemoval=true)\n"
                 + "static final int field
\n" + "
Deprecated, for removal: This " - + "API element is subject to removal in a future version.  annotation_test4 passes.
", + + "API element is subject to removal in a future version. annotation_test4 passes.
", "
@Deprecated(forRemoval=true)\n"
                 + "int required
\n" - + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
Deprecated, for removal: This API element is subject to removal in a future version. " + "annotation_test3 passes.
", "
java.lang.String optional
\n" + "
Deprecated. annotation_test2 passes.
"); checkOutput("pkg/TestClass.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
class_test1 passes.
\n" + "
\n" + "
\n" @@ -118,11 +118,11 @@ + "extends java.lang.Object", "
@Deprecated(forRemoval=true)\n"
                 + "public TestClass​()
\n" - + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
Deprecated, for removal: This API element is subject to removal in a future version. " + "class_test3 passes.
"); checkOutput("pkg/TestEnum.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
enum_test1 passes.
\n" + "
\n" + "
\n" @@ -131,11 +131,11 @@ + "extends java.lang.Enum<TestEnum>", "
@Deprecated(forRemoval=true)\n"
                 + "public static final TestEnum FOR_REMOVAL
\n" - + "
Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
Deprecated, for removal: This API element is subject to removal in a future version. " + "enum_test3 passes.
"); checkOutput("pkg/TestError.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
error_test1 passes.
\n" + "
\n" + "
\n" @@ -144,7 +144,7 @@ + "extends java.lang.Error"); checkOutput("pkg/TestException.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
exception_test1 passes.
\n" + "
\n" + "
\n" @@ -153,7 +153,7 @@ + "extends java.lang.Exception"); checkOutput("pkg/TestInterface.html", true, - "
Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
interface_test1 passes.
\n" + "
\n" + "
\n" diff -r db270eef83ae -r 126285be00b9 langtools/test/jdk/javadoc/doclet/testModules/TestModules.java --- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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" + "\n" + "
This is a test description for the moduleA module. Search " - + "phrase search phrase.
"); + + "phrase search phrase.
"); checkOutput("moduleB-summary.html", found, "\n" + "\n" + "\n" + "\n" + "
This is a test description for the moduleB module. Search " - + "word search_word with no description.
"); + + "word search_word with no description.
"); checkOutput("overview-summary.html", found, "\n" + "
\n" @@ -325,7 +325,7 @@ checkOutput("moduleA-summary.html", found, "
\n" + "
Deprecated, for removal:" - + " This API element is subject to removal in a future version. \n" + + " This API element is subject to removal in a future version.\n" + "
This module is deprecated.
\n" + "
\n" + "\n" @@ -333,7 +333,7 @@ + "\n" + "\n" + "
This is a test description for the moduleA module. Search " - + "phrase search phrase.
"); + + "phrase search phrase.
"); checkOutput("moduleB-summary.html", found, "
\n" + "\n" @@ -341,7 +341,7 @@ + "\n" + "\n" + "
This is a test description for the moduleB module. Search " - + "word search_word with no description.
"); + + "word search_word with no description.
"); checkOutput("overview-summary.html", found, "\n" + "\n" @@ -618,7 +618,7 @@ + "

Module moduleT

\n" + "
", "
This is a test description for the moduleT module. " - + "Search phrase search phrase. " + + "Search phrase search phrase. " + "Make sure there are no exported packages.
", "\n" + "\n" @@ -867,7 +867,7 @@ void checkModuleDeprecation(boolean found) { checkOutput("moduleA-summary.html", found, "
Deprecated, for removal:" - + " This API element is subject to removal in a future version. \n" + + " This API element is subject to removal in a future version.\n" + "
This module is deprecated.
\n" + "
"); checkOutput("deprecated-list.html", found, diff -r db270eef83ae -r 126285be00b9 langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java --- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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.TestEnum"); checkOutput("index-all.html", true, "
class_test1 passes. Search tag" - + " SearchTagDeprecatedClass
", + + " SearchTagDeprecatedClass
", "
error_test3 passes. Search tag for\n" - + " method SearchTagDeprecatedMethod
"); + + " method SearchTagDeprecatedMethod
"); } void checkSplitIndex() { diff -r db270eef83ae -r 126285be00b9 langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java --- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Tue Apr 04 15:15:59 2017 -0700 +++ b/langtools/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