| 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" |
| 25 #include "core/css/CSSValue.h" | 26 #include "core/css/CSSValue.h" |
| 27 #include "core/style/ComputedStyle.h" |
| 28 #include "platform/Length.h" |
| 29 #include "wtf/text/StringBuilder.h" |
| 26 | 30 |
| 27 namespace blink { | 31 namespace blink { |
| 28 | 32 |
| 29 class CORE_EXPORT CSSValuePair : public CSSValue { | 33 class CORE_EXPORT CSSValuePair : public CSSValue { |
| 30 public: | 34 public: |
| 31 enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues }; | 35 enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues }; |
| 32 | 36 |
| 33 static CSSValuePair* create(const CSSValue* first, const CSSValue* second, | 37 static CSSValuePair* create(const CSSValue* first, const CSSValue* second, |
| 34 IdenticalValuesPolicy identicalValuesPolicy) | 38 IdenticalValuesPolicy identicalValuesPolicy) |
| 35 { | 39 { |
| 36 return new CSSValuePair(first, second, identicalValuesPolicy); | 40 return new CSSValuePair(first, second, identicalValuesPolicy); |
| 37 } | 41 } |
| 38 | 42 |
| 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 |
| 39 const CSSValue& first() const { return *m_first; } | 48 const CSSValue& first() const { return *m_first; } |
| 40 const CSSValue& second() const { return *m_second; } | 49 const CSSValue& second() const { return *m_second; } |
| 41 | 50 |
| 42 String customCSSText() const | 51 String customCSSText() const |
| 43 { | 52 { |
| 44 String first = m_first->cssText(); | 53 String first = m_first->cssText(); |
| 45 String second = m_second->cssText(); | 54 String second = m_second->cssText(); |
| 46 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) | 55 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) |
| 47 return first; | 56 return first; |
| 48 return first + ' ' + second; | 57 return first + ' ' + second; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 Member<const CSSValue> m_first; | 80 Member<const CSSValue> m_first; |
| 72 Member<const CSSValue> m_second; | 81 Member<const CSSValue> m_second; |
| 73 IdenticalValuesPolicy m_identicalValuesPolicy; | 82 IdenticalValuesPolicy m_identicalValuesPolicy; |
| 74 }; | 83 }; |
| 75 | 84 |
| 76 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); | 85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); |
| 77 | 86 |
| 78 } // namespace blink | 87 } // namespace blink |
| 79 | 88 |
| 80 #endif // CSSValuePair_h | 89 #endif // CSSValuePair_h |
| OLD | NEW |