OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 m_client = 0; | 157 m_client = 0; |
158 if (m_menuProvider) { | 158 if (m_menuProvider) { |
159 m_menuProvider->disconnect(); | 159 m_menuProvider->disconnect(); |
160 m_menuProvider = nullptr; | 160 m_menuProvider = nullptr; |
161 } | 161 } |
162 m_frontendFrame = nullptr; | 162 m_frontendFrame = nullptr; |
163 } | 163 } |
164 | 164 |
165 float DevToolsHost::zoomFactor() | 165 float DevToolsHost::zoomFactor() |
166 { | 166 { |
167 return m_frontendFrame ? m_frontendFrame->pageZoomFactor() : 1; | |
168 } | |
169 | |
170 float DevToolsHost::convertLengthForEmbedder(float length) | |
171 { | |
172 if (!m_frontendFrame) | 167 if (!m_frontendFrame) |
173 return length; | 168 return 1; |
| 169 float zoomFactor = m_frontendFrame->pageZoomFactor(); |
| 170 // Cancel the device scale factor applied to the zoom factor in |
| 171 // use-zoom-for-dsf mode. |
174 const HostWindow* hostWindow = m_frontendFrame->view()->hostWindow(); | 172 const HostWindow* hostWindow = m_frontendFrame->view()->hostWindow(); |
175 IntRect screen = hostWindow->viewportToScreen(IntRect(0, 0, length, 0)); | 173 float windowToViewportRatio = hostWindow->windowToViewportScalar(1.0f); |
176 return screen.width(); | 174 return zoomFactor / windowToViewportRatio; |
177 } | 175 } |
178 | 176 |
179 void DevToolsHost::setInjectedScriptForOrigin(const String& origin, const String
& script) | 177 void DevToolsHost::setInjectedScriptForOrigin(const String& origin, const String
& script) |
180 { | 178 { |
181 if (m_client) | 179 if (m_client) |
182 m_client->setInjectedScriptForOrigin(origin, script); | 180 m_client->setInjectedScriptForOrigin(origin, script); |
183 } | 181 } |
184 | 182 |
185 void DevToolsHost::copyText(const String& text) | 183 void DevToolsHost::copyText(const String& text) |
186 { | 184 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 { | 240 { |
243 return m_client && m_client->isUnderTest(); | 241 return m_client && m_client->isUnderTest(); |
244 } | 242 } |
245 | 243 |
246 bool DevToolsHost::isHostedMode() | 244 bool DevToolsHost::isHostedMode() |
247 { | 245 { |
248 return false; | 246 return false; |
249 } | 247 } |
250 | 248 |
251 } // namespace blink | 249 } // namespace blink |
OLD | NEW |