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

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.h

Issue 424683004: Use StyleBuilderConverter for text-decoration(-line). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Place the new function in order + refactor Created 6 years, 4 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
« no previous file with comments | « Source/core/css/CSSProperties.in ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 28 matching lines...) Expand all
39 namespace blink { 39 namespace blink {
40 40
41 // Note that we assume the parser only allows valid CSSValue types. 41 // Note that we assume the parser only allows valid CSSValue types.
42 42
43 class StyleBuilderConverter { 43 class StyleBuilderConverter {
44 public: 44 public:
45 static PassRefPtr<StyleReflection> convertBoxReflect(StyleResolverState&, CS SValue*); 45 static PassRefPtr<StyleReflection> convertBoxReflect(StyleResolverState&, CS SValue*);
46 static AtomicString convertFragmentIdentifier(StyleResolverState&, CSSValue* ); 46 static AtomicString convertFragmentIdentifier(StyleResolverState&, CSSValue* );
47 static Color convertColor(StyleResolverState&, CSSValue*, bool forVisitedLin k = false); 47 static Color convertColor(StyleResolverState&, CSSValue*, bool forVisitedLin k = false);
48 template <typename T> static T convertComputedLength(StyleResolverState&, CS SValue*); 48 template <typename T> static T convertComputedLength(StyleResolverState&, CS SValue*);
49 template <typename T> static T convertFlags(StyleResolverState&, CSSValue*);
49 static EGlyphOrientation convertGlyphOrientation(StyleResolverState&, CSSVal ue*); 50 static EGlyphOrientation convertGlyphOrientation(StyleResolverState&, CSSVal ue*);
50 static GridPosition convertGridPosition(StyleResolverState&, CSSValue*); 51 static GridPosition convertGridPosition(StyleResolverState&, CSSValue*);
51 static GridTrackSize convertGridTrackSize(StyleResolverState&, CSSValue*); 52 static GridTrackSize convertGridTrackSize(StyleResolverState&, CSSValue*);
52 template <typename T> static T convertLineWidth(StyleResolverState&, CSSValu e*); 53 template <typename T> static T convertLineWidth(StyleResolverState&, CSSValu e*);
53 static Length convertLength(StyleResolverState&, CSSValue*); 54 static Length convertLength(StyleResolverState&, CSSValue*);
54 static Length convertLengthOrAuto(StyleResolverState&, CSSValue*); 55 static Length convertLengthOrAuto(StyleResolverState&, CSSValue*);
55 static Length convertLengthSizing(StyleResolverState&, CSSValue*); 56 static Length convertLengthSizing(StyleResolverState&, CSSValue*);
56 static Length convertLengthMaxSizing(StyleResolverState&, CSSValue*); 57 static Length convertLengthMaxSizing(StyleResolverState&, CSSValue*);
57 static LengthPoint convertLengthPoint(StyleResolverState&, CSSValue*); 58 static LengthPoint convertLengthPoint(StyleResolverState&, CSSValue*);
58 static LineBoxContain convertLineBoxContain(StyleResolverState&, CSSValue*); 59 static LineBoxContain convertLineBoxContain(StyleResolverState&, CSSValue*);
(...skipping 13 matching lines...) Expand all
72 static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap& , NamedGridLinesMap&, GridTrackSizingDirection); 73 static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap& , NamedGridLinesMap&, GridTrackSizingDirection);
73 }; 74 };
74 75
75 template <typename T> 76 template <typename T>
76 T StyleBuilderConverter::convertComputedLength(StyleResolverState& state, CSSVal ue* value) 77 T StyleBuilderConverter::convertComputedLength(StyleResolverState& state, CSSVal ue* value)
77 { 78 {
78 return toCSSPrimitiveValue(value)->computeLength<T>(state.cssToLengthConvers ionData()); 79 return toCSSPrimitiveValue(value)->computeLength<T>(state.cssToLengthConvers ionData());
79 } 80 }
80 81
81 template <typename T> 82 template <typename T>
83 T StyleBuilderConverter::convertFlags(StyleResolverState& state, CSSValue* value )
84 {
85 T flags = static_cast<T>(0);
86 for (CSSValueListIterator i(value); i.hasMore(); i.advance())
87 flags |= *toCSSPrimitiveValue(i.value());
88 return flags;
89 }
90
91 template <typename T>
82 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, CSSValue* v alue) 92 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, CSSValue* v alue)
83 { 93 {
84 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 94 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
85 CSSValueID valueID = primitiveValue->getValueID(); 95 CSSValueID valueID = primitiveValue->getValueID();
86 if (valueID == CSSValueThin) 96 if (valueID == CSSValueThin)
87 return 1; 97 return 1;
88 if (valueID == CSSValueMedium) 98 if (valueID == CSSValueMedium)
89 return 3; 99 return 3;
90 if (valueID == CSSValueThick) 100 if (valueID == CSSValueThick)
91 return 5; 101 return 5;
(...skipping 17 matching lines...) Expand all
109 { 119 {
110 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 120 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
111 if (primitiveValue->getValueID() == IdForNone) 121 if (primitiveValue->getValueID() == IdForNone)
112 return nullAtom; 122 return nullAtom;
113 return AtomicString(primitiveValue->getStringValue()); 123 return AtomicString(primitiveValue->getStringValue());
114 } 124 }
115 125
116 } // namespace blink 126 } // namespace blink
117 127
118 #endif 128 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSProperties.in ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698