| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/fonts/FontSelector.h" | 35 #include "platform/fonts/FontSelector.h" |
| 36 #include "platform/testing/UnitTestHelpers.h" | 36 #include "platform/testing/UnitTestHelpers.h" |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 #include "wtf/text/AtomicString.h" | 39 #include "wtf/text/AtomicString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class TestFontSelector : public FontSelector { | 43 class TestFontSelector : public FontSelector { |
| 44 public: | 44 public: |
| 45 static PassRefPtrWillBeRawPtr<TestFontSelector> create(const String& path) | 45 static RawPtr<TestFontSelector> create(const String& path) |
| 46 { | 46 { |
| 47 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path); | 47 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path); |
| 48 String otsParseMessage; | 48 String otsParseMessage; |
| 49 return adoptRefWillBeNoop(new TestFontSelector(FontCustomPlatformData::c
reate( | 49 return (new TestFontSelector(FontCustomPlatformData::create( |
| 50 fontBuffer.get(), otsParseMessage))); | 50 fontBuffer.get(), otsParseMessage))); |
| 51 } | 51 } |
| 52 | 52 |
| 53 ~TestFontSelector() override { } | 53 ~TestFontSelector() override { } |
| 54 | 54 |
| 55 PassRefPtr<FontData> getFontData(const FontDescription& fontDescription, | 55 PassRefPtr<FontData> getFontData(const FontDescription& fontDescription, |
| 56 const AtomicString& familyName) override | 56 const AtomicString& familyName) override |
| 57 { | 57 { |
| 58 FontPlatformData platformData = m_customPlatformData->fontPlatformData( | 58 FontPlatformData platformData = m_customPlatformData->fontPlatformData( |
| 59 fontDescription.effectiveFontSize(), | 59 fontDescription.effectiveFontSize(), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 fontDescription.setComputedSize(size); | 92 fontDescription.setComputedSize(size); |
| 93 | 93 |
| 94 Font font(fontDescription); | 94 Font font(fontDescription); |
| 95 font.update(TestFontSelector::create(fontPath)); | 95 font.update(TestFontSelector::create(fontPath)); |
| 96 return font; | 96 return font; |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace blink | 99 } // namespace blink |
| 100 | 100 |
| 101 #endif // TestFontSelector_h | 101 #endif // TestFontSelector_h |
| OLD | NEW |