Skip to content

Commit

Permalink
Perform monospace-related adjustment using true parent style
Browse files Browse the repository at this point in the history
There is currently some code in FontBuilder that tweaks the specified
font size if the current generic font family changes to or from
monospace. This code assumes that the FontDescription stored on the
ComputedStyle pre-CreateFont is the inherited FontDescription, but
this is no longer (always) true.

This means that declarations like font-size:1em can be applied (and
subjected to CreateFont) twice, which means that the second call to
CheckForGenericFamilyChange won't detect a change in the
monospace-ness, hence the specified size will fail to adjust.

This CL fixes this by propagating the actual parent style to
CheckForGenericFamilyChange.

Bug: 1086082, 1086680
Change-Id: Ia61a2327890f27497e4ea5f41dec00a5e0a450d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216511
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772032}
  • Loading branch information
andruud authored and chromium-wpt-export-bot committed May 27, 2020
1 parent 3ddd3b7 commit 14401ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions css/css-fonts/font-size-monospace-adjust-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE html>
<style>
textarea { font-size: 3em; }
</style>
<textarea>Textarea</textarea>
19 changes: 19 additions & 0 deletions css/css-fonts/font-size-monospace-adjust.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/1086082">
<link rel="match" href="font-size-monospace-adjust-ref.html">
<style>
textarea {
font-size: 3em;
transition: margin-bottom 1e10s steps(2, start);
margin-bottom: 10px;
}

.margin {
margin-bottom: 20px;
}
</style>
<textarea id=textarea>Textarea</textarea>
<script>
document.documentElement.offsetTop;
textarea.classList.toggle('margin');
</script>

0 comments on commit 14401ce

Please sign in to comment.