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

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

Issue 1778743003: Make <custom-ident> not insert quotes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win_chromium_rel_ng Created 4 years, 9 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 * 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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/css/FontFace.h" 31 #include "core/css/FontFace.h"
32 32
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "bindings/core/v8/UnionTypesCore.h" 35 #include "bindings/core/v8/UnionTypesCore.h"
36 #include "core/CSSValueKeywords.h" 36 #include "core/CSSValueKeywords.h"
37 #include "core/css/BinaryDataFontFaceSource.h" 37 #include "core/css/BinaryDataFontFaceSource.h"
38 #include "core/css/CSSCustomIdentValue.h"
39 #include "core/css/CSSFontFace.h" 38 #include "core/css/CSSFontFace.h"
40 #include "core/css/CSSFontFaceSrcValue.h" 39 #include "core/css/CSSFontFaceSrcValue.h"
40 #include "core/css/CSSFontFamilyValue.h"
41 #include "core/css/CSSFontSelector.h" 41 #include "core/css/CSSFontSelector.h"
42 #include "core/css/CSSPrimitiveValue.h" 42 #include "core/css/CSSPrimitiveValue.h"
43 #include "core/css/CSSUnicodeRangeValue.h" 43 #include "core/css/CSSUnicodeRangeValue.h"
44 #include "core/css/CSSValueList.h" 44 #include "core/css/CSSValueList.h"
45 #include "core/css/FontFaceDescriptors.h" 45 #include "core/css/FontFaceDescriptors.h"
46 #include "core/css/LocalFontFaceSource.h" 46 #include "core/css/LocalFontFaceSource.h"
47 #include "core/css/RemoteFontFaceSource.h" 47 #include "core/css/RemoteFontFaceSource.h"
48 #include "core/css/StylePropertySet.h" 48 #include "core/css/StylePropertySet.h"
49 #include "core/css/StyleRule.h" 49 #include "core/css/StyleRule.h"
50 #include "core/css/parser/CSSParser.h" 50 #include "core/css/parser/CSSParser.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->baseAddr ess()), source->byteLength()); 106 fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->baseAddr ess()), source->byteLength());
107 return fontFace.release(); 107 return fontFace.release();
108 } 108 }
109 109
110 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(Document* document, const Styl eRuleFontFace* fontFaceRule) 110 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(Document* document, const Styl eRuleFontFace* fontFaceRule)
111 { 111 {
112 const StylePropertySet& properties = fontFaceRule->properties(); 112 const StylePropertySet& properties = fontFaceRule->properties();
113 113
114 // Obtain the font-family property and the src property. Both must be define d. 114 // Obtain the font-family property and the src property. Both must be define d.
115 RefPtrWillBeRawPtr<CSSValue> family = properties.getPropertyCSSValue(CSSProp ertyFontFamily); 115 RefPtrWillBeRawPtr<CSSValue> family = properties.getPropertyCSSValue(CSSProp ertyFontFamily);
116 if (!family || (!family->isCustomIdentValue() && !family->isPrimitiveValue() )) 116 if (!family || (!family->isFontFamilyValue() && !family->isPrimitiveValue()) )
117 return nullptr; 117 return nullptr;
118 RefPtrWillBeRawPtr<CSSValue> src = properties.getPropertyCSSValue(CSSPropert ySrc); 118 RefPtrWillBeRawPtr<CSSValue> src = properties.getPropertyCSSValue(CSSPropert ySrc);
119 if (!src || !src->isValueList()) 119 if (!src || !src->isValueList())
120 return nullptr; 120 return nullptr;
121 121
122 RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(docu ment)); 122 RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(docu ment));
123 123
124 if (fontFace->setFamilyValue(*family) 124 if (fontFace->setFamilyValue(*family)
125 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontStyle) 125 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontStyle)
126 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontWeight) 126 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontWeight)
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 default: 271 default:
272 ASSERT_NOT_REACHED(); 272 ASSERT_NOT_REACHED();
273 return false; 273 return false;
274 } 274 }
275 return true; 275 return true;
276 } 276 }
277 277
278 bool FontFace::setFamilyValue(const CSSValue& familyValue) 278 bool FontFace::setFamilyValue(const CSSValue& familyValue)
279 { 279 {
280 AtomicString family; 280 AtomicString family;
281 if (familyValue.isCustomIdentValue()) { 281 if (familyValue.isFontFamilyValue()) {
282 family = AtomicString(toCSSCustomIdentValue(familyValue).value()); 282 family = AtomicString(toCSSFontFamilyValue(familyValue).value());
283 } else if (toCSSPrimitiveValue(familyValue).isValueID()) { 283 } else if (toCSSPrimitiveValue(familyValue).isValueID()) {
284 // We need to use the raw text for all the generic family types, since @ font-face is a way of actually 284 // We need to use the raw text for all the generic family types, since @ font-face is a way of actually
285 // defining what font to use for those types. 285 // defining what font to use for those types.
286 switch (toCSSPrimitiveValue(familyValue).getValueID()) { 286 switch (toCSSPrimitiveValue(familyValue).getValueID()) {
287 case CSSValueSerif: 287 case CSSValueSerif:
288 family = FontFamilyNames::webkit_serif; 288 family = FontFamilyNames::webkit_serif;
289 break; 289 break;
290 case CSSValueSansSerif: 290 case CSSValueSansSerif:
291 family = FontFamilyNames::webkit_sans_serif; 291 family = FontFamilyNames::webkit_sans_serif;
292 break; 292 break;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 { 643 {
644 return m_cssFontFace->hadBlankText(); 644 return m_cssFontFace->hadBlankText();
645 } 645 }
646 646
647 bool FontFace::hasPendingActivity() const 647 bool FontFace::hasPendingActivity() const
648 { 648 {
649 return m_status == Loading && getExecutionContext() && !getExecutionContext( )->activeDOMObjectsAreStopped(); 649 return m_status == Loading && getExecutionContext() && !getExecutionContext( )->activeDOMObjectsAreStopped();
650 } 650 }
651 651
652 } // namespace blink 652 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698