8148985: javadoc "FRAMES" and "NO FRAMES" links not working correctly

Reviewed-by: jjg, ksrini
This commit is contained in:
Bhavesh Patel 2016-03-02 21:27:01 +00:00
parent c12efa10b2
commit 5b14d73a63
8 changed files with 38 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, 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
@ -96,6 +96,7 @@ public class FrameOutputWriter extends HtmlDocletWriter {
protected void generateFrameFile() throws IOException {
Content frame = getFrameDetails();
HtmlTree body = new HtmlTree(HtmlTag.BODY);
body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
if (configuration.allowTag(HtmlTag.MAIN)) {
HtmlTree main = HtmlTree.MAIN(frame);
body.addContent(main);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, 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
@ -423,6 +423,10 @@ public class HtmlWriter {
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
" }" + DocletConstants.NL +
" function loadFrames() {" + DocletConstants.NL +
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
" top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);

View file

@ -27,6 +27,7 @@ package jdk.javadoc.internal.doclets.formats.html;
import java.io.*;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@ -102,6 +103,7 @@ public class FrameOutputWriter extends HtmlDocletWriter {
protected void generateFrameFile() throws IOException {
Content frame = getFrameDetails();
HtmlTree body = new HtmlTree(HtmlTag.BODY);
body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
if (configuration.allowTag(HtmlTag.MAIN)) {
HtmlTree main = HtmlTree.MAIN(frame);
body.addContent(main);

View file

@ -401,6 +401,10 @@ public class HtmlWriter {
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
" }" + DocletConstants.NL +
" function loadFrames() {" + DocletConstants.NL +
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
" top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, 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 8072945 8081854 8141492
* @bug 8072945 8081854 8141492 8148985
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../lib
@ -688,7 +688,7 @@ public class TestHtmlVersion extends JavadocTester {
checkOutput("index.html", true,
"<!DOCTYPE HTML>",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
"<body>\n"
"<body onload=\"loadFrames()\">\n"
+ "<main role=\"main\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
@ -1599,7 +1599,7 @@ public class TestHtmlVersion extends JavadocTester {
checkOutput("index.html", true,
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
"<body>\n"
"<body onload=\"loadFrames()\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
+ "<div class=\"leftTop\">\n"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2016, 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
@ -100,8 +100,15 @@ public class TestJavascript extends JavadocTester {
+ " }\n"
+ " return true;\n"
+ " }\n"
+ " function loadFrames() {\n"
+ " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ " top.classFrame.location = top.targetPage;\n"
+ " }\n"
+ "</script>");
checkOutput("index.html", true,
"<body onload=\"loadFrames()\"");
//Make sure title javascript only runs if is-external is not true
checkOutput("pkg/C.html", true,
" try {\n"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, 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 8072945 8081854 8141492
* @bug 8072945 8081854 8141492 8148985
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../lib
@ -599,7 +599,7 @@ public class TestHtmlVersion extends JavadocTester {
checkOutput("index.html", true,
"<!DOCTYPE HTML>",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
"<body>\n"
"<body onload=\"loadFrames()\">\n"
+ "<main role=\"main\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
@ -1391,7 +1391,7 @@ public class TestHtmlVersion extends JavadocTester {
checkOutput("index.html", true,
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
"<body>\n"
"<body onload=\"loadFrames()\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
+ "<div class=\"leftTop\">\n"

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2016, 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 4665566 4855876 7025314 8012375 8015997 8016328 8024756
* @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985
* @summary Verify that the output has the right javascript.
* @author jamieh
* @library ../lib
@ -100,8 +100,15 @@ public class TestJavascript extends JavadocTester {
+ " }\n"
+ " return true;\n"
+ " }\n"
+ " function loadFrames() {\n"
+ " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ " top.classFrame.location = top.targetPage;\n"
+ " }\n"
+ "</script>");
checkOutput("index.html", true,
"<body onload=\"loadFrames()\"");
//Make sure title javascript only runs if is-external is not true
checkOutput("pkg/C.html", true,
" try {\n"