RFR: 8292948: JEditorPane ignores font-size styles in external linked css-file [v3]

Stanimir Stamenkov duke at openjdk.org
Sun Aug 28 05:14:08 UTC 2022


> [JDK-8292948] reveals a regression by the fix for [JDK-8257664] (#1759) causing `font-size` declarations from external style sheets to be ignored.
> 
> As far as I've traced, the problem is with the `isDefined(CSS.Attribute.FONT_SIZE)` test:
> 
> https://github.com/openjdk/jdk/blob/70b5b3119b2ed032b021a080f34a4fa28d092fb5/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java#L2825-L2830
> 
> It misses declarations from linked styles via a `resolver` ([`AttributeSet.ResolveAttribute`](https://github.com/openjdk/jdk/blob/b0e0b87891eb81c2b33c1cfa598701b7bd2e5bdf/src/java.desktop/share/classes/javax/swing/text/AttributeSet.java#L187-L191)) attribute that happens to hold the external style sheet rules.  The fix for this would be to move the implied `CSS.Attribute.FONT_SIZE` handling after:
> 
> https://github.com/openjdk/jdk/blob/70b5b3119b2ed032b021a080f34a4fa28d092fb5/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java#L2833-L2835
> 
> and drop the `isDefined()` test.
> 
> [I'll prepare a jtreg test further.]
> 
> [JDK-8292948]: https://bugs.openjdk.org/browse/JDK-8292948 "JEditorPane ignores font-size styles in external linked css-file"
> [JDK-8257664]: https://bugs.openjdk.org/browse/JDK-8257664 "HTMLEditorKit: Wrong CSS relative font sizes"

Stanimir Stamenkov has updated the pull request incrementally with seven additional commits since the last revision:

 - 8292948: Make captureImage() an instance method
   
   Use just the instance editor component.
 - 8292948: Use bigger/different base font than the default
   
   Make potential discrepancies with not resolving the base more obvious.
 - 8292948: Make the setUp(), run/verify() sequence invocation explicit
   
   Simplify overall setup.
 - 8292948: Avoid failing to save image capture when editor == null
   
   The failure to save the image suppresses the original failure.
 - 8292948: Capitalize messages
 - 8292948: Resolve test HTML file from the classpath
   
   Don't rely on the current working directory.
 - 8292948: Adjust @summary

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/10054/files
  - new: https://git.openjdk.org/jdk/pull/10054/files/f7b5c903..c7d8f0b6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10054&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10054&range=01-02

  Stats: 69 lines in 3 files changed: 10 ins; 22 del; 37 mod
  Patch: https://git.openjdk.org/jdk/pull/10054.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10054/head:pull/10054

PR: https://git.openjdk.org/jdk/pull/10054



More information about the client-libs-dev mailing list