RFR: 8266966: Wrong CSS properties are applied to other nodes after fix for JDK-8204568 [v2]

Ambarish Rapte arapte at openjdk.java.net
Mon May 17 19:35:09 UTC 2021


> Issue:
> When css file is added to a `Scene.getStylesheets()` of a Scene which has few controls in addition to a Label then css style of a different control gets applied to Label after Stage is hidden and shown. This is a regression of [JDK-8204568](https://bugs.openjdk.java.net/browse/JDK-8204568).
> 
> The sample program attached to JBS adds a Label, Button, CheckBox and another Label to Scene. The css style of the Button gets applied to second Label after Stage is hidden and shown.
> 
> Fix: Do not `recalculateRelativeSizeProperties()` when `resetToInitialValues()` is in progress.
> After Stage is hidden and shown, the css style is reset to initial value in method `resetToInitialValues()`, which resets the font size of a Control to default font size. This reset results in execution of method `recalculateRelativeSizeProperties()` that was added as part of fix for JDK-8204568. `recalculateRelativeSizeProperties()` uses `getStyleMap()` to get `StyleMap` of the node. In this case `getStyleMap()` returns an incorrect `StyleMap` as the reset is still in progress. 
> 
> A comment is added in this fix to explain how the StyleMap is stored and retrieved.
> Added a system test which fails before and passes after this fix.

Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:

  address review comments

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

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/504/files
  - new: https://git.openjdk.java.net/jfx/pull/504/files/4413dcca..ea0d1bcb

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=504&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=504&range=00-01

  Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jfx/pull/504.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/504/head:pull/504

PR: https://git.openjdk.java.net/jfx/pull/504


More information about the openjfx-dev mailing list