Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: Source/core/rendering/style/ContentData.h

Issue 23731003: Have ContentData::createRenderer() take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/PseudoElement.cpp ('k') | Source/core/rendering/style/ContentData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 static PassOwnPtr<ContentData> create(PassOwnPtr<CounterContent>); 44 static PassOwnPtr<ContentData> create(PassOwnPtr<CounterContent>);
45 static PassOwnPtr<ContentData> create(QuoteType); 45 static PassOwnPtr<ContentData> create(QuoteType);
46 46
47 virtual ~ContentData() { } 47 virtual ~ContentData() { }
48 48
49 virtual bool isCounter() const { return false; } 49 virtual bool isCounter() const { return false; }
50 virtual bool isImage() const { return false; } 50 virtual bool isImage() const { return false; }
51 virtual bool isQuote() const { return false; } 51 virtual bool isQuote() const { return false; }
52 virtual bool isText() const { return false; } 52 virtual bool isText() const { return false; }
53 53
54 virtual RenderObject* createRenderer(Document*, RenderStyle*) const = 0; 54 virtual RenderObject* createRenderer(Document&, RenderStyle*) const = 0;
55 55
56 virtual PassOwnPtr<ContentData> clone() const; 56 virtual PassOwnPtr<ContentData> clone() const;
57 57
58 ContentData* next() const { return m_next.get(); } 58 ContentData* next() const { return m_next.get(); }
59 void setNext(PassOwnPtr<ContentData> next) { m_next = next; } 59 void setNext(PassOwnPtr<ContentData> next) { m_next = next; }
60 60
61 virtual bool equals(const ContentData&) const = 0; 61 virtual bool equals(const ContentData&) const = 0;
62 62
63 private: 63 private:
64 virtual PassOwnPtr<ContentData> cloneInternal() const = 0; 64 virtual PassOwnPtr<ContentData> cloneInternal() const = 0;
65 65
66 OwnPtr<ContentData> m_next; 66 OwnPtr<ContentData> m_next;
67 }; 67 };
68 68
69 class ImageContentData : public ContentData { 69 class ImageContentData : public ContentData {
70 friend class ContentData; 70 friend class ContentData;
71 public: 71 public:
72 const StyleImage* image() const { return m_image.get(); } 72 const StyleImage* image() const { return m_image.get(); }
73 StyleImage* image() { return m_image.get(); } 73 StyleImage* image() { return m_image.get(); }
74 void setImage(PassRefPtr<StyleImage> image) { m_image = image; } 74 void setImage(PassRefPtr<StyleImage> image) { m_image = image; }
75 75
76 virtual bool isImage() const OVERRIDE { return true; } 76 virtual bool isImage() const OVERRIDE { return true; }
77 virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE ; 77 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE ;
78 78
79 virtual bool equals(const ContentData& data) const OVERRIDE 79 virtual bool equals(const ContentData& data) const OVERRIDE
80 { 80 {
81 if (!data.isImage()) 81 if (!data.isImage())
82 return false; 82 return false;
83 return *static_cast<const ImageContentData&>(data).image() == *image(); 83 return *static_cast<const ImageContentData&>(data).image() == *image();
84 } 84 }
85 85
86 private: 86 private:
87 ImageContentData(PassRefPtr<StyleImage> image) 87 ImageContentData(PassRefPtr<StyleImage> image)
(...skipping 10 matching lines...) Expand all
98 RefPtr<StyleImage> m_image; 98 RefPtr<StyleImage> m_image;
99 }; 99 };
100 100
101 class TextContentData : public ContentData { 101 class TextContentData : public ContentData {
102 friend class ContentData; 102 friend class ContentData;
103 public: 103 public:
104 const String& text() const { return m_text; } 104 const String& text() const { return m_text; }
105 void setText(const String& text) { m_text = text; } 105 void setText(const String& text) { m_text = text; }
106 106
107 virtual bool isText() const OVERRIDE { return true; } 107 virtual bool isText() const OVERRIDE { return true; }
108 virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE ; 108 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE ;
109 109
110 virtual bool equals(const ContentData& data) const OVERRIDE 110 virtual bool equals(const ContentData& data) const OVERRIDE
111 { 111 {
112 if (!data.isText()) 112 if (!data.isText())
113 return false; 113 return false;
114 return static_cast<const TextContentData&>(data).text() == text(); 114 return static_cast<const TextContentData&>(data).text() == text();
115 } 115 }
116 116
117 private: 117 private:
118 TextContentData(const String& text) 118 TextContentData(const String& text)
119 : m_text(text) 119 : m_text(text)
120 { 120 {
121 } 121 }
122 122
123 virtual PassOwnPtr<ContentData> cloneInternal() const { return create(text() ); } 123 virtual PassOwnPtr<ContentData> cloneInternal() const { return create(text() ); }
124 124
125 String m_text; 125 String m_text;
126 }; 126 };
127 127
128 class CounterContentData : public ContentData { 128 class CounterContentData : public ContentData {
129 friend class ContentData; 129 friend class ContentData;
130 public: 130 public:
131 const CounterContent* counter() const { return m_counter.get(); } 131 const CounterContent* counter() const { return m_counter.get(); }
132 void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = counter; } 132 void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = counter; }
133 133
134 virtual bool isCounter() const OVERRIDE { return true; } 134 virtual bool isCounter() const OVERRIDE { return true; }
135 virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE ; 135 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE ;
136 136
137 private: 137 private:
138 CounterContentData(PassOwnPtr<CounterContent> counter) 138 CounterContentData(PassOwnPtr<CounterContent> counter)
139 : m_counter(counter) 139 : m_counter(counter)
140 { 140 {
141 } 141 }
142 142
143 virtual PassOwnPtr<ContentData> cloneInternal() const 143 virtual PassOwnPtr<ContentData> cloneInternal() const
144 { 144 {
145 OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counte r())); 145 OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counte r()));
(...skipping 10 matching lines...) Expand all
156 OwnPtr<CounterContent> m_counter; 156 OwnPtr<CounterContent> m_counter;
157 }; 157 };
158 158
159 class QuoteContentData : public ContentData { 159 class QuoteContentData : public ContentData {
160 friend class ContentData; 160 friend class ContentData;
161 public: 161 public:
162 QuoteType quote() const { return m_quote; } 162 QuoteType quote() const { return m_quote; }
163 void setQuote(QuoteType quote) { m_quote = quote; } 163 void setQuote(QuoteType quote) { m_quote = quote; }
164 164
165 virtual bool isQuote() const OVERRIDE { return true; } 165 virtual bool isQuote() const OVERRIDE { return true; }
166 virtual RenderObject* createRenderer(Document*, RenderStyle*) const OVERRIDE ; 166 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE ;
167 167
168 virtual bool equals(const ContentData& data) const OVERRIDE 168 virtual bool equals(const ContentData& data) const OVERRIDE
169 { 169 {
170 if (!data.isQuote()) 170 if (!data.isQuote())
171 return false; 171 return false;
172 return static_cast<const QuoteContentData&>(data).quote() == quote(); 172 return static_cast<const QuoteContentData&>(data).quote() == quote();
173 } 173 }
174 174
175 private: 175 private:
176 QuoteContentData(QuoteType quote) 176 QuoteContentData(QuoteType quote)
(...skipping 12 matching lines...) Expand all
189 } 189 }
190 190
191 inline bool operator!=(const ContentData& a, const ContentData& b) 191 inline bool operator!=(const ContentData& a, const ContentData& b)
192 { 192 {
193 return !(a == b); 193 return !(a == b);
194 } 194 }
195 195
196 } // namespace WebCore 196 } // namespace WebCore
197 197
198 #endif // ContentData_h 198 #endif // ContentData_h
OLDNEW
« no previous file with comments | « Source/core/dom/PseudoElement.cpp ('k') | Source/core/rendering/style/ContentData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698