Zooming in on a headache
Friday, July 1, 2011 7:28:27 PM
I haven't had much time to fiddle with Opera lately; I've mostly just been using it. Because of this I'm not sure whether a couple of new behaviours I've noticed started with 11.10 or 11.50 (or a mix of the two), but the changes they usher in have the potential to be far-reaching and also potentially limiting.
Put simply, zooming now appears to be... a little fucky. More specifically, zooming seems to have more side-effects than it used to, and these side effects, while sometimes beneficial, can also be harmful, and there doesn't seem to be a way around them.
window.inner(Width|Height)
Not so long ago, when one zoomed Opera would blithely continue to report an unzoomed viewport size when reading window.innerWidth and window.innerHeight. This could be a problem in some circumstances, to be sure: most of the time the "true" dimensions are not what you want, if you're zoomed in. There was a workaround which allowed one to find out what the zoomed size was, and though it was a somewhat ugly hack and wasn't always accurate, it nonetheless worked in all but the most extreme circumstances. Consequently you could get both data if you needed them.
Now things are different. Instead you now always get the zoomed size. Admittedly this is almost always what you'll want, but what if it's not? Now there's no way to get the true size, so you're stuck. This was a problem for me when writing improvements to my extension Make It So, as I've wanted to offer users the choice of ignoring the zoom level or not, but I cannot because Opera doesn't offer the tools to do it. Exposing the current and default zoom level to JavaScript would be useful, especially to user JS and extensions where the harm of abuse is easier to circumvent.
This is just the tip of the iceberg, though...
Media queries
This is something I haven't yet investigated much, but it seems as if the media query parser is also given zoomed values for width and height. As with the previous case, this is logical and even admirable in many situations, but also not necessarily what you want. As a trivial example, if I zoom Choose Opera as little as 220% with my usual viewport, it changes to a mobile-tailored layout which is absolutely nothing like what I'm trying to zoom in on. If what I want to do is actually zoom in on detail, I could be entirely thwarted because the detail could very well disappear. That is, to put it plain, not a good thing.
I'm not sure how one might best handle this situation. As I implied above, media queries acting on zoomed pixel values could in many situations be quite beneficial, but unlike with the JS values, it's not something you can really program around in a pinch. You'd either need to add query features (eg. (un?)zoomed-width), add some kind of switch to CSS or leave control solely in the hands of the user and add an Opera preference.
As rapidly becomes apparent, this isn't pretty. Thoughts welcome.
Conclusion
Ook.
In other words, I do wonder why zoom hasn't been more thoroughly embraced as a first-class component of Web UI. For many years full-page zooming was a quirk of Opera (and a wonderful one at that!), but now it's a pervasive feature, present in all of the common agents. Why, then, are there no standardized APIs of any kind to more intelligently work with zooming? Neither the editor's draft of Media Queries nor of CSSOM View mention zooming even once. I don't know about everyone else, but I find that's extremely surprising. I also find it's a bit of a problem.
For a while (ie. several years) I've been toting around a (modified) MIME stylesheet from Opera 7.2, but when doing a manual upgrade to Opera 9.5, I lost the stylesheet due to my own negligence.











