| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "gen/sky/platform/RuntimeEnabledFeatures.h" | 25 #include "gen/sky/platform/RuntimeEnabledFeatures.h" |
| 26 #include "sky/engine/core/css/CSSPropertyMetadata.h" | 26 #include "sky/engine/core/css/CSSPropertyMetadata.h" |
| 27 #include "sky/engine/core/css/CSSValue.h" | 27 #include "sky/engine/core/css/CSSValue.h" |
| 28 #include "sky/engine/platform/text/TextDirection.h" | 28 #include "sky/engine/platform/text/TextDirection.h" |
| 29 #include "sky/engine/wtf/PassRefPtr.h" | 29 #include "sky/engine/wtf/PassRefPtr.h" |
| 30 #include "sky/engine/wtf/RefPtr.h" | 30 #include "sky/engine/wtf/RefPtr.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 struct StylePropertyMetadata { | 34 struct StylePropertyMetadata { |
| 35 StylePropertyMetadata(CSSPropertyID propertyID, bool isSetFromShorthand, int
indexInShorthandsVector, bool important, bool implicit, bool inherited) | 35 StylePropertyMetadata(CSSPropertyID propertyID, bool isSetFromShorthand, int
indexInShorthandsVector, bool implicit, bool inherited) |
| 36 : m_propertyID(propertyID) | 36 : m_propertyID(propertyID) |
| 37 , m_isSetFromShorthand(isSetFromShorthand) | 37 , m_isSetFromShorthand(isSetFromShorthand) |
| 38 , m_indexInShorthandsVector(indexInShorthandsVector) | 38 , m_indexInShorthandsVector(indexInShorthandsVector) |
| 39 , m_important(important) | |
| 40 , m_implicit(implicit) | 39 , m_implicit(implicit) |
| 41 , m_inherited(inherited) | 40 , m_inherited(inherited) |
| 42 { | 41 { |
| 43 } | 42 } |
| 44 | 43 |
| 45 CSSPropertyID shorthandID() const; | 44 CSSPropertyID shorthandID() const; |
| 46 | 45 |
| 47 uint16_t m_propertyID : 10; | 46 uint16_t m_propertyID : 10; |
| 48 uint16_t m_isSetFromShorthand : 1; | 47 uint16_t m_isSetFromShorthand : 1; |
| 49 uint16_t m_indexInShorthandsVector : 2; // If this property was set as part
of an ambiguous shorthand, gives the index in the shorthands vector. | 48 uint16_t m_indexInShorthandsVector : 2; // If this property was set as part
of an ambiguous shorthand, gives the index in the shorthands vector. |
| 50 uint16_t m_important : 1; | |
| 51 uint16_t m_implicit : 1; // Whether or not the property was set implicitly a
s the result of a shorthand. | 49 uint16_t m_implicit : 1; // Whether or not the property was set implicitly a
s the result of a shorthand. |
| 52 uint16_t m_inherited : 1; | 50 uint16_t m_inherited : 1; |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 class CSSProperty { | 53 class CSSProperty { |
| 56 ALLOW_ONLY_INLINE_ALLOCATION(); | 54 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 57 public: | 55 public: |
| 58 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool impor
tant = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0,
bool implicit = false) | 56 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool isSet
FromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false) |
| 59 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, im
portant, implicit, CSSPropertyMetadata::isInheritedProperty(propertyID)) | 57 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, im
plicit, CSSPropertyMetadata::isInheritedProperty(propertyID)) |
| 60 , m_value(value) | 58 , m_value(value) |
| 61 { | 59 { |
| 62 } | 60 } |
| 63 | 61 |
| 64 // FIXME: Remove this. | 62 // FIXME: Remove this. |
| 65 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) | 63 CSSProperty(StylePropertyMetadata metadata, CSSValue* value) |
| 66 : m_metadata(metadata) | 64 : m_metadata(metadata) |
| 67 , m_value(value) | 65 , m_value(value) |
| 68 { | 66 { |
| 69 } | 67 } |
| 70 | 68 |
| 71 CSSPropertyID id() const { return static_cast<CSSPropertyID>(m_metadata.m_pr
opertyID); } | 69 CSSPropertyID id() const { return static_cast<CSSPropertyID>(m_metadata.m_pr
opertyID); } |
| 72 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; | 70 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; |
| 73 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; | 71 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; |
| 74 bool isImportant() const { return m_metadata.m_important; } | |
| 75 | 72 |
| 76 CSSValue* value() const { return m_value.get(); } | 73 CSSValue* value() const { return m_value.get(); } |
| 77 | 74 |
| 78 void wrapValueInCommaSeparatedList(); | 75 void wrapValueInCommaSeparatedList(); |
| 79 | 76 |
| 80 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion); | 77 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirect
ion); |
| 81 static bool isAffectedByAllProperty(CSSPropertyID); | 78 static bool isAffectedByAllProperty(CSSPropertyID); |
| 82 | 79 |
| 83 const StylePropertyMetadata& metadata() const { return m_metadata; } | 80 const StylePropertyMetadata& metadata() const { return m_metadata; } |
| 84 | 81 |
| 85 private: | 82 private: |
| 86 StylePropertyMetadata m_metadata; | 83 StylePropertyMetadata m_metadata; |
| 87 RefPtr<CSSValue> m_value; | 84 RefPtr<CSSValue> m_value; |
| 88 }; | 85 }; |
| 89 | 86 |
| 90 } // namespace blink | 87 } // namespace blink |
| 91 | 88 |
| 92 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSProperty); | 89 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSProperty); |
| 93 | 90 |
| 94 #endif // SKY_ENGINE_CORE_CSS_CSSPROPERTY_H_ | 91 #endif // SKY_ENGINE_CORE_CSS_CSSPROPERTY_H_ |
| OLD | NEW |