On Mon, 2 Dec 2024 17:26:00 GMT, ScientificWare <[email protected]> wrote:
>> This is referenced in Java Bug Database as >> - [JDK-8314731 : Adds support for the alt attribute in the image type input >> HTML tag.](https://bugs.java.com/bugdatabase/view_bug?bug_id=8314731) >> >> This is tracked in JBS as >> - [JDK-8314731 : Add support for the alt attribute in the image type input >> HTML tag](https://bugs.openjdk.java.net/browse/JDK-8314731) >> >> According [HTML 3.2 >> specification](https://www.w3.org/TR/2018/SPSD-html32-20180315/#input) >> >> `alt` is not an attribute of the `input` element. >> >> According [HTML 4.01 >> specifications](https://www.w3.org/TR/html4/interact/forms.html#h-17.4) : >> >>> ... For accessibility reasons, authors should provide [alternate >>> text](https://www.w3.org/TR/html4/struct/objects.html#alternate-text) for >>> the image via the >>> [alt](https://www.w3.org/TR/html4/struct/objects.html#adef-alt) attribute. >>> ... >> >> This feature is not implemented in `FormView.java`. >> >> ⚠️ ~~This also affects the HTML 32 DTD~~ >> >>  >> >> Left before the patch and right after the patch. >> >> >> import java.awt.BorderLayout; >> import java.awt.Dimension; >> import javax.swing.JEditorPane; >> import javax.swing.JFrame; >> import javax.swing.JScrollPane; >> import javax.swing.SwingUtilities; >> import javax.swing.text.Document; >> import javax.swing.text.html.HTMLEditorKit; >> import javax.swing.text.html.StyleSheet; >> >> public class HTMLAddsSupportAltInputTag { >> public static void main(String[] args) { >> new HTMLAddsSupportAltInputTag(); >> } >> >> public HTMLAddsSupportAltInputTag() { >> SwingUtilities.invokeLater(new Runnable(){ >> public void run(){ >> JEditorPane jEditorPane = new JEditorPane(); >> jEditorPane.setEditable(false); >> JScrollPane scrollPane = new JScrollPane(jEditorPane); >> HTMLEditorKit kit = new HTMLEditorKit(); >> jEditorPane.setEditorKit(kit); >> StyleSheet styleSheet = kit.getStyleSheet(); >> styleSheet.addRule(""" >> body { >> color: #000; >> font-family:times; >> margin: 4px; >> } >> """); >> String htmlString = """ >> <html> >> <body> >> <input type=image name=point >> src="file:oracle_logo_50x50.jpg" alt="Logo Oracle JPG"> >> <p> >> <input type=image name=point src="file:none_ora... > > ScientificWare has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 20 commits: > > - Merge master > - Replaces this title with "alt attribute test in HTML image type input". > > Moves this test to /jdk/test/jdk/javax/swing/text/html. > - bug8314731.java : Corrects the CopyRight date. > - FormView.java : > Removes a whitespace > > bug8314731.java : > Adds a newline at end of file. > - getMaximumSpan(int axis) method > doc -> Not used > > mouseReleased(MouseEvent evt) method > elem and hdoc -> not used > return -> could be removed, method returns void > > loadElementDataIntoBuffer(Element elem, StringBuilder buffer) method > value != null -> name can't be null at this point > > getInputElementData(AttributeSet attr) method > value = null -> Already set at null > - Removes files > > make/javac.20231014_162919.args > make/javac.20231014_220237.args > make/javac.20231023_221655.args > - Adds a regression test for JDK-8314731. > - Others changes in the working directory. > - Merge Master > - Merge master > - ... and 10 more: https://git.openjdk.org/jdk/compare/352201dd...de644539 Changes requested by prr (Reviewer). src/java.desktop/share/classes/javax/swing/text/html/FormView.java line 196: > 194: AttributeSet attr = getElement().getAttributes(); > 195: HTML.Tag t = (HTML.Tag) > 196: attr.getAttribute(StyleConstants.NameAttribute); This PR has LOTS of completely unrelated changing to formatting. Please revert ALL of it, so we can see what is related to the change and not be distracted. test/jdk/javax/swing/text/html/bug8314731.java line 28: > 26: * @bug 8314731 > 27: * @summary FormView doesn't support the alt attribute > 28: * @library /java/swing/text/html What is this library ? I don't see it anywhere under the test/jdk folder. And there's no @build tag. Furthermore, this test clearly needs a display which means it needs to be marked @headful test/jdk/javax/swing/text/html/bug8314731.java line 51: > 49: > 50: public static void main(String[] args) throws Exception { > 51: new bug8314731(); the UI needs to be created on the EDT using SwingUtilities.invokeAndWait. And you need use a finally block to be SURE the Frame is disposed, else the test will just sit there. Please make sure you have used jtreg to validate this test. test/jdk/javax/swing/text/html/bug8314731.java line 53: > 51: new bug8314731(); > 52: if (testFailed) { > 53: System.out.println("ok"); I find this backwards - and hence confusing. You really mean "testPassed" not "testFailed". test/jdk/javax/swing/text/html/bug8314731.java line 80: > 78: <input type=image > 79: name=point > 80: src="file:logo.jpeg" and of course you don't need to supply logo.jpeg, because the point is that there should be no image found. ------------- PR Review: https://git.openjdk.org/jdk/pull/15319#pullrequestreview-2476851661 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1868431626 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1868428214 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1868430794 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1868428906 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1868429679
