Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
net_instaweb::CriticalSelectorFilter Class Reference
Inheritance diagram for net_instaweb::CriticalSelectorFilter:
net_instaweb::CssSummarizerBase net_instaweb::RewriteFilter net_instaweb::CommonFilter

Public Member Functions

 CriticalSelectorFilter (RewriteDriver *rewrite_driver)
 
virtual const char * Name () const
 
virtual const char * id () const
 
virtual
RewriteDriver::InlineAuthorizationPolicy 
AllowUnauthorizedDomain () const
 
virtual bool IntendedForInlining () const
 Selectors are inlined into the html.
 
- Public Member Functions inherited from net_instaweb::CssSummarizerBase
 CssSummarizerBase (RewriteDriver *driver)
 
- Public Member Functions inherited from net_instaweb::RewriteFilter
 RewriteFilter (RewriteDriver *driver)
 
virtual const UrlSegmentEncoder * encoder () const
 
virtual bool ComputeOnTheFly () const
 
virtual RewriteContextMakeNestedRewriteContext (RewriteContext *parent, const ResourceSlotPtr &slot)
 
virtual void EncodeUserAgentIntoResourceContext (ResourceContext *context) const
 
virtual const
RewriteOptions::Filter
RelatedFilters (int *num_filters) const
 
virtual const StringPieceVector * RelatedOptions () const
 
- Public Member Functions inherited from net_instaweb::CommonFilter
 CommonFilter (RewriteDriver *driver)
 
const GoogleUrl & base_url () const
 Getters. More...
 
const GoogleUrl & decoded_base_url () const
 
RewriteDriverdriver () const
 
HtmlElement * noscript_element () const
 
void InsertNodeAtBodyEnd (HtmlNode *data)
 
virtual void StartDocument ()
 Note: Don't overload these methods, overload the implementers instead!
 
virtual void StartElement (HtmlElement *element)
 
virtual void EndElement (HtmlElement *element)
 
ResourcePtr CreateInputResource (StringPiece input_url, bool *is_authorized)
 
ResourcePtr CreateInputResourceOrInsertDebugComment (StringPiece input_url, HtmlElement *element)
 
void ResolveUrl (StringPiece input_url, GoogleUrl *out_url)
 
bool BaseUrlIsValid () const
 
bool DebugMode () const
 
bool CanAddPagespeedOnloadToImage (const HtmlElement &)
 
virtual void LogFilterModifiedContent ()
 

Static Public Attributes

static const char kAddStylesFunction []
 
static const char kAddStylesInvocation []
 
static const char kApplyFlushEarlyCss []
 
static const char kInvokeFlushEarlyCssTemplate []
 
static const char kMoveScriptId []
 
static const char kNoscriptStylesClass []
 
- Static Public Attributes inherited from net_instaweb::CssSummarizerBase
static const char kNumCssUsedForCriticalCssComputation []
 
static const char kNumCssNotUsedForCriticalCssComputation []
 
- Static Public Attributes inherited from net_instaweb::CommonFilter
static const char kCreateResourceFailedDebugMsg []
 Debug message to be inserted when resource creation fails.
 

Protected Member Functions

virtual void Summarize (Css::Stylesheet *stylesheet, GoogleString *out) const
 
virtual void RenderSummary (int pos, HtmlElement *element, HtmlCharactersNode *char_node, bool *is_element_deleted)
 
virtual void WillNotRenderSummary (int pos, HtmlElement *element, HtmlCharactersNode *char_node, bool *is_element_deleted)
 
virtual GoogleString CacheKeySuffix () const
 
virtual void StartDocumentImpl ()
 Parser callbacks.
 
virtual void EndDocument ()
 
virtual void RenderDone ()
 
virtual void DetermineEnabled (GoogleString *disabled_reason)
 Filter control API.
 
- Protected Member Functions inherited from net_instaweb::CssSummarizerBase
virtual bool MustSummarize (HtmlElement *element) const
 
virtual void SummariesDone ()
 
int NumStyles () const
 
const SummaryInfoGetSummaryForStyle (int pos) const
 
virtual void StartElementImpl (HtmlElement *element)
 
virtual void Characters (HtmlCharactersNode *characters)
 
