Page Speed Optimization Libraries
1.13.35.1
|
#include "association_transformer.h"
Public Member Functions | |
AssociationTransformer (const GoogleUrl *base_url, const RewriteOptions *options, CssTagScanner::Transformer *backup_transformer, MessageHandler *handler) | |
StringStringMap * | map () |
virtual TransformStatus | Transform (GoogleString *str) |
Additional Inherited Members | |
Public Types inherited from net_instaweb::CssTagScanner::Transformer | |
enum | TransformStatus { kSuccess, kNoChange, kFailure } |
Transformer that uses a std::map to specify which URLs to rewrite to which other URLs. Used by CssFilter to rewrite subresources in CSS even when it cannot be parsed, by using AssociationSlots to update the map before transforming.
|
inline |
base_url is the URL all CSS url()s should be absolutified against, this is generally the URL for the CSS file or HTML file for inline CSS. backup_transformer is another transformer to be applied if no association has been set in AssociationTransformer's map_. It may be set to NULL if no backup is needed.
base_url, options, backup_transformer and handler must live longer than AssociationTransformer.
|
inline |
Map is exposed so that you can set associations. Each key -> value specifies that every instance of the absolute URL key should be transformed to the absolute URL value.
|
virtual |
To do the actual transformation. Call CssTagScanner::TransformUrls() with this AssociationTransformer which will call Transform() on all URLs. Transform will lookup all (absolutified) URLs in map_ and rewrite them if present (otherwise it will pass them to the backup_transformer_).
Implements net_instaweb::CssTagScanner::Transformer.