Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: content/test/layouttest_support.cc

Issue 1378353006: Implementation of dwrite font proxy and removal of dwrite font cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More codereview fixes. Jumped the gun on previous patchset. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/dwrite_font_fake_sender_win.cc ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "components/test_runner/test_common.h" 9 #include "components/test_runner/test_common.h"
10 #include "components/test_runner/web_frame_test_proxy.h" 10 #include "components/test_runner/web_frame_test_proxy.h"
(...skipping 17 matching lines...) Expand all
28 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" 28 #include "third_party/WebKit/public/platform/WebBatteryStatus.h"
29 #include "third_party/WebKit/public/platform/WebGamepads.h" 29 #include "third_party/WebKit/public/platform/WebGamepads.h"
30 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h" 30 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h"
31 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h" 31 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h"
32 #include "third_party/WebKit/public/web/WebHistoryItem.h" 32 #include "third_party/WebKit/public/web/WebHistoryItem.h"
33 #include "third_party/WebKit/public/web/WebView.h" 33 #include "third_party/WebKit/public/web/WebView.h"
34 34
35 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
36 #include "content/browser/frame_host/popup_menu_helper_mac.h" 36 #include "content/browser/frame_host/popup_menu_helper_mac.h"
37 #elif defined(OS_WIN) 37 #elif defined(OS_WIN)
38 #include "content/common/font_warmup_win.h"
39 #include "third_party/WebKit/public/web/win/WebFontRendering.h" 38 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
40 #include "third_party/skia/include/ports/SkFontMgr.h" 39 #include "third_party/skia/include/ports/SkFontMgr.h"
40 #include "third_party/skia/include/ports/SkTypeface_win.h"
41 #include "ui/gfx/win/direct_write.h" 41 #include "ui/gfx/win/direct_write.h"
42 #endif 42 #endif
43 43
44 using blink::WebBatteryStatus; 44 using blink::WebBatteryStatus;
45 using blink::WebDeviceMotionData; 45 using blink::WebDeviceMotionData;
46 using blink::WebDeviceOrientationData; 46 using blink::WebDeviceOrientationData;
47 using blink::WebGamepad; 47 using blink::WebGamepad;
48 using blink::WebGamepads; 48 using blink::WebGamepads;
49 using blink::WebRect; 49 using blink::WebRect;
50 using blink::WebSize; 50 using blink::WebSize;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 typedef test_runner::WebFrameTestProxy< 82 typedef test_runner::WebFrameTestProxy<
83 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy; 83 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy;
84 84
85 FrameProxy* render_frame_proxy = new FrameProxy(params); 85 FrameProxy* render_frame_proxy = new FrameProxy(params);
86 render_frame_proxy->set_base_proxy(GetWebTestProxyBase(params.render_view)); 86 render_frame_proxy->set_base_proxy(GetWebTestProxyBase(params.render_view));
87 87
88 return render_frame_proxy; 88 return render_frame_proxy;
89 } 89 }
90 90
91 #if defined(OS_WIN) 91 #if defined(OS_WIN)
92 void DoPreSandboxWarmupForTypeface(SkTypeface* typeface) {
93 SkPaint paint_warmup;
94 paint_warmup.setTypeface(typeface);
95 wchar_t glyph = L'S';
96 paint_warmup.measureText(&glyph, 2);
97 }
98
92 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer 99 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer
93 // side-loading, support kRegisterFontFiles to allow access to additional fonts. 100 // side-loading, support kRegisterFontFiles to allow access to additional fonts.
94 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { 101 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) {
95 RenderThreadImpl::current()->EnsureWebKitInitialized(); 102 RenderThreadImpl::current()->EnsureWebKitInitialized();
96 std::vector<std::string> files = switches::GetSideloadFontFiles(); 103 std::vector<std::string> files = switches::GetSideloadFontFiles();
97 for (std::vector<std::string>::const_iterator i(files.begin()); 104 for (std::vector<std::string>::const_iterator i(files.begin());
98 i != files.end(); 105 i != files.end();
99 ++i) { 106 ++i) {
100 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); 107 SkTypeface* typeface = fontmgr->createFromFile(i->c_str());
101 DoPreSandboxWarmupForTypeface(typeface); 108 DoPreSandboxWarmupForTypeface(typeface);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 RenderThreadImpl::current() 170 RenderThreadImpl::current()
164 ->blink_platform_impl() 171 ->blink_platform_impl()
165 ->MockBatteryStatusChangedForTesting(status); 172 ->MockBatteryStatusChangedForTesting(status);
166 } 173 }
167 174
168 void EnableRendererLayoutTestMode() { 175 void EnableRendererLayoutTestMode() {
169 RenderThreadImpl::current()->set_layout_test_mode(true); 176 RenderThreadImpl::current()->set_layout_test_mode(true);
170 177
171 #if defined(OS_WIN) 178 #if defined(OS_WIN)
172 if (gfx::win::ShouldUseDirectWrite()) 179 if (gfx::win::ShouldUseDirectWrite())
173 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); 180 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite());
174 #endif 181 #endif
175 } 182 }
176 183
177 void EnableBrowserLayoutTestMode() { 184 void EnableBrowserLayoutTestMode() {
178 #if defined(OS_MACOSX) 185 #if defined(OS_MACOSX)
179 ImageTransportSurface::SetAllowOSMesaForTesting(true); 186 ImageTransportSurface::SetAllowOSMesaForTesting(true);
180 PopupMenuHelper::DontShowPopupMenuForTesting(); 187 PopupMenuHelper::DontShowPopupMenuForTesting();
181 #endif 188 #endif
182 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); 189 RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
183 } 190 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 result.append( 458 result.append(
452 DumpHistoryItem(entry->root_history_node(), 459 DumpHistoryItem(entry->root_history_node(),
453 8, 460 8,
454 index == current_index)); 461 index == current_index));
455 } 462 }
456 result.append("===============================================\n"); 463 result.append("===============================================\n");
457 return result; 464 return result;
458 } 465 }
459 466
460 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « content/test/dwrite_font_fake_sender_win.cc ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698