Commit b6226310 authored by shend's avatar shend Committed by Commit bot

Add class level comments to ComputedStyleBase.

This patch adds class level comments to ComputedStyleBase.

Review-Url: https://codereview.chromium.org/2886093002
Cr-Commit-Position: refs/heads/master@{#474945}
parent e96260c1
...@@ -47,12 +47,45 @@ struct SameSizeAsComputedStyleBase { ...@@ -47,12 +47,45 @@ struct SameSizeAsComputedStyleBase {
// The generated portion of ComputedStyle. For more info, see the header comment // The generated portion of ComputedStyle. For more info, see the header comment
// in ComputedStyle.h. // in ComputedStyle.h.
//
// ComputedStyleBase is a templated class to allow it to use functions // ComputedStyleBase is a generated class that stores data members or 'fields'
// on ComputedStyle. This allows ComputedStyleBase to use hand written // used in ComputedStyle. These fields can represent CSS properties or internal
// functions it would otherwise not know about. // style information.
// It should only be templated with the ComputedStyle class and no other class //
// is allowed. // 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 child nodes (called
// '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 ComputedStyleBases to share the
// same 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.
template <class ComputedStyleFinal> template <class ComputedStyleFinal>
class CORE_EXPORT ComputedStyleBase { class CORE_EXPORT ComputedStyleBase {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment