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

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

Issue 1306433002: Let collapsed border drawings be cacheable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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/paint/TablePainter.cpp ('k') | Source/platform/graphics/paint/DisplayItem.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 // 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ScrollbarForwardButtonStart, 84 ScrollbarForwardButtonStart,
85 ScrollbarForwardTrack, 85 ScrollbarForwardTrack,
86 ScrollbarHorizontal, // For ScrollbarThemeMacNonOverlayAPI only. 86 ScrollbarHorizontal, // For ScrollbarThemeMacNonOverlayAPI only.
87 ScrollbarThumb, 87 ScrollbarThumb,
88 ScrollbarTickmarks, 88 ScrollbarTickmarks,
89 ScrollbarTrackBackground, 89 ScrollbarTrackBackground,
90 ScrollbarVertical, // For ScrollbarThemeMacNonOverlayAPI only. 90 ScrollbarVertical, // For ScrollbarThemeMacNonOverlayAPI only.
91 SelectionGap, 91 SelectionGap,
92 SelectionTint, 92 SelectionTint,
93 TableCellBackgroundFromSelfPaintingRow, // FIXME: To be deprecated. 93 TableCellBackgroundFromSelfPaintingRow, // FIXME: To be deprecated.
94 // Table collapsed borders can be painted together (e.g., left & top) bu t there are at most 4 phases of collapsed
95 // border painting for a single cell. To disambiguate these phases of co llapsed border painting, a mask is used.
96 // TableCollapsedBorderBase can be larger than TableCollapsedBorderUnali gnedBase to ensure the base lower bits are 0's.
97 TableCollapsedBorderUnalignedBase,
98 TableCollapsedBorderBase = (((TableCollapsedBorderUnalignedBase - 1) >> 4) + 1) << 4,
99 TableCollapsedBorderLast = TableCollapsedBorderBase + 0x0f,
94 VideoBitmap, 100 VideoBitmap,
95 WebPlugin, 101 WebPlugin,
96 WebFont, 102 WebFont,
97 DrawingLast = WebFont, 103 DrawingLast = WebFont,
98 104
99 CachedDrawingFirst, 105 CachedDrawingFirst,
100 CachedDrawingLast = CachedDrawingFirst + DrawingLast - DrawingFirst, 106 CachedDrawingLast = CachedDrawingFirst + DrawingLast - DrawingFirst,
101 107
102 ClipFirst, 108 ClipFirst,
103 ClipBoxPaintPhaseFirst = ClipFirst, 109 ClipBoxPaintPhaseFirst = ClipFirst,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 177
172 EndSubtreeFirst, 178 EndSubtreeFirst,
173 EndSubtreePaintPhaseFirst = EndSubtreeFirst, 179 EndSubtreePaintPhaseFirst = EndSubtreeFirst,
174 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, 180 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax,
175 EndSubtreeLast = EndSubtreePaintPhaseLast, 181 EndSubtreeLast = EndSubtreePaintPhaseLast,
176 182
177 UninitializedType, 183 UninitializedType,
178 TypeLast = UninitializedType 184 TypeLast = UninitializedType
179 }; 185 };
180 186
187 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");
189 // Bits or'ed onto TableCollapsedBorderBase to generate a real table collaps ed border type.
190 enum TableCollspaedBorderSides {
191 TableCollapsedBorderTop = 1 << 0,
192 TableCollapsedBorderRight = 1 << 1,
193 TableCollapsedBorderBottom = 1 << 2,
194 TableCollapsedBorderLeft = 1 << 3,
195 };
196
181 DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derive dSize) 197 DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derive dSize)
182 : m_client(client.displayItemClient()) 198 : m_client(client.displayItemClient())
183 , m_scope(0) 199 , m_scope(0)
184 , m_type(type) 200 , m_type(type)
185 , m_derivedSize(derivedSize) 201 , m_derivedSize(derivedSize)
186 , m_skippedCache(false) 202 , m_skippedCache(false)
187 #ifndef NDEBUG 203 #ifndef NDEBUG
188 , m_clientDebugString(client.debugName()) 204 , m_clientDebugString(client.debugName())
189 #endif 205 #endif
190 { 206 {
(...skipping 21 matching lines...) Expand all
212 && type == item.m_type 228 && type == item.m_type
213 && scope == item.m_scope; 229 && scope == item.m_scope;
214 } 230 }
215 231
216 const DisplayItemClient client; 232 const DisplayItemClient client;
217 const Type type; 233 const Type type;
218 const unsigned scope; 234 const unsigned scope;
219 }; 235 };
220 236
221 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage). 237 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage).
222 Type nonCachedType() const 238 static Type nonCachedType(Type type)
223 { 239 {
224 if (isCachedDrawingType(m_type)) 240 if (isCachedDrawingType(type))
225 return cachedDrawingTypeToDrawingType(m_type); 241 return cachedDrawingTypeToDrawingType(type);
226 if (isCachedSubtreeType(m_type)) 242 if (isCachedSubtreeType(type))
227 return cachedSubtreeTypeToBeginSubtreeType(m_type); 243 return cachedSubtreeTypeToBeginSubtreeType(type);
228 return m_type; 244 return type;
229 } 245 }
230 246
231 // Return the Id with cached type converted to non-cached type. 247 // Return the Id with cached type converted to non-cached type.
232 Id nonCachedId() const 248 Id nonCachedId() const
233 { 249 {
234 return Id(m_client, nonCachedType(), m_scope); 250 return Id(m_client, nonCachedType(m_type), m_scope);
235 } 251 }
236 252
237 virtual void replay(GraphicsContext&) { } 253 virtual void replay(GraphicsContext&) { }
238 254
239 DisplayItemClient client() const { return m_client; } 255 DisplayItemClient client() const { return m_client; }
240 Type type() const { return m_type; } 256 Type type() const { return m_type; }
241 257
242 void setScope(unsigned scope) { m_scope = scope; } 258 void setScope(unsigned scope) { m_scope = scope; }
243 unsigned scope() { return m_scope; } 259 unsigned scope() { return m_scope; }
244 260
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; 399 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0;
384 #endif 400 #endif
385 401
386 private: 402 private:
387 bool isEnd() const final { return true; } 403 bool isEnd() const final { return true; }
388 }; 404 };
389 405
390 } // namespace blink 406 } // namespace blink
391 407
392 #endif // DisplayItem_h 408 #endif // DisplayItem_h
OLDNEW
« no previous file with comments | « Source/core/paint/TablePainter.cpp ('k') | Source/platform/graphics/paint/DisplayItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698