Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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:
net_instaweb::RefCounted< SrcSetSlotCollection >

Classes

struct  ImageCandidate
 

Public Member Functions

 SrcSetSlotCollection (RewriteDriver *driver, HtmlElement *element, HtmlElement::Attribute *attribute)
 
void Initialize (CommonFilter *filter)
 
int num_image_candidates ()
 
SrcSetSlotslot (int idx)
 may be nullptr.
 
const GoogleStringurl (int idx)
 
void set_url (int idx, GoogleString new_url)
 
const GoogleStringdescriptor (int idx)
 
HtmlElementelement () const
 
HtmlElement::Attributeattribute () const
 
CommonFilterfilter () const
 The first filter that created this slot collection. There may be others.
 
RewriteDriverdriver ()
 
int begin_line_number () const
 
int end_line_number () const
 
void Commit ()
 
- Public Member Functions inherited from net_instaweb::RefCounted< SrcSetSlotCollection >
void Release ()
 
void AddRef ()
 
bool HasOneRef ()
 

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,
HtmlElement element,
HtmlElement::Attribute attribute 
)

Note: you need to separately call Initialize() to actually create all the slots and the like. This sets up just enough to be able to compare slots.

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).

void net_instaweb::SrcSetSlotCollection::Initialize ( CommonFilter filter)

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

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: