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

Side by Side Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 1011383006: Revert of Added EventSender.setTouchPointRadius() for layoutTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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/shell/renderer/test_runner/event_sender.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 void TextZoomOut(); 376 void TextZoomOut();
377 void ZoomPageIn(); 377 void ZoomPageIn();
378 void ZoomPageOut(); 378 void ZoomPageOut();
379 void SetPageZoomFactor(double factor); 379 void SetPageZoomFactor(double factor);
380 void SetPageScaleFactor(gin::Arguments* args); 380 void SetPageScaleFactor(gin::Arguments* args);
381 void SetPageScaleFactorLimits(gin::Arguments* args); 381 void SetPageScaleFactorLimits(gin::Arguments* args);
382 void ClearTouchPoints(); 382 void ClearTouchPoints();
383 void ReleaseTouchPoint(unsigned index); 383 void ReleaseTouchPoint(unsigned index);
384 void UpdateTouchPoint(unsigned index, double x, double y); 384 void UpdateTouchPoint(unsigned index, double x, double y);
385 void CancelTouchPoint(unsigned index); 385 void CancelTouchPoint(unsigned index);
386 void SetTouchPointRadius(unsigned index,
387 float rx,
388 float ry,
389 bool set_state_moved);
390 void SetTouchModifier(const std::string& key_name, bool set_mask); 386 void SetTouchModifier(const std::string& key_name, bool set_mask);
391 void SetTouchCancelable(bool cancelable); 387 void SetTouchCancelable(bool cancelable);
392 void DumpFilenameBeingDragged(); 388 void DumpFilenameBeingDragged();
393 void GestureFlingCancel(); 389 void GestureFlingCancel();
394 void GestureFlingStart(float x, 390 void GestureFlingStart(float x,
395 float y, 391 float y,
396 float velocity_x, 392 float velocity_x,
397 float velocity_y, 393 float velocity_y,
398 gin::Arguments* args); 394 gin::Arguments* args);
399 void GestureScrollFirstPoint(int x, int y); 395 void GestureScrollFirstPoint(int x, int y);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 .SetMethod("zoomPageIn", &EventSenderBindings::ZoomPageIn) 511 .SetMethod("zoomPageIn", &EventSenderBindings::ZoomPageIn)
516 .SetMethod("zoomPageOut", &EventSenderBindings::ZoomPageOut) 512 .SetMethod("zoomPageOut", &EventSenderBindings::ZoomPageOut)
517 .SetMethod("setPageZoomFactor", &EventSenderBindings::SetPageZoomFactor) 513 .SetMethod("setPageZoomFactor", &EventSenderBindings::SetPageZoomFactor)
518 .SetMethod("setPageScaleFactor", &EventSenderBindings::SetPageScaleFactor) 514 .SetMethod("setPageScaleFactor", &EventSenderBindings::SetPageScaleFactor)
519 .SetMethod("setPageScaleFactorLimits", 515 .SetMethod("setPageScaleFactorLimits",
520 &EventSenderBindings::SetPageScaleFactorLimits) 516 &EventSenderBindings::SetPageScaleFactorLimits)
521 .SetMethod("clearTouchPoints", &EventSenderBindings::ClearTouchPoints) 517 .SetMethod("clearTouchPoints", &EventSenderBindings::ClearTouchPoints)
522 .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint) 518 .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint)
523 .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint) 519 .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint)
524 .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint) 520 .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint)
525 .SetMethod("setTouchPointRadius",
526 &EventSenderBindings::SetTouchPointRadius)
527 .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier) 521 .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier)
528 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) 522 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable)
529 .SetMethod("dumpFilenameBeingDragged", 523 .SetMethod("dumpFilenameBeingDragged",
530 &EventSenderBindings::DumpFilenameBeingDragged) 524 &EventSenderBindings::DumpFilenameBeingDragged)
531 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) 525 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel)
532 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) 526 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart)
533 .SetMethod("gestureScrollFirstPoint", 527 .SetMethod("gestureScrollFirstPoint",
534 &EventSenderBindings::GestureScrollFirstPoint) 528 &EventSenderBindings::GestureScrollFirstPoint)
535 .SetMethod("touchStart", &EventSenderBindings::TouchStart) 529 .SetMethod("touchStart", &EventSenderBindings::TouchStart)
536 .SetMethod("touchMove", &EventSenderBindings::TouchMove) 530 .SetMethod("touchMove", &EventSenderBindings::TouchMove)
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { 700 void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) {
707 if (sender_) 701 if (sender_)
708 sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y )); 702 sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y ));
709 } 703 }
710 704
711 void EventSenderBindings::CancelTouchPoint(unsigned index) { 705 void EventSenderBindings::CancelTouchPoint(unsigned index) {
712 if (sender_) 706 if (sender_)
713 sender_->CancelTouchPoint(index); 707 sender_->CancelTouchPoint(index);
714 } 708 }
715 709
716 void EventSenderBindings::SetTouchPointRadius(unsigned index,
717 float rx,
718 float ry,
719 bool set_state_moved) {
720 if (sender_)
721 sender_->SetTouchPointRadius(index, rx, ry, set_state_moved);
722 }
723
724 void EventSenderBindings::SetTouchModifier(const std::string& key_name, 710 void EventSenderBindings::SetTouchModifier(const std::string& key_name,
725 bool set_mask) { 711 bool set_mask) {
726 if (sender_) 712 if (sender_)
727 sender_->SetTouchModifier(key_name, set_mask); 713 sender_->SetTouchModifier(key_name, set_mask);
728 } 714 }
729 715
730 void EventSenderBindings::SetTouchCancelable(bool cancelable) { 716 void EventSenderBindings::SetTouchCancelable(bool cancelable) {
731 if (sender_) 717 if (sender_)
732 sender_->SetTouchCancelable(cancelable); 718 sender_->SetTouchCancelable(cancelable);
733 } 719 }
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 void EventSender::CancelTouchPoint(unsigned index) { 1604 void EventSender::CancelTouchPoint(unsigned index) {
1619 if (index >= touch_points_.size()) { 1605 if (index >= touch_points_.size()) {
1620 ThrowTouchPointError(); 1606 ThrowTouchPointError();
1621 return; 1607 return;
1622 } 1608 }
1623 1609
1624 WebTouchPoint* touch_point = &touch_points_[index]; 1610 WebTouchPoint* touch_point = &touch_points_[index];
1625 touch_point->state = WebTouchPoint::StateCancelled; 1611 touch_point->state = WebTouchPoint::StateCancelled;
1626 } 1612 }
1627 1613
1628 void EventSender::SetTouchPointRadius(unsigned index,
1629 float rx,
1630 float ry,
1631 bool set_state_moved) {
1632 if (index >= touch_points_.size()) {
1633 ThrowTouchPointError();
1634 return;
1635 }
1636
1637 WebTouchPoint* touch_point = &touch_points_[index];
1638 if (set_state_moved)
1639 touch_point->state = WebTouchPoint::StateMoved;
1640 touch_point->radiusX = rx;
1641 touch_point->radiusY = ry;
1642 }
1643
1644 void EventSender::SetTouchModifier(const std::string& key_name, 1614 void EventSender::SetTouchModifier(const std::string& key_name,
1645 bool set_mask) { 1615 bool set_mask) {
1646 int mask = 0; 1616 int mask = 0;
1647 if (key_name == "shift") 1617 if (key_name == "shift")
1648 mask = WebInputEvent::ShiftKey; 1618 mask = WebInputEvent::ShiftKey;
1649 else if (key_name == "alt") 1619 else if (key_name == "alt")
1650 mask = WebInputEvent::AltKey; 1620 mask = WebInputEvent::AltKey;
1651 else if (key_name == "ctrl") 1621 else if (key_name == "ctrl")
1652 mask = WebInputEvent::ControlKey; 1622 mask = WebInputEvent::ControlKey;
1653 else if (key_name == "meta") 1623 else if (key_name == "meta")
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 args->ThrowError(); 1763 args->ThrowError();
1794 return; 1764 return;
1795 } 1765 }
1796 1766
1797 WebTouchPoint touch_point; 1767 WebTouchPoint touch_point;
1798 touch_point.state = WebTouchPoint::StatePressed; 1768 touch_point.state = WebTouchPoint::StatePressed;
1799 touch_point.position = WebFloatPoint(static_cast<float>(x), 1769 touch_point.position = WebFloatPoint(static_cast<float>(x),
1800 static_cast<float>(y)); 1770 static_cast<float>(y));
1801 touch_point.screenPosition = touch_point.position; 1771 touch_point.screenPosition = touch_point.position;
1802 1772
1773 if (!args->PeekNext().IsEmpty()) {
1774 double radius_x;
1775 if (!args->GetNext(&radius_x)) {
1776 args->ThrowError();
1777 return;
1778 }
1779
1780 double radius_y = radius_x;
1781 if (!args->PeekNext().IsEmpty()) {
1782 if (!args->GetNext(&radius_y)) {
1783 args->ThrowError();
1784 return;
1785 }
1786 }
1787
1788 touch_point.radiusX = static_cast<float>(radius_x);
1789 touch_point.radiusY = static_cast<float>(radius_y);
1790 }
1791
1803 int lowest_id = 0; 1792 int lowest_id = 0;
1804 for (size_t i = 0; i < touch_points_.size(); i++) { 1793 for (size_t i = 0; i < touch_points_.size(); i++) {
1805 if (touch_points_[i].id == lowest_id) 1794 if (touch_points_[i].id == lowest_id)
1806 lowest_id++; 1795 lowest_id++;
1807 } 1796 }
1808 touch_point.id = lowest_id; 1797 touch_point.id = lowest_id;
1809 touch_points_.push_back(touch_point); 1798 touch_points_.push_back(touch_point);
1810 } 1799 }
1811 1800
1812 void EventSender::MouseDragBegin() { 1801 void EventSender::MouseDragBegin() {
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2504
2516 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { 2505 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
2517 if (WebPagePopup* popup = view_->pagePopup()) { 2506 if (WebPagePopup* popup = view_->pagePopup()) {
2518 if (!WebInputEvent::isKeyboardEventType(event.type)) 2507 if (!WebInputEvent::isKeyboardEventType(event.type))
2519 return popup->handleInputEvent(event); 2508 return popup->handleInputEvent(event);
2520 } 2509 }
2521 return view_->handleInputEvent(event); 2510 return view_->handleInputEvent(event);
2522 } 2511 }
2523 2512
2524 } // namespace content 2513 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698