https://bugzilla.wikimedia.org/show_bug.cgi?id=43942

--- Comment #4 from Matthew Flaschen <[email protected]> ---
Sorry, I posted an example on https://gerrit.wikimedia.org/r/#/c/43117/ , since
that's where you flagged the issue.  I realize I should have posted it here
too.

Browsers will not apply screen stylesheets to print preview or the actual
printout.  However, like some other sites, we also have a printable view (e.g.
https://en.wikipedia.org/w/index.php?title=1949_U.S._Open_%28golf%29&printable=yes
).

This should apply only the print stylesheets, so you can see what it looks like
without going to actual print preview.  And it does, with one exception.

If you have a screen media query like:

'screen and (min-width: 982px)'

which we do for Vector's screen-hd, it incorrectly shows in printable view. 
This is the bug.

load.php is actually not a neutral request context in terms of printable.  That
(printable=1 or printable=0) is explicitly passed in for this reason.

On Wikipedia, the actual request with the issue is:

https://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=ext.gadget.DRN-wizard%2CReferenceTooltips%2Ccharinsert%2Cteahouse%7Cext.wikihiero%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmw.PopUpMediaTransform%7Cskins.vector&only=styles&printable=1&skin=vector&*

It sets (among other things):

div#footer {
    margin-left: 11em;
    padding: 1.25em;
}

which is from screen-hd.css.

Without the gadgets (similar to what you might find on a test wiki), it's:

https://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=skins.vector&only=styles&printable=1&skin=vector&*

For context, you can compare to printable=0 below (the regular version) to see
that the regular screen sheets are correctly excluded:

https://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=skins.vector&only=styles&printable=0&skin=vector&*

Either way, load.php calls ResourceLoader::respond, which calls
ResourceLoader::tryRespondFromFileCache.  However, printable requests are not
cached, because ResourceFileCache::useFileCache returns false since printable
is not a recognized key. (Side note, if printable requests were cached, it
would need to be added to ResourceLoaderContext::getHash).

Non-printable requests are of course cached, and this does nothing to change
caching.

It does not affect regular 'screen' stylesheets, and I included tests that
should verify.

Let me know if I can clarify.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to