layout/style/nsStyleStructFwd.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/nsStyleStructFwd.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * Forward declarations to avoid including all of nsStyleStruct.h.
    1.11 + */
    1.12 +
    1.13 +#ifndef nsStyleStructFwd_h_
    1.14 +#define nsStyleStructFwd_h_
    1.15 +
    1.16 +enum nsStyleStructID {
    1.17 +
    1.18 +/*
    1.19 + * Define the constants eStyleStruct_Font, etc.
    1.20 + *
    1.21 + * The C++ standard, section 7.2, guarantees that enums begin with 0 and
    1.22 + * increase by 1.
    1.23 + *
    1.24 + * We separate the IDs of Reset and Inherited structs so that we can use
    1.25 + * the IDs as indices (offset by nsStyleStructID_*_Start) into arrays of
    1.26 + * one type or the other.
    1.27 + */
    1.28 +
    1.29 +nsStyleStructID_Inherited_Start = 0,
    1.30 +// a dummy value so the value after it is the same as ..._Inherited_Start
    1.31 +nsStyleStructID_DUMMY1 = nsStyleStructID_Inherited_Start - 1,
    1.32 +
    1.33 +#define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
    1.34 +  eStyleStruct_##name,
    1.35 +#define STYLE_STRUCT_RESET(name, checkdata_cb)
    1.36 +#include "nsStyleStructList.h"
    1.37 +#undef STYLE_STRUCT_INHERITED
    1.38 +#undef STYLE_STRUCT_RESET
    1.39 +
    1.40 +nsStyleStructID_Reset_Start,
    1.41 +// a dummy value so the value after it is the same as ..._Reset_Start
    1.42 +nsStyleStructID_DUMMY2 = nsStyleStructID_Reset_Start - 1,
    1.43 +
    1.44 +#define STYLE_STRUCT_RESET(name, checkdata_cb) \
    1.45 +  eStyleStruct_##name,
    1.46 +#define STYLE_STRUCT_INHERITED(name, checkdata_cb)
    1.47 +#include "nsStyleStructList.h"
    1.48 +#undef STYLE_STRUCT_INHERITED
    1.49 +#undef STYLE_STRUCT_RESET
    1.50 +
    1.51 +// one past the end; length of 0-based list
    1.52 +nsStyleStructID_Length,
    1.53 +
    1.54 +nsStyleStructID_Inherited_Count =
    1.55 +  nsStyleStructID_Reset_Start - nsStyleStructID_Inherited_Start,
    1.56 +nsStyleStructID_Reset_Count =
    1.57 +  nsStyleStructID_Length - nsStyleStructID_Reset_Start,
    1.58 +
    1.59 +// An ID used for properties that are not in style structs.  This is
    1.60 +// used only in some users of nsStyleStructID, such as
    1.61 +// nsCSSProps::kSIDTable, including some that store SIDs in a bitfield,
    1.62 +// such as nsCSSCompressedDataBlock::mStyleBits.
    1.63 +eStyleStruct_BackendOnly = nsStyleStructID_Length
    1.64 +
    1.65 +};
    1.66 +
    1.67 +// A bit corresponding to each struct ID
    1.68 +#define NS_STYLE_INHERIT_BIT(sid_)        (1 << uint64_t(eStyleStruct_##sid_))
    1.69 +
    1.70 +#endif /* nsStyleStructFwd_h_ */

mercurial