Skip to content
Permalink
Browse files
8240916: Convert to using hyphenated naming for CSS classes
Reviewed-by: hannesw
  • Loading branch information
jonathan-gibbons committed Mar 13, 2020
1 parent 2b465b1 commit afa54b7ed531c6bf321ddee6212b51f5c2e8c889
Showing with 2,076 additions and 2,052 deletions.
  1. +1 −1 make/jdk/src/classes/build/tools/taglet/ModuleGraph.java
  2. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
  3. +26 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java
  4. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
  5. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java
  6. +130 −130 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
  7. +3 −3 test/langtools/jdk/javadoc/doclet/AccessSkipNav/AccessSkipNav.java
  8. +13 −13 test/langtools/jdk/javadoc/doclet/constantValues/TestConstantValuesDriver.java
  9. +32 −32 test/langtools/jdk/javadoc/doclet/testAbstractMethod/TestAbstractMethod.java
  10. +7 −7 test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java
  11. +11 −11 test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java
  12. +5 −5 test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java
  13. +4 −4 test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java
  14. +5 −5 test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java
  15. +111 −111 test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java
  16. +2 −2 test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java
  17. +4 −4 test/langtools/jdk/javadoc/doclet/testExternalOverriddenMethod/TestExternalOverriddenMethod.java
  18. +5 −5 test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
  19. +16 −16 test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java
  20. +2 −2 test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java
  21. +1 −1 test/langtools/jdk/javadoc/doclet/testHref/TestHref.java
  22. +22 −22 test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
  23. +3 −3 test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java
  24. +9 −9 test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java
  25. +148 −148 test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java
  26. +3 −3 test/langtools/jdk/javadoc/doclet/testHtmlTag/TestHtmlTag.java
  27. +159 −159 test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java
  28. +4 −4 test/langtools/jdk/javadoc/doclet/testIndentation/TestIndentation.java
  29. +7 −7 test/langtools/jdk/javadoc/doclet/testIndex/TestIndex.java
  30. +9 −9 test/langtools/jdk/javadoc/doclet/testIndexInDocFiles/TestIndexInDocFiles.java
  31. +11 −11 test/langtools/jdk/javadoc/doclet/testIndexInPackageFiles/TestIndexInPackageFiles.java
  32. +4 −4 test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java
  33. +13 −13 test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java
  34. +87 −87 test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java
  35. +13 −13 test/langtools/jdk/javadoc/doclet/testLambdaFeature/TestLambdaFeature.java
  36. +13 −13 test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java
  37. +3 −3 test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithAutomaticModule.java
  38. +2 −2 test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithModule.java
  39. +2 −2 test/langtools/jdk/javadoc/doclet/testLinkOption/TestOptionOrder.java
  40. +4 −4 test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java
  41. +2 −2 test/langtools/jdk/javadoc/doclet/testLinkToSerialForm/TestLinkToSerialForm.java
  42. +5 −5 ...langtools/jdk/javadoc/doclet/testLinksWithNoDeprecatedOption/TestLinksWithNoDeprecatedOption.java
  43. +3 −3 test/langtools/jdk/javadoc/doclet/testLiteralCodeInPre/TestLiteralCodeInPre.java
  44. +19 −19 test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
  45. +7 −7 test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java
  46. +15 −15 test/langtools/jdk/javadoc/doclet/testMethodSignature/TestMethodSignature.java
  47. +36 −36 test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java
  48. +6 −6 test/langtools/jdk/javadoc/doclet/testModifierEx/TestModifierEx.java
  49. +12 −12 test/langtools/jdk/javadoc/doclet/testModules/TestIndirectExportsOpens.java
  50. +20 −20 test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java
  51. +58 −58 test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java
  52. +313 −313 test/langtools/jdk/javadoc/doclet/testModules/TestModules.java
  53. +15 −15 test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java
  54. +102 −102 test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java
  55. +29 −29 test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java
  56. +9 −9 test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java
  57. +3 −3 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java
  58. +5 −5 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java
  59. +1 −1 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenMethodDocCopy.java
  60. +8 −8 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java
  61. +3 −3 test/langtools/jdk/javadoc/doclet/testPackageAnnotation/TestPackageAnnotation.java
  62. +4 −4 test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java
  63. +2 −2 test/langtools/jdk/javadoc/doclet/testPackageDescription/TestPackageDescription.java
  64. +9 −9 test/langtools/jdk/javadoc/doclet/testPackagePage/TestPackagePage.java
  65. +16 −16 test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java
  66. +9 −9 test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java
  67. +15 −15 test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
  68. +32 −32 test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java
  69. +97 −97 test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
  70. +10 −10 test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java
  71. +9 −9 ...tools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
  72. +3 −3 ...langtools/jdk/javadoc/doclet/testSerializedFormWithClassFile/TestSerializedFormWithClassFile.java
  73. +46 −46 test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java
  74. +4 −4 test/langtools/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java
  75. +8 −8 test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java
  76. +9 −9 test/langtools/jdk/javadoc/doclet/testSystemPropertyPage/TestSystemPropertyPage.java
  77. +41 −41 test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java
  78. +6 −6 test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java
  79. +1 −1 test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java
  80. +150 −150 test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java
  81. +2 −2 test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java
  82. +15 −15 test/langtools/jdk/javadoc/doclet/testUnnamedPackage/TestUnnamedPackage.java
  83. +9 −9 test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
  84. +2 −2 test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTagInModule.java
  85. +6 −6 test/langtools/jdk/javadoc/tool/testLocaleOption/TestLocaleOption.java
