| OLD | NEW |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, CSSStrictMode,
0); | 60 CSSParser::parseValue(parsedStyle.get(), propertyID, s, true, CSSStrictMode,
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& es) |
| 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.throwDOMException(SyntaxError); | 68 es.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, es); |
| 74 if (es.hadException()) | 74 if (es.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)) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 void FontFace::setFeatureSettings(const String& s, ExceptionState& es) | 202 void FontFace::setFeatureSettings(const String& s, ExceptionState& es) |
| 203 { | 203 { |
| 204 setPropertyFromString(s, CSSPropertyWebkitFontFeatureSettings, es); | 204 setPropertyFromString(s, CSSPropertyWebkitFontFeatureSettings, es); |
| 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& es) |
| 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.throwDOMException(SyntaxError); | 211 es.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 Loading... |
| 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 = static_cast<CSSUnicodeRangeValue*>(ran
geList->itemWithoutBoundsCheck(i)); | 449 CSSUnicodeRangeValue* range = static_cast<CSSUnicodeRangeValue*>(ran
geList->itemWithoutBoundsCheck(i)); |
| 450 cssFontFace->addRange(range->from(), range->to()); | 450 cssFontFace->addRange(range->from(), range->to()); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 return cssFontFace; | 453 return cssFontFace; |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace WebCore | 456 } // namespace WebCore |
| OLD | NEW |