| 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 29 matching lines...) Expand all Loading... |
| 40 IdenticalValuesPolicy identicalValuesPolicy) | 40 IdenticalValuesPolicy identicalValuesPolicy) |
| 41 { | 41 { |
| 42 return adoptRefWillBeNoop(new CSSValuePair(first, second, identicalValue
sPolicy)); | 42 return adoptRefWillBeNoop(new CSSValuePair(first, second, identicalValue
sPolicy)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 static PassRefPtrWillBeRawPtr<CSSValuePair> create(const LengthSize& lengthS
ize, const ComputedStyle& style) | 45 static PassRefPtrWillBeRawPtr<CSSValuePair> create(const LengthSize& lengthS
ize, const ComputedStyle& style) |
| 46 { | 46 { |
| 47 return adoptRefWillBeNoop(new CSSValuePair(CSSPrimitiveValue::create(len
gthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.he
ight(), style.effectiveZoom()), KeepIdenticalValues)); | 47 return adoptRefWillBeNoop(new CSSValuePair(CSSPrimitiveValue::create(len
gthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.he
ight(), style.effectiveZoom()), KeepIdenticalValues)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static PassRefPtrWillBeRawPtr<CSSValuePair> deserializeAfterDispatch(CSSDese
rializeStream*); |
| 51 |
| 50 // TODO(sashab): Remove these non-const versions. | 52 // TODO(sashab): Remove these non-const versions. |
| 51 CSSValue& first() { return *m_first; } | 53 CSSValue& first() { return *m_first; } |
| 52 CSSValue& second() { return *m_second; } | 54 CSSValue& second() { return *m_second; } |
| 53 const CSSValue& first() const { return *m_first; } | 55 const CSSValue& first() const { return *m_first; } |
| 54 const CSSValue& second() const { return *m_second; } | 56 const CSSValue& second() const { return *m_second; } |
| 55 | 57 |
| 56 String customCSSText() const | 58 String customCSSText() const |
| 57 { | 59 { |
| 58 String first = m_first->cssText(); | 60 String first = m_first->cssText(); |
| 59 String second = m_second->cssText(); | 61 String second = m_second->cssText(); |
| 60 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) | 62 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) |
| 61 return first; | 63 return first; |
| 62 return first + ' ' + second; | 64 return first + ' ' + second; |
| 63 } | 65 } |
| 64 | 66 |
| 65 bool equals(const CSSValuePair& other) const | 67 bool equals(const CSSValuePair& other) const |
| 66 { | 68 { |
| 67 ASSERT(m_identicalValuesPolicy == other.m_identicalValuesPolicy); | 69 ASSERT(m_identicalValuesPolicy == other.m_identicalValuesPolicy); |
| 68 return compareCSSValuePtr(m_first, other.m_first) | 70 return compareCSSValuePtr(m_first, other.m_first) |
| 69 && compareCSSValuePtr(m_second, other.m_second); | 71 && compareCSSValuePtr(m_second, other.m_second); |
| 70 } | 72 } |
| 71 | 73 |
| 74 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 72 DECLARE_TRACE_AFTER_DISPATCH(); | 75 DECLARE_TRACE_AFTER_DISPATCH(); |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 CSSValuePair(PassRefPtrWillBeRawPtr<CSSValue> first, PassRefPtrWillBeRawPtr<
CSSValue> second, IdenticalValuesPolicy identicalValuesPolicy) | 78 CSSValuePair(PassRefPtrWillBeRawPtr<CSSValue> first, PassRefPtrWillBeRawPtr<
CSSValue> second, IdenticalValuesPolicy identicalValuesPolicy) |
| 76 : CSSValue(ValuePairClass) | 79 : CSSValue(ValuePairClass) |
| 77 , m_first(first) | 80 , m_first(first) |
| 78 , m_second(second) | 81 , m_second(second) |
| 79 , m_identicalValuesPolicy(identicalValuesPolicy) | 82 , m_identicalValuesPolicy(identicalValuesPolicy) |
| 80 { | 83 { |
| 81 ASSERT(m_first); | 84 ASSERT(m_first); |
| 82 ASSERT(m_second); | 85 ASSERT(m_second); |
| 83 } | 86 } |
| 84 | 87 |
| 85 RefPtrWillBeMember<CSSValue> m_first; | 88 RefPtrWillBeMember<CSSValue> m_first; |
| 86 RefPtrWillBeMember<CSSValue> m_second; | 89 RefPtrWillBeMember<CSSValue> m_second; |
| 87 IdenticalValuesPolicy m_identicalValuesPolicy; | 90 IdenticalValuesPolicy m_identicalValuesPolicy; |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); | 93 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); |
| 91 | 94 |
| 92 } // namespace | 95 } // namespace |
| 93 | 96 |
| 94 #endif // CSSValuePair_h | 97 #endif // CSSValuePair_h |
| OLD | NEW |