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/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 Loading... | |
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 TableCollapsedBorderUnalignedBase, | |
pdr.
2015/08/20 07:07:15
This represents a whole bunch of new types just fo
Xianzhu
2015/08/20 16:39:51
I know the 16 new types may look scary :), but thi
| |
95 TableCollapsedBorderBase = (((TableCollapsedBorderUnalignedBase - 1) >> 4) + 1) << 4, | |
96 TableCollapsedBorderLast = TableCollapsedBorderBase + 0x0f, | |
94 VideoBitmap, | 97 VideoBitmap, |
95 WebPlugin, | 98 WebPlugin, |
96 WebFont, | 99 WebFont, |
97 DrawingLast = WebFont, | 100 DrawingLast = WebFont, |
98 | 101 |
99 CachedDrawingFirst, | 102 CachedDrawingFirst, |
100 CachedDrawingLast = CachedDrawingFirst + DrawingLast - DrawingFirst, | 103 CachedDrawingLast = CachedDrawingFirst + DrawingLast - DrawingFirst, |
101 | 104 |
102 ClipFirst, | 105 ClipFirst, |
103 ClipBoxPaintPhaseFirst = ClipFirst, | 106 ClipBoxPaintPhaseFirst = ClipFirst, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 | 174 |
172 EndSubtreeFirst, | 175 EndSubtreeFirst, |
173 EndSubtreePaintPhaseFirst = EndSubtreeFirst, | 176 EndSubtreePaintPhaseFirst = EndSubtreeFirst, |
174 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, | 177 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, |
175 EndSubtreeLast = EndSubtreePaintPhaseLast, | 178 EndSubtreeLast = EndSubtreePaintPhaseLast, |
176 | 179 |
177 UninitializedType, | 180 UninitializedType, |
178 TypeLast = UninitializedType | 181 TypeLast = UninitializedType |
179 }; | 182 }; |
180 | 183 |
184 static_assert(TableCollapsedBorderBase >= TableCollapsedBorderUnalignedBase, "TableCollapsedBorder types overlap with other types"); | |
185 static_assert((TableCollapsedBorderBase & 0xf) == 0, "The lowest 4 bits of T ableCollapsedBorderBase should be zero"); | |
186 enum TableCollspaedBorderSides { | |
187 // Bits or'ed onto TableCollapsedBorderBase to generate a real table col lapsed border type. | |
188 TableCollapsedBorderTop = 1 << 0, | |
189 TableCollapsedBorderRight = 1 << 1, | |
190 TableCollapsedBorderBottom = 1 << 2, | |
191 TableCollapsedBorderLeft = 1 << 3, | |
192 }; | |
193 | |
181 DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derive dSize) | 194 DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derive dSize) |
182 : m_client(client.displayItemClient()) | 195 : m_client(client.displayItemClient()) |
183 , m_scope(0) | 196 , m_scope(0) |
184 , m_type(type) | 197 , m_type(type) |
185 , m_derivedSize(derivedSize) | 198 , m_derivedSize(derivedSize) |
186 , m_skippedCache(false) | 199 , m_skippedCache(false) |
187 #ifndef NDEBUG | 200 #ifndef NDEBUG |
188 , m_clientDebugString(client.debugName()) | 201 , m_clientDebugString(client.debugName()) |
189 #endif | 202 #endif |
190 { | 203 { |
(...skipping 21 matching lines...) Expand all Loading... | |
212 && type == item.m_type | 225 && type == item.m_type |
213 && scope == item.m_scope; | 226 && scope == item.m_scope; |
214 } | 227 } |
215 | 228 |
216 const DisplayItemClient client; | 229 const DisplayItemClient client; |
217 const Type type; | 230 const Type type; |
218 const unsigned scope; | 231 const unsigned scope; |
219 }; | 232 }; |
220 | 233 |
221 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage). | 234 // Convert cached type to non-cached type (e.g., Type::CachedSVGImage -> Typ e::SVGImage). |
222 Type nonCachedType() const | 235 static Type nonCachedType(Type type) |
223 { | 236 { |
224 if (isCachedDrawingType(m_type)) | 237 if (isCachedDrawingType(type)) |
225 return cachedDrawingTypeToDrawingType(m_type); | 238 return cachedDrawingTypeToDrawingType(type); |
226 if (isCachedSubtreeType(m_type)) | 239 if (isCachedSubtreeType(type)) |
227 return cachedSubtreeTypeToBeginSubtreeType(m_type); | 240 return cachedSubtreeTypeToBeginSubtreeType(type); |
228 return m_type; | 241 return type; |
229 } | 242 } |
230 | 243 |
231 // Return the Id with cached type converted to non-cached type. | 244 // Return the Id with cached type converted to non-cached type. |
232 Id nonCachedId() const | 245 Id nonCachedId() const |
233 { | 246 { |
234 return Id(m_client, nonCachedType(), m_scope); | 247 return Id(m_client, nonCachedType(m_type), m_scope); |
235 } | 248 } |
236 | 249 |
237 virtual void replay(GraphicsContext&) { } | 250 virtual void replay(GraphicsContext&) { } |
238 | 251 |
239 DisplayItemClient client() const { return m_client; } | 252 DisplayItemClient client() const { return m_client; } |
240 Type type() const { return m_type; } | 253 Type type() const { return m_type; } |
241 | 254 |
242 void setScope(unsigned scope) { m_scope = scope; } | 255 void setScope(unsigned scope) { m_scope = scope; } |
243 unsigned scope() { return m_scope; } | 256 unsigned scope() { return m_scope; } |
244 | 257 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; | 396 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; |
384 #endif | 397 #endif |
385 | 398 |
386 private: | 399 private: |
387 bool isEnd() const final { return true; } | 400 bool isEnd() const final { return true; } |
388 }; | 401 }; |
389 | 402 |
390 } // namespace blink | 403 } // namespace blink |
391 | 404 |
392 #endif // DisplayItem_h | 405 #endif // DisplayItem_h |
OLD | NEW |