Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
css_outline_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_CSS_OUTLINE_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_CSS_OUTLINE_FILTER_H_
21 
22 #include <cstddef>
23 
28 
29 namespace net_instaweb {
30 
31 class HtmlCharactersNode;
32 class HtmlElement;
33 class MessageHandler;
34 class OutputResource;
35 class RewriteDriver;
36 
39  public:
40  static const char kFilterId[];
41 
42  explicit CssOutlineFilter(RewriteDriver* driver);
43  virtual ~CssOutlineFilter();
44 
45  virtual void StartDocumentImpl();
46 
47  virtual void StartElementImpl(HtmlElement* element);
48  virtual void EndElementImpl(HtmlElement* element);
49 
50  virtual void Flush();
51 
53  virtual void Characters(HtmlCharactersNode* characters);
54 
55  virtual const char* Name() const { return "OutlineCss"; }
56 
57  private:
58  bool WriteResource(const StringPiece& content, OutputResource* resource,
59  MessageHandler* handler);
60  void OutlineStyle(HtmlElement* element, const GoogleString& content);
61 
64  HtmlElement* inline_element_;
66  HtmlCharactersNode* inline_chars_;
67  size_t size_threshold_bytes_;
69 
70 
71 };
72 
73 }
74 
75 #endif
Definition: common_filter.h:47
Leaf node representing raw characters in HTML.
Definition: html_node.h:167
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: css_outline_filter.h:55
Definition: html_element.h:42
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: rewrite_driver.h:100
Filter to take explicit <style> and <script> tags and outline them to files.
Definition: css_outline_filter.h:38
Definition: message_handler.h:39
Definition: output_resource.h:44
virtual void Characters(HtmlCharactersNode *characters)
HTML Events we expect to be in <style> elements.