| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/testing/FontTestHelpers.h" | 5 #include "platform/testing/FontTestHelpers.h" |
| 6 | 6 |
| 7 #include "platform/fonts/Font.h" | 7 #include "platform/fonts/Font.h" |
| 8 #include "platform/fonts/FontCustomPlatformData.h" | 8 #include "platform/fonts/FontCustomPlatformData.h" |
| 9 #include "platform/fonts/FontDescription.h" | 9 #include "platform/fonts/FontDescription.h" |
| 10 #include "platform/fonts/FontSelector.h" | 10 #include "platform/fonts/FontSelector.h" |
| 11 #include "platform/testing/UnitTestHelpers.h" | 11 #include "platform/testing/UnitTestHelpers.h" |
| 12 #include "wtf/OwnPtr.h" |
| 12 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.h" |
| 13 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
| 14 #include <memory> | |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 namespace testing { | 17 namespace testing { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class TestFontSelector : public FontSelector { | 21 class TestFontSelector : public FontSelector { |
| 22 public: | 22 public: |
| 23 static TestFontSelector* create(const String& path) | 23 static TestFontSelector* create(const String& path) |
| 24 { | 24 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 | 43 |
| 44 void willUseFontData(const FontDescription&, const AtomicString& familyName, | 44 void willUseFontData(const FontDescription&, const AtomicString& familyName, |
| 45 const String& text) override { } | 45 const String& text) override { } |
| 46 void willUseRange(const FontDescription&, const AtomicString& familyName, | 46 void willUseRange(const FontDescription&, const AtomicString& familyName, |
| 47 const FontDataForRangeSet&) override { }; | 47 const FontDataForRangeSet&) override { }; |
| 48 | 48 |
| 49 unsigned version() const override { return 0; } | 49 unsigned version() const override { return 0; } |
| 50 void fontCacheInvalidated() override { } | 50 void fontCacheInvalidated() override { } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 TestFontSelector(std::unique_ptr<FontCustomPlatformData> customPlatformData) | 53 TestFontSelector(PassOwnPtr<FontCustomPlatformData> customPlatformData) |
| 54 : m_customPlatformData(std::move(customPlatformData)) | 54 : m_customPlatformData(std::move(customPlatformData)) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 std::unique_ptr<FontCustomPlatformData> m_customPlatformData; | 58 OwnPtr<FontCustomPlatformData> m_customPlatformData; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 Font createTestFont(const AtomicString& familyName, const String& fontPath, floa
t size) | 63 Font createTestFont(const AtomicString& familyName, const String& fontPath, floa
t size) |
| 64 { | 64 { |
| 65 FontFamily family; | 65 FontFamily family; |
| 66 family.setFamily(familyName); | 66 family.setFamily(familyName); |
| 67 | 67 |
| 68 FontDescription fontDescription; | 68 FontDescription fontDescription; |
| 69 fontDescription.setFamily(family); | 69 fontDescription.setFamily(family); |
| 70 fontDescription.setSpecifiedSize(size); | 70 fontDescription.setSpecifiedSize(size); |
| 71 fontDescription.setComputedSize(size); | 71 fontDescription.setComputedSize(size); |
| 72 | 72 |
| 73 Font font(fontDescription); | 73 Font font(fontDescription); |
| 74 font.update(TestFontSelector::create(fontPath)); | 74 font.update(TestFontSelector::create(fontPath)); |
| 75 return font; | 75 return font; |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace testing | 78 } // namespace testing |
| 79 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |