Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/core/css/StylePropertySerializer.cpp

Issue 1850413002: Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address compilation failure Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
30 #include "wtf/text/StringBuilder.h" 31 #include "wtf/text/StringBuilder.h"
31 #include <bitset> 32 #include <bitset>
32 33
33 namespace blink { 34 namespace blink {
34 35
35 static bool isInitialOrInherit(const String& value) 36 static bool isInitialOrInherit(const String& value)
36 { 37 {
37 return value.length() == 7 && (value == "initial" || value == "inherit"); 38 return value.length() == 7 && (value == "initial" || value == "inherit");
38 } 39 }
39 40
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 result.append(value); 850 result.append(value);
850 } 851 }
851 if (isInitialOrInherit(commonValue)) 852 if (isInitialOrInherit(commonValue))
852 return commonValue; 853 return commonValue;
853 return result.isEmpty() ? String() : result.toString(); 854 return result.isEmpty() ? String() : result.toString();
854 } 855 }
855 856
856 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue) 857 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue)
857 { 858 {
858 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. 859 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS.
859 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, initialRepeatValue, (CSSPrimitiveValue::createIdentifier(CSSValueRepeat))); 860 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, initialRepeatValue, (CSSPrimitiveValu e::createIdentifier(CSSValueRepeat)));
860 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatXCSSValue); 861 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? initia lRepeatValue : toCSSPrimitiveValue(repeatXCSSValue);
861 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatYCSSValue); 862 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? initia lRepeatValue : toCSSPrimitiveValue(repeatYCSSValue);
862 CSSValueID repeatXValueId = repeatX.getValueID(); 863 CSSValueID repeatXValueId = repeatX.getValueID();
863 CSSValueID repeatYValueId = repeatY.getValueID(); 864 CSSValueID repeatYValueId = repeatY.getValueID();
864 if (repeatXValueId == repeatYValueId) { 865 if (repeatXValueId == repeatYValueId) {
865 builder.append(repeatX.cssText()); 866 builder.append(repeatX.cssText());
866 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) { 867 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) {
867 builder.appendLiteral("repeat-y"); 868 builder.appendLiteral("repeat-y");
868 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) { 869 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) {
869 builder.appendLiteral("repeat-x"); 870 builder.appendLiteral("repeat-x");
870 } else { 871 } else {
871 builder.append(repeatX.cssText()); 872 builder.append(repeatX.cssText());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 isInitialValue = false; 1013 isInitialValue = false;
1013 if (!value->isInheritedValue()) 1014 if (!value->isInheritedValue())
1014 isInheritedValue = false; 1015 isInheritedValue = false;
1015 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) 1016 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i]))
1016 return false; 1017 return false;
1017 } 1018 }
1018 return isInitialValue || isInheritedValue; 1019 return isInitialValue || isInheritedValue;
1019 } 1020 }
1020 1021
1021 } // namespace blink 1022 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSValuePool.cpp ('k') | third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698