Page Speed Optimization Libraries
1.5.27.2
|
Classes | |
class | Transformer |
Public Member Functions | |
CssTagScanner (HtmlParse *html_parse) | |
bool | ParseCssElement (HtmlElement *element, HtmlElement::Attribute **href, const char **media, int *num_nonstandard_attributes) |
bool | ParseCssElement (HtmlElement *element, HtmlElement::Attribute **href, const char **media) |
Static Public Member Functions | |
static bool | TransformUrls (const StringPiece &contents, Writer *writer, Transformer *transformer, MessageHandler *handler) |
static bool | HasImport (const StringPiece &contents, MessageHandler *handler) |
static bool | HasUrl (const StringPiece &contents) |
Detemines whether this CSS contains a URI value (aka URL). | |
static bool | IsStylesheetOrAlternate (const StringPiece &attribute_value) |
static bool | IsAlternateStylesheet (const StringPiece &attribute_value) |
Does this rel attribute value represent an alternate stylesheet? | |
Static Public Attributes | |
static const char | kStylesheet [] |
static const char | kAlternate [] |
static const char | kUriValue [] |
static bool net_instaweb::CssTagScanner::HasImport | ( | const StringPiece & | contents, |
MessageHandler * | handler | ||
) | [static] |
Does this CSS file contain ? If so, it cannot be combined with previous CSS files. This may give false-positives, but no false-negatives.
static bool net_instaweb::CssTagScanner::IsStylesheetOrAlternate | ( | const StringPiece & | attribute_value | ) | [static] |
Does this attribute value represent a stylesheet or alternate stylesheet? Should be called with element->AttributeValue(HtmlName::kRel) as the arg.
bool net_instaweb::CssTagScanner::ParseCssElement | ( | HtmlElement * | element, |
HtmlElement::Attribute ** | href, | ||
const char ** | media, | ||
int * | num_nonstandard_attributes | ||
) |
Examines an HTML element to determine if it's a CSS link, extracting out the href, the media type (if any) and the number of nonstandard attributes found. If it's not CSS, href is set to NULL, media is set to "", and num_nonstandard_attributes is set to 0.
bool net_instaweb::CssTagScanner::ParseCssElement | ( | HtmlElement * | element, |
HtmlElement::Attribute ** | href, | ||
const char ** | media | ||
) | [inline] |
Many callers don't care about num_nonstandard_attributes, so we provide a version that discards that information.
static bool net_instaweb::CssTagScanner::TransformUrls | ( | const StringPiece & | contents, |
Writer * | writer, | ||
Transformer * | transformer, | ||
MessageHandler * | handler | ||
) | [static] |
Scans the contents of a CSS file, looking for the pattern url(xxx). Performs an arbitrary mutation on all such URLs. If xxx is quoted with single-quotes or double-quotes, those are retained and the URL inside is transformed.