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

Side by Side Diff: Source/core/css/FontFace.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSVariablesMap.cpp ('k') | Source/core/css/FontFaceSet.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 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 static PassRefPtr<CSSValue> parseCSSValue(const String& s, CSSPropertyID propert yID) 55 static PassRefPtr<CSSValue> parseCSSValue(const String& s, CSSPropertyID propert yID)
56 { 56 {
57 if (s.isEmpty()) 57 if (s.isEmpty())
58 return 0; 58 return 0;
59 RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::creat e(); 59 RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::creat e();
60 CSSParser::parseValue(parsedStyle.get(), propertyID, s, true, HTMLStandardMo de, 0); 60 CSSParser::parseValue(parsedStyle.get(), propertyID, s, true, HTMLStandardMo de, 0);
61 return parsedStyle->getPropertyCSSValue(propertyID); 61 return parsedStyle->getPropertyCSSValue(propertyID);
62 } 62 }
63 63
64 PassRefPtr<FontFace> FontFace::create(const String& family, const String& source , const Dictionary& descriptors, ExceptionState& es) 64 PassRefPtr<FontFace> FontFace::create(const String& family, const String& source , const Dictionary& descriptors, ExceptionState& exceptionState)
65 { 65 {
66 RefPtr<CSSValue> src = parseCSSValue(source, CSSPropertySrc); 66 RefPtr<CSSValue> src = parseCSSValue(source, CSSPropertySrc);
67 if (!src || !src->isValueList()) { 67 if (!src || !src->isValueList()) {
68 es.throwUninformativeAndGenericDOMException(SyntaxError); 68 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
69 return 0; 69 return 0;
70 } 70 }
71 71
72 RefPtr<FontFace> fontFace = adoptRef<FontFace>(new FontFace(src)); 72 RefPtr<FontFace> fontFace = adoptRef<FontFace>(new FontFace(src));
73 fontFace->setFamily(family, es); 73 fontFace->setFamily(family, exceptionState);
74 if (es.hadException()) 74 if (exceptionState.hadException())
75 return 0; 75 return 0;
76 76
77 String value; 77 String value;
78 if (descriptors.get("style", value)) { 78 if (descriptors.get("style", value)) {
79 fontFace->setStyle(value, es); 79 fontFace->setStyle(value, exceptionState);
80 if (es.hadException()) 80 if (exceptionState.hadException())
81 return 0; 81 return 0;
82 } 82 }
83 if (descriptors.get("weight", value)) { 83 if (descriptors.get("weight", value)) {
84 fontFace->setWeight(value, es); 84 fontFace->setWeight(value, exceptionState);
85 if (es.hadException()) 85 if (exceptionState.hadException())
86 return 0; 86 return 0;
87 } 87 }
88 if (descriptors.get("stretch", value)) { 88 if (descriptors.get("stretch", value)) {
89 fontFace->setStretch(value, es); 89 fontFace->setStretch(value, exceptionState);
90 if (es.hadException()) 90 if (exceptionState.hadException())
91 return 0; 91 return 0;
92 } 92 }
93 if (descriptors.get("unicodeRange", value)) { 93 if (descriptors.get("unicodeRange", value)) {
94 fontFace->setUnicodeRange(value, es); 94 fontFace->setUnicodeRange(value, exceptionState);
95 if (es.hadException()) 95 if (exceptionState.hadException())
96 return 0; 96 return 0;
97 } 97 }
98 if (descriptors.get("variant", value)) { 98 if (descriptors.get("variant", value)) {
99 fontFace->setVariant(value, es); 99 fontFace->setVariant(value, exceptionState);
100 if (es.hadException()) 100 if (exceptionState.hadException())
101 return 0; 101 return 0;
102 } 102 }
103 if (descriptors.get("featureSettings", value)) { 103 if (descriptors.get("featureSettings", value)) {
104 fontFace->setFeatureSettings(value, es); 104 fontFace->setFeatureSettings(value, exceptionState);
105 if (es.hadException()) 105 if (exceptionState.hadException())
106 return 0; 106 return 0;
107 } 107 }
108 108
109 return fontFace; 109 return fontFace;
110 } 110 }
111 111
112 PassRefPtr<FontFace> FontFace::create(const StyleRuleFontFace* fontFaceRule) 112 PassRefPtr<FontFace> FontFace::create(const StyleRuleFontFace* fontFaceRule)
113 { 113 {
114 const StylePropertySet* properties = fontFaceRule->properties(); 114 const StylePropertySet* properties = fontFaceRule->properties();
115 115
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 String FontFace::variant() const 167 String FontFace::variant() const
168 { 168 {
169 return m_variant ? m_variant->cssText() : "normal"; 169 return m_variant ? m_variant->cssText() : "normal";
170 } 170 }
171 171
172 String FontFace::featureSettings() const 172 String FontFace::featureSettings() const
173 { 173 {
174 return m_featureSettings ? m_featureSettings->cssText() : "normal"; 174 return m_featureSettings ? m_featureSettings->cssText() : "normal";
175 } 175 }
176 176
177 void FontFace::setStyle(const String& s, ExceptionState& es) 177 void FontFace::setStyle(const String& s, ExceptionState& exceptionState)
178 { 178 {
179 setPropertyFromString(s, CSSPropertyFontStyle, es); 179 setPropertyFromString(s, CSSPropertyFontStyle, exceptionState);
180 } 180 }
181 181
182 void FontFace::setWeight(const String& s, ExceptionState& es) 182 void FontFace::setWeight(const String& s, ExceptionState& exceptionState)
183 { 183 {
184 setPropertyFromString(s, CSSPropertyFontWeight, es); 184 setPropertyFromString(s, CSSPropertyFontWeight, exceptionState);
185 } 185 }
186 186
187 void FontFace::setStretch(const String& s, ExceptionState& es) 187 void FontFace::setStretch(const String& s, ExceptionState& exceptionState)
188 { 188 {
189 setPropertyFromString(s, CSSPropertyFontStretch, es); 189 setPropertyFromString(s, CSSPropertyFontStretch, exceptionState);
190 } 190 }
191 191
192 void FontFace::setUnicodeRange(const String& s, ExceptionState& es) 192 void FontFace::setUnicodeRange(const String& s, ExceptionState& exceptionState)
193 { 193 {
194 setPropertyFromString(s, CSSPropertyUnicodeRange, es); 194 setPropertyFromString(s, CSSPropertyUnicodeRange, exceptionState);
195 } 195 }
196 196
197 void FontFace::setVariant(const String& s, ExceptionState& es) 197 void FontFace::setVariant(const String& s, ExceptionState& exceptionState)
198 { 198 {
199 setPropertyFromString(s, CSSPropertyFontVariant, es); 199 setPropertyFromString(s, CSSPropertyFontVariant, exceptionState);
200 } 200 }
201 201
202 void FontFace::setFeatureSettings(const String& s, ExceptionState& es) 202 void FontFace::setFeatureSettings(const String& s, ExceptionState& exceptionStat e)
203 { 203 {
204 setPropertyFromString(s, CSSPropertyWebkitFontFeatureSettings, es); 204 setPropertyFromString(s, CSSPropertyWebkitFontFeatureSettings, exceptionStat e);
205 } 205 }
206 206
207 void FontFace::setPropertyFromString(const String& s, CSSPropertyID propertyID, ExceptionState& es) 207 void FontFace::setPropertyFromString(const String& s, CSSPropertyID propertyID, ExceptionState& exceptionState)
208 { 208 {
209 RefPtr<CSSValue> value = parseCSSValue(s, propertyID); 209 RefPtr<CSSValue> value = parseCSSValue(s, propertyID);
210 if (!value || !setPropertyValue(value, propertyID)) 210 if (!value || !setPropertyValue(value, propertyID))
211 es.throwUninformativeAndGenericDOMException(SyntaxError); 211 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
212 } 212 }
213 213
214 bool FontFace::setPropertyFromStyle(const StylePropertySet* properties, CSSPrope rtyID propertyID) 214 bool FontFace::setPropertyFromStyle(const StylePropertySet* properties, CSSPrope rtyID propertyID)
215 { 215 {
216 return setPropertyValue(properties->getPropertyCSSValue(propertyID), propert yID); 216 return setPropertyValue(properties->getPropertyCSSValue(propertyID), propert yID);
217 } 217 }
218 218
219 bool FontFace::setPropertyValue(PassRefPtr<CSSValue> value, CSSPropertyID proper tyID) 219 bool FontFace::setPropertyValue(PassRefPtr<CSSValue> value, CSSPropertyID proper tyID)
220 { 220 {
221 switch (propertyID) { 221 switch (propertyID) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 unsigned numRanges = rangeList->length(); 447 unsigned numRanges = rangeList->length();
448 for (unsigned i = 0; i < numRanges; i++) { 448 for (unsigned i = 0; i < numRanges; i++) {
449 CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->item WithoutBoundsCheck(i)); 449 CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->item WithoutBoundsCheck(i));
450 cssFontFace->ranges().add(range->from(), range->to()); 450 cssFontFace->ranges().add(range->from(), range->to());
451 } 451 }
452 } 452 }
453 return cssFontFace; 453 return cssFontFace;
454 } 454 }
455 455
456 } // namespace WebCore 456 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSVariablesMap.cpp ('k') | Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698