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

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

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return false; 302 return false;
303 } 303 }
304 return true; 304 return true;
305 } 305 }
306 306
307 bool FontFace::setFamilyValue(const CSSValue& familyValue) { 307 bool FontFace::setFamilyValue(const CSSValue& familyValue) {
308 AtomicString family; 308 AtomicString family;
309 if (familyValue.isFontFamilyValue()) { 309 if (familyValue.isFontFamilyValue()) {
310 family = AtomicString(toCSSFontFamilyValue(familyValue).value()); 310 family = AtomicString(toCSSFontFamilyValue(familyValue).value());
311 } else if (familyValue.isIdentifierValue()) { 311 } else if (familyValue.isIdentifierValue()) {
312 // We need to use the raw text for all the generic family types, since @font -face is a way of actually 312 // We need to use the raw text for all the generic family types, since
313 // defining what font to use for those types. 313 // @font-face is a way of actually defining what font to use for those
314 // types.
314 switch (toCSSIdentifierValue(familyValue).getValueID()) { 315 switch (toCSSIdentifierValue(familyValue).getValueID()) {
315 case CSSValueSerif: 316 case CSSValueSerif:
316 family = FontFamilyNames::webkit_serif; 317 family = FontFamilyNames::webkit_serif;
317 break; 318 break;
318 case CSSValueSansSerif: 319 case CSSValueSansSerif:
319 family = FontFamilyNames::webkit_sans_serif; 320 family = FontFamilyNames::webkit_sans_serif;
320 break; 321 break;
321 case CSSValueCursive: 322 case CSSValueCursive:
322 family = FontFamilyNames::webkit_cursive; 323 family = FontFamilyNames::webkit_cursive;
323 break; 324 break;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 break; 507 break;
507 case CSSValue300: 508 case CSSValue300:
508 weight = FontWeight300; 509 weight = FontWeight300;
509 break; 510 break;
510 case CSSValue200: 511 case CSSValue200:
511 weight = FontWeight200; 512 weight = FontWeight200;
512 break; 513 break;
513 case CSSValue100: 514 case CSSValue100:
514 weight = FontWeight100; 515 weight = FontWeight100;
515 break; 516 break;
516 // Although 'lighter' and 'bolder' are valid keywords for font-weights, th ey are invalid 517 // Although 'lighter' and 'bolder' are valid keywords for font-weights,
517 // inside font-face rules so they are ignored. Reference: http://www.w3.or g/TR/css3-fonts/#descdef-font-weight. 518 // they are invalid inside font-face rules so they are ignored. Reference:
519 // http://www.w3.org/TR/css3-fonts/#descdef-font-weight.
518 case CSSValueLighter: 520 case CSSValueLighter:
519 case CSSValueBolder: 521 case CSSValueBolder:
520 break; 522 break;
521 default: 523 default:
522 ASSERT_NOT_REACHED(); 524 ASSERT_NOT_REACHED();
523 break; 525 break;
524 } 526 }
525 } 527 }
526 528
527 return FontTraits(style, weight, stretch); 529 return FontTraits(style, weight, stretch);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 568 }
567 569
568 return new CSSFontFace(fontFace, ranges); 570 return new CSSFontFace(fontFace, ranges);
569 } 571 }
570 572
571 void FontFace::initCSSFontFace(Document* document, const CSSValue* src) { 573 void FontFace::initCSSFontFace(Document* document, const CSSValue* src) {
572 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); 574 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
573 if (m_error) 575 if (m_error)
574 return; 576 return;
575 577
576 // Each item in the src property's list is a single CSSFontFaceSource. Put the m all into a CSSFontFace. 578 // Each item in the src property's list is a single CSSFontFaceSource. Put
579 // them all into a CSSFontFace.
577 ASSERT(src); 580 ASSERT(src);
578 ASSERT(src->isValueList()); 581 ASSERT(src->isValueList());
579 const CSSValueList* srcList = toCSSValueList(src); 582 const CSSValueList* srcList = toCSSValueList(src);
580 int srcLength = srcList->length(); 583 int srcLength = srcList->length();
581 584
582 for (int i = 0; i < srcLength; i++) { 585 for (int i = 0; i < srcLength; i++) {
583 // An item in the list either specifies a string (local font name) or a URL (remote font to download). 586 // An item in the list either specifies a string (local font name) or a URL
587 // (remote font to download).
584 const CSSFontFaceSrcValue& item = toCSSFontFaceSrcValue(srcList->item(i)); 588 const CSSFontFaceSrcValue& item = toCSSFontFaceSrcValue(srcList->item(i));
585 CSSFontFaceSource* source = nullptr; 589 CSSFontFaceSource* source = nullptr;
586 590
587 if (!item.isLocal()) { 591 if (!item.isLocal()) {
588 const Settings* settings = document ? document->settings() : nullptr; 592 const Settings* settings = document ? document->settings() : nullptr;
589 bool allowDownloading = 593 bool allowDownloading =
590 settings && settings->downloadableBinaryFontsEnabled(); 594 settings && settings->downloadableBinaryFontsEnabled();
591 if (allowDownloading && item.isSupportedFormat() && document) { 595 if (allowDownloading && item.isSupportedFormat() && document) {
592 FontResource* fetched = item.fetch(document); 596 FontResource* fetched = item.fetch(document);
593 if (fetched) { 597 if (fetched) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 bool FontFace::hadBlankText() const { 650 bool FontFace::hadBlankText() const {
647 return m_cssFontFace->hadBlankText(); 651 return m_cssFontFace->hadBlankText();
648 } 652 }
649 653
650 bool FontFace::hasPendingActivity() const { 654 bool FontFace::hasPendingActivity() const {
651 return m_status == Loading && getExecutionContext() && 655 return m_status == Loading && getExecutionContext() &&
652 !getExecutionContext()->activeDOMObjectsAreStopped(); 656 !getExecutionContext()->activeDOMObjectsAreStopped();
653 } 657 }
654 658
655 } // namespace blink 659 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/ElementRuleCollector.cpp ('k') | third_party/WebKit/Source/core/css/FontFaceSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698