Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "third_party/WebKit/public/platform/WebGamepads.h" | 35 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 36 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h" | 36 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h" |
| 37 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h" | 37 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h" |
| 38 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 38 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 39 #include "third_party/WebKit/public/web/WebView.h" | 39 #include "third_party/WebKit/public/web/WebView.h" |
| 40 | 40 |
| 41 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 42 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 42 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 43 #elif defined(OS_WIN) | 43 #elif defined(OS_WIN) |
| 44 #include "content/common/font_warmup_win.h" | 44 #include "content/common/font_warmup_win.h" |
| 45 #include "content/public/common/dwrite_font_platform_win.h" | |
| 45 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 46 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| 46 #include "third_party/skia/include/ports/SkFontMgr.h" | 47 #include "third_party/skia/include/ports/SkFontMgr.h" |
| 48 #include "third_party/skia/include/ports/SkTypeface_win.h" | |
| 47 #include "ui/gfx/win/direct_write.h" | 49 #include "ui/gfx/win/direct_write.h" |
| 48 #endif | 50 #endif |
| 49 | 51 |
| 50 using blink::WebBatteryStatus; | 52 using blink::WebBatteryStatus; |
| 51 using blink::WebDeviceMotionData; | 53 using blink::WebDeviceMotionData; |
| 52 using blink::WebDeviceOrientationData; | 54 using blink::WebDeviceOrientationData; |
| 53 using blink::WebGamepad; | 55 using blink::WebGamepad; |
| 54 using blink::WebGamepads; | 56 using blink::WebGamepads; |
| 55 using blink::WebRect; | 57 using blink::WebRect; |
| 56 using blink::WebSize; | 58 using blink::WebSize; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
| 98 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer | 100 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer |
| 99 // side-loading, support kRegisterFontFiles to allow access to additional fonts. | 101 // side-loading, support kRegisterFontFiles to allow access to additional fonts. |
| 100 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { | 102 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { |
| 101 RenderThreadImpl::current()->EnsureWebKitInitialized(); | 103 RenderThreadImpl::current()->EnsureWebKitInitialized(); |
| 102 std::vector<std::string> files = switches::GetSideloadFontFiles(); | 104 std::vector<std::string> files = switches::GetSideloadFontFiles(); |
| 103 for (std::vector<std::string>::const_iterator i(files.begin()); | 105 for (std::vector<std::string>::const_iterator i(files.begin()); |
| 104 i != files.end(); | 106 i != files.end(); |
| 105 ++i) { | 107 ++i) { |
| 106 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); | 108 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); |
| 107 DoPreSandboxWarmupForTypeface(typeface); | 109 if (!content::ShouldUseDirectWriteFontProxyFieldTrial()) |
|
jam
2016/01/11 05:05:45
also this file
Ilya Kulshin
2016/01/11 20:56:52
Done.
| |
| 110 DoPreSandboxWarmupForTypeface(typeface); | |
| 108 blink::WebFontRendering::addSideloadedFontForTesting(typeface); | 111 blink::WebFontRendering::addSideloadedFontForTesting(typeface); |
| 109 } | 112 } |
| 110 } | 113 } |
| 111 #endif // OS_WIN | 114 #endif // OS_WIN |
| 112 | 115 |
| 113 } // namespace | 116 } // namespace |
| 114 | 117 |
| 115 void EnableWebTestProxyCreation( | 118 void EnableWebTestProxyCreation( |
| 116 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& | 119 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& |
| 117 callback) { | 120 callback) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 void MockBatteryStatusChanged(const WebBatteryStatus& status) { | 170 void MockBatteryStatusChanged(const WebBatteryStatus& status) { |
| 168 RenderThreadImpl::current() | 171 RenderThreadImpl::current() |
| 169 ->blink_platform_impl() | 172 ->blink_platform_impl() |
| 170 ->MockBatteryStatusChangedForTesting(status); | 173 ->MockBatteryStatusChangedForTesting(status); |
| 171 } | 174 } |
| 172 | 175 |
| 173 void EnableRendererLayoutTestMode() { | 176 void EnableRendererLayoutTestMode() { |
| 174 RenderThreadImpl::current()->set_layout_test_mode(true); | 177 RenderThreadImpl::current()->set_layout_test_mode(true); |
| 175 | 178 |
| 176 #if defined(OS_WIN) | 179 #if defined(OS_WIN) |
| 177 if (gfx::win::ShouldUseDirectWrite()) | 180 if (gfx::win::ShouldUseDirectWrite()) { |
| 178 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); | 181 if (content::ShouldUseDirectWriteFontProxyFieldTrial()) |
| 182 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); | |
| 183 else | |
| 184 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); | |
| 185 } | |
| 179 #endif | 186 #endif |
| 180 } | 187 } |
| 181 | 188 |
| 182 void EnableBrowserLayoutTestMode() { | 189 void EnableBrowserLayoutTestMode() { |
| 183 #if defined(OS_MACOSX) | 190 #if defined(OS_MACOSX) |
| 184 ImageTransportSurface::SetAllowOSMesaForTesting(true); | 191 ImageTransportSurface::SetAllowOSMesaForTesting(true); |
| 185 PopupMenuHelper::DontShowPopupMenuForTesting(); | 192 PopupMenuHelper::DontShowPopupMenuForTesting(); |
| 186 #endif | 193 #endif |
| 187 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); | 194 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); |
| 188 } | 195 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 result.append( | 461 result.append( |
| 455 DumpHistoryItem(entry->root_history_node(), | 462 DumpHistoryItem(entry->root_history_node(), |
| 456 8, | 463 8, |
| 457 index == current_index)); | 464 index == current_index)); |
| 458 } | 465 } |
| 459 result.append("===============================================\n"); | 466 result.append("===============================================\n"); |
| 460 return result; | 467 return result; |
| 461 } | 468 } |
| 462 | 469 |
| 463 } // namespace content | 470 } // namespace content |
| OLD | NEW |