> If we made n-many calls to > textPane.getAccessibleContext().getAccessibleText() then we'd add n-many > DocumentListeners to the HTMLDocument. > > These listeners are very light, but even so: after thousands of listeners it > may start to degrade performance.
Jeremy Wood has updated the pull request incrementally with one additional commit since the last revision: 8380790: make sure new Documents get axText listener This is in response to: https://github.com/openjdk/jdk/pull/30401#issuecomment-4144874584 My current output from this test resembles: 2 listeners at "A" javax.swing.plaf.basic.BasicTextUI$UpdateHandler 0x165938a8 javax.swing.text.DefaultCaret$Handler 0x13ad4587 5 listeners at "B" javax.swing.JEditorPane$JEditorPaneAccessibleHypertextSupport$1 0x408dfc5d javax.swing.JEditorPane$JEditorPaneAccessibleHypertextSupport 0x6badfa89 javax.swing.JEditorPane$AccessibleJEditorPaneHTML 0x8542bca javax.swing.plaf.basic.BasicTextUI$UpdateHandler 0x165938a8 javax.swing.text.DefaultCaret$Handler 0x13ad4587 4 listeners at "C" javax.swing.JEditorPane$AccessibleJEditorPaneHTML 0x8542bca javax.swing.text.html.AccessibleHTML$DocumentHandler 0x2343eccf javax.swing.plaf.basic.BasicTextUI$UpdateHandler 0x165938a8 javax.swing.text.DefaultCaret$Handler 0x13ad4587 6 listeners at "D" javax.swing.JEditorPane$JEditorPaneAccessibleHypertextSupport$1 0x13117e17 javax.swing.JEditorPane$JEditorPaneAccessibleHypertextSupport 0x491f0df7 javax.swing.JEditorPane$AccessibleJEditorPaneHTML 0x8542bca javax.swing.text.html.AccessibleHTML$DocumentHandler 0x2343eccf javax.swing.plaf.basic.BasicTextUI$UpdateHandler 0x165938a8 javax.swing.text.DefaultCaret$Handler 0x13ad4587 I'm surprised at each point there are a different number of DocumentListeners, but this confirms that a new JEditorPane$JEditorPaneAccessibleHypertextSupport$1 is being added after setDocument(..) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/30401/files - new: https://git.openjdk.org/jdk/pull/30401/files/40201b3c..e7b1c7aa Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=30401&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=30401&range=02-03 Stats: 32 lines in 2 files changed: 28 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/30401.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30401/head:pull/30401 PR: https://git.openjdk.org/jdk/pull/30401
