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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "content/public/common/page_zoom.h" | |
12 #include "content/shell/renderer/test_runner/mock_spell_check.h" | 11 #include "content/shell/renderer/test_runner/mock_spell_check.h" |
13 #include "content/shell/renderer/test_runner/test_interfaces.h" | 12 #include "content/shell/renderer/test_runner/test_interfaces.h" |
14 #include "content/shell/renderer/test_runner/web_test_delegate.h" | 13 #include "content/shell/renderer/test_runner/web_test_delegate.h" |
15 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 14 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
16 #include "gin/handle.h" | 15 #include "gin/handle.h" |
17 #include "gin/object_template_builder.h" | 16 #include "gin/object_template_builder.h" |
18 #include "gin/wrappable.h" | 17 #include "gin/wrappable.h" |
19 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
20 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
21 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 20 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 window_list.at(i)->GetWebView()->zoomLevel() - 1); | 1555 window_list.at(i)->GetWebView()->zoomLevel() - 1); |
1557 } | 1556 } |
1558 } | 1557 } |
1559 | 1558 |
1560 void EventSender::SetPageZoomFactor(double zoom_factor) { | 1559 void EventSender::SetPageZoomFactor(double zoom_factor) { |
1561 const std::vector<WebTestProxyBase*>& window_list = | 1560 const std::vector<WebTestProxyBase*>& window_list = |
1562 interfaces_->GetWindowList(); | 1561 interfaces_->GetWindowList(); |
1563 | 1562 |
1564 for (size_t i = 0; i < window_list.size(); ++i) { | 1563 for (size_t i = 0; i < window_list.size(); ++i) { |
1565 window_list.at(i)->GetWebView()->setZoomLevel( | 1564 window_list.at(i)->GetWebView()->setZoomLevel( |
1566 ZoomFactorToZoomLevel(zoom_factor)); | 1565 std::log(zoom_factor) / std::log(1.2)); |
1567 } | 1566 } |
1568 } | 1567 } |
1569 | 1568 |
1570 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { | 1569 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { |
1571 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); | 1570 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); |
1572 } | 1571 } |
1573 | 1572 |
1574 void EventSender::SetPageScaleFactorLimits(float min_scale, float max_scale) { | 1573 void EventSender::SetPageScaleFactorLimits(float min_scale, float max_scale) { |
1575 view_->setDefaultPageScaleLimits(min_scale, max_scale); | 1574 view_->setDefaultPageScaleLimits(min_scale, max_scale); |
1576 } | 1575 } |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 | 2512 |
2514 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2513 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
2515 if (WebPagePopup* popup = view_->pagePopup()) { | 2514 if (WebPagePopup* popup = view_->pagePopup()) { |
2516 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2515 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2517 return popup->handleInputEvent(event); | 2516 return popup->handleInputEvent(event); |
2518 } | 2517 } |
2519 return view_->handleInputEvent(event); | 2518 return view_->handleInputEvent(event); |
2520 } | 2519 } |
2521 | 2520 |
2522 } // namespace content | 2521 } // namespace content |
OLD | NEW |