| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DisplayItem_h | 5 #ifndef DisplayItem_h |
| 6 #define DisplayItem_h | 6 #define DisplayItem_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 BeginSubtreeLast = BeginSubtreePaintPhaseLast, | 169 BeginSubtreeLast = BeginSubtreePaintPhaseLast, |
| 170 | 170 |
| 171 EndSubtreeFirst, | 171 EndSubtreeFirst, |
| 172 EndSubtreePaintPhaseFirst = EndSubtreeFirst, | 172 EndSubtreePaintPhaseFirst = EndSubtreeFirst, |
| 173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, | 173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, |
| 174 EndSubtreeLast = EndSubtreePaintPhaseLast, | 174 EndSubtreeLast = EndSubtreePaintPhaseLast, |
| 175 | 175 |
| 176 TypeLast = EndSubtreeLast | 176 TypeLast = EndSubtreeLast |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 struct Id { |
| 180 Id(DisplayItemClient c, Type t) : client(c), type(t), scopeId(0), scopeC
ontainer(nullptr) |
| 181 { |
| 182 ASSERT(c); |
| 183 } |
| 184 |
| 185 bool operator==(const Id& other) const |
| 186 { |
| 187 return client == other.client |
| 188 && type == other.type |
| 189 && scopeId == other.scopeId |
| 190 && scopeContainer == other.scopeContainer; |
| 191 } |
| 192 |
| 193 bool equalToExceptForType(const Id& other, DisplayItem::Type overrideTyp
e) const |
| 194 { |
| 195 return client == other.client |
| 196 && type == overrideType |
| 197 && scopeId == other.scopeId |
| 198 && scopeContainer == other.scopeContainer; |
| 199 } |
| 200 |
| 201 const DisplayItemClient client; |
| 202 const Type type; |
| 203 int scopeId; |
| 204 DisplayItemClient scopeContainer; |
| 205 }; |
| 206 |
| 179 virtual ~DisplayItem() { } | 207 virtual ~DisplayItem() { } |
| 180 | 208 |
| 181 virtual void replay(GraphicsContext&) { } | 209 virtual void replay(GraphicsContext&) { } |
| 182 | 210 |
| 183 DisplayItemClient client() const { return m_client; } | 211 DisplayItemClient client() const { return m_client; } |
| 184 Type type() const { return m_type; } | 212 Type type() const { return m_type; } |
| 213 Id id() const |
| 214 { |
| 215 Id result(m_client, m_type); |
| 216 result.scopeId = m_scopeId; |
| 217 result.scopeContainer = m_scopeContainer; |
| 218 return result; |
| 219 } |
| 185 bool idsEqual(const DisplayItem& other, Type overrideType) const | 220 bool idsEqual(const DisplayItem& other, Type overrideType) const |
| 186 { | 221 { |
| 187 return m_client == other.m_client | 222 return id().equalToExceptForType(other.id(), overrideType); |
| 188 && m_type == overrideType | |
| 189 && m_scopeId == other.m_scopeId | |
| 190 && m_scopeContainer == other.m_scopeContainer; | |
| 191 } | 223 } |
| 192 | 224 |
| 193 void setScope(int scopeId, DisplayItemClient scopeContainer) | 225 void setScope(int scopeId, DisplayItemClient scopeContainer) |
| 194 { | 226 { |
| 195 m_scopeId = scopeId; | 227 m_scopeId = scopeId; |
| 196 m_scopeContainer = scopeContainer; | 228 m_scopeContainer = scopeContainer; |
| 197 } | 229 } |
| 198 | 230 |
| 199 // For DisplayItemList only. Painters should use DisplayItemCacheSkipper ins
tead. | 231 // For DisplayItemList only. Painters should use DisplayItemCacheSkipper ins
tead. |
| 200 void setSkippedCache() { m_skippedCache = true; } | 232 void setSkippedCache() { m_skippedCache = true; } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 DEFINE_CATEGORY_METHODS(EndSubtree) | 291 DEFINE_CATEGORY_METHODS(EndSubtree) |
| 260 DEFINE_PAINT_PHASE_CONVERSION_METHOD(EndSubtree) | 292 DEFINE_PAINT_PHASE_CONVERSION_METHOD(EndSubtree) |
| 261 DEFINE_CONVERSION_METHODS(SubtreeCached, subtreeCached, BeginSubtree, beginS
ubtree) | 293 DEFINE_CONVERSION_METHODS(SubtreeCached, subtreeCached, BeginSubtree, beginS
ubtree) |
| 262 DEFINE_CONVERSION_METHODS(SubtreeCached, subtreeCached, EndSubtree, endSubtr
ee) | 294 DEFINE_CONVERSION_METHODS(SubtreeCached, subtreeCached, EndSubtree, endSubtr
ee) |
| 263 DEFINE_CONVERSION_METHODS(BeginSubtree, beginSubtree, EndSubtree, endSubtree
) | 295 DEFINE_CONVERSION_METHODS(BeginSubtree, beginSubtree, EndSubtree, endSubtree
) |
| 264 | 296 |
| 265 virtual bool isBegin() const { return false; } | 297 virtual bool isBegin() const { return false; } |
| 266 virtual bool isEnd() const { return false; } | 298 virtual bool isEnd() const { return false; } |
| 267 | 299 |
| 268 #if ENABLE(ASSERT) | 300 #if ENABLE(ASSERT) |
| 269 virtual bool isEndAndPairedWith(const DisplayItem& other) const { return fal
se; } | 301 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const { return
false; } |
| 270 #endif | 302 #endif |
| 271 | 303 |
| 272 virtual bool drawsContent() const { return false; } | 304 virtual bool drawsContent() const { return false; } |
| 273 | 305 |
| 274 #ifndef NDEBUG | 306 #ifndef NDEBUG |
| 275 static WTF::String typeAsDebugString(DisplayItem::Type); | 307 static WTF::String typeAsDebugString(DisplayItem::Type); |
| 276 const WTF::String& clientDebugString() const { return m_clientDebugString; } | 308 const WTF::String& clientDebugString() const { return m_clientDebugString; } |
| 277 WTF::String asDebugString() const; | 309 WTF::String asDebugString() const; |
| 278 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; | 310 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; |
| 279 #endif | 311 #endif |
| (...skipping 29 matching lines...) Expand all Loading... |
| 309 | 341 |
| 310 private: | 342 private: |
| 311 virtual bool isBegin() const override final { return true; } | 343 virtual bool isBegin() const override final { return true; } |
| 312 }; | 344 }; |
| 313 | 345 |
| 314 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem { | 346 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem { |
| 315 protected: | 347 protected: |
| 316 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di
splayItem(client, type) { } | 348 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di
splayItem(client, type) { } |
| 317 | 349 |
| 318 #if ENABLE(ASSERT) | 350 #if ENABLE(ASSERT) |
| 319 virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0
; | 351 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
= 0; |
| 320 #endif | 352 #endif |
| 321 | 353 |
| 322 private: | 354 private: |
| 323 virtual bool isEnd() const override final { return true; } | 355 virtual bool isEnd() const override final { return true; } |
| 324 }; | 356 }; |
| 325 | 357 |
| 326 } // namespace blink | 358 } // namespace blink |
| 327 | 359 |
| 328 #endif // DisplayItem_h | 360 #endif // DisplayItem_h |
| OLD | NEW |