| 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 | 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "core/dom/DOMArrayBuffer.h" | 51 #include "core/dom/DOMArrayBuffer.h" |
| 52 #include "core/dom/DOMArrayBufferView.h" | 52 #include "core/dom/DOMArrayBufferView.h" |
| 53 #include "core/dom/DOMException.h" | 53 #include "core/dom/DOMException.h" |
| 54 #include "core/dom/Document.h" | 54 #include "core/dom/Document.h" |
| 55 #include "core/dom/ExceptionCode.h" | 55 #include "core/dom/ExceptionCode.h" |
| 56 #include "core/dom/StyleEngine.h" | 56 #include "core/dom/StyleEngine.h" |
| 57 #include "core/frame/LocalFrame.h" | 57 #include "core/frame/LocalFrame.h" |
| 58 #include "core/frame/Settings.h" | 58 #include "core/frame/Settings.h" |
| 59 #include "core/frame/UseCounter.h" | 59 #include "core/frame/UseCounter.h" |
| 60 #include "platform/FontFamilyNames.h" | 60 #include "platform/FontFamilyNames.h" |
| 61 #include "platform/Histogram.h" |
| 61 #include "platform/SharedBuffer.h" | 62 #include "platform/SharedBuffer.h" |
| 62 #include "public/platform/Platform.h" | |
| 63 | 63 |
| 64 namespace blink { | 64 namespace blink { |
| 65 | 65 |
| 66 static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document,
const String& value, CSSPropertyID propertyID) | 66 static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document,
const String& value, CSSPropertyID propertyID) |
| 67 { | 67 { |
| 68 CSSParserContext context(*document, UseCounter::getFrom(document)); | 68 CSSParserContext context(*document, UseCounter::getFrom(document)); |
| 69 return CSSParser::parseFontFaceDescriptor(propertyID, value, context); | 69 return CSSParser::parseFontFaceDescriptor(propertyID, value, context); |
| 70 } | 70 } |
| 71 | 71 |
| 72 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con
st AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, const Fon
tFaceDescriptors& descriptors) | 72 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con
st AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, const Fon
tFaceDescriptors& descriptors) |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 } else { | 597 } else { |
| 598 source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource()
)); | 598 source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource()
)); |
| 599 } | 599 } |
| 600 | 600 |
| 601 if (source) | 601 if (source) |
| 602 m_cssFontFace->addSource(source.release()); | 602 m_cssFontFace->addSource(source.release()); |
| 603 } | 603 } |
| 604 | 604 |
| 605 if (m_display) | 605 if (m_display) { |
| 606 Platform::current()->histogramEnumeration("WebFont.FontDisplayValue", CS
SValueToFontDisplay(m_display.get()), FontDisplayEnumMax); | 606 DEFINE_STATIC_LOCAL(EnumerationHistogram, fontDisplayHistogram, ("WebFon
t.FontDisplayValue", FontDisplayEnumMax)); |
| 607 fontDisplayHistogram.count(CSSValueToFontDisplay(m_display.get())); |
| 608 } |
| 607 } | 609 } |
| 608 | 610 |
| 609 void FontFace::initCSSFontFace(const unsigned char* data, size_t size) | 611 void FontFace::initCSSFontFace(const unsigned char* data, size_t size) |
| 610 { | 612 { |
| 611 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); | 613 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); |
| 612 if (m_error) | 614 if (m_error) |
| 613 return; | 615 return; |
| 614 | 616 |
| 615 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size); | 617 RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size); |
| 616 OwnPtrWillBeRawPtr<BinaryDataFontFaceSource> source = adoptPtrWillBeNoop(new
BinaryDataFontFaceSource(buffer.get(), m_otsParseMessage)); | 618 OwnPtrWillBeRawPtr<BinaryDataFontFaceSource> source = adoptPtrWillBeNoop(new
BinaryDataFontFaceSource(buffer.get(), m_otsParseMessage)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 641 { | 643 { |
| 642 return m_cssFontFace->hadBlankText(); | 644 return m_cssFontFace->hadBlankText(); |
| 643 } | 645 } |
| 644 | 646 |
| 645 bool FontFace::hasPendingActivity() const | 647 bool FontFace::hasPendingActivity() const |
| 646 { | 648 { |
| 647 return m_status == Loading && executionContext() && !executionContext()->act
iveDOMObjectsAreStopped(); | 649 return m_status == Loading && executionContext() && !executionContext()->act
iveDOMObjectsAreStopped(); |
| 648 } | 650 } |
| 649 | 651 |
| 650 } // namespace blink | 652 } // namespace blink |
| OLD | NEW |