Page Speed Optimization Libraries
1.13.35.1
|
#include "css_url_encoder.h"
Public Member Functions | |
virtual void | Encode (const StringVector &urls, const ResourceContext *encoding, GoogleString *rewritten_url) const |
virtual bool | Decode (const StringPiece &url_segment, StringVector *urls, ResourceContext *dim, MessageHandler *handler) const |
Static Public Member Functions | |
static void | SetInliningImages (const RequestProperties &request_properties, ResourceContext *resource_context) |
Sets Inlining of image according to the user agent. | |
This class implements the encoding of css urls with optional additional dimension metadata. For the legacy encoding, it used to prepend characters indicating whether the user-agent allows for inlining or webp. We may need to employ distinct CSS files for these types of browsers. This information is conveyed in the ResourceContext. http://..path../W.cssfile... CSS file optimized for webp-capable browsers. http://..path../I.cssfile... CSS file optimzed for for non-webp browsers that inline. http://..path../A.cssfile... Archaic browser (ie6+7) does neither.
Note that a legacy CSS URL beginning with W., I., or A. will be misinterpreted and will not be fetchable since the Decode function will strip off the leading 2 characters.
Note that a lot of this is legacy encoding now, and that we just unconditionally use the "A." encoding and rely on content hash and metadata cache + user-agent sniffing to keep things consistent.
|
virtual |
Decode URLs from "url_segment". Note that there may be other meta-data encoded in url_segment, which this function will write into out_data, if present.
Reimplemented from net_instaweb::UrlSegmentEncoder.
|
virtual |
Encodes arbitrary text so it can be used in a url segment. A url segment must contain only characters that are legal in URLs, and exclude "/" and "." which are used for a higher level encoding scheme into which this must fit.
'data' is optional – it can be NULL and it is up to the encoder to decide what to do.
Reimplemented from net_instaweb::UrlSegmentEncoder.