OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #define DEFINE_CONTENT_DATA_TYPE_CASTS(typeName) \ | 69 #define DEFINE_CONTENT_DATA_TYPE_CASTS(typeName) \ |
70 DEFINE_TYPE_CASTS(typeName##ContentData, ContentData, content, content->is##
typeName(), content.is##typeName()) | 70 DEFINE_TYPE_CASTS(typeName##ContentData, ContentData, content, content->is##
typeName(), content.is##typeName()) |
71 | 71 |
72 class ImageContentData FINAL : public ContentData { | 72 class ImageContentData final : public ContentData { |
73 friend class ContentData; | 73 friend class ContentData; |
74 public: | 74 public: |
75 const StyleImage* image() const { return m_image.get(); } | 75 const StyleImage* image() const { return m_image.get(); } |
76 StyleImage* image() { return m_image.get(); } | 76 StyleImage* image() { return m_image.get(); } |
77 void setImage(PassRefPtr<StyleImage> image) { m_image = image; } | 77 void setImage(PassRefPtr<StyleImage> image) { m_image = image; } |
78 | 78 |
79 virtual bool isImage() const OVERRIDE { return true; } | 79 virtual bool isImage() const override { return true; } |
80 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE
; | 80 virtual RenderObject* createRenderer(Document&, RenderStyle*) const override
; |
81 | 81 |
82 virtual bool equals(const ContentData& data) const OVERRIDE | 82 virtual bool equals(const ContentData& data) const override |
83 { | 83 { |
84 if (!data.isImage()) | 84 if (!data.isImage()) |
85 return false; | 85 return false; |
86 return *static_cast<const ImageContentData&>(data).image() == *image(); | 86 return *static_cast<const ImageContentData&>(data).image() == *image(); |
87 } | 87 } |
88 | 88 |
89 private: | 89 private: |
90 ImageContentData(PassRefPtr<StyleImage> image) | 90 ImageContentData(PassRefPtr<StyleImage> image) |
91 : m_image(image) | 91 : m_image(image) |
92 { | 92 { |
93 } | 93 } |
94 | 94 |
95 virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE | 95 virtual PassOwnPtr<ContentData> cloneInternal() const override |
96 { | 96 { |
97 RefPtr<StyleImage> image = const_cast<StyleImage*>(this->image()); | 97 RefPtr<StyleImage> image = const_cast<StyleImage*>(this->image()); |
98 return create(image.release()); | 98 return create(image.release()); |
99 } | 99 } |
100 | 100 |
101 RefPtr<StyleImage> m_image; | 101 RefPtr<StyleImage> m_image; |
102 }; | 102 }; |
103 | 103 |
104 DEFINE_CONTENT_DATA_TYPE_CASTS(Image); | 104 DEFINE_CONTENT_DATA_TYPE_CASTS(Image); |
105 | 105 |
106 class TextContentData FINAL : public ContentData { | 106 class TextContentData final : public ContentData { |
107 friend class ContentData; | 107 friend class ContentData; |
108 public: | 108 public: |
109 const String& text() const { return m_text; } | 109 const String& text() const { return m_text; } |
110 void setText(const String& text) { m_text = text; } | 110 void setText(const String& text) { m_text = text; } |
111 | 111 |
112 virtual bool isText() const OVERRIDE { return true; } | 112 virtual bool isText() const override { return true; } |
113 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE
; | 113 virtual RenderObject* createRenderer(Document&, RenderStyle*) const override
; |
114 | 114 |
115 virtual bool equals(const ContentData& data) const OVERRIDE | 115 virtual bool equals(const ContentData& data) const override |
116 { | 116 { |
117 if (!data.isText()) | 117 if (!data.isText()) |
118 return false; | 118 return false; |
119 return static_cast<const TextContentData&>(data).text() == text(); | 119 return static_cast<const TextContentData&>(data).text() == text(); |
120 } | 120 } |
121 | 121 |
122 private: | 122 private: |
123 TextContentData(const String& text) | 123 TextContentData(const String& text) |
124 : m_text(text) | 124 : m_text(text) |
125 { | 125 { |
126 } | 126 } |
127 | 127 |
128 virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE { return crea
te(text()); } | 128 virtual PassOwnPtr<ContentData> cloneInternal() const override { return crea
te(text()); } |
129 | 129 |
130 String m_text; | 130 String m_text; |
131 }; | 131 }; |
132 | 132 |
133 DEFINE_CONTENT_DATA_TYPE_CASTS(Text); | 133 DEFINE_CONTENT_DATA_TYPE_CASTS(Text); |
134 | 134 |
135 class CounterContentData FINAL : public ContentData { | 135 class CounterContentData final : public ContentData { |
136 friend class ContentData; | 136 friend class ContentData; |
137 public: | 137 public: |
138 const CounterContent* counter() const { return m_counter.get(); } | 138 const CounterContent* counter() const { return m_counter.get(); } |
139 void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = counter; } | 139 void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = counter; } |
140 | 140 |
141 virtual bool isCounter() const OVERRIDE { return true; } | 141 virtual bool isCounter() const override { return true; } |
142 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE
; | 142 virtual RenderObject* createRenderer(Document&, RenderStyle*) const override
; |
143 | 143 |
144 private: | 144 private: |
145 CounterContentData(PassOwnPtr<CounterContent> counter) | 145 CounterContentData(PassOwnPtr<CounterContent> counter) |
146 : m_counter(counter) | 146 : m_counter(counter) |
147 { | 147 { |
148 } | 148 } |
149 | 149 |
150 virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE | 150 virtual PassOwnPtr<ContentData> cloneInternal() const override |
151 { | 151 { |
152 OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counte
r())); | 152 OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counte
r())); |
153 return create(counterData.release()); | 153 return create(counterData.release()); |
154 } | 154 } |
155 | 155 |
156 virtual bool equals(const ContentData& data) const OVERRIDE | 156 virtual bool equals(const ContentData& data) const override |
157 { | 157 { |
158 if (!data.isCounter()) | 158 if (!data.isCounter()) |
159 return false; | 159 return false; |
160 return *static_cast<const CounterContentData&>(data).counter() == *count
er(); | 160 return *static_cast<const CounterContentData&>(data).counter() == *count
er(); |
161 } | 161 } |
162 | 162 |
163 OwnPtr<CounterContent> m_counter; | 163 OwnPtr<CounterContent> m_counter; |
164 }; | 164 }; |
165 | 165 |
166 DEFINE_CONTENT_DATA_TYPE_CASTS(Counter); | 166 DEFINE_CONTENT_DATA_TYPE_CASTS(Counter); |
167 | 167 |
168 class QuoteContentData FINAL : public ContentData { | 168 class QuoteContentData final : public ContentData { |
169 friend class ContentData; | 169 friend class ContentData; |
170 public: | 170 public: |
171 QuoteType quote() const { return m_quote; } | 171 QuoteType quote() const { return m_quote; } |
172 void setQuote(QuoteType quote) { m_quote = quote; } | 172 void setQuote(QuoteType quote) { m_quote = quote; } |
173 | 173 |
174 virtual bool isQuote() const OVERRIDE { return true; } | 174 virtual bool isQuote() const override { return true; } |
175 virtual RenderObject* createRenderer(Document&, RenderStyle*) const OVERRIDE
; | 175 virtual RenderObject* createRenderer(Document&, RenderStyle*) const override
; |
176 | 176 |
177 virtual bool equals(const ContentData& data) const OVERRIDE | 177 virtual bool equals(const ContentData& data) const override |
178 { | 178 { |
179 if (!data.isQuote()) | 179 if (!data.isQuote()) |
180 return false; | 180 return false; |
181 return static_cast<const QuoteContentData&>(data).quote() == quote(); | 181 return static_cast<const QuoteContentData&>(data).quote() == quote(); |
182 } | 182 } |
183 | 183 |
184 private: | 184 private: |
185 QuoteContentData(QuoteType quote) | 185 QuoteContentData(QuoteType quote) |
186 : m_quote(quote) | 186 : m_quote(quote) |
187 { | 187 { |
188 } | 188 } |
189 | 189 |
190 virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE { return crea
te(quote()); } | 190 virtual PassOwnPtr<ContentData> cloneInternal() const override { return crea
te(quote()); } |
191 | 191 |
192 QuoteType m_quote; | 192 QuoteType m_quote; |
193 }; | 193 }; |
194 | 194 |
195 DEFINE_CONTENT_DATA_TYPE_CASTS(Quote); | 195 DEFINE_CONTENT_DATA_TYPE_CASTS(Quote); |
196 | 196 |
197 inline bool operator==(const ContentData& a, const ContentData& b) | 197 inline bool operator==(const ContentData& a, const ContentData& b) |
198 { | 198 { |
199 return a.equals(b); | 199 return a.equals(b); |
200 } | 200 } |
201 | 201 |
202 inline bool operator!=(const ContentData& a, const ContentData& b) | 202 inline bool operator!=(const ContentData& a, const ContentData& b) |
203 { | 203 { |
204 return !(a == b); | 204 return !(a == b); |
205 } | 205 } |
206 | 206 |
207 } // namespace blink | 207 } // namespace blink |
208 | 208 |
209 #endif // ContentData_h | 209 #endif // ContentData_h |
OLD | NEW |