Changeset 166861 in webkit


Ignore:
Timestamp:
Apr 6, 2014 5:54:14 PM (10 years ago)
Author:
mitz@apple.com
Message:

Clean up WKGestureTypes.h
https://bugs.webkit.org/show_bug.cgi?id=131286

Reviewed by Sam Weinig.

Renamed WKGestureTypes.h to GestureTypes.h, dropped the useless “WK” prefixes and changed
into scoped enums, with the exception of SelectionFlags.

  • Shared/ios/GestureTypes.h: Copied from Source/WebKit2/Shared/ios/WKGestureTypes.h.
  • Shared/ios/WKGestureTypes.h: Removed.
  • UIProcess/API/Cocoa/_WKElementAction.mm:

(copyElement):
(saveImage):

  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch):

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _performAction:]):
(toGestureType):
(toUIWKGestureType):
(toSelectionTouch):
(toUIWKSelectionTouch):
(toGestureRecognizerState):
(toUIGestureRecognizerState):
(toUIWKSelectionFlags):
(toSelectionHandlePosition):
(selectionChangedWithGesture):
(selectionChangedWithTouch):
(-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]):
(-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
(-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]):
(-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
(-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):

  • WebKit2.xcodeproj/project.pbxproj:
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::rangeForWebSelectionAtPosition):
(WebKit::WebPage::selectWithGesture):
(WebKit::distanceBetweenRectsForPosition):
(WebKit::computeEdgeCenter):
(WebKit::WebPage::expandedRangeFromHandle):
(WebKit::WebPage::contractedRangeFromHandle):
(WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
(WebKit::shouldExpand):
(WebKit::WebPage::changeBlockSelection):
(WebKit::WebPage::updateBlockSelectionWithTouch):
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::performActionOnElement):

