Changeset 166861 in webkit
- Timestamp:
- Apr 6, 2014 5:54:14 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r166859 r166861 1 2014-04-06 Dan Bernstein <mitz@apple.com> 2 3 Clean up WKGestureTypes.h 4 https://bugs.webkit.org/show_bug.cgi?id=131286 5 6 Reviewed by Sam Weinig. 7 8 Renamed WKGestureTypes.h to GestureTypes.h, dropped the useless “WK” prefixes and changed 9 into scoped enums, with the exception of SelectionFlags. 10 11 * Shared/ios/GestureTypes.h: Copied from Source/WebKit2/Shared/ios/WKGestureTypes.h. 12 * Shared/ios/WKGestureTypes.h: Removed. 13 * UIProcess/API/Cocoa/_WKElementAction.mm: 14 (copyElement): 15 (saveImage): 16 * UIProcess/ios/PageClientImplIOS.mm: 17 (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): 18 * UIProcess/ios/WKContentViewInteraction.h: 19 * UIProcess/ios/WKContentViewInteraction.mm: 20 (-[WKContentView _performAction:]): 21 (toGestureType): 22 (toUIWKGestureType): 23 (toSelectionTouch): 24 (toUIWKSelectionTouch): 25 (toGestureRecognizerState): 26 (toUIGestureRecognizerState): 27 (toUIWKSelectionFlags): 28 (toSelectionHandlePosition): 29 (selectionChangedWithGesture): 30 (selectionChangedWithTouch): 31 (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): 32 (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]): 33 (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): 34 (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]): 35 (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): 36 * WebKit2.xcodeproj/project.pbxproj: 37 * WebProcess/WebPage/WebPage.h: 38 * WebProcess/WebPage/ios/WebPageIOS.mm: 39 (WebKit::WebPage::rangeForWebSelectionAtPosition): 40 (WebKit::WebPage::selectWithGesture): 41 (WebKit::distanceBetweenRectsForPosition): 42 (WebKit::computeEdgeCenter): 43 (WebKit::WebPage::expandedRangeFromHandle): 44 (WebKit::WebPage::contractedRangeFromHandle): 45 (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): 46 (WebKit::shouldExpand): 47 (WebKit::WebPage::changeBlockSelection): 48 (WebKit::WebPage::updateBlockSelectionWithTouch): 49 (WebKit::WebPage::updateSelectionWithTouches): 50 (WebKit::WebPage::performActionOnElement): 51 1 52 2014-04-06 Sam Weinig <sam@webkit.org> 2 53 -
trunk/Source/WebKit2/Shared/ios/GestureTypes.h
r166859 r166861 24 24 */ 25 25 26 #ifndef WKGestureTypes_h27 #define WKGestureTypes_h26 #ifndef GestureTypes_h 27 #define GestureTypes_h 28 28 29 29 namespace WebKit { 30 30 31 typedef enum{32 WKGestureLoupe,33 WKGestureOneFingerTap,34 WKGestureTapAndAHalf,35 WKGestureDoubleTap,36 WKGestureTapAndHalf,37 WKGestureDoubleTapInUneditable,38 WKGestureOneFingerTapInUneditable,39 WKGestureOneFingerTapSelectsAll,40 WKGestureOneFingerDoubleTap,41 WKGestureOneFingerTripleTap,42 WKGestureTwoFingerSingleTap,43 WKGestureTwoFingerRangedSelectGesture,44 WKGestureTapOnLinkWithGesture,45 WKGestureMakeWebSelection46 } WKGestureType;31 enum class GestureType { 32 Loupe, 33 OneFingerTap, 34 TapAndAHalf, 35 DoubleTap, 36 TapAndHalf, 37 DoubleTapInUneditable, 38 OneFingerTapInUneditable, 39 OneFingerTapSelectsAll, 40 OneFingerDoubleTap, 41 OneFingerTripleTap, 42 TwoFingerSingleTap, 43 TwoFingerRangedSelectGesture, 44 TapOnLinkWithGesture, 45 MakeWebSelection 46 }; 47 47 48 typedef enum{49 WKSelectionTouchStarted,50 WKSelectionTouchMoved,51 WKSelectionTouchEnded,52 WKSelectionTouchEndedMovingForward,53 WKSelectionTouchEndedMovingBackward,54 WKSelectionTouchEndedNotMoving55 } WKSelectionTouch;48 enum class SelectionTouch { 49 Started, 50 Moved, 51 Ended, 52 EndedMovingForward, 53 EndedMovingBackward, 54 EndedNotMoving 55 }; 56 56 57 typedef enum{58 WKGestureRecognizerStatePossible,59 WKGestureRecognizerStateBegan,60 WKGestureRecognizerStateChanged,61 WKGestureRecognizerStateEnded,62 WKGestureRecognizerStateCancelled,63 WKGestureRecognizerStateFailed,64 WKGestureRecognizerStateRecognized = WKGestureRecognizerStateEnded65 } WKGestureRecognizerState;57 enum class GestureRecognizerState { 58 Possible, 59 Began, 60 Changed, 61 Ended, 62 Cancelled, 63 Failed, 64 Recognized = Ended 65 }; 66 66 67 typedef enum{68 WKSheetActionCopy,69 WKSheetActionSaveImage70 } WKSheetActions;67 enum class SheetAction { 68 Copy, 69 SaveImage 70 }; 71 71 72 typedef enum{73 WKNone = 0,74 W KWordIsNearTap = 1,75 WKIsBlockSelection = 276 } WKSelectionFlags;72 enum SelectionFlags { 73 None = 0, 74 WordIsNearTap = 1 << 0, 75 IsBlockSelection = 1 << 1, 76 }; 77 77 78 typedef enum { 79 WKHandleTop, 80 WKHandleRight, 81 WKHandleBottom, 82 WKHandleLeft 83 } WKHandlePosition; 78 enum class SelectionHandlePosition { 79 Top, 80 Right, 81 Bottom, 82 Left 83 }; 84 84 85 } // namespace WebKit 85 86 86 #endif // WKGestureTypes_h87 #endif // GestureTypes_h -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm
r164628 r166861 31 31 #if PLATFORM(IOS) 32 32 33 #import "GestureTypes.h" 34 #import "WKContentViewInteraction.h" 33 35 #import "_WKActivatedElementInfoInternal.h" 34 #import "WKContentViewInteraction.h"35 #import "WKGestureTypes.h"36 36 #import <SafariServices/SSReadingList.h> 37 37 #import <WebCore/LocalizedStrings.h> … … 76 76 static void copyElement(WKContentView *view) 77 77 { 78 [view _performAction:WebKit:: WKSheetActionCopy];78 [view _performAction:WebKit::SheetAction::Copy]; 79 79 } 80 80 81 81 static void saveImage(WKContentView *view) 82 82 { 83 [view _performAction:WebKit:: WKSheetActionSaveImage];83 [view _performAction:WebKit::SheetAction::SaveImage]; 84 84 } 85 85 -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r166658 r166861 371 371 void PageClientImpl::didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold) 372 372 { 373 [m_contentView _didUpdateBlockSelectionWithTouch:( WKSelectionTouch)touch withFlags:(WKSelectionFlags)flags growThreshold:growThreshold shrinkThreshold:shrinkThreshold];373 [m_contentView _didUpdateBlockSelectionWithTouch:(SelectionTouch)touch withFlags:(SelectionFlags)flags growThreshold:growThreshold shrinkThreshold:shrinkThreshold]; 374 374 } 375 375 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r166605 r166861 29 29 30 30 #import "AssistedNodeInformation.h" 31 #import "GestureTypes.h" 31 32 #import "InteractionInformationAtPosition.h" 32 33 #import "WKAirPlayRoutePicker.h" 33 34 #import "WKFormPeripheral.h" 34 #import "WKGestureTypes.h"35 35 #import <UIKit/UITextInput_Private.h> 36 36 #import <UIKit/UIView.h> 37 #import <UIKit/UIWKSelectionAssistant.h> 38 #import <UIKit/UIWKTextInteractionAssistant.h> 37 39 #import <UIKit/UIWebFormAccessory.h> 38 40 #import <UIKit/UIWebTouchEventsGestureRecognizer.h> 39 #import <UIKit/UIWKSelectionAssistant.h>40 #import <UIKit/UIWKTextInteractionAssistant.h>41 41 #import <wtf/Forward.h> 42 #import <wtf/Vector.h> 42 43 #import <wtf/text/WTFString.h> 43 #import <wtf/Vector.h>44 44 45 45 namespace WebCore { … … 138 138 - (void)_attemptClickAtLocation:(CGPoint)location; 139 139 - (void)_updatePositionInformation; 140 - (void)_performAction:(WebKit:: WKSheetActions)action;140 - (void)_performAction:(WebKit::SheetAction)action; 141 141 - (void)_willStartScrollingOrZooming; 142 142 - (void)_willStartUserTriggeredScrollingOrZooming; 143 143 - (void)_didEndScrollingOrZooming; 144 - (void)_didUpdateBlockSelectionWithTouch:(WebKit:: WKSelectionTouch)touch withFlags:(WebKit::WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold;144 - (void)_didUpdateBlockSelectionWithTouch:(WebKit::SelectionTouch)touch withFlags:(WebKit::SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold; 145 145 - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect; 146 146 - (void)accessoryDone; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r166605 r166861 883 883 } 884 884 885 - (void)_performAction:( WKSheetActions)action885 - (void)_performAction:(SheetAction)action 886 886 { 887 887 _page->performActionOnElement((uint32_t)action); … … 978 978 // UIWKInteractionViewProtocol 979 979 980 static inline WKGestureType toWKGestureType(UIWKGestureType gestureType)980 static inline GestureType toGestureType(UIWKGestureType gestureType) 981 981 { 982 982 switch (gestureType) { 983 983 case UIWKGestureLoupe: 984 return WKGestureLoupe;984 return GestureType::Loupe; 985 985 case UIWKGestureOneFingerTap: 986 return WKGestureOneFingerTap;986 return GestureType::OneFingerTap; 987 987 case UIWKGestureTapAndAHalf: 988 return WKGestureTapAndAHalf;988 return GestureType::TapAndAHalf; 989 989 case UIWKGestureDoubleTap: 990 return WKGestureDoubleTap;990 return GestureType::DoubleTap; 991 991 case UIWKGestureTapAndHalf: 992 return WKGestureTapAndHalf;992 return GestureType::TapAndHalf; 993 993 case UIWKGestureDoubleTapInUneditable: 994 return WKGestureDoubleTapInUneditable;994 return GestureType::DoubleTapInUneditable; 995 995 case UIWKGestureOneFingerTapInUneditable: 996 return WKGestureOneFingerTapInUneditable;996 return GestureType::OneFingerTapInUneditable; 997 997 case UIWKGestureOneFingerTapSelectsAll: 998 return WKGestureOneFingerTapSelectsAll;998 return GestureType::OneFingerTapSelectsAll; 999 999 case UIWKGestureOneFingerDoubleTap: 1000 return WKGestureOneFingerDoubleTap;1000 return GestureType::OneFingerDoubleTap; 1001 1001 case UIWKGestureOneFingerTripleTap: 1002 return WKGestureOneFingerTripleTap;1002 return GestureType::OneFingerTripleTap; 1003 1003 case UIWKGestureTwoFingerSingleTap: 1004 return WKGestureTwoFingerSingleTap;1004 return GestureType::TwoFingerSingleTap; 1005 1005 case UIWKGestureTwoFingerRangedSelectGesture: 1006 return WKGestureTwoFingerRangedSelectGesture;1006 return GestureType::TwoFingerRangedSelectGesture; 1007 1007 case UIWKGestureTapOnLinkWithGesture: 1008 return WKGestureTapOnLinkWithGesture;1008 return GestureType::TapOnLinkWithGesture; 1009 1009 case UIWKGestureMakeWebSelection: 1010 return WKGestureMakeWebSelection;1010 return GestureType::MakeWebSelection; 1011 1011 } 1012 1012 ASSERT_NOT_REACHED(); 1013 return WKGestureLoupe;1014 } 1015 1016 static inline UIWKGestureType toUIWKGestureType( WKGestureType gestureType)1013 return GestureType::Loupe; 1014 } 1015 1016 static inline UIWKGestureType toUIWKGestureType(GestureType gestureType) 1017 1017 { 1018 1018 switch (gestureType) { 1019 case WKGestureLoupe:1019 case GestureType::Loupe: 1020 1020 return UIWKGestureLoupe; 1021 case WKGestureOneFingerTap:1021 case GestureType::OneFingerTap: 1022 1022 return UIWKGestureOneFingerTap; 1023 case WKGestureTapAndAHalf:1023 case GestureType::TapAndAHalf: 1024 1024 return UIWKGestureTapAndAHalf; 1025 case WKGestureDoubleTap:1025 case GestureType::DoubleTap: 1026 1026 return UIWKGestureDoubleTap; 1027 case WKGestureTapAndHalf:1027 case GestureType::TapAndHalf: 1028 1028 return UIWKGestureTapAndHalf; 1029 case WKGestureDoubleTapInUneditable:1029 case GestureType::DoubleTapInUneditable: 1030 1030 return UIWKGestureDoubleTapInUneditable; 1031 case WKGestureOneFingerTapInUneditable:1031 case GestureType::OneFingerTapInUneditable: 1032 1032 return UIWKGestureOneFingerTapInUneditable; 1033 case WKGestureOneFingerTapSelectsAll:1033 case GestureType::OneFingerTapSelectsAll: 1034 1034 return UIWKGestureOneFingerTapSelectsAll; 1035 case WKGestureOneFingerDoubleTap:1035 case GestureType::OneFingerDoubleTap: 1036 1036 return UIWKGestureOneFingerDoubleTap; 1037 case WKGestureOneFingerTripleTap:1037 case GestureType::OneFingerTripleTap: 1038 1038 return UIWKGestureOneFingerTripleTap; 1039 case WKGestureTwoFingerSingleTap:1039 case GestureType::TwoFingerSingleTap: 1040 1040 return UIWKGestureTwoFingerSingleTap; 1041 case WKGestureTwoFingerRangedSelectGesture:1041 case GestureType::TwoFingerRangedSelectGesture: 1042 1042 return UIWKGestureTwoFingerRangedSelectGesture; 1043 case WKGestureTapOnLinkWithGesture:1043 case GestureType::TapOnLinkWithGesture: 1044 1044 return UIWKGestureTapOnLinkWithGesture; 1045 case WKGestureMakeWebSelection:1045 case GestureType::MakeWebSelection: 1046 1046 return UIWKGestureMakeWebSelection; 1047 1047 } 1048 1048 } 1049 1049 1050 static inline WKSelectionTouch toWKSelectionTouch(UIWKSelectionTouch touch)1050 static inline SelectionTouch toSelectionTouch(UIWKSelectionTouch touch) 1051 1051 { 1052 1052 switch (touch) { 1053 1053 case UIWKSelectionTouchStarted: 1054 return WKSelectionTouchStarted;1054 return SelectionTouch::Started; 1055 1055 case UIWKSelectionTouchMoved: 1056 return WKSelectionTouchMoved;1056 return SelectionTouch::Moved; 1057 1057 case UIWKSelectionTouchEnded: 1058 return WKSelectionTouchEnded;1058 return SelectionTouch::Ended; 1059 1059 case UIWKSelectionTouchEndedMovingForward: 1060 return WKSelectionTouchEndedMovingForward;1060 return SelectionTouch::EndedMovingForward; 1061 1061 case UIWKSelectionTouchEndedMovingBackward: 1062 return WKSelectionTouchEndedMovingBackward;1062 return SelectionTouch::EndedMovingBackward; 1063 1063 case UIWKSelectionTouchEndedNotMoving: 1064 return WKSelectionTouchEndedNotMoving;1064 return SelectionTouch::EndedNotMoving; 1065 1065 } 1066 1066 ASSERT_NOT_REACHED(); 1067 return WKSelectionTouchEnded;1068 } 1069 1070 static inline UIWKSelectionTouch toUIWKSelectionTouch( WKSelectionTouch touch)1067 return SelectionTouch::Ended; 1068 } 1069 1070 static inline UIWKSelectionTouch toUIWKSelectionTouch(SelectionTouch touch) 1071 1071 { 1072 1072 switch (touch) { 1073 case WKSelectionTouchStarted:1073 case SelectionTouch::Started: 1074 1074 return UIWKSelectionTouchStarted; 1075 case WKSelectionTouchMoved:1075 case SelectionTouch::Moved: 1076 1076 return UIWKSelectionTouchMoved; 1077 case WKSelectionTouchEnded:1077 case SelectionTouch::Ended: 1078 1078 return UIWKSelectionTouchEnded; 1079 case WKSelectionTouchEndedMovingForward:1079 case SelectionTouch::EndedMovingForward: 1080 1080 return UIWKSelectionTouchEndedMovingForward; 1081 case WKSelectionTouchEndedMovingBackward:1081 case SelectionTouch::EndedMovingBackward: 1082 1082 return UIWKSelectionTouchEndedMovingBackward; 1083 case WKSelectionTouchEndedNotMoving:1083 case SelectionTouch::EndedNotMoving: 1084 1084 return UIWKSelectionTouchEndedNotMoving; 1085 1085 } 1086 1086 } 1087 1087 1088 static inline WKGestureRecognizerState toWKGestureRecognizerState(UIGestureRecognizerState state)1088 static inline GestureRecognizerState toGestureRecognizerState(UIGestureRecognizerState state) 1089 1089 { 1090 1090 switch (state) { 1091 1091 case UIGestureRecognizerStatePossible: 1092 return WKGestureRecognizerStatePossible;1092 return GestureRecognizerState::Possible; 1093 1093 case UIGestureRecognizerStateBegan: 1094 return WKGestureRecognizerStateBegan;1094 return GestureRecognizerState::Began; 1095 1095 case UIGestureRecognizerStateChanged: 1096 return WKGestureRecognizerStateChanged;1096 return GestureRecognizerState::Changed; 1097 1097 case UIGestureRecognizerStateCancelled: 1098 return WKGestureRecognizerStateCancelled;1098 return GestureRecognizerState::Cancelled; 1099 1099 case UIGestureRecognizerStateEnded: 1100 return WKGestureRecognizerStateEnded;1100 return GestureRecognizerState::Ended; 1101 1101 case UIGestureRecognizerStateFailed: 1102 return WKGestureRecognizerStateFailed;1103 } 1104 } 1105 1106 static inline UIGestureRecognizerState toUIGestureRecognizerState( WKGestureRecognizerState state)1102 return GestureRecognizerState::Failed; 1103 } 1104 } 1105 1106 static inline UIGestureRecognizerState toUIGestureRecognizerState(GestureRecognizerState state) 1107 1107 { 1108 1108 switch (state) { 1109 case WKGestureRecognizerStatePossible:1109 case GestureRecognizerState::Possible: 1110 1110 return UIGestureRecognizerStatePossible; 1111 case WKGestureRecognizerStateBegan:1111 case GestureRecognizerState::Began: 1112 1112 return UIGestureRecognizerStateBegan; 1113 case WKGestureRecognizerStateChanged:1113 case GestureRecognizerState::Changed: 1114 1114 return UIGestureRecognizerStateChanged; 1115 case WKGestureRecognizerStateCancelled:1115 case GestureRecognizerState::Cancelled: 1116 1116 return UIGestureRecognizerStateCancelled; 1117 case WKGestureRecognizerStateEnded:1117 case GestureRecognizerState::Ended: 1118 1118 return UIGestureRecognizerStateEnded; 1119 case WKGestureRecognizerStateFailed:1119 case GestureRecognizerState::Failed: 1120 1120 return UIGestureRecognizerStateFailed; 1121 1121 } 1122 1122 } 1123 1123 1124 static inline UIWKSelectionFlags toUIWKSelectionFlags(WKSelectionFlags flag) 1125 { 1126 switch (flag) { 1127 case WKNone: 1128 return UIWKNone; 1129 case WKWordIsNearTap: 1130 return UIWKWordIsNearTap; 1131 case WKIsBlockSelection: 1132 return UIWKIsBlockSelection; 1133 } 1134 } 1135 1136 static inline WKHandlePosition toWKHandlePosition(UIWKHandlePosition position) 1124 static inline UIWKSelectionFlags toUIWKSelectionFlags(SelectionFlags flags) 1125 { 1126 NSInteger uiFlags = UIWKNone; 1127 if (flags & WordIsNearTap) 1128 uiFlags |= UIWKWordIsNearTap; 1129 if (flags & IsBlockSelection) 1130 uiFlags |= UIWKIsBlockSelection; 1131 1132 return static_cast<UIWKSelectionFlags>(uiFlags); 1133 } 1134 1135 static inline SelectionHandlePosition toSelectionHandlePosition(UIWKHandlePosition position) 1137 1136 { 1138 1137 switch (position) { 1139 1138 case UIWKHandleTop: 1140 return WKHandleTop;1139 return SelectionHandlePosition::Top; 1141 1140 case UIWKHandleRight: 1142 return WKHandleRight;1141 return SelectionHandlePosition::Right; 1143 1142 case UIWKHandleBottom: 1144 return WKHandleBottom;1143 return SelectionHandlePosition::Bottom; 1145 1144 case UIWKHandleLeft: 1146 return WKHandleLeft;1145 return SelectionHandlePosition::Left; 1147 1146 } 1148 1147 } … … 1155 1154 } 1156 1155 if ([view webSelectionAssistant]) 1157 [(UIWKSelectionAssistant *)[view webSelectionAssistant] selectionChangedWithGestureAt:(CGPoint)point withGesture:toUIWKGestureType(( WKGestureType)gestureType) withState:toUIGestureRecognizerState(static_cast<WKGestureRecognizerState>(gestureState)) withFlags:(toUIWKSelectionFlags((WKSelectionFlags)flags))];1156 [(UIWKSelectionAssistant *)[view webSelectionAssistant] selectionChangedWithGestureAt:(CGPoint)point withGesture:toUIWKGestureType((GestureType)gestureType) withState:toUIGestureRecognizerState(static_cast<GestureRecognizerState>(gestureState)) withFlags:(toUIWKSelectionFlags((SelectionFlags)flags))]; 1158 1157 else 1159 [(UIWKTextInteractionAssistant *)[view interactionAssistant] selectionChangedWithGestureAt:(CGPoint)point withGesture:toUIWKGestureType(( WKGestureType)gestureType) withState:toUIGestureRecognizerState(static_cast<WKGestureRecognizerState>(gestureState)) withFlags:(toUIWKSelectionFlags((WKSelectionFlags)flags))];1158 [(UIWKTextInteractionAssistant *)[view interactionAssistant] selectionChangedWithGestureAt:(CGPoint)point withGesture:toUIWKGestureType((GestureType)gestureType) withState:toUIGestureRecognizerState(static_cast<GestureRecognizerState>(gestureState)) withFlags:(toUIWKSelectionFlags((SelectionFlags)flags))]; 1160 1159 } 1161 1160 … … 1167 1166 } 1168 1167 if ([view webSelectionAssistant]) 1169 [(UIWKSelectionAssistant *)[view webSelectionAssistant] selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:toUIWKSelectionTouch(( WKSelectionTouch)touch)];1168 [(UIWKSelectionAssistant *)[view webSelectionAssistant] selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:toUIWKSelectionTouch((SelectionTouch)touch)]; 1170 1169 else 1171 [(UIWKTextInteractionAssistant *)[view interactionAssistant] selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:toUIWKSelectionTouch(( WKSelectionTouch)touch)];1172 } 1173 1174 - (void)_didUpdateBlockSelectionWithTouch:( WebKit::WKSelectionTouch)touch withFlags:(WebKit::WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold1175 { 1176 [_webSelectionAssistant blockSelectionChangedWithTouch:toUIWKSelectionTouch( (WKSelectionTouch)touch) withFlags:toUIWKSelectionFlags((WKSelectionFlags)flags) growThreshold:growThreshold shrinkThreshold:shrinkThreshold];1170 [(UIWKTextInteractionAssistant *)[view interactionAssistant] selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:toUIWKSelectionTouch((SelectionTouch)touch)]; 1171 } 1172 1173 - (void)_didUpdateBlockSelectionWithTouch:(SelectionTouch)touch withFlags:(SelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold 1174 { 1175 [_webSelectionAssistant blockSelectionChangedWithTouch:toUIWKSelectionTouch(touch) withFlags:toUIWKSelectionFlags(flags) growThreshold:growThreshold shrinkThreshold:shrinkThreshold]; 1177 1176 } 1178 1177 1179 1178 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state 1180 1179 { 1181 _page->selectWithGesture(WebCore::IntPoint(point), CharacterGranularity, toWKGestureType(gestureType), toWKGestureRecognizerState(state), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {1180 _page->selectWithGesture(WebCore::IntPoint(point), CharacterGranularity, static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(state)), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) { 1182 1181 selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags); 1183 1182 })); … … 1186 1185 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart 1187 1186 { 1188 _page->updateSelectionWithTouches(WebCore::IntPoint(point), toWKSelectionTouch(touch), baseIsStart, TouchesCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t touch) {1187 _page->updateSelectionWithTouches(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), baseIsStart, TouchesCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t touch) { 1189 1188 selectionChangedWithTouch(error, self, point, touch); 1190 1189 })); … … 1193 1192 - (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState 1194 1193 { 1195 _page->selectWithTwoTouches(WebCore::IntPoint(from), WebCore::IntPoint(to), toWKGestureType(gestureType), toWKGestureRecognizerState(gestureState), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) {1194 _page->selectWithTwoTouches(WebCore::IntPoint(from), WebCore::IntPoint(to), static_cast<uint32_t>(toGestureType(gestureType)), static_cast<uint32_t>(toGestureRecognizerState(gestureState)), GestureCallback::create([self](bool error, const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags) { 1196 1195 selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags); 1197 1196 })); … … 1200 1199 - (void)changeBlockSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch forHandle:(UIWKHandlePosition)handle 1201 1200 { 1202 _page->updateBlockSelectionWithTouch(WebCore::IntPoint(point), toWKSelectionTouch(touch), toWKHandlePosition(handle));1201 _page->updateBlockSelectionWithTouch(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), static_cast<uint32_t>(toSelectionHandlePosition(handle))); 1203 1202 } 1204 1203 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r166859 r166861 547 547 2DA944A21884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */; }; 548 548 2DA944A31884E4F000ED86DB /* WebTouchEventIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */; }; 549 2DA944A41884E4F000ED86DB /* WKGestureTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA9449D1884E4F000ED86DB /* WKGestureTypes.h */; };549 2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA9449D1884E4F000ED86DB /* GestureTypes.h */; }; 550 550 2DA944A71884E94800ED86DB /* DownloadIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A61884E94800ED86DB /* DownloadIOS.mm */; }; 551 551 2DA944AD1884E9BA00ED86DB /* TextCheckerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */; }; … … 2355 2355 2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPlatformTouchPointIOS.cpp; path = ios/WebPlatformTouchPointIOS.cpp; sourceTree = "<group>"; }; 2356 2356 2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebTouchEventIOS.cpp; path = ios/WebTouchEventIOS.cpp; sourceTree = "<group>"; }; 2357 2DA9449D1884E4F000ED86DB /* WKGestureTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKGestureTypes.h; path = ios/WKGestureTypes.h; sourceTree = "<group>"; };2357 2DA9449D1884E4F000ED86DB /* GestureTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GestureTypes.h; path = ios/GestureTypes.h; sourceTree = "<group>"; }; 2358 2358 2DA944A61884E94800ED86DB /* DownloadIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadIOS.mm; path = Downloads/ios/DownloadIOS.mm; sourceTree = "<group>"; }; 2359 2359 2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TextCheckerIOS.mm; path = ios/TextCheckerIOS.mm; sourceTree = "<group>"; }; … … 4458 4458 isa = PBXGroup; 4459 4459 children = ( 4460 2DA9449D1884E4F000ED86DB /* GestureTypes.h */, 4460 4461 2DA944971884E4F000ED86DB /* NativeWebKeyboardEventIOS.mm */, 4461 4462 2DA944981884E4F000ED86DB /* NativeWebTouchEventIOS.mm */, … … 4464 4465 2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */, 4465 4466 2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */, 4466 2DA9449D1884E4F000ED86DB /* WKGestureTypes.h */,4467 4467 ); 4468 4468 name = ios; … … 7139 7139 33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */, 7140 7140 33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */, 7141 2DA944A41884E4F000ED86DB /* WKGestureTypes.h in Headers */,7141 2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */, 7142 7142 33367636130C99B2006C9DE2 /* WebResourceCacheManagerProxy.h in Headers */, 7143 7143 33367658130C9ECB006C9DE2 /* WebResourceCacheManagerProxyMessages.h in Headers */, -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r166818 r166861 78 78 79 79 #if PLATFORM(IOS) 80 #include " WKGestureTypes.h"80 #include "GestureTypes.h" 81 81 #endif 82 82 … … 793 793 #if PLATFORM(IOS) 794 794 static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&); 795 PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, WKSelectionFlags&);795 PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&); 796 796 PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&); 797 void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, WKHandlePosition, float& growThreshold, float& shrinkThreshold);798 PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, WKHandlePosition, float& growThreshold, float& shrinkThreshold, WKSelectionFlags&);799 PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, WKHandlePosition);800 PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, WKHandlePosition, WKSelectionFlags&);797 void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold); 798 PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&); 799 PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition); 800 PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&); 801 801 void getAssistedNodeInformation(AssistedNodeInformation&); 802 802 void platformInitializeAccessibility(); -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r166384 r166861 33 33 #import "EditingRange.h" 34 34 #import "EditorState.h" 35 #import "GestureTypes.h" 35 36 #import "InteractionInformationAtPosition.h" 37 #import "LayerTreeHost.h" 36 38 #import "PluginView.h" 37 #import "LayerTreeHost.h"38 39 #import "VisibleContentRectUpdateInfo.h" 40 #import "WKAccessibilityWebPageObjectIOS.h" 39 41 #import "WebChromeClient.h" 40 42 #import "WebCoreArgumentCoders.h" 43 #import "WebFrame.h" 41 44 #import "WebKitSystemInterface.h" 42 45 #import "WebKitSystemInterfaceIOS.h" 43 #import "WebFrame.h"44 46 #import "WebPageProxyMessages.h" 45 47 #import "WebProcess.h" 46 #import "WKAccessibilityWebPageObjectIOS.h"47 #import "WKGestureTypes.h"48 48 #import <CoreText/CTFont.h> 49 49 #import <WebCore/Chrome.h> 50 50 #import <WebCore/Element.h> 51 51 #import <WebCore/EventHandler.h> 52 #import <WebCore/FloatQuad.h> 52 53 #import <WebCore/FocusController.h> 53 #import <WebCore/FloatQuad.h>54 54 #import <WebCore/Frame.h> 55 55 #import <WebCore/FrameView.h> 56 #import <WebCore/HitTestResult.h>57 56 #import <WebCore/HTMLElementTypeHelpers.h> 58 57 #import <WebCore/HTMLFormElement.h> 59 58 #import <WebCore/HTMLInputElement.h> 59 #import <WebCore/HTMLOptGroupElement.h> 60 60 #import <WebCore/HTMLOptionElement.h> 61 #import <WebCore/HTMLOptGroupElement.h>62 61 #import <WebCore/HTMLOptionElement.h> 63 62 #import <WebCore/HTMLParserIdioms.h> 64 63 #import <WebCore/HTMLSelectElement.h> 65 64 #import <WebCore/HTMLTextAreaElement.h> 65 #import <WebCore/HitTestResult.h> 66 66 #import <WebCore/KeyboardEvent.h> 67 67 #import <WebCore/MainFrame.h> … … 439 439 } 440 440 441 PassRefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, WKSelectionFlags& flags)441 PassRefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, SelectionFlags& flags) 442 442 { 443 443 HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint((point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent | HitTestRequest::AllowChildFrameContent); … … 492 492 return range; 493 493 } 494 flags = WKIsBlockSelection;494 flags = IsBlockSelection; 495 495 range = Range::create(bestChoice->document()); 496 496 range->selectNodeContents(bestChoice, ASSERT_NO_EXCEPTION); … … 534 534 } 535 535 RefPtr<Range> range; 536 WKSelectionFlags flags = WKNone;537 WKGestureRecognizerState wkGestureState = static_cast<WKGestureRecognizerState>(gestureState);538 switch (static_cast< WKGestureType>(gestureType)) {539 case WKGestureOneFingerTap:536 SelectionFlags flags = None; 537 GestureRecognizerState wkGestureState = static_cast<GestureRecognizerState>(gestureState); 538 switch (static_cast<GestureType>(gestureType)) { 539 case GestureType::OneFingerTap: 540 540 { 541 541 VisiblePosition result; … … 570 570 break; 571 571 572 case WKGestureLoupe:572 case GestureType::Loupe: 573 573 range = Range::create(*frame.document(), position, position); 574 574 break; 575 575 576 case WKGestureTapAndAHalf:576 case GestureType::TapAndAHalf: 577 577 switch (wkGestureState) { 578 case WKGestureRecognizerStateBegan:578 case GestureRecognizerState::Began: 579 579 range = wordRangeFromPosition(position); 580 580 m_currentWordRange = Range::create(*frame.document(), range->startPosition(), range->endPosition()); 581 581 break; 582 case WKGestureRecognizerStateChanged:582 case GestureRecognizerState::Changed: 583 583 range = Range::create(*frame.document(), m_currentWordRange->startPosition(), m_currentWordRange->endPosition()); 584 584 if (position < range->startPosition()) … … 587 587 range->setEnd(position.deepEquivalent(), ASSERT_NO_EXCEPTION); 588 588 break; 589 case WKGestureRecognizerStateEnded:590 case WKGestureRecognizerStateCancelled:589 case GestureRecognizerState::Ended: 590 case GestureRecognizerState::Cancelled: 591 591 m_currentWordRange = nullptr; 592 592 break; 593 case WKGestureRecognizerStateFailed:594 case WKGestureRecognizerStatePossible:593 case GestureRecognizerState::Failed: 594 case GestureRecognizerState::Possible: 595 595 ASSERT_NOT_REACHED(); 596 596 } 597 597 break; 598 598 599 case WKGestureOneFingerDoubleTap:599 case GestureType::OneFingerDoubleTap: 600 600 if (atBoundaryOfGranularity(position, LineGranularity, DirectionForward)) { 601 601 // Double-tap at end of line only places insertion point there. … … 607 607 break; 608 608 609 case WKGestureTwoFingerSingleTap:609 case GestureType::TwoFingerSingleTap: 610 610 // Single tap with two fingers selects the entire paragraph. 611 611 range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward); 612 612 break; 613 613 614 case WKGestureOneFingerTripleTap:614 case GestureType::OneFingerTripleTap: 615 615 if (atBoundaryOfGranularity(position, LineGranularity, DirectionForward)) { 616 616 // Triple-tap at end of line only places insertion point there. … … 622 622 break; 623 623 624 case WKGestureMakeWebSelection:625 if (wkGestureState == WKGestureRecognizerStateBegan) {624 case GestureType::MakeWebSelection: 625 if (wkGestureState == GestureRecognizerState::Began) { 626 626 m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth); 627 627 m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight); … … 629 629 } 630 630 range = rangeForWebSelectionAtPosition(point, position, flags); 631 if (wkGestureState == WKGestureRecognizerStateEnded && flags & WKIsBlockSelection)631 if (wkGestureState == GestureRecognizerState::Ended && flags & IsBlockSelection) 632 632 m_currentBlockSelection = range; 633 633 break; … … 639 639 frame.selection().setSelectedRange(range.get(), position.affinity(), true); 640 640 641 send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, flags, callbackID));641 send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, static_cast<uint32_t>(flags), callbackID)); 642 642 m_shouldReturnWordAtSelection = false; 643 643 } … … 723 723 static const int maxHitTests = 10; 724 724 725 static inline float distanceBetweenRectsForPosition(IntRect& first, IntRect& second, WKHandlePosition handlePosition)725 static inline float distanceBetweenRectsForPosition(IntRect& first, IntRect& second, SelectionHandlePosition handlePosition) 726 726 { 727 727 switch (handlePosition) { 728 case WKHandleTop:728 case SelectionHandlePosition::Top: 729 729 return abs(first.y() - second.y()); 730 case WKHandleRight:730 case SelectionHandlePosition::Right: 731 731 return abs(first.maxX() - second.maxX()); 732 case WKHandleBottom:732 case SelectionHandlePosition::Bottom: 733 733 return abs(first.maxY() - second.maxY()); 734 case WKHandleLeft:734 case SelectionHandlePosition::Left: 735 735 return abs(first.x() - second.x()); 736 736 } … … 773 773 } 774 774 775 static inline IntPoint computeEdgeCenter(const IntRect& box, WKHandlePosition handlePosition)775 static inline IntPoint computeEdgeCenter(const IntRect& box, SelectionHandlePosition handlePosition) 776 776 { 777 777 switch (handlePosition) { 778 case WKHandleTop:778 case SelectionHandlePosition::Top: 779 779 return IntPoint(box.x() + box.width() / 2, box.y()); 780 case WKHandleRight:780 case SelectionHandlePosition::Right: 781 781 return IntPoint(box.maxX(), box.y() + box.height() / 2); 782 case WKHandleBottom:782 case SelectionHandlePosition::Bottom: 783 783 return IntPoint(box.x() + box.width() / 2, box.maxY()); 784 case WKHandleLeft:784 case SelectionHandlePosition::Left: 785 785 return IntPoint(box.x(), box.y() + box.height() / 2); 786 786 } 787 787 } 788 788 789 PassRefPtr<Range> WebPage::expandedRangeFromHandle(Range* currentRange, WKHandlePosition handlePosition)789 PassRefPtr<Range> WebPage::expandedRangeFromHandle(Range* currentRange, SelectionHandlePosition handlePosition) 790 790 { 791 791 // FIXME: We should use boundingRect() instead of boundingBox() in this function when <rdar://problem/16063723> is fixed. … … 809 809 IntPoint testPoint = edgeCenter; 810 810 switch (handlePosition) { 811 case WKHandleTop:811 case SelectionHandlePosition::Top: 812 812 testPoint.move(0, -distance); 813 813 break; 814 case WKHandleRight:814 case SelectionHandlePosition::Right: 815 815 testPoint.move(distance, 0); 816 816 break; 817 case WKHandleBottom:817 case SelectionHandlePosition::Bottom: 818 818 testPoint.move(0, distance); 819 819 break; 820 case WKHandleLeft:820 case SelectionHandlePosition::Left: 821 821 testPoint.move(-distance, 0); 822 822 break; … … 838 838 if (isBetterChoice) { 839 839 switch (handlePosition) { 840 case WKHandleTop:841 case WKHandleBottom:840 case SelectionHandlePosition::Top: 841 case SelectionHandlePosition::Bottom: 842 842 isBetterChoice = (copyRect.height() > currentBox.height()); 843 843 break; 844 case WKHandleRight:845 case WKHandleLeft:844 case SelectionHandlePosition::Right: 845 case SelectionHandlePosition::Left: 846 846 isBetterChoice = (copyRect.width() > currentBox.width()); 847 847 break; … … 853 853 // Furtherore, is it smaller than the best we've found so far? 854 854 switch (handlePosition) { 855 case WKHandleTop:856 case WKHandleBottom:855 case SelectionHandlePosition::Top: 856 case SelectionHandlePosition::Bottom: 857 857 isBetterChoice = (copyRect.height() < bestRect.height()); 858 858 break; 859 case WKHandleRight:860 case WKHandleLeft:859 case SelectionHandlePosition::Right: 860 case SelectionHandlePosition::Left: 861 861 isBetterChoice = (copyRect.width() < bestRect.width()); 862 862 break; … … 878 878 } 879 879 880 PassRefPtr<Range> WebPage::contractedRangeFromHandle(Range* currentRange, WKHandlePosition handlePosition, WKSelectionFlags& flags)880 PassRefPtr<Range> WebPage::contractedRangeFromHandle(Range* currentRange, SelectionHandlePosition handlePosition, SelectionFlags& flags) 881 881 { 882 882 // Shrinking with a base and extent will always give better results. If we only have a single element, … … 887 887 IntRect currentBox = currentRange->boundingBox(); 888 888 IntPoint edgeCenter = computeEdgeCenter(currentBox, handlePosition); 889 flags = WKIsBlockSelection;889 flags = IsBlockSelection; 890 890 891 891 float maxDistance; 892 892 893 893 switch (handlePosition) { 894 case WKHandleTop:895 case WKHandleBottom:894 case SelectionHandlePosition::Top: 895 case SelectionHandlePosition::Bottom: 896 896 maxDistance = currentBox.height(); 897 897 break; 898 case WKHandleRight:899 case WKHandleLeft:898 case SelectionHandlePosition::Right: 899 case SelectionHandlePosition::Left: 900 900 maxDistance = currentBox.width(); 901 901 break; … … 911 911 float shrankDistance; 912 912 switch (handlePosition) { 913 case WKHandleTop:914 case WKHandleBottom:913 case SelectionHandlePosition::Top: 914 case SelectionHandlePosition::Bottom: 915 915 shrankDistance = abs(currentBox.height() - bestRect.height()); 916 916 break; 917 case WKHandleRight:918 case WKHandleLeft:917 case SelectionHandlePosition::Right: 918 case SelectionHandlePosition::Left: 919 919 shrankDistance = abs(currentBox.width() - bestRect.width()); 920 920 break; … … 928 928 IntPoint testPoint = edgeCenter; 929 929 switch (handlePosition) { 930 case WKHandleTop:930 case SelectionHandlePosition::Top: 931 931 testPoint.move(0, distance); 932 932 break; 933 case WKHandleRight:933 case SelectionHandlePosition::Right: 934 934 testPoint.move(-distance, 0); 935 935 break; 936 case WKHandleBottom:936 case SelectionHandlePosition::Bottom: 937 937 testPoint.move(0, -distance); 938 938 break; 939 case WKHandleLeft:939 case SelectionHandlePosition::Left: 940 940 testPoint.move(distance, 0); 941 941 break; … … 943 943 944 944 RefPtr<Range> newRange = rangeForBlockAtPoint(testPoint); 945 if (handlePosition == WKHandleTop || handlePosition == WKHandleLeft)945 if (handlePosition == SelectionHandlePosition::Top || handlePosition == SelectionHandlePosition::Left) 946 946 newRange = Range::create(newRange->startContainer()->document(), newRange->startPosition(), currentRange->endPosition()); 947 947 else … … 951 951 bool isBetterChoice; 952 952 switch (handlePosition) { 953 case WKHandleTop:954 case WKHandleBottom:953 case SelectionHandlePosition::Top: 954 case SelectionHandlePosition::Bottom: 955 955 isBetterChoice = (copyRect.height() < currentBox.height()); 956 956 break; 957 case WKHandleLeft:958 case WKHandleRight:957 case SelectionHandlePosition::Left: 958 case SelectionHandlePosition::Right: 959 959 isBetterChoice = (copyRect.width() > bestRect.width()); 960 960 break; … … 964 964 if (bestRange && isBetterChoice) { 965 965 switch (handlePosition) { 966 case WKHandleTop:967 case WKHandleBottom:966 case SelectionHandlePosition::Top: 967 case SelectionHandlePosition::Bottom: 968 968 isBetterChoice = (copyRect.height() > bestRect.height()); 969 969 break; 970 case WKHandleLeft:971 case WKHandleRight:970 case SelectionHandlePosition::Left: 971 case SelectionHandlePosition::Right: 972 972 isBetterChoice = (copyRect.width() > bestRect.width()); 973 973 break; … … 993 993 RenderObject* renderer = node->renderer(); 994 994 if (renderer && renderer->childrenInline() && (renderer->isRenderBlock() && !toRenderBlock(renderer)->inlineElementContinuation()) && !renderer->isTable()) { 995 flags = WKNone;995 flags = None; 996 996 } 997 997 } … … 1000 1000 } 1001 1001 1002 void WebPage::computeExpandAndShrinkThresholdsForHandle(const IntPoint& point, WKHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold)1002 void WebPage::computeExpandAndShrinkThresholdsForHandle(const IntPoint& point, SelectionHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold) 1003 1003 { 1004 1004 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 1007 1007 1008 1008 RefPtr<Range> expandedRange = expandedRangeFromHandle(currentRange.get(), handlePosition); 1009 WKSelectionFlags flags;1009 SelectionFlags flags; 1010 1010 RefPtr<Range> contractedRange = contractedRangeFromHandle(currentRange.get(), handlePosition, flags); 1011 1011 … … 1022 1022 1023 1023 switch (handlePosition) { 1024 case WKHandleTop: {1024 case SelectionHandlePosition::Top: { 1025 1025 current = currentBounds.y(); 1026 1026 expanded = expandedBounds.y(); … … 1030 1030 break; 1031 1031 } 1032 case WKHandleRight: {1032 case SelectionHandlePosition::Right: { 1033 1033 current = currentBounds.maxX(); 1034 1034 expanded = expandedBounds.maxX(); … … 1038 1038 break; 1039 1039 } 1040 case WKHandleBottom: {1040 case SelectionHandlePosition::Bottom: { 1041 1041 current = currentBounds.maxY(); 1042 1042 expanded = expandedBounds.maxY(); … … 1046 1046 break; 1047 1047 } 1048 case WKHandleLeft: {1048 case SelectionHandlePosition::Left: { 1049 1049 current = currentBounds.x(); 1050 1050 expanded = expandedBounds.x(); … … 1063 1063 growThreshold = maxThreshold; 1064 1064 1065 if ( (flags & WKIsBlockSelection)&& areRangesEqual(contractedRange.get(), currentRange.get()))1065 if (flags & IsBlockSelection && areRangesEqual(contractedRange.get(), currentRange.get())) 1066 1066 shrinkThreshold = minThreshold; 1067 1067 } 1068 1068 1069 static inline bool shouldExpand( WKHandlePosition handlePosition, const IntRect& rect, const IntPoint& point)1069 static inline bool shouldExpand(SelectionHandlePosition handlePosition, const IntRect& rect, const IntPoint& point) 1070 1070 { 1071 1071 switch (handlePosition) { 1072 case WKHandleTop:1072 case SelectionHandlePosition::Top: 1073 1073 return (point.y() < rect.y()); 1074 case WKHandleLeft:1074 case SelectionHandlePosition::Left: 1075 1075 return (point.x() < rect.x()); 1076 case WKHandleRight:1076 case SelectionHandlePosition::Right: 1077 1077 return (point.x() > rect.maxX()); 1078 case WKHandleBottom:1078 case SelectionHandlePosition::Bottom: 1079 1079 return (point.y() > rect.maxY()); 1080 1080 } 1081 1081 } 1082 1082 1083 PassRefPtr<WebCore::Range> WebPage::changeBlockSelection(const IntPoint& point, WKHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold, WKSelectionFlags& flags)1083 PassRefPtr<WebCore::Range> WebPage::changeBlockSelection(const IntPoint& point, SelectionHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags& flags) 1084 1084 { 1085 1085 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 1106 1106 float growThreshold = 0; 1107 1107 float shrinkThreshold = 0; 1108 WKSelectionFlags flags = WKIsBlockSelection;1109 1110 switch (static_cast< WKSelectionTouch>(touch)) {1111 case WKSelectionTouchStarted:1112 computeExpandAndShrinkThresholdsForHandle(adjustedPoint, static_cast< WKHandlePosition>(handlePosition), growThreshold, shrinkThreshold);1108 SelectionFlags flags = IsBlockSelection; 1109 1110 switch (static_cast<SelectionTouch>(touch)) { 1111 case SelectionTouch::Started: 1112 computeExpandAndShrinkThresholdsForHandle(adjustedPoint, static_cast<SelectionHandlePosition>(handlePosition), growThreshold, shrinkThreshold); 1113 1113 break; 1114 case WKSelectionTouchEnded:1114 case SelectionTouch::Ended: 1115 1115 break; 1116 case WKSelectionTouchMoved:1117 changeBlockSelection(adjustedPoint, static_cast< WKHandlePosition>(handlePosition), growThreshold, shrinkThreshold, flags);1116 case SelectionTouch::Moved: 1117 changeBlockSelection(adjustedPoint, static_cast<SelectionHandlePosition>(handlePosition), growThreshold, shrinkThreshold, flags); 1118 1118 break; 1119 1119 default: … … 1121 1121 } 1122 1122 1123 send(Messages::WebPageProxy::DidUpdateBlockSelectionWithTouch(touch, flags, growThreshold, shrinkThreshold));1123 send(Messages::WebPageProxy::DidUpdateBlockSelectionWithTouch(touch, static_cast<uint32_t>(flags), growThreshold, shrinkThreshold)); 1124 1124 } 1125 1125 … … 1142 1142 VisiblePosition result; 1143 1143 1144 switch (static_cast< WKSelectionTouch>(touches)) {1145 case WKSelectionTouchStarted:1146 case WKSelectionTouchEndedNotMoving:1144 switch (static_cast<SelectionTouch>(touches)) { 1145 case SelectionTouch::Started: 1146 case SelectionTouch::EndedNotMoving: 1147 1147 break; 1148 1148 1149 case WKSelectionTouchEnded:1149 case SelectionTouch::Ended: 1150 1150 if (frame.selection().selection().isContentEditable()) { 1151 1151 result = closestWordBoundaryForPosition(position); … … 1156 1156 break; 1157 1157 1158 case WKSelectionTouchEndedMovingForward:1158 case SelectionTouch::EndedMovingForward: 1159 1159 range = rangeAtWordBoundaryForPosition(&frame, position, baseIsStart, DirectionForward); 1160 1160 break; 1161 1161 1162 case WKSelectionTouchEndedMovingBackward:1162 case SelectionTouch::EndedMovingBackward: 1163 1163 range = rangeAtWordBoundaryForPosition(&frame, position, baseIsStart, DirectionBackward); 1164 1164 break; 1165 1165 1166 case WKSelectionTouchMoved:1166 case SelectionTouch::Moved: 1167 1167 range = rangeForPosition(&frame, position, baseIsStart); 1168 1168 break; … … 1530 1530 return; 1531 1531 1532 if (static_cast< WKSheetActions>(action) == WKSheetActionCopy) {1532 if (static_cast<SheetAction>(action) == SheetAction::Copy) { 1533 1533 if (element->renderer()->isRenderImage()) { 1534 1534 Element* linkElement = containingLinkElement(element); … … 1541 1541 m_interactionNode->document().frame()->editor().copyURL(element->document().completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(HTMLNames::hrefAttr))), element->textContent()); 1542 1542 } 1543 } else if (static_cast< WKSelectionTouch>(action) == WKSheetActionSaveImage) {1543 } else if (static_cast<SheetAction>(action) == SheetAction::SaveImage) { 1544 1544 if (!element->renderer()->isRenderImage()) 1545 1545 return;
Note: See TracChangeset
for help on using the changeset viewer.