> This PR supersedes #2223. > The original PR was created from master, whereas this PR is created from a > fresh branch. > > Below is a copy of the original description, but as @mrserb correctly > [pointed > out](https://github.com/openjdk/jdk/pull/2223#issuecomment-767048399), there > is actually no relevant change from CSS 2.1 to CSS 2.2, so I <strike>striked > out</strike> that part. > > ### Original Description > > @prsadhuk asked me to take over his pull request #1628, since I filed the bug > an suggested this fix. > > I thought the current behavior would be buggy, but actually the units are > quite precise. I checked the size of a text in font-size of 1 in, and it > really was approximately 1 inch. The problem is just that browsers behave > differently. > > <strike> > Swing follows the CSS 2.1 spec: > https://www.w3.org/TR/CSS21/syndata.html#length-units. > But in CSS 2.2, length units where redefined: > https://www.w3.org/TR/CSS22/syndata.html#length-units. > Now px is also an absolute unit, and there are constant conversion factors > between all absolute units. > > The CSS 2.2 spec includes the following two notes regarding this change: > > Note that if the anchor unit is the pixel unit, the physical units might > not match their physical measurements. Alternatively if the anchor unit is a > physical unit, the pixel unit might not map to a whole number of device > pixels. > > Note that this definition of the pixel unit and the physical units > differs from previous versions of CSS. In particular, in previous versions of > CSS the pixel unit and the physical units were not related by a fixed ratio: > the physical units were always tied to their physical measurements while the > pixel unit would vary to most closely match the reference pixel. (This change > was made because too much existing content relies on the assumption of 96dpi, > and breaking that assumption breaks the content.) > > So the spec changed the behavior to better support high-DPI devices with > existing content, and that is exactly my intention with this PR as well. > </strike>
Matthias Perktold has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 20 additional commits since the last revision: - Merge branch 'master' into JDK-8231286 - Merge remote-tracking branch 'upstream/master' - Remove unnecessary import - Remove unnecessary JFrame creation - Calculate conversion factors rather than hardcoding them for better precision - Link to CSS 2.2 spec from length mapping comments - Moved HtmlFontSizeTest into ./CSS/8231286 - Updated copyright year of CSS.java - Aligned length mapping comments with space after `//` - Move StyleSheet rule into body tag - ... and 10 more: https://git.openjdk.java.net/jdk/compare/df416425...1040de5c ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2256/files - new: https://git.openjdk.java.net/jdk/pull/2256/files/db90d0a7..1040de5c Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2256&range=05 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2256&range=04-05 Stats: 119128 lines in 2976 files changed: 46329 ins; 42875 del; 29924 mod Patch: https://git.openjdk.java.net/jdk/pull/2256.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2256/head:pull/2256 PR: https://git.openjdk.java.net/jdk/pull/2256