Changeset 293278 in webkit
- Timestamp:
- Apr 22, 2022, 7:15:14 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bindings/IDLTypes.h (modified) (2 diffs)
-
css/typedom/numeric/CSSMathProduct.cpp (modified) (1 diff)
-
css/typedom/numeric/CSSNumericType.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r293264 r293278 1 2022-04-22 Alex Christensen <achristensen@webkit.org> 2 3 Reduce sizeof(CSSNumericType) 4 https://bugs.webkit.org/show_bug.cgi?id=239680 5 6 Reviewed by Yusuke Suzuki. 7 8 * bindings/IDLTypes.h: 9 (WebCore::IDLType::nullValue): 10 (WebCore::IDLType::isNullType): 11 (WebCore::IDLType::extractValueFromNullable): 12 * css/typedom/numeric/CSSMathProduct.cpp: 13 (WebCore::multiplyTypes): 14 * css/typedom/numeric/CSSNumericType.h: 15 (WebCore::CSSNumericType::valueForType): 16 (WebCore::CSSNumericType::valueForType const): 17 1 18 2022-04-22 Patrick Angle <pangle@apple.com> 2 19 -
trunk/Source/WebCore/bindings/IDLTypes.h
r289700 r293278 31 31 #include <variant> 32 32 #include <wtf/Brigand.h> 33 #include <wtf/Markable.h> 33 34 #include <wtf/StdLibExtras.h> 34 35 #include <wtf/URL.h> … … 76 77 static bool isNullValue(const NullableType& value) { return !value; } 77 78 static ImplementationType extractValueFromNullable(const NullableType& value) { return value.value(); } 79 80 template<typename Traits> using NullableTypeWithLessPadding = Markable<ImplementationType, Traits>; 81 template<typename Traits> 82 static NullableTypeWithLessPadding<Traits> nullValue() { return std::nullopt; } 83 template<typename Traits> 84 static bool isNullType(const NullableTypeWithLessPadding<Traits>& value) { return !value; } 85 template<typename Traits> 86 static ImplementationType extractValueFromNullable(const NullableTypeWithLessPadding<Traits>& value) { return value.value(); } 78 87 }; 79 88 -
trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp
r293086 r293278 44 44 return std::nullopt; 45 45 46 auto add = [] (auto left, auto right) -> std::optional<unsigned>{46 auto add = [] (auto left, auto right) -> CSSNumericType::BaseTypeStorage { 47 47 if (!left) 48 48 return right; -
trunk/Source/WebCore/css/typedom/numeric/CSSNumericType.h
r293005 r293278 30 30 #include "CSSNumericBaseType.h" 31 31 #include <optional> 32 #include <wtf/Markable.h> 32 33 #include <wtf/text/StringConcatenateNumbers.h> 33 34 … … 36 37 // https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-type 37 38 struct CSSNumericType { 38 std::optional<long> length; 39 std::optional<long> angle; 40 std::optional<long> time; 41 std::optional<long> frequency; 42 std::optional<long> resolution; 43 std::optional<long> flex; 44 std::optional<long> percent; 45 std::optional<CSSNumericBaseType> percentHint; 39 using BaseTypeStorage = Markable<int, IntegralMarkableTraits<int, std::numeric_limits<int>::min()>>; 40 BaseTypeStorage length; 41 BaseTypeStorage angle; 42 BaseTypeStorage time; 43 BaseTypeStorage frequency; 44 BaseTypeStorage resolution; 45 BaseTypeStorage flex; 46 BaseTypeStorage percent; 47 Markable<CSSNumericBaseType, EnumMarkableTraits<CSSNumericBaseType>> percentHint; 46 48 47 49 bool operator==(const CSSNumericType& other) const … … 57 59 } 58 60 59 std::optional<long>& valueForType(CSSNumericBaseType type)61 BaseTypeStorage& valueForType(CSSNumericBaseType type) 60 62 { 61 63 switch (type) { … … 78 80 } 79 81 80 const std::optional<long>& valueForType(CSSNumericBaseType type) const82 const BaseTypeStorage& valueForType(CSSNumericBaseType type) const 81 83 { 82 84 return const_cast<CSSNumericType*>(this)->valueForType(type);
Note:
See TracChangeset
for help on using the changeset viewer.