Chromium Code Reviews| Index: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| diff --git a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| index 28006cabf0a4aea5176a84566b9fe40aa7936b2f..de396edaa36ecb8fad60b4e4525e12092929c69a 100644 |
| --- a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| +++ b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| @@ -46,12 +46,46 @@ struct SameSizeAsComputedStyleBase { |
| // The generated portion of ComputedStyle. For more info, see the header comment |
| // in ComputedStyle.h. |
| - |
| -// ComputedStyleBase is a templated class to allow it to use functions |
| -// on ComputedStyle. This allows ComputedStyleBase to use hand written |
| -// functions it would otherwise not know about. |
| -// It should only be templated with the ComputedStyle class and no other class |
| -// is allowed. |
| +// |
| +// ComputedStyleBase is a generated class that stores data members or 'fields' |
| +// used in ComputedStyle. These fields can represent CSS properties or internal |
| +// style information. |
| +// |
| +// STORAGE: |
| +// |
| +// Fields are organised in a tree structure, where a node (called a 'group') |
| +// stores a set of fields and a set of pointers to children nodes (called |
|
suzyh_UTC10 (ex-contributor)
2017/05/19 02:33:59
Nit: I think the usual phrasing would be "child no
shend
2017/05/22 01:42:23
Done.
|
| +// 'subgroups'). We can visualise the tree structure with ComputedStyleBase as |
| +// the root node: |
| +// |
| +// ComputedStyleBase (fields: display, vertical-align, ...) |
| +// |- StyleSurroundData (fields: padding, border, ...) |
| +// |- StyleBoxData (fields: width, height, ...) |
| +// |- ... |
| +// |- StyleRareNonInheritedData (fields: box-shadow, text-overflow, ...) |
| +// |- StyleFlexibleBoxData (fields: flex-direction, flex-wrap, ...) |
| +// |- ... |
| +// |
| +// This design saves memory by allowing multiple groups to share the same |
|
suzyh_UTC10 (ex-contributor)
2017/05/19 02:33:59
Is the sharing by multiple groups within one Compu
shend
2017/05/22 01:42:23
Done.
|
| +// instance of a subgroup. For example, if a page never uses flex box |
| +// properties, then every ComputedStyleBase can share the same instance of |
| +// StyleFlexibleBoxData. Without this sharing, we would need to allocate a copy |
| +// of all the flex box fields for every ComputedStyleBase. Similarly, when an |
| +// element inherits from its parent, its ComputedStyleBase can simply share all |
| +// of its subgroups with the parent's. |
| +// |
| +// INTERFACE: |
| +// |
| +// The functions generated for a field is determined by its 'template'. For |
| +// example, a field with the 'keyword' template has only one setter, whereas an |
| +// 'external' field has an extra setter that takes an rvalue reference. A list |
| +// of the available templates can be found in CSSProperties.json5. |
| +// |
| +// ComputedStyleBase is a template class to allow it to use functions on |
| +// ComputedStyle. This allows ComputedStyleBase to use hand written functions it |
| +// would otherwise not know about. It should only be templated with the |
| +// ComputedStyle class and no other class is allowed. |
| +// TODO(nainar): Enforce this in code. |
| template <class ComputedStyleFinal> |
| class CORE_EXPORT ComputedStyleBase { |
| public: |