8347058: When automatically translating the page to pt-br, all CSS styling disappears

Reviewed-by: hannesw, liach
This commit is contained in:
Nizar Benalla 2025-01-28 11:13:54 +00:00
parent a4942a2f7a
commit 3a8680e919
7 changed files with 31 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -347,7 +347,7 @@ public class Head extends Content {
private void addStylesheet(HtmlTree head, DocPath stylesheet) {
head.add(HtmlTree.LINK("stylesheet", "text/css",
pathToRoot.resolve(stylesheet).getPath(), "Style"));
pathToRoot.resolve(stylesheet).getPath()));
}
private void addScripts(HtmlTree head) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2025, 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
@ -779,15 +779,13 @@ public class HtmlTree extends Content {
* @param rel the relevance of the link: the {@code rel} attribute
* @param type the type of link: the {@code type} attribute
* @param href the path for the link: the {@code href} attribute
* @param title title for the link: the {@code title} attribute
* @return the element
*/
public static HtmlTree LINK(String rel, String type, String href, String title) {
public static HtmlTree LINK(String rel, String type, String href) {
return new HtmlTree(HtmlTag.LINK)
.put(HtmlAttr.REL, rel)
.put(HtmlAttr.TYPE, type)
.put(HtmlAttr.HREF, href)
.put(HtmlAttr.TITLE, title);
.put(HtmlAttr.HREF, href);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8219313
* @bug 8219313 8347058
* @summary Support module specific stylesheets
* @library /tools/lib ../../lib
* @modules jdk.compiler/com.sun.tools.javac.api
@ -82,22 +82,22 @@ public class TestModuleSpecificStylesheet extends JavadocTester {
checkOutput("ma/module-summary.html", true,
"""
<link rel="stylesheet" type="text/css" href="../ma/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../ma/doc-files/spanstyle.css">""");
checkOutput("ma/pa/package-summary.html", true,
"""
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css">""");
checkOutput("ma/pa/A.html", true,
"""
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css">""");
checkOutput("ma/pa/pb/B.html", true,
"""
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css">""");
checkOutput("ma/pa/pb/package-summary.html", true,
"""
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css">""");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, 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
@ -24,7 +24,7 @@
/*
* @test
* @bug 4749567 8071982 8175200 8186332 8185371 8182765 8217034 8261976 8261976
* 8275786
* 8275786 8347058
* @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist,
* -nonavbar, -notree, -stylesheetfile, --main-stylesheet, --add-stylesheet,
* --add-script options.
@ -118,7 +118,7 @@ public class TestOptions extends JavadocTester {
checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet");
checkOutput("pkg/Foo.html", true, """
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css">""");
}
@Test
@ -131,7 +131,7 @@ public class TestOptions extends JavadocTester {
checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet");
checkOutput("pkg/Foo.html", true, """
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css">""");
}
@Test
@ -149,9 +149,9 @@ public class TestOptions extends JavadocTester {
checkOutput("resource-files/additional-stylesheet-3.css", true, "Additional javadoc style sheet 3");
checkOutput("pkg/Foo.html", true,
"""
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-1.css" title="Style">
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-2.css" title="Style">
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-3.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-1.css">
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-2.css">
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-3.css">""");
}
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8213354
* @bug 8213354 8347058
* @summary Support package-specific stylesheets
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -82,15 +82,15 @@ public class TestPackageSpecificStylesheet extends JavadocTester {
checkOutput("pkg/A.html", true,
"""
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css">""");
checkOutput("pkg/package-summary.html", true,
"""
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css">""");
checkOutput("pkg2/B.html", false,
"""
<link rel="stylesheet" type="text/css" href="../pkg2/doc-files/spanstyle.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="../pkg2/doc-files/spanstyle.css">""");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2025, 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
@ -26,7 +26,7 @@
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
* 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
* 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528
* 8266808 8248863 8305710 8318082
* 8266808 8248863 8305710 8318082 8347058
* @summary Test the search feature of javadoc.
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -418,7 +418,7 @@ public class TestSearch extends JavadocTester {
// Test for search related markup
checkOutput(fileName, expectedOutput,
"""
<link rel="stylesheet" type="text/css" href="resource-files/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="resource-files/jquery-ui.min.css">
""",
"""
<script type="text/javascript" src="script-files/jquery-3.7.1.min.js"></script>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, 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
@ -25,7 +25,7 @@
* @test
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
* 8175218 8176452 8181215 8182263 8183511 8169819 8183037 8185369 8182765 8196201 8184205 8223378 8241544
* 8253117 8263528 8289334 8292594
* 8253117 8263528 8289334 8292594 8347058
* @summary Run tests on doclet stylesheet.
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -186,7 +186,7 @@ public class TestStylesheet extends JavadocTester {
// Test whether a link to the stylesheet file is inserted properly
// in the class documentation.
"""
<link rel="stylesheet" type="text/css" href="../resource-files/stylesheet.css" title="Style">""",
<link rel="stylesheet" type="text/css" href="../resource-files/stylesheet.css">""",
"""
<div class="block">Test comment for a class which has an <a name="named_anchor">anchor_with_name</a> and
an <a id="named_anchor1">anchor_with_id</a>.</div>""");
@ -200,7 +200,7 @@ public class TestStylesheet extends JavadocTester {
checkOutput("index.html", true,
"""
<link rel="stylesheet" type="text/css" href="resource-files/stylesheet.css" title="Style">""");
<link rel="stylesheet" type="text/css" href="resource-files/stylesheet.css">""");
checkOutput("resource-files/stylesheet.css", false,
"""