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 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 enum { | 32 enum { |
33 // Must be kept in sync with core/paint/PaintPhase.h. | 33 // Must be kept in sync with core/paint/PaintPhase.h. |
34 kPaintPhaseMax = 11, | 34 kPaintPhaseMax = 11, |
35 }; | 35 }; |
36 | 36 |
37 // A display item type uniquely identifies a display item of a client. | 37 // A display item type uniquely identifies a display item of a client. |
38 // Some display item types can be categorized using the following directives: | 38 // Some display item types can be categorized using the following directives: |
39 // - In enum Type: | 39 // - In enum Type: |
40 // - enum value <Category>First; | 40 // - enum value <Category>First; |
41 // - enum values of the category, first of which should equal <Category>Firs
t; | 41 // - enum values of the category, first of which should equal |
42 // (for ease of maintenance, the values should be in alphabetic order) | 42 // <Category>First (for ease of maintenance, the values should be in |
43 // - enum value <Category>Last which should be equal to the last of the enum
values of the category | 43 // alphabetic order); |
44 // - DEFINE_CATEGORY_METHODS(<Category>) to define is<Category>Type(Type) and
is<Category>() methods. | 44 // - enum value <Category>Last which should be equal to the last of the enum |
| 45 // values of the category |
| 46 // - DEFINE_CATEGORY_METHODS(<Category>) to define is<Category>Type(Type) and |
| 47 // is<Category>() methods. |
45 // | 48 // |
46 // A category or subset of a category can contain types each of which correspo
nds to a PaintPhase: | 49 // A category or subset of a category can contain types each of which |
| 50 // corresponds to a PaintPhase: |
47 // - In enum Type: | 51 // - In enum Type: |
48 // - enum value <Category>[<Subset>]PaintPhaseFirst; | 52 // - enum value <Category>[<Subset>]PaintPhaseFirst; |
49 // - enum value <Category>[<Subset>]PaintPhaseLast = <Category>[<Subset>]Pai
ntPhaseFirst + PaintPhaseMax; | 53 // - enum value <Category>[<Subset>]PaintPhaseLast = |
| 54 // <Category>[<Subset>]PaintPhaseFirst + PaintPhaseMax; |
50 // - DEFINE_PAINT_PHASE_CONVERSION_METHOD(<Category>[<Subset>]) to define | 55 // - DEFINE_PAINT_PHASE_CONVERSION_METHOD(<Category>[<Subset>]) to define |
51 // paintPhaseTo<Category>[<Subset>]Type(PaintPhase) method. | 56 // paintPhaseTo<Category>[<Subset>]Type(PaintPhase) method. |
52 // | 57 // |
53 // A category can be derived from another category, containing types each of w
hich corresponds to a | 58 // A category can be derived from another category, containing types each of |
54 // value of the latter category: | 59 // which corresponds to a value of the latter category: |
55 // - In enum Type: | 60 // - In enum Type: |
56 // - enum value <Category>First; | 61 // - enum value <Category>First; |
57 // - enum value <Category>Last = <Category>First + <BaseCategory>Last - <Bas
eCategory>First; | 62 // - enum value <Category>Last = |
58 // - DEFINE_CONVERSION_METHODS(<Category>, <category>, <BaseCategory>, <baseCa
tegory>) to define methods to | 63 // <Category>First + <BaseCategory>Last - <BaseCategory>First; |
59 // convert types between the categories; | 64 // - DEFINE_CONVERSION_METHODS(<Category>, |
| 65 // <category>, |
| 66 // <BaseCategory>, |
| 67 // <baseCategory>) |
| 68 // to define methods to convert types between the categories. |
60 enum Type { | 69 enum Type { |
61 kDrawingFirst, | 70 kDrawingFirst, |
62 kDrawingPaintPhaseFirst = kDrawingFirst, | 71 kDrawingPaintPhaseFirst = kDrawingFirst, |
63 kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax, | 72 kDrawingPaintPhaseLast = kDrawingFirst + kPaintPhaseMax, |
64 kBoxDecorationBackground, | 73 kBoxDecorationBackground, |
65 kCaret, | 74 kCaret, |
66 kColumnRules, | 75 kColumnRules, |
67 kDebugDrawing, | 76 kDebugDrawing, |
68 kDocumentBackground, | 77 kDocumentBackground, |
69 kDragImage, | 78 kDragImage, |
(...skipping 24 matching lines...) Expand all Loading... |
94 kScrollbarForwardTrack, | 103 kScrollbarForwardTrack, |
95 kScrollbarThumb, | 104 kScrollbarThumb, |
96 kScrollbarTickmarks, | 105 kScrollbarTickmarks, |
97 kScrollbarTrackBackground, | 106 kScrollbarTrackBackground, |
98 kScrollbarCompositedScrollbar, | 107 kScrollbarCompositedScrollbar, |
99 kSelectionTint, | 108 kSelectionTint, |
100 kTableCellBackgroundFromColumnGroup, | 109 kTableCellBackgroundFromColumnGroup, |
101 kTableCellBackgroundFromColumn, | 110 kTableCellBackgroundFromColumn, |
102 kTableCellBackgroundFromSection, | 111 kTableCellBackgroundFromSection, |
103 kTableCellBackgroundFromRow, | 112 kTableCellBackgroundFromRow, |
104 // Table collapsed borders can be painted together (e.g., left & top) but th
ere are at most 4 phases of collapsed | 113 // Table collapsed borders can be painted together (e.g., left & top) but |
105 // border painting for a single cell. To disambiguate these phases of collap
sed border painting, a mask is used. | 114 // there are at most 4 phases of collapsed border painting for a single |
106 // TableCollapsedBorderBase can be larger than TableCollapsedBorderUnaligned
Base to ensure the base lower bits are 0's. | 115 // cell. To disambiguate these phases of collapsed border painting, a mask |
| 116 // is used. TableCollapsedBorderBase can be larger than |
| 117 // TableCollapsedBorderUnalignedBase to ensure the base lower bits are 0's. |
107 kTableCollapsedBorderUnalignedBase, | 118 kTableCollapsedBorderUnalignedBase, |
108 kTableCollapsedBorderBase = | 119 kTableCollapsedBorderBase = |
109 (((kTableCollapsedBorderUnalignedBase - 1) >> 4) + 1) << 4, | 120 (((kTableCollapsedBorderUnalignedBase - 1) >> 4) + 1) << 4, |
110 kTableCollapsedBorderLast = kTableCollapsedBorderBase + 0x0f, | 121 kTableCollapsedBorderLast = kTableCollapsedBorderBase + 0x0f, |
111 kTableSectionBoxShadowInset, | 122 kTableSectionBoxShadowInset, |
112 kTableSectionBoxShadowNormal, | 123 kTableSectionBoxShadowNormal, |
113 kTableRowBoxShadowInset, | 124 kTableRowBoxShadowInset, |
114 kTableRowBoxShadowNormal, | 125 kTableRowBoxShadowNormal, |
115 kVideoBitmap, | 126 kVideoBitmap, |
116 kWebPlugin, | 127 kWebPlugin, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 kEndSubsequence, | 199 kEndSubsequence, |
189 | 200 |
190 kUninitializedType, | 201 kUninitializedType, |
191 kTypeLast = kUninitializedType | 202 kTypeLast = kUninitializedType |
192 }; | 203 }; |
193 | 204 |
194 static_assert(kTableCollapsedBorderBase >= kTableCollapsedBorderUnalignedBase, | 205 static_assert(kTableCollapsedBorderBase >= kTableCollapsedBorderUnalignedBase, |
195 "TableCollapsedBorder types overlap with other types"); | 206 "TableCollapsedBorder types overlap with other types"); |
196 static_assert((kTableCollapsedBorderBase & 0xf) == 0, | 207 static_assert((kTableCollapsedBorderBase & 0xf) == 0, |
197 "The lowest 4 bits of TableCollapsedBorderBase should be zero"); | 208 "The lowest 4 bits of TableCollapsedBorderBase should be zero"); |
198 // Bits or'ed onto TableCollapsedBorderBase to generate a real table collapsed
border type. | 209 // Bits or'ed onto TableCollapsedBorderBase to generate a real table collapsed |
| 210 // border type. |
199 enum TableCollapsedBorderSides { | 211 enum TableCollapsedBorderSides { |
200 TableCollapsedBorderTop = 1 << 0, | 212 TableCollapsedBorderTop = 1 << 0, |
201 TableCollapsedBorderRight = 1 << 1, | 213 TableCollapsedBorderRight = 1 << 1, |
202 TableCollapsedBorderBottom = 1 << 2, | 214 TableCollapsedBorderBottom = 1 << 2, |
203 TableCollapsedBorderLeft = 1 << 3, | 215 TableCollapsedBorderLeft = 1 << 3, |
204 }; | 216 }; |
205 | 217 |
206 DisplayItem(const DisplayItemClient& client, Type type, size_t derivedSize) | 218 DisplayItem(const DisplayItemClient& client, Type type, size_t derivedSize) |
207 : m_client(&client), | 219 : m_client(&client), |
208 m_type(type), | 220 m_type(type), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 return *m_client; | 252 return *m_client; |
241 } | 253 } |
242 Type getType() const { return m_type; } | 254 Type getType() const { return m_type; } |
243 | 255 |
244 // Size of this object in memory, used to move it with memcpy. | 256 // Size of this object in memory, used to move it with memcpy. |
245 // This is not sizeof(*this), because it needs to account for the size of | 257 // This is not sizeof(*this), because it needs to account for the size of |
246 // the derived class (i.e. runtime type). Derived classes are expected to | 258 // the derived class (i.e. runtime type). Derived classes are expected to |
247 // supply this to the DisplayItem constructor. | 259 // supply this to the DisplayItem constructor. |
248 size_t derivedSize() const { return m_derivedSize; } | 260 size_t derivedSize() const { return m_derivedSize; } |
249 | 261 |
250 // For PaintController only. Painters should use DisplayItemCacheSkipper inste
ad. | 262 // For PaintController only. Painters should use DisplayItemCacheSkipper |
| 263 // instead. |
251 void setSkippedCache() { m_skippedCache = true; } | 264 void setSkippedCache() { m_skippedCache = true; } |
252 bool skippedCache() const { return m_skippedCache; } | 265 bool skippedCache() const { return m_skippedCache; } |
253 | 266 |
254 // TODO(wkorman): Only DrawingDisplayItem needs the visual rect argument. | 267 // TODO(wkorman): Only DrawingDisplayItem needs the visual rect argument. |
255 // Consider refactoring class hierarchy to make this more explicit. | 268 // Consider refactoring class hierarchy to make this more explicit. |
256 virtual void appendToWebDisplayItemList(const IntRect&, | 269 virtual void appendToWebDisplayItemList(const IntRect&, |
257 WebDisplayItemList*) const {} | 270 WebDisplayItemList*) const {} |
258 | 271 |
259 // See comments of enum Type for usage of the following macros. | 272 // See comments of enum Type for usage of the following macros. |
260 #define DEFINE_CATEGORY_METHODS(Category) \ | 273 #define DEFINE_CATEGORY_METHODS(Category) \ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; | 422 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; |
410 #endif | 423 #endif |
411 | 424 |
412 private: | 425 private: |
413 bool isEnd() const final { return true; } | 426 bool isEnd() const final { return true; } |
414 }; | 427 }; |
415 | 428 |
416 } // namespace blink | 429 } // namespace blink |
417 | 430 |
418 #endif // DisplayItem_h | 431 #endif // DisplayItem_h |
OLD | NEW |