OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 return i; | 711 return i; |
712 } | 712 } |
713 return std::numeric_limits<unsigned>::max(); | 713 return std::numeric_limits<unsigned>::max(); |
714 } | 714 } |
715 | 715 |
716 static void addTouchPointsUpdateStateIfNecessary(WebTouchPoint::State state, Tou
chList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const
LayoutItem layoutItem) | 716 static void addTouchPointsUpdateStateIfNecessary(WebTouchPoint::State state, Tou
chList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const
LayoutItem layoutItem) |
717 { | 717 { |
718 unsigned initialTouchPointsLength = *touchPointsLength; | 718 unsigned initialTouchPointsLength = *touchPointsLength; |
719 for (unsigned i = 0; i < touches->length(); ++i) { | 719 for (unsigned i = 0; i < touches->length(); ++i) { |
720 const unsigned pointIndex = *touchPointsLength; | 720 const unsigned pointIndex = *touchPointsLength; |
721 if (pointIndex >= static_cast<unsigned>(WebTouchEvent::touchesLengthCap)
) | 721 if (pointIndex >= static_cast<unsigned>(WebTouchEvent::kTouchesLengthCap
)) |
722 return; | 722 return; |
723 | 723 |
724 const Touch* touch = touches->item(i); | 724 const Touch* touch = touches->item(i); |
725 unsigned existingPointIndex = indexOfTouchPointWithId(touchPoints, initi
alTouchPointsLength, touch->identifier()); | 725 unsigned existingPointIndex = indexOfTouchPointWithId(touchPoints, initi
alTouchPointsLength, touch->identifier()); |
726 if (existingPointIndex != std::numeric_limits<unsigned>::max()) { | 726 if (existingPointIndex != std::numeric_limits<unsigned>::max()) { |
727 touchPoints[existingPointIndex].state = state; | 727 touchPoints[existingPointIndex].state = state; |
728 } else { | 728 } else { |
729 touchPoints[pointIndex] = toWebTouchPoint(touch, layoutItem, state); | 729 touchPoints[pointIndex] = toWebTouchPoint(touch, layoutItem, state); |
730 ++(*touchPointsLength); | 730 ++(*touchPointsLength); |
731 } | 731 } |
(...skipping 15 matching lines...) Expand all Loading... |
747 type = Undefined; | 747 type = Undefined; |
748 return; | 748 return; |
749 } | 749 } |
750 | 750 |
751 timeStampSeconds = event.platformTimeStamp(); | 751 timeStampSeconds = event.platformTimeStamp(); |
752 modifiers = event.modifiers(); | 752 modifiers = event.modifiers(); |
753 dispatchType = event.cancelable() ? WebInputEvent::Blocking : WebInputEvent:
:EventNonBlocking; | 753 dispatchType = event.cancelable() ? WebInputEvent::Blocking : WebInputEvent:
:EventNonBlocking; |
754 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); | 754 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); |
755 | 755 |
756 // Currently touches[] is empty, add stationary points as-is. | 756 // Currently touches[] is empty, add stationary points as-is. |
757 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign
ed>(WebTouchEvent::touchesLengthCap); ++i) { | 757 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign
ed>(WebTouchEvent::kTouchesLengthCap); ++i) { |
758 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutItem, WebTo
uchPoint::StateStationary); | 758 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutItem, WebTo
uchPoint::StateStationary); |
759 ++touchesLength; | 759 ++touchesLength; |
760 } | 760 } |
761 // If any existing points are also in the change list, we should update | 761 // If any existing points are also in the change list, we should update |
762 // their state, otherwise just add the new points. | 762 // their state, otherwise just add the new points. |
763 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutItem); | 763 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutItem); |
764 } | 764 } |
765 | 765 |
766 WebGestureEventBuilder::WebGestureEventBuilder(const LayoutItem layoutItem, cons
t GestureEvent& event) | 766 WebGestureEventBuilder::WebGestureEventBuilder(const LayoutItem layoutItem, cons
t GestureEvent& event) |
767 { | 767 { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 break; | 816 break; |
817 case GestureSourceTouchscreen: | 817 case GestureSourceTouchscreen: |
818 sourceDevice = WebGestureDeviceTouchscreen; | 818 sourceDevice = WebGestureDeviceTouchscreen; |
819 break; | 819 break; |
820 case GestureSourceUninitialized: | 820 case GestureSourceUninitialized: |
821 NOTREACHED(); | 821 NOTREACHED(); |
822 } | 822 } |
823 } | 823 } |
824 | 824 |
825 } // namespace blink | 825 } // namespace blink |
OLD | NEW |