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

Side by Side Diff: third_party/WebKit/Source/core/css/properties/README.md

Issue 2746793002: Added core/css/properties/README.md. (Closed)
Patch Set: Addressed reviewer comments. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Property APIs
2
3 This directory contains implementations for CSS property APIs, as well as Utils
4 files containing functions commonly used by the property APIs.
5
6 A CSS property API represents a single CSS property or a group of CSS
7 properties, and defines the logic for that property or group of properties.
8
9 Examples:
10
11 * A single property API: the `CSSPropertyAPILineHeight` class is used only by
12 the `line-height` property
13 * A group of properties that share logic: the `CSSPropertyAPIImage` class
14 is shared by the `border-image-source` and `list-style-image` properties.
15
16 Status (March 16 2017): Eventually, all logic pertaining to a single property
17 should be found only within its CSS property API. Currently, the code base is in
18 a transitional state and property specific logic is still scattered around the
19 code base. See Project Ribbon
20 [tracking bug](https://bugs.chromium.org/p/chromium/issues/detail?id=545324) and
21 [design doc](https://docs.google.com/document/d/1ywjUTmnxF5FXlpUTuLpint0w4TdSsjJ zdWJqmhNzlss/edit#heading=h.1ckibme4i78b)
22 for details of progress.
23
24 ## How to add a new property API
25
26 1. Add a .cpp file to this directory named
27 `CSSPropertyAPI<Property/GroupName>.cpp`
28 2. Implement the property API in the .cpp file
29 1. Add `#include "core/css/properties/CSSPropertyAPI<Property/GroupName>.h" `
30 (this will be a generated file)
31 2. Implement the required methods on the API, e.g. `parseSingleValue`
32 3. If logic is required by multiple property APIs you may need to create a new
33 Utils file.
34 4. Add the new property to `core/css/CSSProperties.json5`. Ensure that you
35 include the 'api_class' flag and the 'api_methods' flag so that the API
36 files are generated correctly (see
37 [CSSProperties.json5](https://cs.chromium.org/chromium/src/third_party/WebKi t/Source/core/css/CSSProperties.json5)
38 for more details)
39 5. Add new files to BUILD files
40 1. Add the new .cpp file to
41 [core/css/BUILD.gn](https://codesearch.chromium.org/chromium/src/third_p arty/WebKit/Source/core/css/BUILD.gn)
42 in the `blink_core_sources` target's `sources` parameter
43 2. Add the generated .h file to
44 [core/BUILD.gn](https://codesearch.chromium.org/chromium/src/third_party /WebKit/Source/core/BUILD.gn)
45 in the `css_properties` target's `outputs` parameter
46
47 See [this example CL](https://codereview.chromium.org/2735093005), which
48 converts the existing line-height property to use the CSSPropertyAPI design.
49 This new line-height property API only implements the parseSingleValue method,
50 using
51 [CSSPropertyFontUtils.cpp](https://cs.chromium.org/chromium/src/third_party/WebK it/Source/core/css/properties/CSSPropertyFontUtils.h)
52 to access shared font logic.
OLDNEW
« 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