Changeset 279358 in webkit for trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp
- Timestamp:
- Jun 28, 2021, 6:34:20 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp
r266717 r279358 1 1 /* 2 * Copyright (C) 2016 Apple Inc.All rights reserved.2 * Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #include "config.h" 27 27 #include "CSSCustomPropertyValue.h" 28 28 29 #include "CSSTokenizer.h" 29 30 30 31 namespace WebCore { 31 32 33 Ref<CSSCustomPropertyValue> CSSCustomPropertyValue::createEmpty(const AtomString& name) 34 { 35 return adoptRef(*new CSSCustomPropertyValue(name, Monostate { })); 36 } 37 32 38 bool CSSCustomPropertyValue::equals(const CSSCustomPropertyValue& other) const 33 39 { 34 if (this == &other)35 return true;36 40 if (m_name != other.m_name || m_value.index() != other.m_value.index()) 37 41 return false; 38 return WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) { 42 return WTF::switchOn(m_value, [&](const Monostate&) { 43 return true; 44 }, [&](const Ref<CSSVariableReferenceValue>& value) { 39 45 return value.get() == WTF::get<Ref<CSSVariableReferenceValue>>(other.m_value).get(); 40 46 }, [&](const CSSValueID& value) { … … 51 57 String CSSCustomPropertyValue::customCSSText() const 52 58 { 53 if ( !m_serialized) {54 m_serialized = true;55 56 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) {59 if (m_stringValue.isNull()) { 60 WTF::switchOn(m_value, [&](const Monostate&) { 61 m_stringValue = emptyString(); 62 }, [&](const Ref<CSSVariableReferenceValue>& value) { 57 63 m_stringValue = value->cssText(); 58 64 }, [&](const CSSValueID& value) { … … 72 78 { 73 79 Vector<CSSParserToken> result; 74 75 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>&) { 80 WTF::switchOn(m_value, [&](const Monostate&) { 81 // Do nothing. 82 }, [&](const Ref<CSSVariableReferenceValue>&) { 76 83 ASSERT_NOT_REACHED(); 77 84 }, [&](const CSSValueID&) { 78 // Do nothing 85 // Do nothing. 79 86 }, [&](const Ref<CSSVariableData>& value) { 80 87 result.appendVector(value->tokens()); 81 }, [&](const Length&) { 82 CSSTokenizer tokenizer(cssText()); 83 84 auto tokenizerRange = tokenizer.tokenRange(); 85 while (!tokenizerRange.atEnd()) 86 result.append(tokenizerRange.consume()); 87 }, [&](const Ref<StyleImage>&) { 88 CSSTokenizer tokenizer(cssText()); 89 88 }, [&](auto&) { 89 CSSTokenizer tokenizer(customCSSText()); 90 90 auto tokenizerRange = tokenizer.tokenRange(); 91 91 while (!tokenizerRange.atEnd()) 92 92 result.append(tokenizerRange.consume()); 93 93 }); 94 95 94 return result; 96 95 }
Note:
See TracChangeset
for help on using the changeset viewer.