summaryrefslogtreecommitdiff
path: root/src/bytecode/bytecode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/bytecode.h')
-rw-r--r--src/bytecode/bytecode.h52
1 files changed, 35 insertions, 17 deletions
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7518281..ccfdcac 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -18,9 +18,20 @@ typedef uint32_t css_code_t;
typedef enum css_properties_e opcode_t;
+enum flag_value {
+ FLAG_VALUE__NONE = 0,
+ FLAG_VALUE_INHERIT = 1,
+ FLAG_VALUE_INITIAL = 2,
+ FLAG_VALUE_REVERT = 3,
+ FLAG_VALUE_UNSET = 4,
+};
+
enum flag {
- FLAG_IMPORTANT = (1<<0),
- FLAG_INHERIT = (1<<1)
+ FLAG_IMPORTANT = (1 << 0),
+ FLAG_INHERIT = (FLAG_VALUE_INHERIT << 1),
+ FLAG_INITIAL = (FLAG_VALUE_INITIAL << 1),
+ FLAG_REVERT = (FLAG_VALUE_REVERT << 1),
+ FLAG_UNSET = (FLAG_VALUE_UNSET << 1),
};
@@ -34,19 +45,16 @@ typedef enum unit {
UNIT_MM = (1u << 8) + 5,
UNIT_PT = (1u << 8) + 6,
UNIT_PC = (1u << 8) + 7,
- UNIT_CAP = (1u << 8) + 8,
- UNIT_CH = (1u << 8) + 9,
- UNIT_IC = (1u << 8) + 10,
- UNIT_REM = (1u << 8) + 11,
- UNIT_LH = (1u << 8) + 12,
- UNIT_RLH = (1u << 8) + 13,
- UNIT_VH = (1u << 8) + 14,
- UNIT_VW = (1u << 8) + 15,
- UNIT_VI = (1u << 8) + 16,
- UNIT_VB = (1u << 8) + 17,
- UNIT_VMIN = (1u << 8) + 18,
- UNIT_VMAX = (1u << 8) + 19,
- UNIT_Q = (1u << 8) + 20,
+ UNIT_CH = (1u << 8) + 8,
+ UNIT_REM = (1u << 8) + 9,
+ UNIT_LH = (1u << 8) + 10,
+ UNIT_VH = (1u << 8) + 11,
+ UNIT_VW = (1u << 8) + 12,
+ UNIT_VI = (1u << 8) + 13,
+ UNIT_VB = (1u << 8) + 14,
+ UNIT_VMIN = (1u << 8) + 15,
+ UNIT_VMAX = (1u << 8) + 16,
+ UNIT_Q = (1u << 8) + 17,
UNIT_PCT = (1 << 9),
@@ -98,12 +106,22 @@ static inline uint16_t getValue(css_code_t OPV)
static inline bool isImportant(css_code_t OPV)
{
- return getFlags(OPV) & 0x1;
+ return getFlags(OPV) & FLAG_IMPORTANT;
+}
+
+static inline enum flag_value getFlagValue(css_code_t OPV)
+{
+ return (getFlags(OPV) >> 1) & 0x7;
+}
+
+static inline bool hasFlagValue(css_code_t OPV)
+{
+ return getFlagValue(OPV) != FLAG_VALUE__NONE;
}
static inline bool isInherit(css_code_t OPV)
{
- return getFlags(OPV) & 0x2;
+ return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
}
#endif