If it's a URL, it obviously can't be a local file; check that first to
avoid PHP warnings about malformed paths.
Bug: 60960
Change-Id: Id784c089c3de8af79af7524ef5ab5cc2f7b8af9e
The function used to check if the $path parameter is null on every
inner loop iteration, only to effectively return an empty array if it
was. Rephrased the code to say exactly that.
(Not sure what the behavior is good for, though…)
Change-Id: I716bfde581d3ed4c02f0d9f544beb9d0a1906261
Introduce new static function, CSSMin::buildUrlValue.
Actually using such values in CSS does not work well because the
URL_REGEX is nowhere near good enough. :(
Change-Id: I04a7078dd0087bcb461fa5e5168c870d37c255f4
We would previously return the path to the local file on the
filesystem, which is useless in all cases and possibly a security
issue in some. Now we return the URL at which the file would be
accessible had it existed.
Also reordered the code around that part to make the control flow
clearer and added a test.
Change-Id: I1d5befb2ea385ae4d316c5d8c5d1fc092b64c4ff
Each can be selectively embedded by placing the /* @embed */ comment
just before the url() value. /* @embed */ at the beginning of the rule
affects all url() values appearing in it.
Three changes in existing behavior for previously supported syntax:
* /* @embed */ comments are no longer preserved in output
* rules not terminated by semicolons are correctly supported
* spaces within url() values are correctly supported
Bug: 46757
Bug: 56514
Change-Id: If9082f553fa920c606f12093f39f4a163ebacc32
The code for encoding suitable images as base64 data URIs was previously part
of the remap method of CSSMin, which greps CSS files for /* @embed */
annotations. This patch moves it into its own method, encodeImageAsDataURI.
Change-Id: I6f57116c6a6c18ff9d4e28760dd484ea2c8fc493
There's no reason why it should be protected. People sometimes use
'protected' to mean 'ancillary to the main purpose of the class', but
'protected' comes with the added cost of making the class API less
flexible. I intend to call this method in a future revision of Id052a04dd2,
but I think it should be public regardless.
Change-Id: I56365df3152df1180ce73de98202e3a91def1485
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.
Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
* No need to strip them from everywhere all over. This bug is only
caused by the presence of a trailing slash on $remote.
* To make sure everything still works before and after I added
unit tests for CSSMin in Ic9195614acfd, making this dependent
on that change.
Change-Id: Ia82048a328a056117afe0d653fe22f5429b21f5a
CSSMin::minify()'s processing of url references for path adjustment or embedding had excluded explicit fully-qualified http: and https: URLs, but was damaging others such as data: URIs that were actually hardcoded into the original CSS.
This was affecting styles used on no.wikipedia.org which embedded a few icons directly into the style sheet.
Now checking for any URL scheme rather than hardcoding a check for http & https.