/work/obj-fuzz/dist/include/mozilla/ServoStyleConsts.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #ifndef mozilla_ServoStyleConsts_h |
6 | | #define mozilla_ServoStyleConsts_h |
7 | | |
8 | | /* Generated with cbindgen:0.6.2 */ |
9 | | |
10 | | /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. |
11 | | * To generate this file: |
12 | | * 1. Get the latest cbindgen using `cargo install --force cbindgen` |
13 | | * a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release |
14 | | * 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate style -o layout/style/ServoStyleConsts.h` |
15 | | */ |
16 | | |
17 | | #include <cstdint> |
18 | | #include <cstdlib> |
19 | | |
20 | | namespace mozilla { |
21 | | |
22 | | // The value for the `appearance` property. |
23 | | // |
24 | | // https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance |
25 | | // |
26 | | // NOTE(emilio): When changing this you may want to regenerate the C++ bindings |
27 | | // (see components/style/cbindgen.toml) |
28 | | enum class StyleAppearance : uint8_t { |
29 | | // No appearance at all. |
30 | | None, |
31 | | // A typical dialog button. |
32 | | Button, |
33 | | // Various arrows that go in buttons |
34 | | ButtonArrowDown, |
35 | | ButtonArrowNext, |
36 | | ButtonArrowPrevious, |
37 | | ButtonArrowUp, |
38 | | // A rectangular button that contains complex content |
39 | | // like images (e.g. HTML <button> elements) |
40 | | ButtonBevel, |
41 | | // The focus outline box inside of a button. |
42 | | ButtonFocus, |
43 | | // The caret of a text area |
44 | | Caret, |
45 | | // A dual toolbar button (e.g., a Back button with a dropdown) |
46 | | Dualbutton, |
47 | | // A groupbox. |
48 | | Groupbox, |
49 | | // A inner-spin button. |
50 | | InnerSpinButton, |
51 | | // List boxes. |
52 | | Listbox, |
53 | | // A listbox item. |
54 | | Listitem, |
55 | | // Menu Bar background |
56 | | Menubar, |
57 | | // <menu> and <menuitem> appearances |
58 | | Menuitem, |
59 | | Checkmenuitem, |
60 | | Radiomenuitem, |
61 | | // For text on non-iconic menuitems only |
62 | | Menuitemtext, |
63 | | // A dropdown list. |
64 | | Menulist, |
65 | | // The dropdown button(s) that open up a dropdown list. |
66 | | MenulistButton, |
67 | | // The text part of a dropdown list, to left of button. |
68 | | MenulistText, |
69 | | // An editable textfield with a dropdown list (a combobox). |
70 | | MenulistTextfield, |
71 | | // Menu Popup background. |
72 | | Menupopup, |
73 | | // menu checkbox/radio appearances |
74 | | Menucheckbox, |
75 | | Menuradio, |
76 | | Menuseparator, |
77 | | Menuarrow, |
78 | | // An image in the menu gutter, like in bookmarks or history. |
79 | | Menuimage, |
80 | | // A horizontal meter bar. |
81 | | Meterbar, |
82 | | // The meter bar's meter indicator. |
83 | | Meterchunk, |
84 | | // The "arrowed" part of the dropdown button that open up a dropdown list. |
85 | | MozMenulistButton, |
86 | | // For HTML's <input type=number> |
87 | | NumberInput, |
88 | | // A horizontal progress bar. |
89 | | Progressbar, |
90 | | // The progress bar's progress indicator |
91 | | Progresschunk, |
92 | | // A vertical progress bar. |
93 | | ProgressbarVertical, |
94 | | // A vertical progress chunk. |
95 | | ProgresschunkVertical, |
96 | | // A checkbox element. |
97 | | Checkbox, |
98 | | // A radio element within a radio group. |
99 | | Radio, |
100 | | // A generic container that always repaints on state changes. This is a |
101 | | // hack to make XUL checkboxes and radio buttons work. |
102 | | CheckboxContainer, |
103 | | RadioContainer, |
104 | | // The label part of a checkbox or radio button, used for painting a focus |
105 | | // outline. |
106 | | CheckboxLabel, |
107 | | RadioLabel, |
108 | | // nsRangeFrame and its subparts |
109 | | Range, |
110 | | RangeThumb, |
111 | | // The resizer background area in a status bar for the resizer widget in |
112 | | // the corner of a window. |
113 | | Resizerpanel, |
114 | | // The resizer itself. |
115 | | Resizer, |
116 | | // A slider. |
117 | | ScaleHorizontal, |
118 | | ScaleVertical, |
119 | | // A slider's thumb. |
120 | | ScalethumbHorizontal, |
121 | | ScalethumbVertical, |
122 | | // If the platform supports it, the left/right chunks of the slider thumb. |
123 | | Scalethumbstart, |
124 | | Scalethumbend, |
125 | | // The ticks for a slider. |
126 | | Scalethumbtick, |
127 | | // A scrollbar. |
128 | | Scrollbar, |
129 | | // A small scrollbar. |
130 | | ScrollbarSmall, |
131 | | // The scrollbar slider |
132 | | ScrollbarHorizontal, |
133 | | ScrollbarVertical, |
134 | | // A scrollbar button (up/down/left/right). |
135 | | // Keep these in order (some code casts these values to `int` in order to |
136 | | // compare them against each other). |
137 | | ScrollbarbuttonUp, |
138 | | ScrollbarbuttonDown, |
139 | | ScrollbarbuttonLeft, |
140 | | ScrollbarbuttonRight, |
141 | | // The scrollbar thumb. |
142 | | ScrollbarthumbHorizontal, |
143 | | ScrollbarthumbVertical, |
144 | | // The scrollbar track. |
145 | | ScrollbartrackHorizontal, |
146 | | ScrollbartrackVertical, |
147 | | // The scroll corner |
148 | | Scrollcorner, |
149 | | // A searchfield. |
150 | | Searchfield, |
151 | | // A separator. Can be horizontal or vertical. |
152 | | Separator, |
153 | | // A spin control (up/down control for time/date pickers). |
154 | | Spinner, |
155 | | // The up button of a spin control. |
156 | | SpinnerUpbutton, |
157 | | // The down button of a spin control. |
158 | | SpinnerDownbutton, |
159 | | // The textfield of a spin control |
160 | | SpinnerTextfield, |
161 | | // A splitter. Can be horizontal or vertical. |
162 | | Splitter, |
163 | | // A status bar in a main application window. |
164 | | Statusbar, |
165 | | // A single pane of a status bar. |
166 | | Statusbarpanel, |
167 | | // A single tab in a tab widget. |
168 | | Tab, |
169 | | // A single pane (inside the tabpanels container). |
170 | | Tabpanel, |
171 | | // The tab panels container. |
172 | | Tabpanels, |
173 | | // The tabs scroll arrows (left/right). |
174 | | TabScrollArrowBack, |
175 | | TabScrollArrowForward, |
176 | | // A textfield or text area. |
177 | | Textfield, |
178 | | // A multiline text field. |
179 | | TextfieldMultiline, |
180 | | // A toolbar in an application window. |
181 | | Toolbar, |
182 | | // A single toolbar button (with no associated dropdown). |
183 | | Toolbarbutton, |
184 | | // The dropdown portion of a toolbar button |
185 | | ToolbarbuttonDropdown, |
186 | | // The gripper for a toolbar. |
187 | | Toolbargripper, |
188 | | // The toolbox that contains the toolbars. |
189 | | Toolbox, |
190 | | // A tooltip. |
191 | | Tooltip, |
192 | | // A listbox or tree widget header |
193 | | Treeheader, |
194 | | // An individual header cell |
195 | | Treeheadercell, |
196 | | // The sort arrow for a header. |
197 | | Treeheadersortarrow, |
198 | | // A tree item. |
199 | | Treeitem, |
200 | | // A tree widget branch line |
201 | | Treeline, |
202 | | // A tree widget twisty. |
203 | | Treetwisty, |
204 | | // Open tree widget twisty. |
205 | | Treetwistyopen, |
206 | | // A tree widget. |
207 | | Treeview, |
208 | | // Window and dialog backgrounds. |
209 | | Window, |
210 | | Dialog, |
211 | | // Vista Rebars. |
212 | | MozWinCommunicationsToolbox, |
213 | | MozWinMediaToolbox, |
214 | | MozWinBrowsertabbarToolbox, |
215 | | // Vista glass. |
216 | | MozWinGlass, |
217 | | MozWinBorderlessGlass, |
218 | | // -moz-apperance style used in setting proper glass margins. |
219 | | MozWinExcludeGlass, |
220 | | // Titlebar elements on the Mac. |
221 | | MozMacFullscreenButton, |
222 | | // Mac help button. |
223 | | MozMacHelpButton, |
224 | | // Windows themed window frame elements. |
225 | | MozWindowButtonBox, |
226 | | MozWindowButtonBoxMaximized, |
227 | | MozWindowButtonClose, |
228 | | MozWindowButtonMaximize, |
229 | | MozWindowButtonMinimize, |
230 | | MozWindowButtonRestore, |
231 | | MozWindowFrameBottom, |
232 | | MozWindowFrameLeft, |
233 | | MozWindowFrameRight, |
234 | | MozWindowTitlebar, |
235 | | MozWindowTitlebarMaximized, |
236 | | MozGtkInfoBar, |
237 | | MozMacActiveSourceListSelection, |
238 | | MozMacDisclosureButtonClosed, |
239 | | MozMacDisclosureButtonOpen, |
240 | | MozMacSourceList, |
241 | | MozMacSourceListSelection, |
242 | | MozMacVibrancyDark, |
243 | | MozMacVibrancyLight, |
244 | | MozMacVibrantTitlebarDark, |
245 | | MozMacVibrantTitlebarLight, |
246 | | // A non-disappearing scrollbar. |
247 | | ScrollbarNonDisappearing, |
248 | | // A themed focus outline (for outline:auto). |
249 | | // |
250 | | // This isn't exposed to CSS at all, just here for convenience. |
251 | | FocusOutline, |
252 | | // A dummy variant that should be last to let the GTK widget do hackery. |
253 | | Count, |
254 | | }; |
255 | | |
256 | | // Defines an element’s display type, which consists of |
257 | | // the two basic qualities of how an element generates boxes |
258 | | // <https://drafts.csswg.org/css-display/#propdef-display> |
259 | | // |
260 | | // |
261 | | // NOTE(emilio): Order is important in Gecko! |
262 | | // |
263 | | // If you change it, make sure to take a look at the |
264 | | // FrameConstructionDataByDisplay stuff (both the XUL and non-XUL version), and |
265 | | // ensure it's still correct! |
266 | | // |
267 | | // Also, when you change this from Gecko you may need to regenerate the |
268 | | // C++-side bindings (see components/style/cbindgen.toml). |
269 | | enum class StyleDisplay : uint8_t { |
270 | | None = 0, |
271 | | Block, |
272 | | FlowRoot, |
273 | | Inline, |
274 | | InlineBlock, |
275 | | ListItem, |
276 | | Table, |
277 | | InlineTable, |
278 | | TableRowGroup, |
279 | | TableColumn, |
280 | | TableColumnGroup, |
281 | | TableHeaderGroup, |
282 | | TableFooterGroup, |
283 | | TableRow, |
284 | | TableCell, |
285 | | TableCaption, |
286 | | Flex, |
287 | | InlineFlex, |
288 | | Grid, |
289 | | InlineGrid, |
290 | | Ruby, |
291 | | RubyBase, |
292 | | RubyBaseContainer, |
293 | | RubyText, |
294 | | RubyTextContainer, |
295 | | Contents, |
296 | | WebkitBox, |
297 | | WebkitInlineBox, |
298 | | MozBox, |
299 | | MozInlineBox, |
300 | | MozGrid, |
301 | | MozInlineGrid, |
302 | | MozGridGroup, |
303 | | MozGridLine, |
304 | | MozStack, |
305 | | MozInlineStack, |
306 | | MozDeck, |
307 | | MozGroupbox, |
308 | | MozPopup, |
309 | | }; |
310 | | |
311 | | // Values for the display-mode media feature. |
312 | | enum class StyleDisplayMode : uint8_t { |
313 | | Browser = 0, |
314 | | MinimalUi, |
315 | | Standalone, |
316 | | Fullscreen, |
317 | | }; |
318 | | |
319 | | enum class StyleFillRule : uint8_t { |
320 | | Nonzero, |
321 | | Evenodd, |
322 | | }; |
323 | | |
324 | | // The path command absolute type. |
325 | | enum class StyleIsAbsolute : uint8_t { |
326 | | Yes, |
327 | | No, |
328 | | }; |
329 | | |
330 | | // A CSS float value. |
331 | | using StyleCSSFloat = float; |
332 | | |
333 | | // The path coord type. |
334 | | struct StyleCoordPair { |
335 | | StyleCSSFloat _0; |
336 | | StyleCSSFloat _1; |
337 | | |
338 | 0 | bool operator==(const StyleCoordPair& other) const { |
339 | 0 | return _0 == other._0 && |
340 | 0 | _1 == other._1; |
341 | 0 | } |
342 | | }; |
343 | | |
344 | | // The EllipticalArc flag type. |
345 | | struct StyleArcFlag { |
346 | | bool _0; |
347 | | |
348 | 0 | bool operator==(const StyleArcFlag& other) const { |
349 | 0 | return _0 == other._0; |
350 | 0 | } |
351 | | }; |
352 | | |
353 | | // The SVG path command. |
354 | | // The fields of these commands are self-explanatory, so we skip the documents. |
355 | | // Note: the index of the control points, e.g. control1, control2, are mapping to the control |
356 | | // points of the Bézier curve in the spec. |
357 | | // |
358 | | // https://www.w3.org/TR/SVG11/paths.html#PathData |
359 | | struct StylePathCommand { |
360 | | enum class Tag : uint8_t { |
361 | | // The unknown type. |
362 | | // https://www.w3.org/TR/SVG/paths.html#__svg__SVGPathSeg__PATHSEG_UNKNOWN |
363 | | Unknown, |
364 | | // The "moveto" command. |
365 | | MoveTo, |
366 | | // The "lineto" command. |
367 | | LineTo, |
368 | | // The horizontal "lineto" command. |
369 | | HorizontalLineTo, |
370 | | // The vertical "lineto" command. |
371 | | VerticalLineTo, |
372 | | // The cubic Bézier curve command. |
373 | | CurveTo, |
374 | | // The smooth curve command. |
375 | | SmoothCurveTo, |
376 | | // The quadratic Bézier curve command. |
377 | | QuadBezierCurveTo, |
378 | | // The smooth quadratic Bézier curve command. |
379 | | SmoothQuadBezierCurveTo, |
380 | | // The elliptical arc curve command. |
381 | | EllipticalArc, |
382 | | // The "closepath" command. |
383 | | ClosePath, |
384 | | }; |
385 | | |
386 | | struct StyleMoveTo_Body { |
387 | | StyleCoordPair point; |
388 | | StyleIsAbsolute absolute; |
389 | | |
390 | 0 | bool operator==(const StyleMoveTo_Body& other) const { |
391 | 0 | return point == other.point && |
392 | 0 | absolute == other.absolute; |
393 | 0 | } |
394 | | }; |
395 | | |
396 | | struct StyleLineTo_Body { |
397 | | StyleCoordPair point; |
398 | | StyleIsAbsolute absolute; |
399 | | |
400 | 0 | bool operator==(const StyleLineTo_Body& other) const { |
401 | 0 | return point == other.point && |
402 | 0 | absolute == other.absolute; |
403 | 0 | } |
404 | | }; |
405 | | |
406 | | struct StyleHorizontalLineTo_Body { |
407 | | StyleCSSFloat x; |
408 | | StyleIsAbsolute absolute; |
409 | | |
410 | 0 | bool operator==(const StyleHorizontalLineTo_Body& other) const { |
411 | 0 | return x == other.x && |
412 | 0 | absolute == other.absolute; |
413 | 0 | } |
414 | | }; |
415 | | |
416 | | struct StyleVerticalLineTo_Body { |
417 | | StyleCSSFloat y; |
418 | | StyleIsAbsolute absolute; |
419 | | |
420 | 0 | bool operator==(const StyleVerticalLineTo_Body& other) const { |
421 | 0 | return y == other.y && |
422 | 0 | absolute == other.absolute; |
423 | 0 | } |
424 | | }; |
425 | | |
426 | | struct StyleCurveTo_Body { |
427 | | StyleCoordPair control1; |
428 | | StyleCoordPair control2; |
429 | | StyleCoordPair point; |
430 | | StyleIsAbsolute absolute; |
431 | | |
432 | 0 | bool operator==(const StyleCurveTo_Body& other) const { |
433 | 0 | return control1 == other.control1 && |
434 | 0 | control2 == other.control2 && |
435 | 0 | point == other.point && |
436 | 0 | absolute == other.absolute; |
437 | 0 | } |
438 | | }; |
439 | | |
440 | | struct StyleSmoothCurveTo_Body { |
441 | | StyleCoordPair control2; |
442 | | StyleCoordPair point; |
443 | | StyleIsAbsolute absolute; |
444 | | |
445 | 0 | bool operator==(const StyleSmoothCurveTo_Body& other) const { |
446 | 0 | return control2 == other.control2 && |
447 | 0 | point == other.point && |
448 | 0 | absolute == other.absolute; |
449 | 0 | } |
450 | | }; |
451 | | |
452 | | struct StyleQuadBezierCurveTo_Body { |
453 | | StyleCoordPair control1; |
454 | | StyleCoordPair point; |
455 | | StyleIsAbsolute absolute; |
456 | | |
457 | 0 | bool operator==(const StyleQuadBezierCurveTo_Body& other) const { |
458 | 0 | return control1 == other.control1 && |
459 | 0 | point == other.point && |
460 | 0 | absolute == other.absolute; |
461 | 0 | } |
462 | | }; |
463 | | |
464 | | struct StyleSmoothQuadBezierCurveTo_Body { |
465 | | StyleCoordPair point; |
466 | | StyleIsAbsolute absolute; |
467 | | |
468 | 0 | bool operator==(const StyleSmoothQuadBezierCurveTo_Body& other) const { |
469 | 0 | return point == other.point && |
470 | 0 | absolute == other.absolute; |
471 | 0 | } |
472 | | }; |
473 | | |
474 | | struct StyleEllipticalArc_Body { |
475 | | StyleCSSFloat rx; |
476 | | StyleCSSFloat ry; |
477 | | StyleCSSFloat angle; |
478 | | StyleArcFlag large_arc_flag; |
479 | | StyleArcFlag sweep_flag; |
480 | | StyleCoordPair point; |
481 | | StyleIsAbsolute absolute; |
482 | | |
483 | 0 | bool operator==(const StyleEllipticalArc_Body& other) const { |
484 | 0 | return rx == other.rx && |
485 | 0 | ry == other.ry && |
486 | 0 | angle == other.angle && |
487 | 0 | large_arc_flag == other.large_arc_flag && |
488 | 0 | sweep_flag == other.sweep_flag && |
489 | 0 | point == other.point && |
490 | 0 | absolute == other.absolute; |
491 | 0 | } |
492 | | }; |
493 | | |
494 | | Tag tag; |
495 | | union { |
496 | | StyleMoveTo_Body move_to; |
497 | | StyleLineTo_Body line_to; |
498 | | StyleHorizontalLineTo_Body horizontal_line_to; |
499 | | StyleVerticalLineTo_Body vertical_line_to; |
500 | | StyleCurveTo_Body curve_to; |
501 | | StyleSmoothCurveTo_Body smooth_curve_to; |
502 | | StyleQuadBezierCurveTo_Body quad_bezier_curve_to; |
503 | | StyleSmoothQuadBezierCurveTo_Body smooth_quad_bezier_curve_to; |
504 | | StyleEllipticalArc_Body elliptical_arc; |
505 | | }; |
506 | | |
507 | 0 | static StylePathCommand Unknown() { |
508 | 0 | StylePathCommand result; |
509 | 0 | result.tag = Tag::Unknown; |
510 | 0 | return result; |
511 | 0 | } |
512 | | |
513 | | static StylePathCommand MoveTo(StyleCoordPair const& aPoint, |
514 | 0 | StyleIsAbsolute const& aAbsolute) { |
515 | 0 | StylePathCommand result; |
516 | 0 | result.move_to.point = aPoint; |
517 | 0 | result.move_to.absolute = aAbsolute; |
518 | 0 | result.tag = Tag::MoveTo; |
519 | 0 | return result; |
520 | 0 | } |
521 | | |
522 | | static StylePathCommand LineTo(StyleCoordPair const& aPoint, |
523 | 0 | StyleIsAbsolute const& aAbsolute) { |
524 | 0 | StylePathCommand result; |
525 | 0 | result.line_to.point = aPoint; |
526 | 0 | result.line_to.absolute = aAbsolute; |
527 | 0 | result.tag = Tag::LineTo; |
528 | 0 | return result; |
529 | 0 | } |
530 | | |
531 | | static StylePathCommand HorizontalLineTo(StyleCSSFloat const& aX, |
532 | 0 | StyleIsAbsolute const& aAbsolute) { |
533 | 0 | StylePathCommand result; |
534 | 0 | result.horizontal_line_to.x = aX; |
535 | 0 | result.horizontal_line_to.absolute = aAbsolute; |
536 | 0 | result.tag = Tag::HorizontalLineTo; |
537 | 0 | return result; |
538 | 0 | } |
539 | | |
540 | | static StylePathCommand VerticalLineTo(StyleCSSFloat const& aY, |
541 | 0 | StyleIsAbsolute const& aAbsolute) { |
542 | 0 | StylePathCommand result; |
543 | 0 | result.vertical_line_to.y = aY; |
544 | 0 | result.vertical_line_to.absolute = aAbsolute; |
545 | 0 | result.tag = Tag::VerticalLineTo; |
546 | 0 | return result; |
547 | 0 | } |
548 | | |
549 | | static StylePathCommand CurveTo(StyleCoordPair const& aControl1, |
550 | | StyleCoordPair const& aControl2, |
551 | | StyleCoordPair const& aPoint, |
552 | 0 | StyleIsAbsolute const& aAbsolute) { |
553 | 0 | StylePathCommand result; |
554 | 0 | result.curve_to.control1 = aControl1; |
555 | 0 | result.curve_to.control2 = aControl2; |
556 | 0 | result.curve_to.point = aPoint; |
557 | 0 | result.curve_to.absolute = aAbsolute; |
558 | 0 | result.tag = Tag::CurveTo; |
559 | 0 | return result; |
560 | 0 | } |
561 | | |
562 | | static StylePathCommand SmoothCurveTo(StyleCoordPair const& aControl2, |
563 | | StyleCoordPair const& aPoint, |
564 | 0 | StyleIsAbsolute const& aAbsolute) { |
565 | 0 | StylePathCommand result; |
566 | 0 | result.smooth_curve_to.control2 = aControl2; |
567 | 0 | result.smooth_curve_to.point = aPoint; |
568 | 0 | result.smooth_curve_to.absolute = aAbsolute; |
569 | 0 | result.tag = Tag::SmoothCurveTo; |
570 | 0 | return result; |
571 | 0 | } |
572 | | |
573 | | static StylePathCommand QuadBezierCurveTo(StyleCoordPair const& aControl1, |
574 | | StyleCoordPair const& aPoint, |
575 | 0 | StyleIsAbsolute const& aAbsolute) { |
576 | 0 | StylePathCommand result; |
577 | 0 | result.quad_bezier_curve_to.control1 = aControl1; |
578 | 0 | result.quad_bezier_curve_to.point = aPoint; |
579 | 0 | result.quad_bezier_curve_to.absolute = aAbsolute; |
580 | 0 | result.tag = Tag::QuadBezierCurveTo; |
581 | 0 | return result; |
582 | 0 | } |
583 | | |
584 | | static StylePathCommand SmoothQuadBezierCurveTo(StyleCoordPair const& aPoint, |
585 | 0 | StyleIsAbsolute const& aAbsolute) { |
586 | 0 | StylePathCommand result; |
587 | 0 | result.smooth_quad_bezier_curve_to.point = aPoint; |
588 | 0 | result.smooth_quad_bezier_curve_to.absolute = aAbsolute; |
589 | 0 | result.tag = Tag::SmoothQuadBezierCurveTo; |
590 | 0 | return result; |
591 | 0 | } |
592 | | |
593 | | static StylePathCommand EllipticalArc(StyleCSSFloat const& aRx, |
594 | | StyleCSSFloat const& aRy, |
595 | | StyleCSSFloat const& aAngle, |
596 | | StyleArcFlag const& aLargeArcFlag, |
597 | | StyleArcFlag const& aSweepFlag, |
598 | | StyleCoordPair const& aPoint, |
599 | 0 | StyleIsAbsolute const& aAbsolute) { |
600 | 0 | StylePathCommand result; |
601 | 0 | result.elliptical_arc.rx = aRx; |
602 | 0 | result.elliptical_arc.ry = aRy; |
603 | 0 | result.elliptical_arc.angle = aAngle; |
604 | 0 | result.elliptical_arc.large_arc_flag = aLargeArcFlag; |
605 | 0 | result.elliptical_arc.sweep_flag = aSweepFlag; |
606 | 0 | result.elliptical_arc.point = aPoint; |
607 | 0 | result.elliptical_arc.absolute = aAbsolute; |
608 | 0 | result.tag = Tag::EllipticalArc; |
609 | 0 | return result; |
610 | 0 | } |
611 | | |
612 | 0 | static StylePathCommand ClosePath() { |
613 | 0 | StylePathCommand result; |
614 | 0 | result.tag = Tag::ClosePath; |
615 | 0 | return result; |
616 | 0 | } |
617 | | |
618 | 0 | bool IsUnknown() const { |
619 | 0 | return tag == Tag::Unknown; |
620 | 0 | } |
621 | | |
622 | 0 | bool IsMoveTo() const { |
623 | 0 | return tag == Tag::MoveTo; |
624 | 0 | } |
625 | | |
626 | 0 | bool IsLineTo() const { |
627 | 0 | return tag == Tag::LineTo; |
628 | 0 | } |
629 | | |
630 | 0 | bool IsHorizontalLineTo() const { |
631 | 0 | return tag == Tag::HorizontalLineTo; |
632 | 0 | } |
633 | | |
634 | 0 | bool IsVerticalLineTo() const { |
635 | 0 | return tag == Tag::VerticalLineTo; |
636 | 0 | } |
637 | | |
638 | 0 | bool IsCurveTo() const { |
639 | 0 | return tag == Tag::CurveTo; |
640 | 0 | } |
641 | | |
642 | 0 | bool IsSmoothCurveTo() const { |
643 | 0 | return tag == Tag::SmoothCurveTo; |
644 | 0 | } |
645 | | |
646 | 0 | bool IsQuadBezierCurveTo() const { |
647 | 0 | return tag == Tag::QuadBezierCurveTo; |
648 | 0 | } |
649 | | |
650 | 0 | bool IsSmoothQuadBezierCurveTo() const { |
651 | 0 | return tag == Tag::SmoothQuadBezierCurveTo; |
652 | 0 | } |
653 | | |
654 | 0 | bool IsEllipticalArc() const { |
655 | 0 | return tag == Tag::EllipticalArc; |
656 | 0 | } |
657 | | |
658 | 0 | bool IsClosePath() const { |
659 | 0 | return tag == Tag::ClosePath; |
660 | 0 | } |
661 | | |
662 | 0 | bool operator==(const StylePathCommand& other) const { |
663 | 0 | if (tag != other.tag) { |
664 | 0 | return false; |
665 | 0 | } |
666 | 0 | switch (tag) { |
667 | 0 | case Tag::MoveTo: return move_to == other.move_to; |
668 | 0 | case Tag::LineTo: return line_to == other.line_to; |
669 | 0 | case Tag::HorizontalLineTo: return horizontal_line_to == other.horizontal_line_to; |
670 | 0 | case Tag::VerticalLineTo: return vertical_line_to == other.vertical_line_to; |
671 | 0 | case Tag::CurveTo: return curve_to == other.curve_to; |
672 | 0 | case Tag::SmoothCurveTo: return smooth_curve_to == other.smooth_curve_to; |
673 | 0 | case Tag::QuadBezierCurveTo: return quad_bezier_curve_to == other.quad_bezier_curve_to; |
674 | 0 | case Tag::SmoothQuadBezierCurveTo: return smooth_quad_bezier_curve_to == other.smooth_quad_bezier_curve_to; |
675 | 0 | case Tag::EllipticalArc: return elliptical_arc == other.elliptical_arc; |
676 | 0 | default: return true; |
677 | 0 | } |
678 | 0 | } |
679 | | }; |
680 | | |
681 | | } // namespace mozilla |
682 | | |
683 | | #endif // mozilla_ServoStyleConsts_h |