OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/css/resolver/FontBuilder.h" | 5 #include "core/css/resolver/FontBuilder.h" |
6 | 6 |
7 #include "core/css/CSSFontSelector.h" | 7 #include "core/css/CSSFontSelector.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/StyleEngine.h" | 9 #include "core/dom/StyleEngine.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
11 #include "core/style/ComputedStyle.h" | 11 #include "core/style/ComputedStyle.h" |
12 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include <memory> | |
15 | 14 |
16 namespace blink { | 15 namespace blink { |
17 | 16 |
18 class FontBuilderTest { | 17 class FontBuilderTest { |
19 public: | 18 public: |
20 FontBuilderTest() | 19 FontBuilderTest() |
21 : m_dummy(DummyPageHolder::create(IntSize(800, 600))) | 20 : m_dummy(DummyPageHolder::create(IntSize(800, 600))) |
22 { | 21 { |
23 settings().setDefaultFontSize(16.0f); | 22 settings().setDefaultFontSize(16.0f); |
24 } | 23 } |
25 | 24 |
26 Document& document() { return m_dummy->document(); } | 25 Document& document() { return m_dummy->document(); } |
27 Settings& settings() { return *document().settings(); } | 26 Settings& settings() { return *document().settings(); } |
28 | 27 |
29 private: | 28 private: |
30 std::unique_ptr<DummyPageHolder> m_dummy; | 29 OwnPtr<DummyPageHolder> m_dummy; |
31 }; | 30 }; |
32 | 31 |
33 using BuilderFunc = void (*)(FontBuilder&); | 32 using BuilderFunc = void (*)(FontBuilder&); |
34 using DescriptionFunc = void (*)(FontDescription&); | 33 using DescriptionFunc = void (*)(FontDescription&); |
35 | 34 |
36 struct FunctionPair { | 35 struct FunctionPair { |
37 FunctionPair(DescriptionFunc base, BuilderFunc value) | 36 FunctionPair(DescriptionFunc base, BuilderFunc value) |
38 : setBaseValue(base) | 37 : setBaseValue(base) |
39 , setValue(value) | 38 , setValue(value) |
40 { | 39 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 FunctionPair(fontVariantCapsBase, fontVariantCapsValue), | 162 FunctionPair(fontVariantCapsBase, fontVariantCapsValue), |
164 FunctionPair(fontVariantLigaturesBase, fontVariantLigaturesValue), | 163 FunctionPair(fontVariantLigaturesBase, fontVariantLigaturesValue), |
165 FunctionPair(fontVariantNumericBase, fontVariantNumericValue), | 164 FunctionPair(fontVariantNumericBase, fontVariantNumericValue), |
166 FunctionPair(fontTextRenderingBase, fontTextRenderingValue), | 165 FunctionPair(fontTextRenderingBase, fontTextRenderingValue), |
167 FunctionPair(fontKerningBase, fontKerningValue), | 166 FunctionPair(fontKerningBase, fontKerningValue), |
168 FunctionPair(fontFontSmoothingBase, fontFontSmoothingValue), | 167 FunctionPair(fontFontSmoothingBase, fontFontSmoothingValue), |
169 FunctionPair(fontSizeBase, fontSizeValue), | 168 FunctionPair(fontSizeBase, fontSizeValue), |
170 FunctionPair(fontScriptBase, fontScriptValue))); | 169 FunctionPair(fontScriptBase, fontScriptValue))); |
171 | 170 |
172 } // namespace blink | 171 } // namespace blink |
OLD | NEW |