Skip to content

Commit 3a8680e

Browse files
committedJan 28, 2025
8347058: When automatically translating the page to pt-br, all CSS styling disappears
Reviewed-by: hannesw, liach
1 parent a4942a2 commit 3a8680e

File tree

7 files changed

+31
-33
lines changed

7 files changed

+31
-33
lines changed
 

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -347,7 +347,7 @@ private void addStylesheets(HtmlTree head) {
347347

348348
private void addStylesheet(HtmlTree head, DocPath stylesheet) {
349349
head.add(HtmlTree.LINK("stylesheet", "text/css",
350-
pathToRoot.resolve(stylesheet).getPath(), "Style"));
350+
pathToRoot.resolve(stylesheet).getPath()));
351351
}
352352

353353
private void addScripts(HtmlTree head) {

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -779,15 +779,13 @@ public static HtmlTree LI(HtmlStyle style, Content body) {
779779
* @param rel the relevance of the link: the {@code rel} attribute
780780
* @param type the type of link: the {@code type} attribute
781781
* @param href the path for the link: the {@code href} attribute
782-
* @param title title for the link: the {@code title} attribute
783782
* @return the element
784783
*/
785-
public static HtmlTree LINK(String rel, String type, String href, String title) {
784+
public static HtmlTree LINK(String rel, String type, String href) {
786785
return new HtmlTree(HtmlTag.LINK)
787786
.put(HtmlAttr.REL, rel)
788787
.put(HtmlAttr.TYPE, type)
789-
.put(HtmlAttr.HREF, href)
790-
.put(HtmlAttr.TITLE, title);
788+
.put(HtmlAttr.HREF, href);
791789
}
792790

793791
/**

‎test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8219313
26+
* @bug 8219313 8347058
2727
* @summary Support module specific stylesheets
2828
* @library /tools/lib ../../lib
2929
* @modules jdk.compiler/com.sun.tools.javac.api
@@ -82,22 +82,22 @@ public void test(Path base) throws Exception {
8282

8383
checkOutput("ma/module-summary.html", true,
8484
"""
85-
<link rel="stylesheet" type="text/css" href="../ma/doc-files/spanstyle.css" title="Style">""");
85+
<link rel="stylesheet" type="text/css" href="../ma/doc-files/spanstyle.css">""");
8686

8787
checkOutput("ma/pa/package-summary.html", true,
8888
"""
89-
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css" title="Style">""");
89+
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css">""");
9090

9191
checkOutput("ma/pa/A.html", true,
9292
"""
93-
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css" title="Style">""");
93+
<link rel="stylesheet" type="text/css" href="../../ma/doc-files/spanstyle.css">""");
9494

9595
checkOutput("ma/pa/pb/B.html", true,
9696
"""
97-
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css" title="Style">""");
97+
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css">""");
9898

9999
checkOutput("ma/pa/pb/package-summary.html", true,
100100
"""
101-
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css" title="Style">""");
101+
<link rel="stylesheet" type="text/css" href="../../../ma/doc-files/spanstyle.css">""");
102102
}
103103
}

‎test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @bug 4749567 8071982 8175200 8186332 8185371 8182765 8217034 8261976 8261976
27-
* 8275786
27+
* 8275786 8347058
2828
* @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist,
2929
* -nonavbar, -notree, -stylesheetfile, --main-stylesheet, --add-stylesheet,
3030
* --add-script options.
@@ -118,7 +118,7 @@ public void testStylesheetFile() {
118118

119119
checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet");
120120
checkOutput("pkg/Foo.html", true, """
121-
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css" title="Style">""");
121+
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css">""");
122122
}
123123

124124
@Test
@@ -131,7 +131,7 @@ public void testStylesheetFileAltOption() {
131131

132132
checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet");
133133
checkOutput("pkg/Foo.html", true, """
134-
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css" title="Style">""");
134+
<link rel="stylesheet" type="text/css" href="../resource-files/custom-stylesheet.css">""");
135135
}
136136

137137
@Test
@@ -149,9 +149,9 @@ public void testAdditionalStylesheetFile() {
149149
checkOutput("resource-files/additional-stylesheet-3.css", true, "Additional javadoc style sheet 3");
150150
checkOutput("pkg/Foo.html", true,
151151
"""
152-
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-1.css" title="Style">
153-
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-2.css" title="Style">
154-
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-3.css" title="Style">""");
152+
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-1.css">
153+
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-2.css">
154+
<link rel="stylesheet" type="text/css" href="../resource-files/additional-stylesheet-3.css">""");
155155
}
156156

157157
@Test

‎test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8213354
26+
* @bug 8213354 8347058
2727
* @summary Support package-specific stylesheets
2828
* @library /tools/lib ../../lib
2929
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -82,15 +82,15 @@ public void test(Path base) throws Exception {
8282

8383
checkOutput("pkg/A.html", true,
8484
"""
85-
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css" title="Style">""");
85+
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css">""");
8686

8787
checkOutput("pkg/package-summary.html", true,
8888
"""
89-
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css" title="Style">""");
89+
<link rel="stylesheet" type="text/css" href="../pkg/doc-files/spanstyle.css">""");
9090

9191
checkOutput("pkg2/B.html", false,
9292
"""
93-
<link rel="stylesheet" type="text/css" href="../pkg2/doc-files/spanstyle.css" title="Style">""");
93+
<link rel="stylesheet" type="text/css" href="../pkg2/doc-files/spanstyle.css">""");
9494

9595
}
9696
}

‎test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
2626
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
2727
* 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
2828
* 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528
29-
* 8266808 8248863 8305710 8318082
29+
* 8266808 8248863 8305710 8318082 8347058
3030
* @summary Test the search feature of javadoc.
3131
* @library ../../lib
3232
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -418,7 +418,7 @@ void checkSearchOutput(String fileName, boolean expectedOutput) {
418418
// Test for search related markup
419419
checkOutput(fileName, expectedOutput,
420420
"""
421-
<link rel="stylesheet" type="text/css" href="resource-files/jquery-ui.min.css" title="Style">
421+
<link rel="stylesheet" type="text/css" href="resource-files/jquery-ui.min.css">
422422
""",
423423
"""
424424
<script type="text/javascript" src="script-files/jquery-3.7.1.min.js"></script>

‎test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
2525
* @test
2626
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
2727
* 8175218 8176452 8181215 8182263 8183511 8169819 8183037 8185369 8182765 8196201 8184205 8223378 8241544
28-
* 8253117 8263528 8289334 8292594
28+
* 8253117 8263528 8289334 8292594 8347058
2929
* @summary Run tests on doclet stylesheet.
3030
* @library /tools/lib ../../lib
3131
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -186,7 +186,7 @@ public void test(Path base) {
186186
// Test whether a link to the stylesheet file is inserted properly
187187
// in the class documentation.
188188
"""
189-
<link rel="stylesheet" type="text/css" href="../resource-files/stylesheet.css" title="Style">""",
189+
<link rel="stylesheet" type="text/css" href="../resource-files/stylesheet.css">""",
190190
"""
191191
<div class="block">Test comment for a class which has an <a name="named_anchor">anchor_with_name</a> and
192192
an <a id="named_anchor1">anchor_with_id</a>.</div>""");
@@ -200,7 +200,7 @@ public void test(Path base) {
200200

201201
checkOutput("index.html", true,
202202
"""
203-
<link rel="stylesheet" type="text/css" href="resource-files/stylesheet.css" title="Style">""");
203+
<link rel="stylesheet" type="text/css" href="resource-files/stylesheet.css">""");
204204

205205
checkOutput("resource-files/stylesheet.css", false,
206206
"""

0 commit comments

Comments
 (0)
Please sign in to comment.