Bug 94805 - webkit does not adjust a view unit based font size until the page is refreshed (premature optimisation?)
Summary: webkit does not adjust a view unit based font size until the page is refreshe...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://m8y.org/tmp/testcase272.xhtml
Depends on:
Reported: 2012-08-23 06:41 PDT by nemo
Modified: 2012-10-22 08:07 PDT (History)
2 users (show)

See Also:

demo of problem (1.25 KB, application/xhtml+xml)
2012-08-23 06:42 PDT, nemo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description nemo 2012-08-23 06:41:43 PDT
This is particularly unfortunate since one of the strengths of view units is the ability to set variable font size.

Now. I'm not totally sure this is a bug in Webkit since unfortunately Internet Explorer 10 does the exact same thing.

It might be in the spec that way.
But, what you'd think *could* be done, would be that even if resizing the font continuously would be a performance issue, surely you could at least avoid the need for a manual refresh by the user by simply queuing a request to do this recalc maybe 500ms after any window resize.  That way while the window was being resized, it wouldn't trigger 'cause it'd continually be pushed back.  But as soon as it was done resizing, we'd get a nicely sized font.
Comment 1 nemo 2012-08-23 06:42:18 PDT
Created attachment 160150 [details]
demo of problem
Comment 2 nemo 2012-08-23 07:19:06 PDT
I updated http://m8y.org/tmp/testcase272.xhtml to link to http://m8y.org/tmp/testcase273.xhtml which adds a javascript workaround.
Comment 3 nemo 2012-08-23 07:56:38 PDT
Added a delay to the workaround, in the interests of performance.
Now of course, the workaround might well screw up web pages. Reloading does do that.
If anyone knows of a way to trigger this recalc without reloading, do let me know. I'd love a "nicer" JS workaround.
Comment 4 nemo 2012-08-23 09:30:46 PDT
Hm... Doing any change to the content seems to work too. Sweet.
Going to try a subtle adjustment of colour for forcing a recalc.
Comment 5 nemo 2012-08-23 09:54:04 PDT
Actually, that wasn't enough. Toggling styles was enough in the Chrome dev tool, but didn't seem to have any effect in JS.
Sooo, resorted to removing the rule and adding it back in.
That worked.
Updated http://m8y.org/tmp/testcase273.xhtml accordingly.
Comment 6 nemo 2012-08-25 06:25:03 PDT
BTW, recreating the rule doesn't seem to be enough for IE10 either, soo, going to have to try and find some other workaround there.
Comment 7 nemo 2012-08-25 06:27:08 PDT
Oh. That is. location.reload() (ugh)  *does* work in IE10 but removing the rule doesn't seem to, unless the delay matters.
Probably not too interesting to the webkit guys, but maybe interesting to other page creators who run into this bug.
Comment 8 nemo 2012-10-22 08:07:22 PDT

So, Firefox now has this in nightlies, implemented correctly.
Of the two other major browsers, IE10's brokenness is more irritating to fix, but if you guys would fix Webkit, maybe that would
put pressure on them?