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

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

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Fixing tests Created 5 years, 3 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 22 matching lines...) Expand all
33 33
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "bindings/core/v8/ScriptState.h" 35 #include "bindings/core/v8/ScriptState.h"
36 #include "bindings/core/v8/UnionTypesCore.h" 36 #include "bindings/core/v8/UnionTypesCore.h"
37 #include "core/CSSValueKeywords.h" 37 #include "core/CSSValueKeywords.h"
38 #include "core/css/BinaryDataFontFaceSource.h" 38 #include "core/css/BinaryDataFontFaceSource.h"
39 #include "core/css/CSSFontFace.h" 39 #include "core/css/CSSFontFace.h"
40 #include "core/css/CSSFontFaceSrcValue.h" 40 #include "core/css/CSSFontFaceSrcValue.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/CSSStringValueBase.h"
43 #include "core/css/CSSUnicodeRangeValue.h" 44 #include "core/css/CSSUnicodeRangeValue.h"
44 #include "core/css/CSSValueList.h" 45 #include "core/css/CSSValueList.h"
45 #include "core/css/FontFaceDescriptors.h" 46 #include "core/css/FontFaceDescriptors.h"
46 #include "core/css/LocalFontFaceSource.h" 47 #include "core/css/LocalFontFaceSource.h"
47 #include "core/css/RemoteFontFaceSource.h" 48 #include "core/css/RemoteFontFaceSource.h"
48 #include "core/css/StylePropertySet.h" 49 #include "core/css/StylePropertySet.h"
49 #include "core/css/StyleRule.h" 50 #include "core/css/StyleRule.h"
50 #include "core/css/parser/CSSParser.h" 51 #include "core/css/parser/CSSParser.h"
51 #include "core/dom/DOMArrayBuffer.h" 52 #include "core/dom/DOMArrayBuffer.h"
52 #include "core/dom/DOMArrayBufferView.h" 53 #include "core/dom/DOMArrayBufferView.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 270 }
270 return true; 271 return true;
271 } 272 }
272 273
273 bool FontFace::setFamilyValue(CSSValueList* familyList) 274 bool FontFace::setFamilyValue(CSSValueList* familyList)
274 { 275 {
275 // The font-family descriptor has to have exactly one family name. 276 // The font-family descriptor has to have exactly one family name.
276 if (familyList->length() != 1) 277 if (familyList->length() != 1)
277 return false; 278 return false;
278 279
279 CSSPrimitiveValue* familyValue = toCSSPrimitiveValue(familyList->item(0)); 280 CSSValue* familyValue = familyList->item(0);
280 AtomicString family; 281 AtomicString family;
281 if (familyValue->isCustomIdent()) { 282 if (familyValue->isCustomIdentValue()) {
282 family = AtomicString(familyValue->getStringValue()); 283 family = AtomicString(toCSSCustomIdentValue(familyValue)->value());
283 } else if (familyValue->isValueID()) { 284 } 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 285 // 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. 286 // defining what font to use for those types.
286 switch (familyValue->getValueID()) { 287 switch (toCSSPrimitiveValue(familyValue)->getValueID()) {
287 case CSSValueSerif: 288 case CSSValueSerif:
288 family = FontFamilyNames::webkit_serif; 289 family = FontFamilyNames::webkit_serif;
289 break; 290 break;
290 case CSSValueSansSerif: 291 case CSSValueSansSerif:
291 family = FontFamilyNames::webkit_sans_serif; 292 family = FontFamilyNames::webkit_sans_serif;
292 break; 293 break;
293 case CSSValueCursive: 294 case CSSValueCursive:
294 family = FontFamilyNames::webkit_cursive; 295 family = FontFamilyNames::webkit_cursive;
295 break; 296 break;
296 case CSSValueFantasy: 297 case CSSValueFantasy:
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 { 618 {
618 return m_cssFontFace->hadBlankText(); 619 return m_cssFontFace->hadBlankText();
619 } 620 }
620 621
621 bool FontFace::hasPendingActivity() const 622 bool FontFace::hasPendingActivity() const
622 { 623 {
623 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped(); 624 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped();
624 } 625 }
625 626
626 } // namespace blink 627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698