| 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, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/css/StylePropertySerializer.h" | 23 #include "core/css/StylePropertySerializer.h" |
| 24 | 24 |
| 25 #include "core/CSSValueKeywords.h" | 25 #include "core/CSSValueKeywords.h" |
| 26 #include "core/StylePropertyShorthand.h" | 26 #include "core/StylePropertyShorthand.h" |
| 27 #include "core/css/CSSCustomPropertyDeclaration.h" | 27 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 28 #include "core/css/CSSPropertyMetadata.h" | 28 #include "core/css/CSSPropertyMetadata.h" |
| 29 #include "core/css/CSSValuePool.h" | 29 #include "core/css/CSSValuePool.h" |
| 30 #include "wtf/StdLibExtras.h" | |
| 31 #include "wtf/text/StringBuilder.h" | 30 #include "wtf/text/StringBuilder.h" |
| 32 #include <bitset> | 31 #include <bitset> |
| 33 | 32 |
| 34 namespace blink { | 33 namespace blink { |
| 35 | 34 |
| 36 static bool isInitialOrInherit(const String& value) | 35 static bool isInitialOrInherit(const String& value) |
| 37 { | 36 { |
| 38 return value.length() == 7 && (value == "initial" || value == "inherit"); | 37 return value.length() == 7 && (value == "initial" || value == "inherit"); |
| 39 } | 38 } |
| 40 | 39 |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 result.append(value); | 849 result.append(value); |
| 851 } | 850 } |
| 852 if (isInitialOrInherit(commonValue)) | 851 if (isInitialOrInherit(commonValue)) |
| 853 return commonValue; | 852 return commonValue; |
| 854 return result.isEmpty() ? String() : result.toString(); | 853 return result.isEmpty() ? String() : result.toString(); |
| 855 } | 854 } |
| 856 | 855 |
| 857 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue&
repeatXCSSValue, const CSSValue& repeatYCSSValue) | 856 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue&
repeatXCSSValue, const CSSValue& repeatYCSSValue) |
| 858 { | 857 { |
| 859 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. | 858 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. |
| 860 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, initialRepeatValue, (CSSPrimitiveValu
e::createIdentifier(CSSValueRepeat))); | 859 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, initialRepeatValue,
(CSSPrimitiveValue::createIdentifier(CSSValueRepeat))); |
| 861 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? initia
lRepeatValue : toCSSPrimitiveValue(repeatXCSSValue); | 860 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? *initi
alRepeatValue : toCSSPrimitiveValue(repeatXCSSValue); |
| 862 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? initia
lRepeatValue : toCSSPrimitiveValue(repeatYCSSValue); | 861 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? *initi
alRepeatValue : toCSSPrimitiveValue(repeatYCSSValue); |
| 863 CSSValueID repeatXValueId = repeatX.getValueID(); | 862 CSSValueID repeatXValueId = repeatX.getValueID(); |
| 864 CSSValueID repeatYValueId = repeatY.getValueID(); | 863 CSSValueID repeatYValueId = repeatY.getValueID(); |
| 865 if (repeatXValueId == repeatYValueId) { | 864 if (repeatXValueId == repeatYValueId) { |
| 866 builder.append(repeatX.cssText()); | 865 builder.append(repeatX.cssText()); |
| 867 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR
epeat) { | 866 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR
epeat) { |
| 868 builder.appendLiteral("repeat-y"); | 867 builder.appendLiteral("repeat-y"); |
| 869 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR
epeat) { | 868 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR
epeat) { |
| 870 builder.appendLiteral("repeat-x"); | 869 builder.appendLiteral("repeat-x"); |
| 871 } else { | 870 } else { |
| 872 builder.append(repeatX.cssText()); | 871 builder.append(repeatX.cssText()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 isInitialValue = false; | 1012 isInitialValue = false; |
| 1014 if (!value->isInheritedValue()) | 1013 if (!value->isInheritedValue()) |
| 1015 isInheritedValue = false; | 1014 isInheritedValue = false; |
| 1016 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 1015 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
| 1017 return false; | 1016 return false; |
| 1018 } | 1017 } |
| 1019 return isInitialValue || isInheritedValue; | 1018 return isInitialValue || isInheritedValue; |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 } // namespace blink | 1021 } // namespace blink |
| OLD | NEW |