diff options
Diffstat (limited to 'Source/WebCore/css/CSSProperty.h')
-rw-r--r-- | Source/WebCore/css/CSSProperty.h | 88 |
1 files changed, 30 insertions, 58 deletions
diff --git a/Source/WebCore/css/CSSProperty.h b/Source/WebCore/css/CSSProperty.h index f5f1a6a05..debf1951f 100644 --- a/Source/WebCore/css/CSSProperty.h +++ b/Source/WebCore/css/CSSProperty.h @@ -1,6 +1,6 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006 Apple Inc. * Copyright (C) 2013 Intel Corporation. All rights reserved. * * This library is free software; you can redistribute it and/or @@ -19,15 +19,11 @@ * Boston, MA 02110-1301, USA. */ -#ifndef CSSProperty_h -#define CSSProperty_h +#pragma once #include "CSSPropertyNames.h" #include "CSSValue.h" -#include "RenderStyleConstants.h" -#include "TextDirection.h" #include "WritingMode.h" -#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -44,6 +40,16 @@ struct StylePropertyMetadata { } CSSPropertyID shorthandID() const; + + bool operator==(const StylePropertyMetadata& other) const + { + return m_propertyID == other.m_propertyID + && m_isSetFromShorthand == other.m_isSetFromShorthand + && m_indexInShorthandsVector == other.m_indexInShorthandsVector + && m_important == other.m_important + && m_implicit == other.m_implicit + && m_inherited == other.m_inherited; + } uint16_t m_propertyID : 10; uint16_t m_isSetFromShorthand : 1; @@ -55,16 +61,9 @@ struct StylePropertyMetadata { class CSSProperty { public: - CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool important = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false) + CSSProperty(CSSPropertyID propertyID, RefPtr<CSSValue>&& value, bool important = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false) : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, important, implicit, isInheritedProperty(propertyID)) - , m_value(value) - { - } - - // FIXME: Remove this. - CSSProperty(StylePropertyMetadata metadata, CSSValue* value) - : m_metadata(metadata) - , m_value(value) + , m_value(WTFMove(value)) { } @@ -80,55 +79,30 @@ public: static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode); static bool isInheritedProperty(CSSPropertyID); static bool isDirectionAwareProperty(CSSPropertyID); + static bool isDescriptorOnly(CSSPropertyID); const StylePropertyMetadata& metadata() const { return m_metadata; } + bool operator==(const CSSProperty& other) const + { + if (!(m_metadata == other.m_metadata)) + return false; + + if (!m_value && !other.m_value) + return true; + + if (!m_value || !other.m_value) + return false; + + return m_value->equals(*other.m_value); + } + private: StylePropertyMetadata m_metadata; RefPtr<CSSValue> m_value; }; -inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId) -{ - CSSPropertyID propertyId = CSSPropertyInvalid; - switch (propId) { - case CSSPropertyTransitionDelay: - propertyId = CSSPropertyWebkitTransitionDelay; - break; - case CSSPropertyTransitionDuration: - propertyId = CSSPropertyWebkitTransitionDuration; - break; - case CSSPropertyTransitionProperty: - propertyId = CSSPropertyWebkitTransitionProperty; - break; - case CSSPropertyTransitionTimingFunction: - propertyId = CSSPropertyWebkitTransitionTimingFunction; - break; - case CSSPropertyTransition: - propertyId = CSSPropertyWebkitTransition; - break; - case CSSPropertyWebkitTransitionDelay: - propertyId = CSSPropertyTransitionDelay; - break; - case CSSPropertyWebkitTransitionDuration: - propertyId = CSSPropertyTransitionDuration; - break; - case CSSPropertyWebkitTransitionProperty: - propertyId = CSSPropertyTransitionProperty; - break; - case CSSPropertyWebkitTransitionTimingFunction: - propertyId = CSSPropertyTransitionTimingFunction; - break; - case CSSPropertyWebkitTransition: - propertyId = CSSPropertyTransition; - break; - default: - propertyId = propId; - break; - } - ASSERT(propertyId != CSSPropertyInvalid); - return propertyId; -} +typedef Vector<CSSProperty, 256> ParsedPropertyVector; } // namespace WebCore @@ -138,5 +112,3 @@ template <> struct VectorTraits<WebCore::CSSProperty> : VectorTraitsBase<false, static const bool canMoveWithMemcpy = true; }; } - -#endif // CSSProperty_h |