| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef CSSValuePair_h | 21 #ifndef CSSValuePair_h |
| 22 #define CSSValuePair_h | 22 #define CSSValuePair_h |
| 23 | 23 |
| 24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
| 25 #include "core/css/CSSPrimitiveValue.h" | |
| 26 #include "core/css/CSSValue.h" | 25 #include "core/css/CSSValue.h" |
| 27 #include "core/style/ComputedStyle.h" | 26 #include "wtf/text/WTFString.h" |
| 28 #include "platform/Length.h" | |
| 29 #include "wtf/text/StringBuilder.h" | |
| 30 | 27 |
| 31 namespace blink { | 28 namespace blink { |
| 32 | 29 |
| 33 class CORE_EXPORT CSSValuePair : public CSSValue { | 30 class CORE_EXPORT CSSValuePair : public CSSValue { |
| 34 public: | 31 public: |
| 35 enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues }; | 32 enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues }; |
| 36 | 33 |
| 37 static CSSValuePair* create(const CSSValue* first, const CSSValue* second, | 34 static CSSValuePair* create(const CSSValue* first, const CSSValue* second, |
| 38 IdenticalValuesPolicy identicalValuesPolicy) | 35 IdenticalValuesPolicy identicalValuesPolicy) |
| 39 { | 36 { |
| 40 return new CSSValuePair(first, second, identicalValuesPolicy); | 37 return new CSSValuePair(first, second, identicalValuesPolicy); |
| 41 } | 38 } |
| 42 | 39 |
| 43 static CSSValuePair* create(const LengthSize& lengthSize, const ComputedStyl
e& style) | |
| 44 { | |
| 45 return new CSSValuePair(CSSPrimitiveValue::create(lengthSize.width(), st
yle.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.height(), style.effec
tiveZoom()), KeepIdenticalValues); | |
| 46 } | |
| 47 | |
| 48 const CSSValue& first() const { return *m_first; } | 40 const CSSValue& first() const { return *m_first; } |
| 49 const CSSValue& second() const { return *m_second; } | 41 const CSSValue& second() const { return *m_second; } |
| 50 | 42 |
| 51 String customCSSText() const | 43 String customCSSText() const |
| 52 { | 44 { |
| 53 String first = m_first->cssText(); | 45 String first = m_first->cssText(); |
| 54 String second = m_second->cssText(); | 46 String second = m_second->cssText(); |
| 55 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) | 47 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) |
| 56 return first; | 48 return first; |
| 57 return first + ' ' + second; | 49 return first + ' ' + second; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 Member<const CSSValue> m_first; | 72 Member<const CSSValue> m_first; |
| 81 Member<const CSSValue> m_second; | 73 Member<const CSSValue> m_second; |
| 82 IdenticalValuesPolicy m_identicalValuesPolicy; | 74 IdenticalValuesPolicy m_identicalValuesPolicy; |
| 83 }; | 75 }; |
| 84 | 76 |
| 85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); | 77 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); |
| 86 | 78 |
| 87 } // namespace blink | 79 } // namespace blink |
| 88 | 80 |
| 89 #endif // CSSValuePair_h | 81 #endif // CSSValuePair_h |
| OLD | NEW |