1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CASCADE_ORIGIN_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CASCADE_ORIGIN_H_ 7 8 #include <cstdint> 9 10 namespace blink { 11 12 // Represents the origin criteria described by css-cascade [1]. 13 // 14 // [1] https://www.w3.org/TR/css-cascade-3/#cascade-origin 15 enum class CascadeOrigin : uint8_t { 16 kNone = 0, 17 kUserAgent = 0b0001, 18 kUser = 0b0010, 19 kAuthor = 0b0011, 20 kAnimation = 0b0100, 21 // The lower four bits of kAuthor, kUser and kUserAgent can be inverted to 22 // efficiently produce a "cascade correct" value when compared with the values 23 // specified in this enum: 24 // 25 // kAuthor important: ~0b0011 == 0b1100 (> kAnimation) 26 // kUser important: ~0b0010 == 0b1101 (> kAuthor important) 27 // kUserAgent important: ~0b0001 == 0b1110 (> kUser important) 28 // 29 // Because kTransition has a higher priority than anything else, it's set to 30 // 0b10000, which is greater than kUserAgent important. Although 0b1111 is 31 // available, we avoid using that such that the fourth bit can be used as 32 // as quick is-important check. 33 kTransition = 0b10000, 34 }; 35 36 } // namespace blink 37 38 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CASCADE_ORIGIN_H_ 39