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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl

Issue 2886093002: Add class level comments to ComputedStyleBase. (Closed)
Patch Set: Rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac954700c5542ff38b67240ce8b6dd17ea13dd78..a36ebde395f4c5681115aae93acafd6799fa36ae 100644
--- a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl
@@ -47,12 +47,45 @@ 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 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>
class CORE_EXPORT ComputedStyleBase {
public:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698