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

Side by Side Diff: Source/platform/graphics/paint/DisplayItem.h

Issue 1313223002: Simplify subtree (now subsequence) caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
OLDNEW
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/ContiguousContainer.h" 9 #include "platform/graphics/ContiguousContainer.h"
10 #include "platform/graphics/paint/DisplayItemClient.h" 10 #include "platform/graphics/paint/DisplayItemClient.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 EndCompositing, 158 EndCompositing,
159 BeginTransform, 159 BeginTransform,
160 EndTransform, 160 EndTransform,
161 BeginClipPath, 161 BeginClipPath,
162 EndClipPath, 162 EndClipPath,
163 BeginFixedPosition, 163 BeginFixedPosition,
164 EndFixedPosition, 164 EndFixedPosition,
165 BeginFixedPositionContainer, 165 BeginFixedPositionContainer,
166 EndFixedPositionContainer, 166 EndFixedPositionContainer,
167 167
168 CachedSubtreeFirst, 168 BeginSubtree,
169 CachedSubtreePaintPhaseFirst = CachedSubtreeFirst, 169 EndSubtree,
170 CachedSubtreePaintPhaseLast = CachedSubtreePaintPhaseFirst + PaintPhaseM ax, 170 CachedSubtree,
chrishtr 2015/08/25 23:48:19 How about CachedStackingContext or some other more
Xianzhu 2015/08/26 23:21:06 CachedSubsequence sgtm.
171 CachedSubtreeLast = CachedSubtreePaintPhaseLast,
172
173 BeginSubtreeFirst,
174 BeginSubtreePaintPhaseFirst = BeginSubtreeFirst,
175 BeginSubtreePaintPhaseLast = BeginSubtreePaintPhaseFirst + PaintPhaseMax ,
176 BeginSubtreeLast = BeginSubtreePaintPhaseLast,
177
178 EndSubtreeFirst,
179 EndSubtreePaintPhaseFirst = EndSubtreeFirst,
180 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax,
181 EndSubtreeLast = EndSubtreePaintPhaseLast,
182 171
183 UninitializedType, 172 UninitializedType,
184 TypeLast = UninitializedType 173 TypeLast = UninitializedType
185 }; 174 };
186 175
187 static_assert(TableCollapsedBorderBase >= TableCollapsedBorderUnalignedBase, "TableCollapsedBorder types overlap with other types"); 176 static_assert(TableCollapsedBorderBase >= TableCollapsedBorderUnalignedBase, "TableCollapsedBorder types overlap with other types");
188 static_assert((TableCollapsedBorderBase & 0xf) == 0, "The lowest 4 bits of T ableCollapsedBorderBase should be zero"); 177 static_assert((TableCollapsedBorderBase & 0xf) == 0, "The lowest 4 bits of T ableCollapsedBorderBase should be zero");
189 // Bits or'ed onto TableCollapsedBorderBase to generate a real table collaps ed border type. 178 // Bits or'ed onto TableCollapsedBorderBase to generate a real table collaps ed border type.
190 enum TableCollspaedBorderSides { 179 enum TableCollspaedBorderSides {
191 TableCollapsedBorderTop = 1 << 0, 180 TableCollapsedBorderTop = 1 << 0,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 const DisplayItemClient client; 221 const DisplayItemClient client;
233 const Type type; 222 const Type type;
234 const unsigned scope; 223 const unsigned scope;
235 }; 224 };
236 225
237 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage). 226 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage).
238 static Type nonCachedType(Type type) 227 static Type nonCachedType(Type type)
239 { 228 {
240 if (isCachedDrawingType(type)) 229 if (isCachedDrawingType(type))
241 return cachedDrawingTypeToDrawingType(type); 230 return cachedDrawingTypeToDrawingType(type);
242 if (isCachedSubtreeType(type)) 231 if (type == CachedSubtree)
243 return cachedSubtreeTypeToBeginSubtreeType(type); 232 return BeginSubtree;
244 return type; 233 return type;
245 } 234 }
246 235
247 // Return the Id with cached type converted to non-cached type. 236 // Return the Id with cached type converted to non-cached type.
248 Id nonCachedId() const 237 Id nonCachedId() const
249 { 238 {
250 return Id(m_client, nonCachedType(m_type), m_scope); 239 return Id(m_client, nonCachedType(m_type), m_scope);
251 } 240 }
252 241
253 virtual void replay(GraphicsContext&) { } 242 virtual void replay(GraphicsContext&) { }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 DEFINE_PAINT_PHASE_CONVERSION_METHOD(ClipColumnBounds) 302 DEFINE_PAINT_PHASE_CONVERSION_METHOD(ClipColumnBounds)
314 303
315 DEFINE_PAIRED_CATEGORY_METHODS(FloatClip, floatClip) 304 DEFINE_PAIRED_CATEGORY_METHODS(FloatClip, floatClip)
316 DEFINE_PAINT_PHASE_CONVERSION_METHOD(FloatClip) 305 DEFINE_PAINT_PHASE_CONVERSION_METHOD(FloatClip)
317 306
318 DEFINE_PAIRED_CATEGORY_METHODS(Scroll, scroll) 307 DEFINE_PAIRED_CATEGORY_METHODS(Scroll, scroll)
319 DEFINE_PAINT_PHASE_CONVERSION_METHOD(Scroll) 308 DEFINE_PAINT_PHASE_CONVERSION_METHOD(Scroll)
320 309
321 DEFINE_PAIRED_CATEGORY_METHODS(Transform3D, transform3D); 310 DEFINE_PAIRED_CATEGORY_METHODS(Transform3D, transform3D);
322 311
323 DEFINE_CATEGORY_METHODS(CachedSubtree) 312 static bool isCachedType(Type type) { return isCachedDrawingType(type) || ty pe == CachedSubtree; }
324 DEFINE_PAINT_PHASE_CONVERSION_METHOD(CachedSubtree)
325 DEFINE_CATEGORY_METHODS(BeginSubtree)
326 DEFINE_PAINT_PHASE_CONVERSION_METHOD(BeginSubtree)
327 DEFINE_CATEGORY_METHODS(EndSubtree)
328 DEFINE_PAINT_PHASE_CONVERSION_METHOD(EndSubtree)
329 DEFINE_CONVERSION_METHODS(CachedSubtree, cachedSubtree, BeginSubtree, beginS ubtree)
330 DEFINE_CONVERSION_METHODS(CachedSubtree, cachedSubtree, EndSubtree, endSubtr ee)
331 DEFINE_CONVERSION_METHODS(BeginSubtree, beginSubtree, EndSubtree, endSubtree )
332
333 static bool isCachedType(Type type) { return isCachedDrawingType(type) || is CachedSubtreeType(type); }
334 bool isCached() const { return isCachedType(m_type); } 313 bool isCached() const { return isCachedType(m_type); }
335 static bool isCacheableType(Type type) { return isDrawingType(type) || isBeg inSubtreeType(type); } 314 static bool isCacheableType(Type type) { return isDrawingType(type) || type == BeginSubtree; }
336 bool isCacheable() const { return !skippedCache() && isCacheableType(m_type) ; } 315 bool isCacheable() const { return !skippedCache() && isCacheableType(m_type) ; }
337 316
338 virtual bool isBegin() const { return false; } 317 virtual bool isBegin() const { return false; }
339 virtual bool isEnd() const { return false; } 318 virtual bool isEnd() const { return false; }
340 319
341 #if ENABLE(ASSERT) 320 #if ENABLE(ASSERT)
342 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const { return false; } 321 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const { return false; }
343 #endif 322 #endif
344 323
345 virtual bool drawsContent() const { return false; } 324 virtual bool drawsContent() const { return false; }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; 378 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0;
400 #endif 379 #endif
401 380
402 private: 381 private:
403 bool isEnd() const final { return true; } 382 bool isEnd() const final { return true; }
404 }; 383 };
405 384
406 } // namespace blink 385 } // namespace blink
407 386
408 #endif // DisplayItem_h 387 #endif // DisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698