virtual void EndElementImpl (HtmlElement *element)
 
virtual RewriteContextMakeRewriteContext ()
 
- Protected Member Functions inherited from net_instaweb::RewriteFilter
virtual const char * LoggingId ()
 This class logs using id().
 
- Protected Member Functions inherited from net_instaweb::CommonFilter
ServerContextserver_context () const
 
const RewriteOptionsrewrite_options ()
 

Additional Inherited Members

- Static Public Member Functions inherited from net_instaweb::CssSummarizerBase
static void InitStats (Statistics *statistics)
 
- Static Public Member Functions inherited from net_instaweb::RewriteFilter
static StringPiece GetCharsetForScript (const Resource *script, const StringPiece attribute_charset, const StringPiece enclosing_charset)
 
static GoogleString GetCharsetForStylesheet (const Resource *stylesheet, const StringPiece attribute_charset, const StringPiece enclosing_charset)
 
- Static Public Member Functions inherited from net_instaweb::CommonFilter
static bool ExtractMetaTagDetails (const HtmlElement &element, const ResponseHeaders *headers, GoogleString *content, GoogleString *mime_type, GoogleString *charset)
 
- Protected Types inherited from net_instaweb::CssSummarizerBase
enum  SummaryState {
  kSummaryOk, kSummaryStillPending, kSummaryCssParseError, kSummaryResourceCreationFailed,
  kSummaryInputUnavailable, kSummarySlotRemoved
}
 

Member Function Documentation

virtual RewriteDriver::InlineAuthorizationPolicy net_instaweb::CriticalSelectorFilter::AllowUnauthorizedDomain ( ) const
inlinevirtual

This filter needs access to all critical selectors (even those from unauthorized domains) in order to inline them into HTML. Inlining css from unauthorized domains into HTML is considered safe because it does not cause any new content to be executed compared to the unoptimized page.

Reimplemented from net_instaweb::CommonFilter.

virtual GoogleString net_instaweb::CriticalSelectorFilter::CacheKeySuffix ( ) const
protectedvirtual

Since our computation depends on the selectors that are relevant to the webpage, we incorporate them into the cache key as well.

Reimplemented from net_instaweb::CssSummarizerBase.

virtual void net_instaweb::CriticalSelectorFilter::RenderSummary ( int  pos,
HtmlElement *  element,
HtmlCharactersNode *  char_node,
bool *  is_element_deleted 
)
protectedvirtual

This can be optionally overridden to modify a CSS element based on a successfully computed summary. It might not be invoked if cached information is not readily available, and will not be invoked if CSS parsing failed or some other error occurred. Invocation occurs from a thread with HTML parser context state, so both DOM modification and GetSummaryForStyle() are safe to use. If invoked, the method will be called before SummariesDone().

pos is the position of the element in the summary table.

element points to the <link> or <style> element that was summarized. If the element was a <style>, char_node will also point to its contents node; otherwise it will be NULL. Overrides need to set is_element_deleted to true if they delete the element.

The default implementation does nothing.

Reimplemented from net_instaweb::CssSummarizerBase.

virtual void net_instaweb::CriticalSelectorFilter::Summarize ( Css::Stylesheet *  stylesheet,
GoogleString *  out 
) const
protectedvirtual

Overrides of CssSummarizerBase summary API. These help us compute the critical portions of the various fragments in the page, and to write them out to the page. We also use this to pick up the output of filters before us, like rewrite_css; so we run this even on things that will not contain on-screen critical CSS.

Implements net_instaweb::CssSummarizerBase.

virtual void net_instaweb::CriticalSelectorFilter::WillNotRenderSummary ( int  pos,
HtmlElement *  element,
HtmlCharactersNode *  char_node,
bool *  is_element_deleted 
)
protectedvirtual

Like RenderSummary, but called in cases where we're unable to render a summary for some reason (including not being able to compute one). Note: not called when we're canceled due to disable_further_processing.

Like with RenderSummary, this corresponds to entry [pos] in the summary table, and elements points to the <link> or <style> containing CSS, with char_node being non-null in case it was a <style>. Overrides need to set is_element_deleted to true if they delete the element.

Reimplemented from net_instaweb::CssSummarizerBase.


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