Location:
trunk/Source/WebKit2
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r166859 r166861  
     12014-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
    1522014-04-06  Sam Weinig  <sam@webkit.org>
    253
  • trunk/Source/WebKit2/Shared/ios/GestureTypes.h

    r166859 r166861  
    2424 */
    2525
    26 #ifndef WKGestureTypes_h
    27 #define WKGestureTypes_h
     26#ifndef GestureTypes_h
     27#define GestureTypes_h
    2828
    2929namespace WebKit {
    3030
    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     WKGestureMakeWebSelection
    46 } WKGestureType;
     31enum 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};
    4747
    48 typedef enum {
    49     WKSelectionTouchStarted,
    50     WKSelectionTouchMoved,
    51     WKSelectionTouchEnded,
    52     WKSelectionTouchEndedMovingForward,
    53     WKSelectionTouchEndedMovingBackward,
    54     WKSelectionTouchEndedNotMoving
    55 } WKSelectionTouch;
     48enum class SelectionTouch {
     49    Started,
     50    Moved,
     51    Ended,
     52    EndedMovingForward,
     53    EndedMovingBackward,
     54    EndedNotMoving
     55};
    5656
    57 typedef enum {
    58     WKGestureRecognizerStatePossible,
    59     WKGestureRecognizerStateBegan,
    60     WKGestureRecognizerStateChanged,
    61     WKGestureRecognizerStateEnded,
    62     WKGestureRecognizerStateCancelled,
    63     WKGestureRecognizerStateFailed,
    64     WKGestureRecognizerStateRecognized = WKGestureRecognizerStateEnded
    65 } WKGestureRecognizerState;
     57enum class GestureRecognizerState {
     58    Possible,
     59    Began,
     60    Changed,
     61    Ended,
     62    Cancelled,
     63    Failed,
     64    Recognized = Ended
     65};
    6666
    67 typedef enum {
    68     WKSheetActionCopy,
    69     WKSheetActionSaveImage
    70 } WKSheetActions;
     67enum class SheetAction {
     68    Copy,
     69    SaveImage
     70};
    7171
    72 typedef enum {
    73     WKNone = 0,
    74     WKWordIsNearTap = 1,
    75     WKIsBlockSelection = 2
    76 } WKSelectionFlags;
     72enum SelectionFlags {
     73    None = 0,
     74    WordIsNearTap = 1 << 0,
     75    IsBlockSelection = 1 << 1,
     76};
    7777
    78 typedef enum {
    79     WKHandleTop,
    80     WKHandleRight,
    81     WKHandleBottom,
    82     WKHandleLeft
    83 } WKHandlePosition;
     78enum class SelectionHandlePosition {
     79    Top,
     80    Right,
     81    Bottom,
     82    Left
     83};
     84
    8485} // namespace WebKit
    8586
    86 #endif // WKGestureTypes_h
     87#endif // GestureTypes_h
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm

    r164628 r166861  
    3131#if PLATFORM(IOS)
    3232
     33#import "GestureTypes.h"
     34#import "WKContentViewInteraction.h"
    3335#import "_WKActivatedElementInfoInternal.h"
    34 #import "WKContentViewInteraction.h"
    35 #import "WKGestureTypes.h"
    3636#import <SafariServices/SSReadingList.h>
    3737#import <WebCore/LocalizedStrings.h>
     
    7676static void copyElement(WKContentView *view)
    7777{
    78     [view _performAction:WebKit::WKSheetActionCopy];
     78    [view _performAction:WebKit::SheetAction::Copy];
    7979}
    8080
    8181static void saveImage(WKContentView *view)
    8282{
    83     [view _performAction:WebKit::WKSheetActionSaveImage];
     83    [view _performAction:WebKit::SheetAction::SaveImage];
    8484}
    8585
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm

    r166658 r166861  
    371371void PageClientImpl::didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold)
    372372{
    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];
    374374}
    375375
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r166605 r166861  
    2929
    3030#import "AssistedNodeInformation.h"
     31#import "GestureTypes.h"
    3132#import "InteractionInformationAtPosition.h"
    3233#import "WKAirPlayRoutePicker.h"
    3334#import "WKFormPeripheral.h"
    34 #import "WKGestureTypes.h"
    3535#import <UIKit/UITextInput_Private.h>
    3636#import <UIKit/UIView.h>
     37#import <UIKit/UIWKSelectionAssistant.h>
     38#import <UIKit/UIWKTextInteractionAssistant.h>
    3739#import <UIKit/UIWebFormAccessory.h>
    3840#import <UIKit/UIWebTouchEventsGestureRecognizer.h>
    39 #import <UIKit/UIWKSelectionAssistant.h>
    40 #import <UIKit/UIWKTextInteractionAssistant.h>
    4141#import <wtf/Forward.h>
     42#import <wtf/Vector.h>
    4243#import <wtf/text/WTFString.h>
    43 #import <wtf/Vector.h>
    4444
    4545namespace WebCore {
     
    138138- (void)_attemptClickAtLocation:(CGPoint)location;
    139139- (void)_updatePositionInformation;
    140 - (void)_performAction:(WebKit::WKSheetActions)action;
     140- (void)_performAction:(WebKit::SheetAction)action;
    141141- (void)_willStartScrollingOrZooming;
    142142- (void)_willStartUserTriggeredScrollingOrZooming;
    143143- (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;
    145145- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect;
    146146- (void)accessoryDone;
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r166605 r166861  
    883883}
    884884
    885 - (void)_performAction:(WKSheetActions)action
     885- (void)_performAction:(SheetAction)action
    886886{
    887887    _page->performActionOnElement((uint32_t)action);
     
    978978// UIWKInteractionViewProtocol
    979979
    980 static inline WKGestureType toWKGestureType(UIWKGestureType gestureType)
     980static inline GestureType toGestureType(UIWKGestureType gestureType)
    981981{
    982982    switch (gestureType) {
    983983    case UIWKGestureLoupe:
    984         return WKGestureLoupe;
     984        return GestureType::Loupe;
    985985    case UIWKGestureOneFingerTap:
    986         return WKGestureOneFingerTap;
     986        return GestureType::OneFingerTap;
    987987    case UIWKGestureTapAndAHalf:
    988         return WKGestureTapAndAHalf;
     988        return GestureType::TapAndAHalf;
    989989    case UIWKGestureDoubleTap:
    990         return WKGestureDoubleTap;
     990        return GestureType::DoubleTap;
    991991    case UIWKGestureTapAndHalf:
    992         return WKGestureTapAndHalf;
     992        return GestureType::TapAndHalf;
    993993    case UIWKGestureDoubleTapInUneditable:
    994         return WKGestureDoubleTapInUneditable;
     994        return GestureType::DoubleTapInUneditable;
    995995    case UIWKGestureOneFingerTapInUneditable:
    996         return WKGestureOneFingerTapInUneditable;
     996        return GestureType::OneFingerTapInUneditable;
    997997    case UIWKGestureOneFingerTapSelectsAll:
    998         return WKGestureOneFingerTapSelectsAll;
     998        return GestureType::OneFingerTapSelectsAll;
    999999    case UIWKGestureOneFingerDoubleTap:
    1000         return WKGestureOneFingerDoubleTap;
     1000        return GestureType::OneFingerDoubleTap;
    10011001    case UIWKGestureOneFingerTripleTap:
    1002         return WKGestureOneFingerTripleTap;
     1002        return GestureType::OneFingerTripleTap;
    10031003    case UIWKGestureTwoFingerSingleTap:
    1004         return WKGestureTwoFingerSingleTap;
     1004        return GestureType::TwoFingerSingleTap;
    10051005    case UIWKGestureTwoFingerRangedSelectGesture:
    1006         return WKGestureTwoFingerRangedSelectGesture;
     1006        return GestureType::TwoFingerRangedSelectGesture;
    10071007    case UIWKGestureTapOnLinkWithGesture:
    1008         return WKGestureTapOnLinkWithGesture;
     1008        return GestureType::TapOnLinkWithGesture;
    10091009    case UIWKGestureMakeWebSelection:
    1010         return WKGestureMakeWebSelection;
     1010        return GestureType::MakeWebSelection;
    10111011    }
    10121012    ASSERT_NOT_REACHED();
    1013     return WKGestureLoupe;
    1014 }
    1015 
    1016 static inline UIWKGestureType toUIWKGestureType(WKGestureType gestureType)
     1013    return GestureType::Loupe;
     1014}
     1015
     1016static inline UIWKGestureType toUIWKGestureType(GestureType gestureType)
    10171017{
    10181018    switch (gestureType) {
    1019     case WKGestureLoupe:
     1019    case GestureType::Loupe:
    10201020        return UIWKGestureLoupe;
    1021     case WKGestureOneFingerTap:
     1021    case GestureType::OneFingerTap:
    10221022        return UIWKGestureOneFingerTap;
    1023     case WKGestureTapAndAHalf:
     1023    case GestureType::TapAndAHalf:
    10241024        return UIWKGestureTapAndAHalf;
    1025     case WKGestureDoubleTap:
     1025    case GestureType::DoubleTap:
    10261026        return UIWKGestureDoubleTap;
    1027     case WKGestureTapAndHalf:
     1027    case GestureType::TapAndHalf:
    10281028        return UIWKGestureTapAndHalf;
    1029     case WKGestureDoubleTapInUneditable:
     1029    case GestureType::DoubleTapInUneditable:
    10301030        return UIWKGestureDoubleTapInUneditable;
    1031     case WKGestureOneFingerTapInUneditable:
     1031    case GestureType::OneFingerTapInUneditable:
    10321032        return UIWKGestureOneFingerTapInUneditable;
    1033     case WKGestureOneFingerTapSelectsAll:
     1033    case GestureType::OneFingerTapSelectsAll:
    10341034        return UIWKGestureOneFingerTapSelectsAll;
    1035     case WKGestureOneFingerDoubleTap:
     1035    case GestureType::OneFingerDoubleTap:
    10361036        return UIWKGestureOneFingerDoubleTap;
    1037     case WKGestureOneFingerTripleTap:
     1037    case GestureType::OneFingerTripleTap:
    10381038        return UIWKGestureOneFingerTripleTap;
    1039     case WKGestureTwoFingerSingleTap:
     1039    case GestureType::TwoFingerSingleTap:
    10401040        return UIWKGestureTwoFingerSingleTap;
    1041     case WKGestureTwoFingerRangedSelectGesture:
     1041    case GestureType::TwoFingerRangedSelectGesture:
    10421042        return UIWKGestureTwoFingerRangedSelectGesture;
    1043     case WKGestureTapOnLinkWithGesture:
     1043    case GestureType::TapOnLinkWithGesture:
    10441044        return UIWKGestureTapOnLinkWithGesture;
    1045     case WKGestureMakeWebSelection:
     1045    case GestureType::MakeWebSelection:
    10461046        return UIWKGestureMakeWebSelection;
    10471047    }
    10481048}
    10491049
    1050 static inline WKSelectionTouch toWKSelectionTouch(UIWKSelectionTouch touch)
     1050static inline SelectionTouch toSelectionTouch(UIWKSelectionTouch touch)
    10511051{
    10521052    switch (touch) {
    10531053    case UIWKSelectionTouchStarted:
    1054         return WKSelectionTouchStarted;
     1054        return SelectionTouch::Started;
    10551055    case UIWKSelectionTouchMoved:
    1056         return WKSelectionTouchMoved;
     1056        return SelectionTouch::Moved;
    10571057    case UIWKSelectionTouchEnded:
    1058         return WKSelectionTouchEnded;
     1058        return SelectionTouch::Ended;
    10591059    case UIWKSelectionTouchEndedMovingForward:
    1060         return WKSelectionTouchEndedMovingForward;
     1060        return SelectionTouch::EndedMovingForward;
    10611061    case UIWKSelectionTouchEndedMovingBackward:
    1062         return WKSelectionTouchEndedMovingBackward;
     1062        return SelectionTouch::EndedMovingBackward;
    10631063    case UIWKSelectionTouchEndedNotMoving:
    1064         return WKSelectionTouchEndedNotMoving;
     1064        return SelectionTouch::EndedNotMoving;
    10651065    }
    10661066    ASSERT_NOT_REACHED();
    1067     return WKSelectionTouchEnded;
    1068 }
    1069 
    1070 static inline UIWKSelectionTouch toUIWKSelectionTouch(WKSelectionTouch touch)
     1067    return SelectionTouch::Ended;
     1068}
     1069
     1070static inline UIWKSelectionTouch toUIWKSelectionTouch(SelectionTouch touch)
    10711071{
    10721072    switch (touch) {
    1073     case WKSelectionTouchStarted:
     1073    case SelectionTouch::Started:
    10741074        return UIWKSelectionTouchStarted;
    1075     case WKSelectionTouchMoved:
     1075    case SelectionTouch::Moved:
    10761076        return UIWKSelectionTouchMoved;
    1077     case WKSelectionTouchEnded:
     1077    case SelectionTouch::Ended:
    10781078        return UIWKSelectionTouchEnded;
    1079     case WKSelectionTouchEndedMovingForward:
     1079    case SelectionTouch::EndedMovingForward:
    10801080        return UIWKSelectionTouchEndedMovingForward;
    1081     case WKSelectionTouchEndedMovingBackward:
     1081    case SelectionTouch::EndedMovingBackward:
    10821082        return UIWKSelectionTouchEndedMovingBackward;
    1083     case WKSelectionTouchEndedNotMoving:
     1083    case SelectionTouch::EndedNotMoving:
    10841084        return UIWKSelectionTouchEndedNotMoving;
    10851085    }
    10861086}
    10871087
    1088 static inline WKGestureRecognizerState toWKGestureRecognizerState(UIGestureRecognizerState state)
     1088static inline GestureRecognizerState toGestureRecognizerState(UIGestureRecognizerState state)
    10891089{
    10901090    switch (state) {
    10911091    case UIGestureRecognizerStatePossible:
    1092         return WKGestureRecognizerStatePossible;
     1092        return GestureRecognizerState::Possible;
    10931093    case UIGestureRecognizerStateBegan:
    1094         return WKGestureRecognizerStateBegan;
     1094        return GestureRecognizerState::Began;
    10951095    case UIGestureRecognizerStateChanged:
    1096         return WKGestureRecognizerStateChanged;
     1096        return GestureRecognizerState::Changed;
    10971097    case UIGestureRecognizerStateCancelled:
    1098         return WKGestureRecognizerStateCancelled;
     1098        return GestureRecognizerState::Cancelled;
    10991099    case UIGestureRecognizerStateEnded:
    1100         return WKGestureRecognizerStateEnded;
     1100        return GestureRecognizerState::Ended;
    11011101    case UIGestureRecognizerStateFailed:
    1102         return WKGestureRecognizerStateFailed;
    1103     }
    1104 }
    1105 
    1106 static inline UIGestureRecognizerState toUIGestureRecognizerState(WKGestureRecognizerState state)
     1102        return GestureRecognizerState::Failed;
     1103    }
     1104}
     1105
     1106static inline UIGestureRecognizerState toUIGestureRecognizerState(GestureRecognizerState state)
    11071107{
    11081108    switch (state) {
    1109     case WKGestureRecognizerStatePossible:
     1109    case GestureRecognizerState::Possible:
    11101110        return UIGestureRecognizerStatePossible;
    1111     case WKGestureRecognizerStateBegan:
     1111    case GestureRecognizerState::Began:
    11121112        return UIGestureRecognizerStateBegan;
    1113     case WKGestureRecognizerStateChanged:
     1113    case GestureRecognizerState::Changed:
    11141114        return UIGestureRecognizerStateChanged;
    1115     case WKGestureRecognizerStateCancelled:
     1115    case GestureRecognizerState::Cancelled:
    11161116        return UIGestureRecognizerStateCancelled;
    1117     case WKGestureRecognizerStateEnded:
     1117    case GestureRecognizerState::Ended:
    11181118        return UIGestureRecognizerStateEnded;
    1119     case WKGestureRecognizerStateFailed:
     1119    case GestureRecognizerState::Failed:
    11201120        return UIGestureRecognizerStateFailed;
    11211121    }
    11221122}
    11231123
    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)
     1124static 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
     1135static inline SelectionHandlePosition toSelectionHandlePosition(UIWKHandlePosition position)
    11371136{
    11381137    switch (position) {
    11391138    case UIWKHandleTop:
    1140         return WKHandleTop;
     1139        return SelectionHandlePosition::Top;
    11411140    case UIWKHandleRight:
    1142         return WKHandleRight;
     1141        return SelectionHandlePosition::Right;
    11431142    case UIWKHandleBottom:
    1144         return WKHandleBottom;
     1143        return SelectionHandlePosition::Bottom;
    11451144    case UIWKHandleLeft:
    1146         return WKHandleLeft;
     1145        return SelectionHandlePosition::Left;
    11471146    }
    11481147}
     
    11551154    }
    11561155    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))];
    11581157    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))];
    11601159}
    11611160
     
    11671166    }
    11681167    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)];
    11701169    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)shrinkThreshold
    1175 {
    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];
    11771176}
    11781177
    11791178- (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state
    11801179{
    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) {
    11821181        selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags);
    11831182    }));
     
    11861185- (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart
    11871186{
    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) {
    11891188        selectionChangedWithTouch(error, self, point, touch);
    11901189    }));
     
    11931192- (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState
    11941193{
    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) {
    11961195        selectionChangedWithGesture(error, self, point, gestureType, gestureState, flags);
    11971196    }));
     
    12001199- (void)changeBlockSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch forHandle:(UIWKHandlePosition)handle
    12011200{
    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)));
    12031202}
    12041203
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r166859 r166861  
    547547                2DA944A21884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */; };
    548548                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 */; };
    550550                2DA944A71884E94800ED86DB /* DownloadIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A61884E94800ED86DB /* DownloadIOS.mm */; };
    551551                2DA944AD1884E9BA00ED86DB /* TextCheckerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */; };
     
    23552355                2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPlatformTouchPointIOS.cpp; path = ios/WebPlatformTouchPointIOS.cpp; sourceTree = "<group>"; };
    23562356                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>"; };
    23582358                2DA944A61884E94800ED86DB /* DownloadIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadIOS.mm; path = Downloads/ios/DownloadIOS.mm; sourceTree = "<group>"; };
    23592359                2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TextCheckerIOS.mm; path = ios/TextCheckerIOS.mm; sourceTree = "<group>"; };
     
    44584458                        isa = PBXGroup;
    44594459                        children = (
     4460                                2DA9449D1884E4F000ED86DB /* GestureTypes.h */,
    44604461                                2DA944971884E4F000ED86DB /* NativeWebKeyboardEventIOS.mm */,
    44614462                                2DA944981884E4F000ED86DB /* NativeWebTouchEventIOS.mm */,
     
    44644465                                2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */,
    44654466                                2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */,
    4466                                 2DA9449D1884E4F000ED86DB /* WKGestureTypes.h */,
    44674467                        );
    44684468                        name = ios;
     
    71397139                                33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
    71407140                                33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */,
    7141                                 2DA944A41884E4F000ED86DB /* WKGestureTypes.h in Headers */,
     7141                                2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */,
    71427142                                33367636130C99B2006C9DE2 /* WebResourceCacheManagerProxy.h in Headers */,
    71437143                                33367658130C9ECB006C9DE2 /* WebResourceCacheManagerProxyMessages.h in Headers */,
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r166818 r166861  
    7878
    7979#if PLATFORM(IOS)
    80 #include "WKGestureTypes.h"
     80#include "GestureTypes.h"
    8181#endif
    8282
     
    793793#if PLATFORM(IOS)
    794794    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&);
    796796    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&);
    801801    void getAssistedNodeInformation(AssistedNodeInformation&);
    802802    void platformInitializeAccessibility();
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r166384 r166861  
    3333#import "EditingRange.h"
    3434#import "EditorState.h"
     35#import "GestureTypes.h"
    3536#import "InteractionInformationAtPosition.h"
     37#import "LayerTreeHost.h"
    3638#import "PluginView.h"
    37 #import "LayerTreeHost.h"
    3839#import "VisibleContentRectUpdateInfo.h"
     40#import "WKAccessibilityWebPageObjectIOS.h"
    3941#import "WebChromeClient.h"
    4042#import "WebCoreArgumentCoders.h"
     43#import "WebFrame.h"
    4144#import "WebKitSystemInterface.h"
    4245#import "WebKitSystemInterfaceIOS.h"
    43 #import "WebFrame.h"
    4446#import "WebPageProxyMessages.h"
    4547#import "WebProcess.h"
    46 #import "WKAccessibilityWebPageObjectIOS.h"
    47 #import "WKGestureTypes.h"
    4848#import <CoreText/CTFont.h>
    4949#import <WebCore/Chrome.h>
    5050#import <WebCore/Element.h>
    5151#import <WebCore/EventHandler.h>
     52#import <WebCore/FloatQuad.h>
    5253#import <WebCore/FocusController.h>
    53 #import <WebCore/FloatQuad.h>
    5454#import <WebCore/Frame.h>
    5555#import <WebCore/FrameView.h>
    56 #import <WebCore/HitTestResult.h>
    5756#import <WebCore/HTMLElementTypeHelpers.h>
    5857#import <WebCore/HTMLFormElement.h>
    5958#import <WebCore/HTMLInputElement.h>
     59#import <WebCore/HTMLOptGroupElement.h>
    6060#import <WebCore/HTMLOptionElement.h>
    61 #import <WebCore/HTMLOptGroupElement.h>
    6261#import <WebCore/HTMLOptionElement.h>
    6362#import <WebCore/HTMLParserIdioms.h>
    6463#import <WebCore/HTMLSelectElement.h>
    6564#import <WebCore/HTMLTextAreaElement.h>
     65#import <WebCore/HitTestResult.h>
    6666#import <WebCore/KeyboardEvent.h>
    6767#import <WebCore/MainFrame.h>
     
    439439}
    440440
    441 PassRefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, WKSelectionFlags& flags)
     441PassRefPtr<Range> WebPage::rangeForWebSelectionAtPosition(const IntPoint& point, const VisiblePosition& position, SelectionFlags& flags)
    442442{
    443443    HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint((point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent | HitTestRequest::AllowChildFrameContent);
     
    492492            return range;
    493493    }
    494     flags = WKIsBlockSelection;
     494    flags = IsBlockSelection;
    495495    range = Range::create(bestChoice->document());
    496496    range->selectNodeContents(bestChoice, ASSERT_NO_EXCEPTION);
     
    534534    }
    535535    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:
    540540    {
    541541        VisiblePosition result;
     
    570570        break;
    571571
    572     case WKGestureLoupe:
     572    case GestureType::Loupe:
    573573        range = Range::create(*frame.document(), position, position);
    574574        break;
    575575
    576     case WKGestureTapAndAHalf:
     576    case GestureType::TapAndAHalf:
    577577        switch (wkGestureState) {
    578         case WKGestureRecognizerStateBegan:
     578        case GestureRecognizerState::Began:
    579579            range = wordRangeFromPosition(position);
    580580            m_currentWordRange = Range::create(*frame.document(), range->startPosition(), range->endPosition());
    581581            break;
    582         case WKGestureRecognizerStateChanged:
     582        case GestureRecognizerState::Changed:
    583583            range = Range::create(*frame.document(), m_currentWordRange->startPosition(), m_currentWordRange->endPosition());
    584584            if (position < range->startPosition())
     
    587587                range->setEnd(position.deepEquivalent(), ASSERT_NO_EXCEPTION);
    588588            break;
    589         case WKGestureRecognizerStateEnded:
    590         case WKGestureRecognizerStateCancelled:
     589        case GestureRecognizerState::Ended:
     590        case GestureRecognizerState::Cancelled:
    591591            m_currentWordRange = nullptr;
    592592            break;
    593         case WKGestureRecognizerStateFailed:
    594         case WKGestureRecognizerStatePossible:
     593        case GestureRecognizerState::Failed:
     594        case GestureRecognizerState::Possible:
    595595            ASSERT_NOT_REACHED();
    596596        }
    597597        break;
    598598
    599     case WKGestureOneFingerDoubleTap:
     599    case GestureType::OneFingerDoubleTap:
    600600        if (atBoundaryOfGranularity(position, LineGranularity, DirectionForward)) {
    601601            // Double-tap at end of line only places insertion point there.
     
    607607        break;
    608608
    609     case WKGestureTwoFingerSingleTap:
     609    case GestureType::TwoFingerSingleTap:
    610610        // Single tap with two fingers selects the entire paragraph.
    611611        range = enclosingTextUnitOfGranularity(position, ParagraphGranularity, DirectionForward);
    612612        break;
    613613
    614     case WKGestureOneFingerTripleTap:
     614    case GestureType::OneFingerTripleTap:
    615615        if (atBoundaryOfGranularity(position, LineGranularity, DirectionForward)) {
    616616            // Triple-tap at end of line only places insertion point there.
     
    622622        break;
    623623
    624     case WKGestureMakeWebSelection:
    625         if (wkGestureState == WKGestureRecognizerStateBegan) {
     624    case GestureType::MakeWebSelection:
     625        if (wkGestureState == GestureRecognizerState::Began) {
    626626            m_blockSelectionDesiredSize.setWidth(blockSelectionStartWidth);
    627627            m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight);
     
    629629        }
    630630        range = rangeForWebSelectionAtPosition(point, position, flags);
    631         if (wkGestureState == WKGestureRecognizerStateEnded && flags & WKIsBlockSelection)
     631        if (wkGestureState == GestureRecognizerState::Ended && flags & IsBlockSelection)
    632632            m_currentBlockSelection = range;
    633633        break;
     
    639639        frame.selection().setSelectedRange(range.get(), position.affinity(), true);
    640640
    641     send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, flags, callbackID));
     641    send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, static_cast<uint32_t>(flags), callbackID));
    642642    m_shouldReturnWordAtSelection = false;
    643643}
     
    723723static const int maxHitTests = 10;
    724724
    725 static inline float distanceBetweenRectsForPosition(IntRect& first, IntRect& second, WKHandlePosition handlePosition)
     725static inline float distanceBetweenRectsForPosition(IntRect& first, IntRect& second, SelectionHandlePosition handlePosition)
    726726{
    727727    switch (handlePosition) {
    728     case WKHandleTop:
     728    case SelectionHandlePosition::Top:
    729729        return abs(first.y() - second.y());
    730     case WKHandleRight:
     730    case SelectionHandlePosition::Right:
    731731        return abs(first.maxX() - second.maxX());
    732     case WKHandleBottom:
     732    case SelectionHandlePosition::Bottom:
    733733        return abs(first.maxY() - second.maxY());
    734     case WKHandleLeft:
     734    case SelectionHandlePosition::Left:
    735735        return abs(first.x() - second.x());
    736736    }
     
    773773}
    774774
    775 static inline IntPoint computeEdgeCenter(const IntRect& box, WKHandlePosition handlePosition)
     775static inline IntPoint computeEdgeCenter(const IntRect& box, SelectionHandlePosition handlePosition)
    776776{
    777777    switch (handlePosition) {
    778     case WKHandleTop:
     778    case SelectionHandlePosition::Top:
    779779        return IntPoint(box.x() + box.width() / 2, box.y());
    780     case WKHandleRight:
     780    case SelectionHandlePosition::Right:
    781781        return IntPoint(box.maxX(), box.y() + box.height() / 2);
    782     case WKHandleBottom:
     782    case SelectionHandlePosition::Bottom:
    783783        return IntPoint(box.x() + box.width() / 2, box.maxY());
    784     case WKHandleLeft:
     784    case SelectionHandlePosition::Left:
    785785        return IntPoint(box.x(), box.y() + box.height() / 2);
    786786    }
    787787}
    788788
    789 PassRefPtr<Range> WebPage::expandedRangeFromHandle(Range* currentRange, WKHandlePosition handlePosition)
     789PassRefPtr<Range> WebPage::expandedRangeFromHandle(Range* currentRange, SelectionHandlePosition handlePosition)
    790790{
    791791    // FIXME: We should use boundingRect() instead of boundingBox() in this function when <rdar://problem/16063723> is fixed.
     
    809809        IntPoint testPoint = edgeCenter;
    810810        switch (handlePosition) {
    811         case WKHandleTop:
     811        case SelectionHandlePosition::Top:
    812812            testPoint.move(0, -distance);
    813813            break;
    814         case WKHandleRight:
     814        case SelectionHandlePosition::Right:
    815815            testPoint.move(distance, 0);
    816816            break;
    817         case WKHandleBottom:
     817        case SelectionHandlePosition::Bottom:
    818818            testPoint.move(0, distance);
    819819            break;
    820         case WKHandleLeft:
     820        case SelectionHandlePosition::Left:
    821821            testPoint.move(-distance, 0);
    822822            break;
     
    838838        if (isBetterChoice) {
    839839            switch (handlePosition) {
    840             case WKHandleTop:
    841             case WKHandleBottom:
     840            case SelectionHandlePosition::Top:
     841            case SelectionHandlePosition::Bottom:
    842842                isBetterChoice = (copyRect.height() > currentBox.height());
    843843                break;
    844             case WKHandleRight:
    845             case WKHandleLeft:
     844            case SelectionHandlePosition::Right:
     845            case SelectionHandlePosition::Left:
    846846                isBetterChoice = (copyRect.width() > currentBox.width());
    847847                break;
     
    853853            // Furtherore, is it smaller than the best we've found so far?
    854854            switch (handlePosition) {
    855             case WKHandleTop:
    856             case WKHandleBottom:
     855            case SelectionHandlePosition::Top:
     856            case SelectionHandlePosition::Bottom:
    857857                isBetterChoice = (copyRect.height() < bestRect.height());
    858858                break;
    859             case WKHandleRight:
    860             case WKHandleLeft:
     859            case SelectionHandlePosition::Right:
     860            case SelectionHandlePosition::Left:
    861861                isBetterChoice = (copyRect.width() < bestRect.width());
    862862                break;
     
    878878}
    879879
    880 PassRefPtr<Range> WebPage::contractedRangeFromHandle(Range* currentRange, WKHandlePosition handlePosition, WKSelectionFlags& flags)
     880PassRefPtr<Range> WebPage::contractedRangeFromHandle(Range* currentRange, SelectionHandlePosition handlePosition, SelectionFlags& flags)
    881881{
    882882    // Shrinking with a base and extent will always give better results. If we only have a single element,
     
    887887    IntRect currentBox = currentRange->boundingBox();
    888888    IntPoint edgeCenter = computeEdgeCenter(currentBox, handlePosition);
    889     flags = WKIsBlockSelection;
     889    flags = IsBlockSelection;
    890890
    891891    float maxDistance;
    892892
    893893    switch (handlePosition) {
    894     case WKHandleTop:
    895     case WKHandleBottom:
     894    case SelectionHandlePosition::Top:
     895    case SelectionHandlePosition::Bottom:
    896896        maxDistance = currentBox.height();
    897897        break;
    898     case WKHandleRight:
    899     case WKHandleLeft:
     898    case SelectionHandlePosition::Right:
     899    case SelectionHandlePosition::Left:
    900900        maxDistance = currentBox.width();
    901901        break;
     
    911911            float shrankDistance;
    912912            switch (handlePosition) {
    913             case WKHandleTop:
    914             case WKHandleBottom:
     913            case SelectionHandlePosition::Top:
     914            case SelectionHandlePosition::Bottom:
    915915                shrankDistance = abs(currentBox.height() - bestRect.height());
    916916                break;
    917             case WKHandleRight:
    918             case WKHandleLeft:
     917            case SelectionHandlePosition::Right:
     918            case SelectionHandlePosition::Left:
    919919                shrankDistance = abs(currentBox.width() - bestRect.width());
    920920                break;
     
    928928        IntPoint testPoint = edgeCenter;
    929929        switch (handlePosition) {
    930         case WKHandleTop:
     930        case SelectionHandlePosition::Top:
    931931            testPoint.move(0, distance);
    932932            break;
    933         case WKHandleRight:
     933        case SelectionHandlePosition::Right:
    934934            testPoint.move(-distance, 0);
    935935            break;
    936         case WKHandleBottom:
     936        case SelectionHandlePosition::Bottom:
    937937            testPoint.move(0, -distance);
    938938            break;
    939         case WKHandleLeft:
     939        case SelectionHandlePosition::Left:
    940940            testPoint.move(distance, 0);
    941941            break;
     
    943943
    944944        RefPtr<Range> newRange = rangeForBlockAtPoint(testPoint);
    945         if (handlePosition == WKHandleTop || handlePosition == WKHandleLeft)
     945        if (handlePosition == SelectionHandlePosition::Top || handlePosition == SelectionHandlePosition::Left)
    946946            newRange = Range::create(newRange->startContainer()->document(), newRange->startPosition(), currentRange->endPosition());
    947947        else
     
    951951        bool isBetterChoice;
    952952        switch (handlePosition) {
    953         case WKHandleTop:
    954         case WKHandleBottom:
     953        case SelectionHandlePosition::Top:
     954        case SelectionHandlePosition::Bottom:
    955955            isBetterChoice = (copyRect.height() < currentBox.height());
    956956            break;
    957         case WKHandleLeft:
    958         case WKHandleRight:
     957        case SelectionHandlePosition::Left:
     958        case SelectionHandlePosition::Right:
    959959            isBetterChoice = (copyRect.width() > bestRect.width());
    960960            break;
     
    964964        if (bestRange && isBetterChoice) {
    965965            switch (handlePosition) {
    966             case WKHandleTop:
    967             case WKHandleBottom:
     966            case SelectionHandlePosition::Top:
     967            case SelectionHandlePosition::Bottom:
    968968                isBetterChoice = (copyRect.height() > bestRect.height());
    969969                break;
    970             case WKHandleLeft:
    971             case WKHandleRight:
     970            case SelectionHandlePosition::Left:
     971            case SelectionHandlePosition::Right:
    972972                isBetterChoice = (copyRect.width() > bestRect.width());
    973973                break;
     
    993993        RenderObject* renderer = node->renderer();
    994994        if (renderer && renderer->childrenInline() && (renderer->isRenderBlock() && !toRenderBlock(renderer)->inlineElementContinuation()) && !renderer->isTable()) {
    995             flags = WKNone;
     995            flags = None;
    996996        }
    997997    }
     
    10001000}
    10011001
    1002 void WebPage::computeExpandAndShrinkThresholdsForHandle(const IntPoint& point, WKHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold)
     1002void WebPage::computeExpandAndShrinkThresholdsForHandle(const IntPoint& point, SelectionHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold)
    10031003{
    10041004    Frame& frame = m_page->focusController().focusedOrMainFrame();
     
    10071007
    10081008    RefPtr<Range> expandedRange = expandedRangeFromHandle(currentRange.get(), handlePosition);
    1009     WKSelectionFlags flags;
     1009    SelectionFlags flags;
    10101010    RefPtr<Range> contractedRange = contractedRangeFromHandle(currentRange.get(), handlePosition, flags);
    10111011
     
    10221022
    10231023    switch (handlePosition) {
    1024     case WKHandleTop: {
     1024    case SelectionHandlePosition::Top: {
    10251025        current = currentBounds.y();
    10261026        expanded = expandedBounds.y();
     
    10301030        break;
    10311031    }
    1032     case WKHandleRight: {
     1032    case SelectionHandlePosition::Right: {
    10331033        current = currentBounds.maxX();
    10341034        expanded = expandedBounds.maxX();
     
    10381038        break;
    10391039    }
    1040     case WKHandleBottom: {
     1040    case SelectionHandlePosition::Bottom: {
    10411041        current = currentBounds.maxY();
    10421042        expanded = expandedBounds.maxY();
     
    10461046        break;
    10471047    }
    1048     case WKHandleLeft: {
     1048    case SelectionHandlePosition::Left: {
    10491049        current = currentBounds.x();
    10501050        expanded = expandedBounds.x();
     
    10631063        growThreshold = maxThreshold;
    10641064
    1065     if ((flags & WKIsBlockSelection) && areRangesEqual(contractedRange.get(), currentRange.get()))
     1065    if (flags & IsBlockSelection && areRangesEqual(contractedRange.get(), currentRange.get()))
    10661066        shrinkThreshold = minThreshold;
    10671067}
    10681068
    1069 static inline bool shouldExpand(WKHandlePosition handlePosition, const IntRect& rect, const IntPoint& point)
     1069static inline bool shouldExpand(SelectionHandlePosition handlePosition, const IntRect& rect, const IntPoint& point)
    10701070{
    10711071    switch (handlePosition) {
    1072     case WKHandleTop:
     1072    case SelectionHandlePosition::Top:
    10731073        return (point.y() < rect.y());
    1074     case WKHandleLeft:
     1074    case SelectionHandlePosition::Left:
    10751075        return (point.x() < rect.x());
    1076     case WKHandleRight:
     1076    case SelectionHandlePosition::Right:
    10771077        return (point.x() > rect.maxX());
    1078     case WKHandleBottom:
     1078    case SelectionHandlePosition::Bottom:
    10791079        return (point.y() > rect.maxY());
    10801080    }
    10811081}
    10821082
    1083 PassRefPtr<WebCore::Range> WebPage::changeBlockSelection(const IntPoint& point, WKHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold, WKSelectionFlags& flags)
     1083PassRefPtr<WebCore::Range> WebPage::changeBlockSelection(const IntPoint& point, SelectionHandlePosition handlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags& flags)
    10841084{
    10851085    Frame& frame = m_page->focusController().focusedOrMainFrame();
     
    11061106    float growThreshold = 0;
    11071107    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);
    11131113        break;
    1114     case WKSelectionTouchEnded:
     1114    case SelectionTouch::Ended:
    11151115        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);
    11181118        break;
    11191119    default:
     
    11211121    }
    11221122
    1123     send(Messages::WebPageProxy::DidUpdateBlockSelectionWithTouch(touch, flags, growThreshold, shrinkThreshold));
     1123    send(Messages::WebPageProxy::DidUpdateBlockSelectionWithTouch(touch, static_cast<uint32_t>(flags), growThreshold, shrinkThreshold));
    11241124}
    11251125
     
    11421142    VisiblePosition result;
    11431143   
    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:
    11471147            break;
    11481148       
    1149         case WKSelectionTouchEnded:
     1149        case SelectionTouch::Ended:
    11501150            if (frame.selection().selection().isContentEditable()) {
    11511151                result = closestWordBoundaryForPosition(position);
     
    11561156            break;
    11571157
    1158         case WKSelectionTouchEndedMovingForward:
     1158        case SelectionTouch::EndedMovingForward:
    11591159            range = rangeAtWordBoundaryForPosition(&frame, position, baseIsStart, DirectionForward);
    11601160            break;
    11611161           
    1162         case WKSelectionTouchEndedMovingBackward:
     1162        case SelectionTouch::EndedMovingBackward:
    11631163            range = rangeAtWordBoundaryForPosition(&frame, position, baseIsStart, DirectionBackward);
    11641164            break;
    11651165
    1166         case WKSelectionTouchMoved:
     1166        case SelectionTouch::Moved:
    11671167            range = rangeForPosition(&frame, position, baseIsStart);
    11681168            break;
     
    15301530        return;
    15311531
    1532     if (static_cast<WKSheetActions>(action) == WKSheetActionCopy) {
     1532    if (static_cast<SheetAction>(action) == SheetAction::Copy) {
    15331533        if (element->renderer()->isRenderImage()) {
    15341534            Element* linkElement = containingLinkElement(element);
     
    15411541            m_interactionNode->document().frame()->editor().copyURL(element->document().completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(HTMLNames::hrefAttr))), element->textContent());
    15421542        }
    1543     } else if (static_cast<WKSelectionTouch>(action) == WKSheetActionSaveImage) {
     1543    } else if (static_cast<SheetAction>(action) == SheetAction::SaveImage) {
    15441544        if (!element->renderer()->isRenderImage())
    15451545            return;
Note: See TracChangeset for help on using the changeset viewer.