1{
2  // This file specifies the fields we want to diff in the various diff functions
3  // in ComputedStyle.
4
5  parameters: {
6    // The name parameter represents the name of the function to be created.
7
8    fields_to_diff: {
9      default: [],
10    },
11
12    // A list of methods to diff (these can be public getters of fields or
13    // functions that use fields to determine a value).
14    // Each entry is expressed as a dict of two fields:
15    // 1. method: the method to be diffed
16    // 2. field_dependencies: lists the properties this method depends on.
17    methods_to_diff: {
18      default: [],
19    },
20
21    // A list of predicates that have the diff logic built into them and are only
22    // called by the diff functions in ComputedStyle.
23    // Each entry is expressed as a dict of two fields:
24    // 1. predicate: the predicate to be tested
25    // 2. field_dependencies: lists the properties this predicate test depends on.
26    // TODO: Note that you also have to pass in the arguments for the predicate.
27    // This may be removed in the future if we are always passing the other ComputedStyle
28    predicates_to_test: {
29      default: [],
30    },
31  },
32  data: [
33    {
34        name: "ScrollAnchorDisablingPropertyChanged",
35        fields_to_diff: ["width", "min-width", "max-width", "height", "min-height", "max-height", "margin-top", "margin-left", "margin-right", "margin-bottom",
36                  "left", "right", "top", "bottom", "padding-top",
37                  "padding-left", "padding-right", "padding-bottom",
38                  "contain-intrinsic-size"],
39        methods_to_diff: [
40          {
41            method: "GetPosition()",
42            field_dependencies: ["position"]
43          },
44        ]
45    },
46    {
47        name: "DiffNeedsReshapeAndFullLayoutAndPaintInvalidation",
48        fields_to_diff: ["font"],
49        methods_to_diff: [
50          {
51            method: "TextTransform()",
52            field_dependencies: ["text-transform"]
53          },
54          {
55            method: "WhiteSpace()",
56            field_dependencies: ["white-space"]
57          },
58          {
59            method: "Direction()",
60            field_dependencies: ["direction"]
61          },
62          {
63            method: "RtlOrdering()",
64            field_dependencies: ["-webkit-rtl-ordering"]
65          },
66          {
67            method: "GetUnicodeBidi()",
68            field_dependencies: ["unicode-bidi"]
69          },
70        ]
71    },
72    {
73        name: "DiffNeedsFullLayoutAndPaintInvalidation",
74        fields_to_diff: ["padding-top", "padding-left", "padding-right",
75                "padding-bottom", "appearance", "-webkit-line-clamp",
76                "text-overflow", "shape-margin", "order", "-webkit-highlight",
77                "text-indent", "text-align-last", "TextIndentLine", "EffectiveZoom",
78                "word-break", "overflow-wrap", "-webkit-line-break",
79                "-webkit-text-security", "hyphens", "HyphenationLimitBefore",
80                "HyphenationLimitAfter", "-webkit-hyphenate-character",
81                "image-orientation", "-webkit-ruby-position",
82                "TextEmphasisMark", "-webkit-text-emphasis-position",
83                "TextEmphasisCustomMark", "text-justify", "text-orientation",
84                "text-combine-upright", "tab-size", "text-size-adjust",
85                "list-style-image", "line-height-step",
86                "-webkit-text-stroke-width", "line-height",
87                "-webkit-border-horizontal-spacing",
88                "-webkit-border-vertical-spacing", "TextAutosizingMultiplier",
89                "NamedGridColumnLines", "NamedGridRowLines", "OrderedNamedGridColumnLines",
90                "OrderedNamedGridRowLines", "AutoRepeatNamedGridColumnLines",
91                "AutoRepeatNamedGridRowLines", "AutoRepeatOrderedNamedGridColumnLines",
92                "AutoRepeatOrderedNamedGridRowLines", "ImplicitNamedGridColumnLines",
93                "ImplicitNamedGridRowLines", "NamedGridArea", "grid-auto-rows",
94                "grid-template-rows", "grid-template-columns", "grid-auto-columns", "row-gap",
95                "NamedGridAreaRowCount", "NamedGridAreaColumnCount",
96                "GridAutoRepeatColumns", "GridAutoRepeatRows", "GridAutoRepeatColumnsInsertionPoint",
97                "GridAutoRepeatRowsInsertionPoint", "grid-auto-flow", "GridAutoRepeatColumnsType",
98                "GridAutoRepeatRowsType", "-webkit-box-flex",
99                "-webkit-box-ordinal-group", "flex-basis",
100                "flex-shrink", "flex-grow", "flex-direction", "flex-wrap", "-webkit-box-align",
101                "-webkit-box-pack", "-webkit-box-orient",
102                "grid-row-start", "grid-row-end", "grid-column-start", "grid-column-end",
103                "column-gap", "column-width", "column-rule-style",
104                "column-rule-width", "column-rule-color", "-internal-visited-column-rule-color",
105                "column-count", "HasAutoColumnCount", "HasAutoColumnWidth", "column-fill", "column-span",],
106        methods_to_diff: [
107          {
108            method: "BorderLeftWidth()",
109            field_dependencies: ["border-left-width"]
110          },
111          {
112            method: "BorderTopWidth()",
113            field_dependencies: ["border-top-width"]
114          },
115          {
116            method: "BorderBottomWidth()",
117            field_dependencies: ["border-bottom-width"]
118          },
119          {
120            method: "BorderRightWidth()",
121            field_dependencies: ["border-right-width"]
122          },
123          {
124            method: "HasPseudoElementStyle(kPseudoIdScrollbar)",
125            field_dependencies: ["StyleType"]
126          },
127          {
128            method: "BoxDirection()",
129            field_dependencies: ["-webkit-box-direction"]
130          },
131          {
132            method: "GetTextAlign()",
133            field_dependencies: ["text-align"]
134          },
135          {
136            method: "GetWritingMode()",
137            field_dependencies: ["writing-mode"]
138          },
139          {
140            method: "OverflowX()",
141            field_dependencies: ["overflow-x"]
142          },
143          {
144            method: "OverflowY()",
145            field_dependencies: ["overflow-y"]
146          },
147          {
148            method: "Clear()",
149            field_dependencies: ["clear"]
150          },
151          {
152            method: "Floating()",
153            field_dependencies: ["float"]
154          },
155          {
156            method: "DisplayLayoutCustomName()",
157            field_dependencies: ["DisplayLayoutCustomName"]
158          },
159          {
160            method: "OriginalDisplay()",
161            field_dependencies: ["OriginalDisplay"]
162          },
163        ],
164        predicates_to_test: [
165          {
166            predicate: "a.TextShadowDataEquivalent(b)",
167            field_dependencies: ["text-shadow"]
168          },
169          {
170            predicate: "a.QuotesDataEquivalent(b)",
171            field_dependencies: ["quotes"]
172          },
173          {
174            predicate: "a.OpacityChangedStackingContext(b)",
175            field_dependencies: ["IsStackingContextWithoutContainment",
176                                 "opacity"]
177          },
178        ]
179    },
180    {
181        name: "DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType",
182        methods_to_diff: [
183          {
184            method: "BorderCollapse()",
185            field_dependencies: ["border-collapse"]
186          },
187          {
188            method: "EmptyCells()",
189            field_dependencies: ["empty-cells"]
190          },
191          {
192            method: "CaptionSide()",
193            field_dependencies: ["caption-side"]
194          },
195          {
196            method: "TableLayout()",
197            field_dependencies: ["table-layout"]
198          },
199        ]
200    },
201    {
202        name: "DiffNeedsFullLayoutAndPaintInvalidationDisplayListItem",
203        methods_to_diff: [
204          {
205            method: "ListStyleType()",
206            field_dependencies: ["ListStyleType"]
207          },
208          {
209            method: "ListStyleStringValue()",
210            field_dependencies: ["ListStyleStringValue"]
211          },
212          {
213            method: "ListStylePosition()",
214            field_dependencies: ["list-style-position"]
215          },
216        ]
217    },
218    {
219        name: "DiffNeedsFullLayout",
220        fields_to_diff: ["width", "min-width", "max-width", "height", "min-height",
221                "max-height", "VerticalAlignLength", "box-sizing", "align-content",
222                "align-items", "align-self", "justify-content", "justify-items",
223                "justify-self", "contain", "contain-intrinsic-size", "aspect-ratio",
224                "overflow-clip-margin", "-internal-align-self-block"],
225        methods_to_diff: [
226          {
227            method: "VerticalAlign()",
228            field_dependencies: ["VerticalAlign"]
229          },
230          {
231            method: "GetPosition()",
232            field_dependencies: ["position"]
233          },
234        ]
235    },
236    {
237        name: "DiffNeedsPaintInvalidation",
238        fields_to_diff: ["-webkit-user-modify", "user-select", "image-rendering",
239                "-webkit-user-drag", "object-fit", "object-position",
240                "mix-blend-mode", "isolation", "Mask", "MaskBoxImage"],
241        methods_to_diff: [
242          {
243            method: "Visibility()",
244            field_dependencies: ["visibility"]
245          },
246          {
247            method: "PrintColorAdjust()",
248            field_dependencies: ["-webkit-print-color-adjust"]
249          },
250          {
251            method: "InsideLink()",
252            field_dependencies: ["InsideLink"]
253          },
254          {
255            method: "InternalVisitedBackgroundColor()",
256            field_dependencies: ["-internal-visited-background-color"]
257          },
258          {
259            method: "Resize()",
260            field_dependencies: ["resize"]
261          },
262          {
263            method: "UsedColorScheme()",
264            field_dependencies: ["color-scheme"]
265          },
266        ],
267        predicates_to_test: [
268          {
269            predicate: "a.BoxShadowDataEquivalent(b)",
270            field_dependencies: ["box-shadow"]
271          },
272          {
273            predicate: "a.ShapeOutsideDataEquivalent(b)",
274            field_dependencies: ["shape-outside"]
275          },
276          {
277            predicate: "a.ClipPathDataEquivalent(b)",
278            field_dependencies: ["clip-path"]
279          },
280          {
281            predicate: "a.OutlineVisuallyEqual(b)",
282            field_dependencies: ["outline-width", "outline-color", "outline-offset", "outline-style", "OutlineStyleIsAuto"]
283          },
284          {
285            predicate: "a.InternalVisitedBorderLeftColorHasNotChanged(b)",
286            field_dependencies: ["-internal-visited-border-left-color"]
287          },
288          {
289            predicate: "a.InternalVisitedBorderRightColorHasNotChanged(b)",
290            field_dependencies: ["-internal-visited-border-right-color"]
291          },
292          {
293            predicate: "a.InternalVisitedBorderBottomColorHasNotChanged(b)",
294            field_dependencies: ["-internal-visited-border-bottom-color"]
295          },
296          {
297            predicate: "a.InternalVisitedBorderTopColorHasNotChanged(b)",
298            field_dependencies: ["-internal-visited-border-top-color"]
299          },
300          {
301            predicate: "a.InternalVisitedOutlineColorHasNotChanged(b)",
302            field_dependencies: ["-internal-visited-outline-color"]
303          },
304        ]
305    },
306    {
307        name: "DiffNeedsVisualRectUpdate",
308        methods_to_diff: [
309          {
310            method: "Visibility()",
311            field_dependencies: ["visibility"]
312          },
313          {
314            method: "Resize()",
315            field_dependencies: ["resize"]
316          },
317        ],
318        predicates_to_test: [
319          {
320            predicate: "a.ClipPathDataEquivalent(b)",
321            field_dependencies: ["clip-path"]
322          }
323        ]
324    },
325    {
326        name: "UpdatePropertySpecificDifferencesZIndex",
327        fields_to_diff: ["z-index"],
328        methods_to_diff: [
329          {
330            method: "IsStackingContextWithoutContainment()",
331            field_dependencies: ["IsStackingContextWithoutContainment"]
332          },
333        ]
334    },
335    {
336        name: "DiffTransformData",
337        fields_to_diff: ["transform", "translate", "rotate",
338                    "scale", "offset-path", "offset-rotate", "transform-origin",
339                     "offset-position", "offset-anchor", "offset-distance",
340                     "transform-box"],
341    },
342    {
343        name: "UpdatePropertySpecificDifferencesTransform",
344        fields_to_diff: ["transform", "translate", "rotate",
345                    "scale", "offset-path", "offset-rotate", "transform-origin",
346                     "offset-position", "offset-anchor", "offset-distance",
347                     "perspective", "perspective-origin", "transform-box"],
348        methods_to_diff: [
349          {
350            // It's possible for the old and new style transform data to be equivalent
351            // while hasTransform() differs, as it checks a number of conditions aside
352            // from just the matrix, including but not limited to animation state.
353            method: "HasTransform()",
354            field_dependencies: ["transform", "offset-position",
355                    "HasCurrentTransformAnimation", "translate", "rotate",
356                    "scale"]
357          },
358        ]
359    },
360    {
361        name: "UpdatePropertySpecificDifferencesOpacity",
362        fields_to_diff: ["opacity"],
363    },
364    {
365        name: "UpdatePropertySpecificDifferencesFilter",
366        predicates_to_test: [
367          {
368            predicate: "a.ReflectionDataEquivalent(b)",
369            field_dependencies: ["-webkit-box-reflect"]
370          },
371          {
372            predicate: "a.FilterDataEquivalent(b)",
373            field_dependencies: ["filter"]
374          },
375        ]
376    },
377    {
378        name: "UpdatePropertySpecificDifferencesMask",
379        fields_to_diff: ["Mask", "MaskBoxImage"],
380    },
381    {
382        name: "UpdatePropertySpecificDifferencesNeedsRecomputeVisualOverflow",
383        predicates_to_test: [
384          {
385            predicate: "a.BoxShadowDataEquivalent(b)",
386            field_dependencies: ["box-shadow"]
387          },
388          {
389            predicate: "a.OutlineVisuallyEqual(b)",
390            field_dependencies: ["outline-width", "outline-color", "outline-offset", "outline-style", "OutlineStyleIsAuto"]
391          },
392          {
393            predicate: "a.BorderVisualOverflowEqual(b)",
394            field_dependencies: ["border-image"]
395          },
396          {
397            predicate: "a.TextDecorationVisualOverflowEqual(b)",
398            field_dependencies: ["text-decoration-thickness", "text-decoration-style",
399                                 "text-decoration-line", "text-underline-offset", "text-underline-position",
400                                 "AppliedTextDecorations"]
401          },
402        ]
403    },
404    {
405        name: "UpdatePropertySpecificDifferencesTextDecorationOrColor",
406        fields_to_diff: ["color", "-internal-visited-color", "text-decoration-line",
407                "text-decoration-style", "text-decoration-color",
408                "text-decoration-thickness", "text-underline-offset",
409                "-internal-visited-text-decoration-color", "TextEmphasisFill",
410                "text-underline-position", "text-decoration-skip-ink", "AppliedTextDecorations"],
411        methods_to_diff: [
412          {
413            method: "HasSimpleUnderlineInternal()",
414            field_dependencies: ["HasSimpleUnderline"]
415          },
416          {
417            method: "TextFillColor()",
418            field_dependencies: ["-webkit-text-fill-color"]
419          },
420          {
421            method: "TextStrokeColor()",
422            field_dependencies: ["-webkit-text-stroke-color"]
423          },
424          {
425            method: "TextEmphasisColor()",
426            field_dependencies: ["-webkit-text-emphasis-color"]
427          },
428          {
429            method: "InternalVisitedTextFillColor()",
430            field_dependencies: ["-internal-visited-text-fill-color"]
431          },
432          {
433            method: "InternalVisitedTextStrokeColor()",
434            field_dependencies: ["-internal-visited-text-stroke-color"]
435          },
436          {
437            method: "InternalVisitedTextEmphasisColor()",
438            field_dependencies: ["-internal-visited-text-emphasis-color"]
439          },
440          {
441            method: "CaretColor()",
442            field_dependencies: ["caret-color"]
443          },
444          {
445            method: "InternalVisitedCaretColor()",
446            field_dependencies: ["-internal-visited-caret-color"]
447          },
448        ]
449    },
450  ],
451}
452