@@ -75,7 +75,7 @@ public String toString(List<? extends DocTree> tags, Element element) {
}
return "<dt>Module Graph:</dt>"
+ "<dd>"
+ "<a class=moduleGraph href=\"" + imageFile + "\">"
+ "<a class=\"module-graph\" href=\"" + imageFile + "\">"
+ getImage(moduleName, imageFile, thumbnailHeight, false)
+ hoverImage
+ "</a>"
@@ -287,7 +287,7 @@ protected void addStylesheets(Content tree) {
* @return the header content for the HTML file
*/
private static Content getHeader() {
return new HtmlTree(HtmlTag.BODY).put(HtmlAttr.CLASS, "source");
return new HtmlTree(HtmlTag.BODY).setStyle(HtmlStyle.source);
}

/**
@@ -25,8 +25,11 @@

package jdk.javadoc.internal.doclets.formats.html.markup;

import java.util.Locale;
import java.util.regex.Pattern;

/**
* Enum representing HTML styles. The name map to values in the CSS file.
* Enum representing HTML styles, with associated entries in the stylesheet files.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
@@ -118,6 +121,7 @@
serializedClassDetails,
servicesSummary,
skipNav,
source,
sourceContainer,
sourceLineNo,
subNav,
@@ -136,5 +140,25 @@
typeSummary,
useSummary,
usesSummary,
verticalSeparator
verticalSeparator;

private final String cssName;

HtmlStyle() {
cssName = Pattern.compile("\\p{Upper}")
.matcher(toString())
.replaceAll(mr -> "-" + mr.group().toLowerCase(Locale.US));
}

HtmlStyle(String cssName) {
this.cssName = cssName;
}

/**
* Returns the CSS class name associated with this style.
* @return the CSS class name
*/
public String cssName() {
return cssName;
}
}
@@ -147,7 +147,7 @@ public HtmlTree setRole(Role role) {
* @return this object
*/
public HtmlTree setStyle(HtmlStyle style) {
return put(HtmlAttr.CLASS, style.toString());
return put(HtmlAttr.CLASS, style.cssName());
}

/**
@@ -357,7 +357,7 @@ public void addRow(Element element, List<Content> contents) {

if (stripedStyles != null) {
int rowIndex = bodyRows.size();
row.put(HtmlAttr.CLASS, stripedStyles.get(rowIndex % 2).name());
row.setStyle(stripedStyles.get(rowIndex % 2));
}
int colIndex = 0;
for (Content c : contents) {
@@ -444,7 +444,7 @@ private Content toContent() {
}
}
HtmlTree tabpanel = new HtmlTree(HtmlTag.DIV)
.put(HtmlAttr.ID, tableStyle + "_tabpanel")
.put(HtmlAttr.ID, tableStyle.cssName() + "_tabpanel")
.put(HtmlAttr.ROLE, "tabpanel");
table.add(getTableBody());
tabpanel.add(table);
@@ -458,7 +458,7 @@ private HtmlTree createTab(String tabId, HtmlStyle style, boolean defaultTab, St
HtmlTree tab = new HtmlTree(HtmlTag.BUTTON)
.put(HtmlAttr.ROLE, "tab")
.put(HtmlAttr.ARIA_SELECTED, defaultTab ? "true" : "false")
.put(HtmlAttr.ARIA_CONTROLS, tableStyle + "_tabpanel")
.put(HtmlAttr.ARIA_CONTROLS, tableStyle.cssName() + "_tabpanel")
.put(HtmlAttr.TABINDEX, defaultTab ? "0" : "-1")
.put(HtmlAttr.ONKEYDOWN, "switchTab(event)")
.put(HtmlAttr.ID, tabId)
@@ -543,7 +543,7 @@ private void appendTabInfo(StringBuilder sb, int value, String id, String name)

private void appendStyleInfo(StringBuilder sb, HtmlStyle... styles) {
for (HtmlStyle style : styles) {
sb.append("var ").append(style).append(" = \"").append(style).append("\";\n");
sb.append("var ").append(style.name()).append(" = \"").append(style.cssName()).append("\";\n");
}

}

0 comments on commit afa54b7

Please sign in to comment.