| 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 met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/v8/ScriptState.h" | 34 #include "bindings/v8/ScriptState.h" |
| 35 #include "core/css/CSSFontFaceLoadEvent.h" | 35 #include "core/css/CSSFontFaceLoadEvent.h" |
| 36 #include "core/css/CSSFontFaceSource.h" | 36 #include "core/css/CSSFontFaceSource.h" |
| 37 #include "core/css/CSSFontSelector.h" | 37 #include "core/css/CSSFontSelector.h" |
| 38 #include "core/css/CSSParser.h" | 38 #include "core/css/CSSParser.h" |
| 39 #include "core/css/CSSSegmentedFontFace.h" | 39 #include "core/css/CSSSegmentedFontFace.h" |
| 40 #include "core/css/StylePropertySet.h" | 40 #include "core/css/StylePropertySet.h" |
| 41 #include "core/css/resolver/StyleResolver.h" | 41 #include "core/css/resolver/StyleResolver.h" |
| 42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
| 43 #include "core/frame/FrameView.h" | 43 #include "core/frame/FrameView.h" |
| 44 #include "core/platform/HistogramSupport.h" | 44 #include "public/platform/Platform.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 static const int defaultFontSize = 10; | 48 static const int defaultFontSize = 10; |
| 49 static const char* const defaultFontFamily = "sans-serif"; | 49 static const char* const defaultFontFamily = "sans-serif"; |
| 50 | 50 |
| 51 class LoadFontPromiseResolver : public CSSSegmentedFontFace::LoadFontCallback { | 51 class LoadFontPromiseResolver : public CSSSegmentedFontFace::LoadFontCallback { |
| 52 public: | 52 public: |
| 53 static PassRefPtr<LoadFontPromiseResolver> create(const FontFamily& family,
ScriptPromise promise, ExecutionContext* context) | 53 static PassRefPtr<LoadFontPromiseResolver> create(const FontFamily& family,
ScriptPromise promise, ExecutionContext* context) |
| 54 { | 54 { |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 font = style->font(); | 435 font = style->font(); |
| 436 font.update(styleResolver->fontSelector()); | 436 font.update(styleResolver->fontSelector()); |
| 437 return true; | 437 return true; |
| 438 } | 438 } |
| 439 | 439 |
| 440 void FontFaceSet::FontLoadHistogram::record() | 440 void FontFaceSet::FontLoadHistogram::record() |
| 441 { | 441 { |
| 442 if (m_recorded) | 442 if (m_recorded) |
| 443 return; | 443 return; |
| 444 m_recorded = true; | 444 m_recorded = true; |
| 445 HistogramSupport::histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1
, 100, 50); | 445 WebKit::Platform::current()->histogramCustomCounts("WebFont.WebFontsInPage",
m_count, 1, 100, 50); |
| 446 } | 446 } |
| 447 | 447 |
| 448 static const char* supplementName() | 448 static const char* supplementName() |
| 449 { | 449 { |
| 450 return "FontFaceSet"; | 450 return "FontFaceSet"; |
| 451 } | 451 } |
| 452 | 452 |
| 453 PassRefPtr<FontFaceSet> FontFaceSet::from(Document* document) | 453 PassRefPtr<FontFaceSet> FontFaceSet::from(Document* document) |
| 454 { | 454 { |
| 455 RefPtr<FontFaceSet> fonts = static_cast<FontFaceSet*>(SupplementType::from(d
ocument, supplementName())); | 455 RefPtr<FontFaceSet> fonts = static_cast<FontFaceSet*>(SupplementType::from(d
ocument, supplementName())); |
| 456 if (!fonts) { | 456 if (!fonts) { |
| 457 fonts = FontFaceSet::create(document); | 457 fonts = FontFaceSet::create(document); |
| 458 SupplementType::provideTo(document, supplementName(), fonts); | 458 SupplementType::provideTo(document, supplementName(), fonts); |
| 459 } | 459 } |
| 460 | 460 |
| 461 return fonts.release(); | 461 return fonts.release(); |
| 462 } | 462 } |
| 463 | 463 |
| 464 void FontFaceSet::didLayout(Document* document) | 464 void FontFaceSet::didLayout(Document* document) |
| 465 { | 465 { |
| 466 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu
ment, supplementName()))) | 466 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu
ment, supplementName()))) |
| 467 fonts->didLayout(); | 467 fonts->didLayout(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 } // namespace WebCore | 471 } // namespace WebCore |
| OLD | NEW |