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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 #include "ui/events/blink/blink_event_util.h" | 53 #include "ui/events/blink/blink_event_util.h" |
| 54 #include "ui/gfx/geometry/vector2d.h" | 54 #include "ui/gfx/geometry/vector2d.h" |
| 55 #include "ui/gfx/icc_profile.h" | 55 #include "ui/gfx/icc_profile.h" |
| 56 #include "ui/gfx/test/icc_profiles.h" | 56 #include "ui/gfx/test/icc_profiles.h" |
| 57 | 57 |
| 58 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 59 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 59 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 60 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
| 61 #include "content/child/font_warmup_win.h" | 61 #include "content/child/font_warmup_win.h" |
| 62 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 62 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| 63 #include "third_party/skia/include/core/SkRefCnt.h" | |
| 63 #include "third_party/skia/include/ports/SkFontMgr.h" | 64 #include "third_party/skia/include/ports/SkFontMgr.h" |
| 64 #include "third_party/skia/include/ports/SkTypeface_win.h" | 65 #include "third_party/skia/include/ports/SkTypeface_win.h" |
| 65 #include "ui/gfx/win/direct_write.h" | 66 #include "ui/gfx/win/direct_write.h" |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 using blink::WebDeviceMotionData; | 69 using blink::WebDeviceMotionData; |
| 69 using blink::WebDeviceOrientationData; | 70 using blink::WebDeviceOrientationData; |
| 70 using blink::WebGamepad; | 71 using blink::WebGamepad; |
| 71 using blink::WebGamepads; | 72 using blink::WebGamepads; |
| 72 using blink::WebRect; | 73 using blink::WebRect; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 146 |
| 146 float GetWindowToViewportScale(RenderWidget* render_widget) { | 147 float GetWindowToViewportScale(RenderWidget* render_widget) { |
| 147 blink::WebFloatRect rect(0, 0, 1.0f, 0.0); | 148 blink::WebFloatRect rect(0, 0, 1.0f, 0.0); |
| 148 render_widget->convertWindowToViewport(&rect); | 149 render_widget->convertWindowToViewport(&rect); |
| 149 return rect.width; | 150 return rect.width; |
| 150 } | 151 } |
| 151 | 152 |
| 152 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
| 153 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer | 154 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer |
| 154 // side-loading, support kRegisterFontFiles to allow access to additional fonts. | 155 // side-loading, support kRegisterFontFiles to allow access to additional fonts. |
| 155 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { | 156 void RegisterSideloadedTypefaces(sk_sp<SkFontMgr> fontmgr) { |
|
f(malita)
2017/01/09 15:25:34
looks like we're not passing a ref here - can this
bungeman-chromium
2017/01/09 19:15:28
I did it this way because previously the caller wa
| |
| 156 std::vector<std::string> files = switches::GetSideloadFontFiles(); | 157 std::vector<std::string> files = switches::GetSideloadFontFiles(); |
| 157 for (std::vector<std::string>::const_iterator i(files.begin()); | 158 for (std::vector<std::string>::const_iterator i(files.begin()); |
| 158 i != files.end(); | 159 i != files.end(); |
| 159 ++i) { | 160 ++i) { |
| 160 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); | 161 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); |
| 161 blink::WebFontRendering::addSideloadedFontForTesting(typeface); | 162 blink::WebFontRendering::addSideloadedFontForTesting(typeface); |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 #endif // OS_WIN | 165 #endif // OS_WIN |
| 165 | 166 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 | 600 |
| 600 void ForceTextInputStateUpdateForRenderFrame(RenderFrame* frame) { | 601 void ForceTextInputStateUpdateForRenderFrame(RenderFrame* frame) { |
| 601 if (auto* render_widget = | 602 if (auto* render_widget = |
| 602 static_cast<RenderFrameImpl*>(frame)->GetRenderWidget()) { | 603 static_cast<RenderFrameImpl*>(frame)->GetRenderWidget()) { |
| 603 render_widget->UpdateTextInputState(ShowIme::IF_NEEDED, | 604 render_widget->UpdateTextInputState(ShowIme::IF_NEEDED, |
| 604 ChangeSource::FROM_NON_IME); | 605 ChangeSource::FROM_NON_IME); |
| 605 } | 606 } |
| 606 } | 607 } |
| 607 | 608 |
| 608 } // namespace content | 609 } // namespace content |
| OLD | NEW |