DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
header = """/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

// See the comment in ServoBindings.h about the same.
#pragma GCC diagnostic push
#ifdef __clang__
#  pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
#endif
// Work-around silly windows.h define.
#pragma push_macro("STRICT")
#undef STRICT
"""
trailer = """
#pragma pop_macro("STRICT")
#pragma GCC diagnostic pop
#include "mozilla/ServoStyleConstsInlines.h"
"""
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
 * To generate this file:
 *   1. Get the latest cbindgen using `cargo install --force cbindgen`
 *      a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
 *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate style -o layout/style/ServoStyleConsts.h`
 */
"""
include_guard = "mozilla_ServoStyleConsts_h"
include_version = true
braces = "SameLine"
line_length = 80
tab_width = 2
language = "C++"
namespaces = ["mozilla"]
includes = ["mozilla/ServoStyleConstsForwards.h"]

[parse]
parse_deps = true
extra_bindings = ["style"]
include = ["style", "cssparser", "style_traits", "servo_arc"]

[struct]
associated_constants_in_body = true
derive_eq = true
derive_neq = true

[defines]
# These will actually never be defined, but is handy to avoid cbindgen
# generating Servo-only types.
"feature = servo" = "CBINDGEN_IS_SERVO"
"feature = servo-layout-2013" = "CBINDGEN_IS_SERVO"
"feature = servo-layout-2020" = "CBINDGEN_IS_SERVO"
# These will always be defined.
"feature = gecko" = "CBINDGEN_IS_GECKO"
"feature = cbindgen" = "CBINDGEN_IS_GECKO"
# These depend on the build.
"target_pointer_width = 32" = "SERVO_32_BITS"
"target_pointer_width = 64" = "HAVE_64BIT_BUILD"

[macro_expansion]
bitflags = true

[enum]
derive_helper_methods = true
derive_const_casts = true
derive_tagged_enum_destructor = true
derive_tagged_enum_copy_constructor = true
derive_tagged_enum_copy_assignment = true
private_default_tagged_enum_constructor = true
cast_assert_name = "MOZ_ASSERT"

[export]
prefix = "Style"
exclude = [
  "NS_LogCtor",
  "NS_LogDtor",
]
include = [
  "Appearance",
  "BreakBetween",
  "BreakWithin",
  "BorderStyle",
  "OutlineStyle",
  "ComputedFontStretchRange",
  "ComputedFontStyleDescriptor",
  "ComputedFontWeightRange",
  "ComputedTimingFunction",
  "ComputedValueFlags",
  "CursorKind",
  "DisplayOutside",
  "DisplayInside",
  "DisplayMode",
  "PrefersColorScheme",
  "ExtremumLength",
  "FillRule",
  "FontDisplay",
  "FontFaceSourceListComponent",
  "FontLanguageOverride",
  "GenericFontFamily",
  "FontFamilyNameSyntax",
  "OverflowWrap",
  "TimingFunction",
  "OffsetPath",
  "OffsetRotate",
  "UnicodeRange",
  "UserSelect",
  "Float",
  "OverscrollBehavior",
  "ScrollSnapAlign",
  "ScrollSnapAxis",
  "ScrollSnapStrictness",
  "ScrollSnapType",
  "OverflowAnchor",
  "OverflowClipBox",
  "Resize",
  "Overflow",
  "LengthPercentage",
  "LetterSpacing",
  "NonNegativeLengthPercentage",
  "LengthPercentageOrAuto",
  "LineHeight",
  "NonNegativeLengthPercentageOrAuto",
  "NonNegativeLengthPercentageOrNormal",
  "LengthOrAuto",
  "NonNegativeLengthOrAuto",
  "TextDecorationSkipInk",
  "TextDecorationLength",
  "Rect",
  "IntersectionObserverRootMargin",
  "Size",
  "MaxSize",
  "FlexBasis",
  "Position",
  "PositionOrAuto",
  "BackgroundSize",
  "BorderImageSlice",
  "BorderSpacing",
  "BorderRadius",
  "NonNegativeLengthOrNumberRect",
  "Perspective",
  "ZIndex",
  "TransformOrigin",
  "LineBreak",
  "WordBreak",
  "Contain",
  "Origin",
  "RestyleHint",
  "TouchAction",
  "WillChange",
  "TextDecorationLine",
  "TextUnderlinePosition",
  "TextTransform",
  "TextOverflow",
  "MozListReversed",
  "Owned",
  "OwnedOrNull",
  "Strong",
  "ScrollbarColor",
  "Color",
  "ColorOrAuto",
  "SystemColor",
  "GradientItem",
  "VerticalAlign",
  "BasicShape",
  "ShapeRadius",
  "ArcSlice",
  "ForgottenArcSlicePtr",
  "HeaderWithLength",
  "MozContextProperties",
  "Quotes",
  "BoxShadow",
  "SimpleShadow",
  "Transform",
  "Rotate",
  "Scale",
  "Translate",
  "BorderImageWidth",
  "ComputedUrl",
  "ComputedImageUrl",
  "UrlOrNone",
  "ImageUrlOrNone",
  "Filter",
  "Gradient",
  "GridTemplateAreas",
  "GridLine",
  "TrackSize",
  "TrackBreadth",
  "ImplicitGridTracks",
  "SVGPaint",
  "SVGPaintKind",
  "GridTemplateComponent",
  "TextEmphasisStyle",
  "VariantAlternatesList",
  "PaintOrder",
  "SVGPaintOrder",
  "ClipRectOrAuto",
  "CounterSetOrReset",
  "CounterIncrement",
  "WritingMode",
  "Content",
  "ContentItem",
  "AlignSelf",
  "JustifySelf",
  "AlignItems",
  "ComputedJustifyItems",
  "AlignContent",
  "JustifyContent",
  "AlignTracks",
  "JustifyTracks",
  "TransformStyle",
  "Image",
  "ClipPath",
  "ShapeOutside",
  "GridAutoFlow",
  "Cursor",
  "SVGStrokeDashArray",
  "SVGLength",
  "SVGOpacity",
  "SVGWidth",
  "TextAlign",
  "TextAlignLast",
  "AspectRatio",
]
item_types = ["enums", "structs", "unions", "typedefs", "functions", "constants"]
renaming_overrides_prefixing = true

# Prevent some renaming for Gecko types that cbindgen doesn't otherwise understand.
[export.rename]
"nscolor" = "nscolor"
"nsAtom" = "nsAtom"
"nsIURI" = "nsIURI"
"imgRequestProxy" = "imgRequestProxy"
"nsCompatibility" = "nsCompatibility"
"SharedFontList" = "SharedFontList"
"nsSimpleContentList" = "nsSimpleContentList"
"nsACString" = "nsACString"
"nsAString" = "nsAString"
"nsString" = "nsString"
"CopyableTArray" = "CopyableTArray"
"nsTArray" = "nsTArray"
"nsPresContext" = "nsPresContext"
"ComputedTiming" = "ComputedTiming"
"CountedUnknownProperty" = "CountedUnknownProperty"
"RefPtr" = "RefPtr"
"nsCSSPropertyID" = "nsCSSPropertyID"
"nsCSSPropertyIDSet" = "nsCSSPropertyIDSet"
"nsCSSValueSharedList" = "nsCSSValueSharedList"
"AnimationPropertySegment" = "AnimationPropertySegment"
"RawServoAnimationValueMap" = "RawServoAnimationValueMap"
"RawServoAnimationValueTable" = "RawServoAnimationValueTable"
"nsCSSUnit" = "nsCSSUnit"
"ParsingMode" = "ParsingMode"
"InheritTarget" = "InheritTarget"
"PseudoStyleType" = "PseudoStyleType"
"DeclarationBlockMutationClosure" = "DeclarationBlockMutationClosure"
"AtomArray" = "AtomArray"
"UpdateAnimationsTasks" = "UpdateAnimationsTasks"
"StyleRuleInclusion" = "StyleRuleInclusion"
"nsFontFaceRuleContainer" = "nsFontFaceRuleContainer"
"MediumFeaturesChangedResult" = "MediumFeaturesChangedResult"
"FontSizePrefs" = "FontSizePrefs"
"nsCSSFontDesc" = "nsCSSFontDesc"
"nsresult" = "nsresult"
"gfxFontFeature" = "gfxFontFeature"
"gfxFontFeatureValueSet" = "gfxFontFeatureValueSet"
"SeenPtrs" = "SeenPtrs"
"gfxFontVariation" = "gfxFontVariation"
"URLExtraData" = "URLExtraData"
"Keyframe" = "Keyframe"
"nsChangeHint" = "nsChangeHint"
"ServoElementSnapshotTable" = "ServoElementSnapshotTable"
"nsTimingFunction" = "nsTimingFunction"
"Keyframe" = "Keyframe"
"ComputedKeyframeValues" = "ComputedKeyframeValues"
"OriginFlags" = "OriginFlags"
"ServoTraversalFlags" = "ServoTraversalFlags"
"ServoStyleSetSizes" = "ServoStyleSetSizes"

[export.body]
"CSSPixelLength" = """
  inline nscoord ToAppUnits() const;
  inline bool IsZero() const;
  CSSCoord ToCSSPixels() const { return _0; }
  inline void ScaleBy(float);
"""

"GenericCalcNode" = """
 private:

  template <typename ResultT, typename PercentageConverter>
  ResultT ResolveInternal(ResultT aPercentageBasis,
                          PercentageConverter aPercentageConverter) const;

 public:
  CSSCoord ResolveToCSSPixels(CSSCoord aPercentageBasis) const;

  using CoordPercentageRounder = nscoord(*)(float);
  nscoord Resolve(nscoord aBasis, CoordPercentageRounder) const;

  void ScaleLengthsBy(float);
"""

"LengthPercentageUnion" = """
  using Self = StyleLengthPercentageUnion;

  // TODO(emilio): cbindgen should be able to generate these in the body of the
  // union, but it seems it's only implemented for structs, not unions.
  static const uint8_t TAG_CALC = StyleLengthPercentageUnion_TAG_CALC;
  static const uint8_t TAG_LENGTH = StyleLengthPercentageUnion_TAG_LENGTH;
  static const uint8_t TAG_PERCENTAGE = StyleLengthPercentageUnion_TAG_PERCENTAGE;
  static const uint8_t TAG_MASK = StyleLengthPercentageUnion_TAG_MASK;

 private:
  uint8_t Tag() const {
    return tag.tag & TAG_MASK;
  }

 public:
  // We need to do all this manually because cbingen can't reason about unions.
  inline StyleLengthPercentageUnion();
  inline StyleLengthPercentageUnion(const Self&);
  inline ~StyleLengthPercentageUnion();
  inline Self& operator=(const Self&);

  inline bool operator==(const Self& aOther) const;
  inline bool operator!=(const Self& aOther) const;

  inline bool IsLength() const;
  inline bool IsPercentage() const;
  inline bool IsCalc() const;

  inline const StyleLength& AsLength() const;
  inline StyleLength& AsLength();

  inline const StylePercentage& AsPercentage() const;
  inline StylePercentage& AsPercentage();

  inline const StyleCalcLengthPercentage& AsCalc() const;
  inline StyleCalcLengthPercentage& AsCalc();

  static inline Self Zero();
  static inline Self FromAppUnits(nscoord);
  static inline Self FromPixels(CSSCoord);
  static inline Self FromPercentage(float);

  inline void ScaleLengthsBy(float);
  inline bool HasPercent() const;
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline CSSCoord ToLengthInCSSPixels() const;
  inline bool ConvertsToPercentage() const;
  inline bool HasLengthAndPercentage() const;
  inline float ToPercentage() const;
  inline bool IsDefinitelyZero() const;
  inline CSSCoord ResolveToCSSPixels(CSSCoord aPercentageBasisInCSSPixels) const;
  template<typename T> inline CSSCoord ResolveToCSSPixelsWith(T aPercentageGetter) const;
  template<typename T, typename U>
  inline nscoord Resolve(T aPercentageGetter, U aPercentRoundingFunction) const;
  template<typename T>
  inline nscoord Resolve(nscoord aPercentageBasis, T aPercentRoundingFunction) const;
  template<typename T> inline nscoord Resolve(T aPercentageGetter) const;
  inline nscoord Resolve(nscoord aPercentageBasis) const;
"""

"GenericLengthPercentageOrAuto" = """
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline bool ConvertsToPercentage() const;
  inline float ToPercentage() const;
  inline bool HasPercent() const;
  inline bool HasLengthAndPercentage() const;

  // Just some convenient aliases for LengthOrAuto, to avoid confusing naming.
  inline bool IsLength() const;
  inline const StyleLength& AsLength() const;
"""

"GenericSize" = """
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline bool ConvertsToPercentage() const;
  inline float ToPercentage() const;
  inline bool HasPercent() const;
  inline bool HasLengthAndPercentage() const;
  inline bool BehavesLikeInitialValueOnBlockAxis() const;
"""

"GenericFlexBasis" = """
  inline bool IsAuto() const;
"""

"GenericMaxSize" = """
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline bool ConvertsToPercentage() const;
  inline float ToPercentage() const;
  inline bool HasPercent() const;
  inline bool HasLengthAndPercentage() const;
  inline bool BehavesLikeInitialValueOnBlockAxis() const;
"""

"GenericPosition" = """
  inline bool HasPercent() const;
  inline bool DependsOnPositioningAreaSize() const;
  static inline StyleGenericPosition FromPercentage(float);
"""

"GenericBackgroundSize" = """
  bool IsInitialValue() const;
"""

"Rect" = """
  template<typename Predicate> inline bool All(Predicate) const;
  template<typename Predicate> inline bool Any(Predicate) const;

  // Defined in WritingModes.h
  inline const T& Get(mozilla::Side) const;
  inline const T& Get(WritingMode, LogicalSide) const;
  inline const T& GetIStart(WritingMode) const;
  inline const T& GetBStart(WritingMode) const;
  inline const T& Start(LogicalAxis, WritingMode) const;
  inline const T& GetIEnd(WritingMode) const;
  inline const T& GetBEnd(WritingMode) const;
  inline const T& End(LogicalAxis, WritingMode) const;

  inline T& Get(mozilla::Side);
  inline T& Get(WritingMode, LogicalSide);
  inline T& GetIStart(WritingMode);
  inline T& GetBStart(WritingMode);
  inline T& GetIEnd(WritingMode);
  inline T& GetBEnd(WritingMode);
"""

"GenericBorderRadius" = """
  inline const StyleLengthPercentage& Get(HalfCorner) const;
"""

"RestyleHint" = """
  static inline StyleRestyleHint RestyleSubtree();
  static inline StyleRestyleHint RecascadeSubtree();
  static inline StyleRestyleHint ForAnimations();
  // Returns true if this change hint is guaranteed to at least recascade all
  // elements in the subtree of the element it is applied to.
  inline bool DefinitelyRecascadesAllSubtree() const;
"""

"TextTransform" = """
  static inline StyleTextTransform None();
  inline bool IsNone() const;
"""

"TextUnderlinePosition" = """
  inline bool IsAuto() const;
  inline bool IsFromFont() const;
  inline bool IsUnder() const;
  inline bool IsLeft() const;
  inline bool IsRight() const;
"""

# TODO(emilio): Add hooks to cbindgen to be able to generate MOZ_MUST_USE_TYPE
# or [[nodiscard]] on the functions.
"Owned" = """
  UniquePtr<GeckoType> Consume() {
    UniquePtr<GeckoType> ret(ptr);
    ptr = nullptr;
    return ret;
  }
"""

"OwnedOrNull" = """
  UniquePtr<GeckoType> Consume() {
    UniquePtr<GeckoType> ret(ptr);
    ptr = nullptr;
    return ret;
  }
"""

"Strong" = """
  already_AddRefed<GeckoType> Consume() {
    already_AddRefed<GeckoType> ret(const_cast<GeckoType*>(ptr));
    ptr = nullptr;
    return ret;
  }
"""

"GenericColor" = """
  static inline StyleGenericColor FromColor(nscolor);
  static inline StyleGenericColor Black();
  static inline StyleGenericColor White();
  static inline StyleGenericColor Transparent();
  bool MaybeTransparent() const;
  /**
   * Compute the final color, taking into account the foreground color from the
   * frame's ComputedStyle.
   */
  nscolor CalcColor(const nsIFrame*) const;
  /**
   * Compute the final color, taking into account the foreground color from the
   * style.
   */
  nscolor CalcColor(const ComputedStyle&) const;
  /**
   * Compute the final color, making the argument the foreground color.
   */
  nscolor CalcColor(nscolor) const;
  nscolor CalcColor(const StyleRGBA&) const;
"""

"RGBA" = """
  static inline StyleRGBA Transparent();
  static inline StyleRGBA FromColor(nscolor);

  inline nscolor ToColor() const;
"""

"OwnedSlice" = """
  StyleOwnedSlice() :
    ptr((T*)alignof(T)),
    len(0) {}

  inline void Clear();
  inline void CopyFrom(const StyleOwnedSlice&);
  inline void SwapElements(StyleOwnedSlice&);

  StyleOwnedSlice& operator=(const StyleOwnedSlice&);
  StyleOwnedSlice& operator=(StyleOwnedSlice&&);

  inline StyleOwnedSlice(const StyleOwnedSlice&);
  inline StyleOwnedSlice(StyleOwnedSlice&&);
  inline explicit StyleOwnedSlice(Vector<T>&&);

  inline ~StyleOwnedSlice();

  Span<const T> AsSpan() const {
    return MakeSpan(ptr, len);
  }

  size_t Length() const {
    return AsSpan().Length();
  }

  bool IsEmpty() const { return Length() == 0; }

  bool operator==(const StyleOwnedSlice& other) const {
    return AsSpan() == other.AsSpan();
  }

  bool operator!=(const StyleOwnedSlice& other) const {
    return !(*this == other);
  }
"""

"ArcInner" = """
  // Increase the reference count.
  inline void IncrementRef();
  // Release the reference count, and return whether the result must be freed or not.
  [[nodiscard]] inline bool DecrementRef();
"""

"ArcSlice" = """
  inline StyleArcSlice();
  inline StyleArcSlice(const StyleArcSlice& aOther);

  // Should be easily implementable if wanted, but the default implementation would leak.
  StyleArcSlice& operator=(const StyleArcSlice&) = delete;
  StyleArcSlice& operator=(StyleArcSlice&&) = delete;

  inline explicit StyleArcSlice(const StyleForgottenArcSlicePtr<T>& aPtr);
  inline ~StyleArcSlice();
  inline Span<const T> AsSpan() const;
  inline size_t Length() const;
  inline bool IsEmpty() const;
  inline bool operator==(const StyleArcSlice& other) const;
  inline bool operator!=(const StyleArcSlice& other) const;
"""

"Arc" = """
  StyleArc() = delete;
  inline StyleArc(const StyleArc& Other);
 private:
  inline void Release();
 public:
  inline ~StyleArc();

  inline StyleArc& operator=(const StyleArc&);
  inline StyleArc& operator=(StyleArc&&);

  const T* operator->() const {
    MOZ_DIAGNOSTIC_ASSERT(p, "Arc shouldn't be null");
    return &p->data;
  }
  const T& operator*() const {
    MOZ_DIAGNOSTIC_ASSERT(p, "Arc shouldn't be null");
    return p->data;
  }
  bool operator==(const StyleArc& other) const {
    return p == other.p || *(*this) == *other;
  }
  bool operator!=(const StyleArc& other) const {
    return !(*this == other);
  }
"""

"CustomIdent" = """
  inline nsAtom* AsAtom() const;
"""

"Atom" = """
  StyleAtom(size_t) = delete;
  StyleAtom() = delete;

  inline bool IsStatic() const;
  inline nsAtom* AsAtom() const;

 private:
  inline void AddRef();
  inline void Release();

 public:
  inline explicit StyleAtom(already_AddRefed<nsAtom> aAtom);
  inline StyleAtom(const StyleAtom& aOther);
  inline StyleAtom& operator=(const StyleAtom&);
  inline ~StyleAtom();
"""

"OwnedStr" = """
  inline nsDependentCSubstring AsString() const;
"""

"GenericTransformOrigin" = """
  inline bool HasPercent() const;
"""

"GenericTransform" = """
  inline Span<const T> Operations() const;
  inline bool IsNone() const;
  bool HasPercent() const;
"""

"Angle" = """
  inline static StyleAngle Zero();
  inline float ToDegrees() const;
  inline double ToRadians() const;
  StyleAngle operator+(const StyleAngle& aAngle) const {
    return StyleAngle{_0 + aAngle._0};
  }
  StyleAngle operator-(const StyleAngle& aAngle) const {
    return StyleAngle{_0 - aAngle._0};
  }
"""

"CoordPair" = """
  explicit StyleCoordPair(const gfx::Point& aPoint): _0(aPoint.x), _1(aPoint.y) {}
"""

"TextOverflow" = """
  StyleTextOverflow()
    : first(StyleTextOverflowSide::Clip()),
      second(StyleTextOverflowSide::Clip()),
      sides_are_logical(true) {}
"""

"UrlExtraData" = """
  StyleUrlExtraData() = delete;

  // Could be implemented if wanted.
  StyleUrlExtraData(const StyleUrlExtraData&) = delete;
  StyleUrlExtraData& operator=(const StyleUrlExtraData&) = delete;

  inline bool IsShared() const;

  inline ~StyleUrlExtraData();
  inline const URLExtraData& get() const;
"""

"CssUrlData" = """
  // Implemented in nsStyleStruct.cpp
  bool operator==(const StyleCssUrlData& other) const;
  bool operator!=(const StyleCssUrlData& other) const {
    return !(*this == other);
  }
"""

"LoadData" = """
  ~StyleLoadData();
"""

"CssUrl" = """
  inline nsDependentCSubstring SpecifiedSerialization() const;
  inline const URLExtraData& ExtraData() const;
  inline StyleLoadData& LoadData() const;
  inline nsIURI* GetURI() const;
"""

"ComputedUrl" = """
  // Forwarded from CssUrl.
  inline nsDependentCSubstring SpecifiedSerialization() const;
  inline const URLExtraData& ExtraData() const;
  inline nsIURI* GetURI() const;
  inline StyleLoadData& LoadData() const;

  inline bool IsLocalRef() const;
  inline bool HasRef() const;
  inline StyleCorsMode CorsMode() const;
  already_AddRefed<nsIURI> ResolveLocalRef(nsIURI* aBase) const;
  already_AddRefed<nsIURI> ResolveLocalRef(const nsIContent* aContent) const;

  // Only relevant for images.
  inline bool IsImageResolved() const;
  inline imgRequestProxy* GetImage() const;
  void ResolveImage(dom::Document&, const StyleComputedUrl* aOldImage);
"""

"GenericGradient" = """
  inline bool Repeating() const;
  bool IsOpaque() const;
"""

"GenericGridLine" = """
  // Returns the `auto` value.
  inline StyleGenericGridLine();
  inline bool IsAuto() const;
  // The line name, or nsGkAtoms::_empty if not present.
  inline nsAtom* LineName() const;
"""

"GenericTrackBreadth" = """
  inline bool HasPercent() const;
"""

"GenericTrackSize" = """
  // Implemented in nsGridContainerFrame.cpp
  inline const StyleGenericTrackBreadth<L>& GetMin() const;
  inline const StyleGenericTrackBreadth<L>& GetMax() const;
"""

"GenericGridTemplateComponent" = """
  inline Maybe<size_t> RepeatAutoIndex() const;
  inline const StyleGenericTrackRepeat<L, I>* GetRepeatAutoValue() const;
  inline bool HasRepeatAuto() const;
  inline Span<const StyleOwnedSlice<StyleCustomIdent>> LineNameLists(bool aIsSubgrid) const;
  inline Span<const StyleGenericTrackListValue<L, I>> TrackListValues() const;
"""

"GenericClipRect" = """
  // Get the layout rect, replacing auto right / bottom values for aAutoSize.
  inline nsRect ToLayoutRect(nscoord aAutoSize = NS_MAXSIZE) const;
"""

"GenericRotate" = """
 public:
  // The implementation of IPC LayersMessages needs this to be public.
  StyleGenericRotate(): tag(Tag::None) {}
"""

"GenericScale" = """
 public:
  // The implementation of IPC LayersMessages needs this to be public.
  StyleGenericScale(): tag(Tag::None) {}
"""

"GenericTranslate" = """
 public:
  // The implementation of IPC LayersMessages needs this to be public.
  StyleGenericTranslate(): tag(Tag::None) {}
"""

"GenericOffsetPath" = """
 public:
  // The implementation of IPC LayersMessages needs this to be public.
  StyleGenericOffsetPath(): tag(Tag::None) {}
"""

"GenericPositionOrAuto" = """
 public:
  // The implementation of IPC LayersMessages needs this to be public.
  StyleGenericPositionOrAuto(): tag(Tag::Auto) {}
"""

"GenericImage" = """
 public:
  // Whether this image may have an image request associated with it.
  bool IsImageRequestType() const;

  // Gets the image request URL.
  const StyleComputedImageUrl* GetImageRequestURLValue() const;

  // Gets the image data of this image if it has any image request.
  imgRequestProxy* GetImageRequest() const;

  // Returns true if this image is fully loaded, and its size is calculated.
  // Always returns true if there's no image request involved and this image
  // is not `none`.
  bool IsComplete() const;

  // Returns true if this image has an available size and hasn't errored.
  // Always returns true if there's no image request involved and this image
  // is not `none`.
  bool IsSizeAvailable() const;

  // Starts the decoding of a image. Returns true if the current frame of the
  // image is complete. The return value is intended to be used instead of
  // IsComplete because IsComplete may not be up to date if notifications
  // from decoding are pending because they are being sent async.
  bool StartDecoding() const;

  // Returns true if the item is definitely opaque --- i.e., paints every
  // pixel within its bounds opaquely, and the bounds contains at least a pixel.
  bool IsOpaque() const;

  struct ActualCropRect {
    nsIntRect mRect; // in image pixels
    bool mIsEntireImage;
  };

  Maybe<ActualCropRect> ComputeActualCropRect() const;

  // Resolves the underlying image request if any.
  void ResolveImage(dom::Document&, const StyleGenericImage* aOld);

  // Returns whether this image has been resolved.
  bool IsResolved() const;
"""

"Ratio" = """
  inline AspectRatio ToLayoutRatio() const;
"""

"GenericAspectRatio" = """
  bool HasRatio() const { return ratio.IsRatio(); }
  bool HasMappedRatio() const { return auto_ && HasRatio(); }

  static StyleGenericAspectRatio Auto() {
    return {true, StylePreferredRatio<N>::None()};
  }
"""