Page Speed Optimization Libraries  1.11.33.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
net_instaweb::SrcSetSlotCollection Class Reference

#include "srcset_slot.h"

Inheritance diagram for net_instaweb::SrcSetSlotCollection:

Classes

struct  ImageCandidate
 

Public Member Functions

 SrcSetSlotCollection (RewriteDriver *driver, CommonFilter *filter, HtmlElement *element, HtmlElement::Attribute *attribute)
 
int num_image_candidates ()
 
SrcSetSlotslot (int idx)
 may be nullptr.
 
const GoogleString & url (int idx)
 
void set_url (int idx, GoogleString new_url)
 
const GoogleString & descriptor (int idx)
 
HtmlElement * element ()
 
RewriteDriverdriver ()
 
void Commit ()
 

Static Public Member Functions

static void ParseSrcSet (StringPiece input, std::vector< ImageCandidate > *out)
 
static GoogleString Serialize (const std::vector< ImageCandidate > &in)
 

Protected Member Functions

 REFCOUNT_FRIEND_DECLARATION (SrcSetSlotCollection)
 

Detailed Description

Since the various images inside a src attribute share the attribute, we hook them all up to a single SrcSetSlotCollection (which they own).

Constructor & Destructor Documentation

net_instaweb::SrcSetSlotCollection::SrcSetSlotCollection ( RewriteDriver driver,
CommonFilter filter,
HtmlElement *  element,
HtmlElement::Attribute *  attribute 
)
explicit

This will parse the passed in srcset attribute, and create all the slots, and all their resources.

Member Function Documentation

void net_instaweb::SrcSetSlotCollection::Commit ( )

This serializes everything back to the attribute. (Which is sadly quadratic, but the size should be small enough that it's more practical than trying to coordinate).

static void net_instaweb::SrcSetSlotCollection::ParseSrcSet ( StringPiece  input,
std::vector< ImageCandidate > *  out 
)
static

Parses the input srcset attribute into *out (replacing its contents), filling in the url and descriptor fields (but not trying to create resources or fill in slot).


The documentation for this class was generated from the following file: