servo/components/style/cbindgen.toml
author Jonathan Kingston <jkt@mozilla.com>
Fri, 15 Feb 2019 21:40:35 +0100
changeset 459565 4739353088fcad81bc126deab56e8de0fad7a88a
parent 459424 b793fdc5bd9c81836987c418463027218d5bc285
child 459723 e4fea76e563b54ae8c02ef8afde0144aca573b2f
permissions -rw-r--r--
Bug 1494034 - Add support for CSS prefers-color-scheme media feature. r=emilio

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/. */"""
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 "nsCoord.h"
#include "Units.h"
#include "mozilla/gfx/Types.h"
class nsAtom;
namespace mozilla {
  class WritingMode;
  enum LogicalSide : uint8_t;
  namespace css {
    struct URLValue;
  }

  // Work-around weird cbindgen renaming.
  typedef css::URLValue StyleURLValue;
  typedef nsAtom StylensAtom;
}
"""
include_guard = "mozilla_ServoStyleConsts_h"
include_version = true
braces = "SameLine"
line_length = 80
tab_width = 2
language = "C++"
namespaces = ["mozilla"]

[parse]
parse_deps = true
include = ["cssparser", "style_traits"]

[struct]
derive_eq = true
derive_neq = true

[enum]
derive_helper_methods = true

[export]
prefix = "Style"
include = [
  "Appearance",
  "BreakBetween",
  "BreakWithin",
  "BorderStyle",
  "OutlineStyle",
  "ComputedFontStretchRange",
  "ComputedFontStyleDescriptor",
  "ComputedFontWeightRange",
  "ComputedTimingFunction",
  "CursorKind",
  "Display",
  "DisplayMode",
  "PrefersColorScheme",
  "ExtremumLength",
  "FillRule",
  "FontDisplay",
  "FontFaceSourceListComponent",
  "FontLanguageOverride",
  "OverflowWrap",
  "TimingFunction",
  "PathCommand",
  "UnicodeRange",
  "UserSelect",
  "Float",
  "OverscrollBehavior",
  "ScrollSnapType",
  "OverflowAnchor",
  "OverflowClipBox",
  "Resize",
  "Overflow",
  "LengthPercentage",
  "NonNegativeLengthPercentage",
  "LengthPercentageOrAuto",
  "Rect",
  "IntersectionObserverRootMargin",
  "Size",
  "MaxSize",
  "FlexBasis",
  "Position",
  "BackgroundSize",
]
item_types = ["enums", "structs", "typedefs"]

[export.body]
"LengthPercentage" = """
  // Defined in nsStyleCoord.h
  static constexpr inline StyleLengthPercentage Zero();
  static inline StyleLengthPercentage FromAppUnits(nscoord);
  static inline StyleLengthPercentage FromPercentage(float);
  inline CSSCoord LengthInCSSPixels() const;
 private:
  inline nscoord LengthComponent() const;
 public:
  inline float Percentage() const;
  inline bool HasPercent() const;
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline bool ConvertsToPercentage() const;
  inline bool HasLengthAndPercentage() const;
  inline float ToPercentage() 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 const StyleLengthPercentage& AsLengthPercentage() const;
  inline bool ConvertsToLength() const;
  inline nscoord ToLength() const;
  inline bool ConvertsToPercentage() const;
  inline float ToPercentage() const;
  inline bool HasPercent() const;
  inline bool HasLengthAndPercentage() const;
"""

"GenericSize" = """
  inline const StyleLengthPercentage& AsLengthPercentage() const;
  inline StyleExtremumLength AsExtremumLength() const;
  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;
  inline const StyleSize& AsSize() const;
"""

"GenericMaxSize" = """
  inline const StyleLengthPercentage& AsLengthPercentage() const;
  inline StyleExtremumLength AsExtremumLength() const;
  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 DependsOnPositioningAreaSize() const;
  static inline StyleGenericPosition FromPercentage(float);
"""

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

"Rect" = """
  // Defined in nsStyleCoord.h
  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(mozilla::WritingMode, mozilla::LogicalSide) const;
  inline const T& GetIStart(mozilla::WritingMode) const;
  inline const T& GetBStart(mozilla::WritingMode) const;
  inline const T& GetIEnd(mozilla::WritingMode) const;
  inline const T& GetBEnd(mozilla::WritingMode) const;
"""