OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (button_ == -1 || event_name == EventTypeNames::mousemove || | 389 if (button_ == -1 || event_name == EventTypeNames::mousemove || |
390 event_name == EventTypeNames::mouseleave || | 390 event_name == EventTypeNames::mouseleave || |
391 event_name == EventTypeNames::mouseenter || | 391 event_name == EventTypeNames::mouseenter || |
392 event_name == EventTypeNames::mouseover || | 392 event_name == EventTypeNames::mouseover || |
393 event_name == EventTypeNames::mouseout) { | 393 event_name == EventTypeNames::mouseout) { |
394 return 0; | 394 return 0; |
395 } | 395 } |
396 return button_; | 396 return button_; |
397 } | 397 } |
398 | 398 |
399 int MouseEvent::which() const { | 399 unsigned MouseEvent::which() const { |
400 // For the DOM, the return values for left, middle and right mouse buttons are | 400 // For the DOM, the return values for left, middle and right mouse buttons are |
401 // 0, 1, 2, respectively. | 401 // 0, 1, 2, respectively. |
402 // For the Netscape "which" property, the return values for left, middle and | 402 // For the Netscape "which" property, the return values for left, middle and |
403 // right mouse buttons are 1, 2, 3, respectively. | 403 // right mouse buttons are 1, 2, 3, respectively. |
404 // So we must add 1. | 404 // So we must add 1. |
405 return button_ + 1; | 405 return (unsigned)(button_ + 1); |
406 } | 406 } |
407 | 407 |
408 Node* MouseEvent::toElement() const { | 408 Node* MouseEvent::toElement() const { |
409 // MSIE extension - "the object toward which the user is moving the mouse | 409 // MSIE extension - "the object toward which the user is moving the mouse |
410 // pointer" | 410 // pointer" |
411 if (type() == EventTypeNames::mouseout || | 411 if (type() == EventTypeNames::mouseout || |
412 type() == EventTypeNames::mouseleave) | 412 type() == EventTypeNames::mouseleave) |
413 return relatedTarget() ? relatedTarget()->ToNode() : nullptr; | 413 return relatedTarget() ? relatedTarget()->ToNode() : nullptr; |
414 | 414 |
415 return target() ? target()->ToNode() : nullptr; | 415 return target() ? target()->ToNode() : nullptr; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 598 |
599 int MouseEvent::offsetY() { | 599 int MouseEvent::offsetY() { |
600 if (!HasPosition()) | 600 if (!HasPosition()) |
601 return 0; | 601 return 0; |
602 if (!has_cached_relative_position_) | 602 if (!has_cached_relative_position_) |
603 ComputeRelativePosition(); | 603 ComputeRelativePosition(); |
604 return std::round(offset_location_.Y()); | 604 return std::round(offset_location_.Y()); |
605 } | 605 } |
606 | 606 |
607 } // namespace blink | 607 } // namespace blink |
OLD | NEW |