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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Font.cpp

Issue 2751163002: Report UseCounter metric when observing NotDef glyphs (Closed)
Patch Set: Relax num_glyphs assertion, not feasible on Mac Created 3 years, 7 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 return true; 404 return true;
405 405
406 if (!PrimaryFont()) 406 if (!PrimaryFont())
407 return false; 407 return false;
408 408
409 const FontPlatformData& platform_data = PrimaryFont()->PlatformData(); 409 const FontPlatformData& platform_data = PrimaryFont()->PlatformData();
410 TypesettingFeatures features = GetFontDescription().GetTypesettingFeatures(); 410 TypesettingFeatures features = GetFontDescription().GetTypesettingFeatures();
411 return !platform_data.HasSpaceInLigaturesOrKerning(features); 411 return !platform_data.HasSpaceInLigaturesOrKerning(features);
412 }; 412 };
413 413
414 void Font::ReportNotDefGlyph() const {
415 FontSelector* fontSelector = font_fallback_list_->GetFontSelector();
416 // We have a few non-DOM usages of Font code, for example in DragImage::Create
417 // and in EmbeddedObjectPainter::paintReplaced. In those cases, we can't
418 // retrieve a font selector as our connection to a Document object to report
419 // UseCounter metrics, and thus we cannot report notdef glyphs.
420 if (fontSelector)
421 fontSelector->ReportNotDefGlyph();
422 }
423
414 void Font::WillUseFontData(const String& text) const { 424 void Font::WillUseFontData(const String& text) const {
415 const FontFamily& family = GetFontDescription().Family(); 425 const FontFamily& family = GetFontDescription().Family();
416 if (font_fallback_list_ && font_fallback_list_->GetFontSelector() && 426 if (font_fallback_list_ && font_fallback_list_->GetFontSelector() &&
417 !family.FamilyIsEmpty()) 427 !family.FamilyIsEmpty())
418 font_fallback_list_->GetFontSelector()->WillUseFontData( 428 font_fallback_list_->GetFontSelector()->WillUseFontData(
419 GetFontDescription(), family.Family(), text); 429 GetFontDescription(), family.Family(), text);
420 } 430 }
421 431
422 PassRefPtr<FontFallbackIterator> Font::CreateFontFallbackIterator( 432 PassRefPtr<FontFallbackIterator> Font::CreateFontFallbackIterator(
423 FontFallbackPriority fallback_priority) const { 433 FontFallbackPriority fallback_priority) const {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 499
490 bool Font::LoadingCustomFonts() const { 500 bool Font::LoadingCustomFonts() const {
491 return font_fallback_list_ && font_fallback_list_->LoadingCustomFonts(); 501 return font_fallback_list_ && font_fallback_list_->LoadingCustomFonts();
492 } 502 }
493 503
494 bool Font::IsFallbackValid() const { 504 bool Font::IsFallbackValid() const {
495 return !font_fallback_list_ || font_fallback_list_->IsValid(); 505 return !font_fallback_list_ || font_fallback_list_->IsValid();
496 } 506 }
497 507
498 } // namespace blink 508 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Font.h ('k') | third_party/WebKit/Source/platform/fonts/FontSelector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698