19 #ifndef PAGESPEED_KERNEL_HTML_HTML_NODE_H_
20 #define PAGESPEED_KERNEL_HTML_HTML_NODE_H_
25 #include "base/logging.h"
32 namespace net_instaweb {
37 typedef std::list<HtmlEvent*> HtmlEventList;
38 typedef HtmlEventList::iterator HtmlEventListIterator;
49 virtual bool live()
const = 0;
55 virtual void MarkAsDead(
const HtmlEventListIterator&
end) = 0;
58 return arena->Allocate(size);
62 LOG(FATAL) <<
"HtmlNode must not be deleted directly.";
78 HtmlEventList* queue) = 0;
81 virtual HtmlEventListIterator
begin()
const = 0;
83 virtual HtmlEventListIterator
end()
const = 0;
86 void operator delete(
void* ptr) {
87 LOG(FATAL) <<
"HtmlNode must not be deleted directly.";
97 void set_parent(
HtmlElement* parent) { parent_ = parent; }
106 virtual bool live()
const {
return (data_.get() != NULL) && data_->is_live_; }
110 const GoogleString& contents()
const {
return data_->contents_; }
111 virtual HtmlEventListIterator
begin()
const {
114 virtual HtmlEventListIterator
end()
const {
117 void set_iter(
const HtmlEventListIterator& iter) {
121 void FreeData() { data_.reset(NULL); }
124 HtmlLeafNode(HtmlElement* parent,
const HtmlEventListIterator& iter,
125 const StringPiece& contents);
133 Data(
const HtmlEventListIterator& iter,
const StringPiece& contents)
134 : contents_(contents.data(), contents.size()),
140 HtmlEventListIterator iter_;
143 scoped_ptr<Data> data_;
154 HtmlEventList* queue);
158 const StringPiece& contents,
159 const HtmlEventListIterator& iter)
170 void Append(
const StringPiece& str) {
180 HtmlEventList* queue);
184 const StringPiece& contents,
185 const HtmlEventListIterator& iter)
200 HtmlEventList* queue);
204 const StringPiece& contents,
205 const HtmlEventListIterator& iter)
220 HtmlEventList* queue);
224 const StringPiece& contents,
225 const HtmlEventListIterator& iter)
240 HtmlEventList* queue);
244 const StringPiece& contents,
245 const HtmlEventListIterator& iter)
Definition: html_node.h:103
virtual void SynthesizeEvents(const HtmlEventListIterator &iter, HtmlEventList *queue)
GoogleString * mutable_contents()
Definition: html_node.h:129
Leaf node representing raw characters in HTML.
Definition: html_node.h:167
virtual void SynthesizeEvents(const HtmlEventListIterator &iter, HtmlEventList *queue)
Definition: html_parse.h:88
Definition: html_element.h:42
virtual void MarkAsDead(const HtmlEventListIterator &end)
virtual HtmlEventListIterator end() const =0
Return an iterator pointing to the last event associated with this node.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual HtmlEventListIterator begin() const
Return an iterator pointing to the first event associated with this node.
Definition: html_node.h:111
Definition: html_node.h:43
virtual void SynthesizeEvents(const HtmlEventListIterator &iter, HtmlEventList *queue)=0
Definition: html_testing_peer.h:33
Leaf node representing an HTML directive.
Definition: html_node.h:233
virtual void SynthesizeEvents(const HtmlEventListIterator &iter, HtmlEventList *queue)
Leaf node representing a CDATA section.
Definition: html_node.h:147
Definition: html_lexer.h:45
Leaf node representing an HTML IE directive.
Definition: html_node.h:213
virtual void MarkAsDead(const HtmlEventListIterator &end)=0
virtual HtmlEventListIterator begin() const =0
Return an iterator pointing to the first event associated with this node.
virtual void SynthesizeEvents(const HtmlEventListIterator &iter, HtmlEventList *queue)
HtmlNode(HtmlElement *parent)
Definition: html_node.h:71
virtual HtmlEventListIterator end() const
Return an iterator pointing to the last event associated with this node.
Definition: html_node.h:114