Closed Bug 1620359 Opened 4 years ago Closed 4 years ago

Viewport units not correctly updated if a following font-face load doesn't cause a restyle.

Categories

(Core :: Layout, defect, P3)

74 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: beretta.christian2602, Assigned: emilio)

Details

Attachments

(3 files)

Attached image view of the problem

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

Using an external stylesheet with a font-face declaration in the header of an .HTML file.
Then I use Viewport to define size of a DIV in the CSS.

Actual results:

During the viewing of that on your browser (both mozilla firefox standard and firefox developer edition) and after rescaling the window a white box appear to fill the gap

Expected results:

After resizing of the window the won't be no white box, so the page automatically adjust.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout
Product: Firefox → Core

can you attach or link to the test case so we can look into it? thanks.

Flags: needinfo?(beretta.christian2602)

https://codepen.io/chri-b/pen/abOLygX
Please notice that in the header there is Fontawesome script kit causing the issue.

Flags: needinfo?(beretta.christian2602)
Attached file Reduced test-case.

Thanks! I could not repro with that example, but thanks to that I could build a test-case that reproduces it consistently for me.

Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true
Type: enhancement → defect
Flags: needinfo?(emilio)
Summary: Uncompatibility issue using an external stylesheet with a font-face declaration and firefox viewport: firefox doesn't rescale the viewport and a "white box" appear to fill the gap; it only disappear after page refresh. → Viewport units not correctly updated if a following font-face load doesn't cause a restyle.
Priority: -- → P3

This is probably an old-ish bug made more frequent by the font loading
optimizations.

PostRebuildAllStyleData is a bit of a misnomer, but was always calling
ClearCachedData() on the style set, even if we weren't guaranteed to restyle
every element.

This means both wasted work and correctness issues (as the "uses <rare-feature>"
bits are cleared during this call, on the assumption that we'll then visit all
elements and that'd recompute it properly).

For now, unify a bit the different code paths and only clear these bits if we're
guaranteed to restyle all elements.

I should rename this to something better in a follow-up, and ideally also
decouple the ClearCachedData() calls a bit...

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d2a5c9e9e156
Don't clear the "uses viewport units" bit when a font that doesn't cause a style change loads. r=jfkthame
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/22123 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75

(In reply to Web Platform Test Sync Bot (Matrix: #interop:mozilla.org) from comment #8)

Can't merge web-platform-tests PR due to failing upstream checks:
Github PR https://github.com/web-platform-tests/wpt/pull/22123

I think this is because my test passed one out of ten times without the patch applied... James, is that right? If so, maybe admin-merge?

Maybe we shouldn't consider the firefox-stability task to block landing Gecko patches?

Flags: needinfo?(emilio)

Err, see above ^.

Flags: needinfo?(james)
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
Flags: needinfo?(james)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: