Don't use the WK prefix for internal C++ types
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jun 2014 21:33:34 +0000 (21:33 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jun 2014 21:33:34 +0000 (21:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134214

Reviewed by Dan Bernstein.

* Shared/AssistedNodeInformation.cpp:
(WebKit::OptionItem::encode):
(WebKit::OptionItem::decode):
(WebKit::WKOptionItem::encode): Deleted.
(WebKit::WKOptionItem::decode): Deleted.
* Shared/AssistedNodeInformation.h:
(WebKit::OptionItem::OptionItem):
(WebKit::AssistedNodeInformation::AssistedNodeInformation):
(WebKit::WKOptionItem::WKOptionItem): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView inputView]):
(-[WKContentView requiresAccessoryView]):
(-[WKContentView _updateAccessory]):
(-[WKContentView textInputTraits]):
(-[WKContentView assistedNodeSelectOptions]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKContentView _stopAssistingNode]):
* UIProcess/ios/forms/WKFormInputControl.mm:
(-[WKDateTimePicker initWithView:datePickerMode:]):
(-[WKFormInputControl initWithView:]):
* UIProcess/ios/forms/WKFormSelectControl.h:
* UIProcess/ios/forms/WKFormSelectControl.mm:
(adjustedFontSize):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKOptionPickerCell initWithOptionItem:]):
(-[WKOptionGroupPickerCell initWithOptionItem:]):
(-[WKMultipleSelectPicker initWithView:]):
(-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
(-[WKMultipleSelectPicker pickerView:row:column:checked:]):
(-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
(-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectTableViewController initWithView:hasGroups:]):
(-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
(-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
(-[WKSelectTableViewController populateCell:withItem:]):
(-[WKSelectTableViewController findItemIndexAt:]):
(-[WKSelectTableViewController findItemAt:]):
(-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
(-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170321 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/AssistedNodeInformation.cpp
Source/WebKit2/Shared/AssistedNodeInformation.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit2/UIProcess/ios/forms/WKFormInputControl.mm
Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.h
Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.mm
Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm
Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 7a2e156..335597c 100644 (file)
@@ -1,3 +1,55 @@
+2014-06-23  Anders Carlsson  <andersca@apple.com>
+
+        Don't use the WK prefix for internal C++ types
+        https://bugs.webkit.org/show_bug.cgi?id=134214
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/AssistedNodeInformation.cpp:
+        (WebKit::OptionItem::encode):
+        (WebKit::OptionItem::decode):
+        (WebKit::WKOptionItem::encode): Deleted.
+        (WebKit::WKOptionItem::decode): Deleted.
+        * Shared/AssistedNodeInformation.h:
+        (WebKit::OptionItem::OptionItem):
+        (WebKit::AssistedNodeInformation::AssistedNodeInformation):
+        (WebKit::WKOptionItem::WKOptionItem): Deleted.
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _requiresKeyboardWhenFirstResponder]):
+        (-[WKContentView inputView]):
+        (-[WKContentView requiresAccessoryView]):
+        (-[WKContentView _updateAccessory]):
+        (-[WKContentView textInputTraits]):
+        (-[WKContentView assistedNodeSelectOptions]):
+        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
+        (-[WKContentView _stopAssistingNode]):
+        * UIProcess/ios/forms/WKFormInputControl.mm:
+        (-[WKDateTimePicker initWithView:datePickerMode:]):
+        (-[WKFormInputControl initWithView:]):
+        * UIProcess/ios/forms/WKFormSelectControl.h:
+        * UIProcess/ios/forms/WKFormSelectControl.mm:
+        (adjustedFontSize):
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKOptionPickerCell initWithOptionItem:]):
+        (-[WKOptionGroupPickerCell initWithOptionItem:]):
+        (-[WKMultipleSelectPicker initWithView:]):
+        (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
+        (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
+        (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
+        (-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectTableViewController initWithView:hasGroups:]):
+        (-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
+        (-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
+        (-[WKSelectTableViewController populateCell:withItem:]):
+        (-[WKSelectTableViewController findItemIndexAt:]):
+        (-[WKSelectTableViewController findItemAt:]):
+        (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
+        (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation):
+
 2014-06-23  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] No way to grant storage quotas for web application cache
index fc3d814..47b2a2d 100644 (file)
@@ -32,7 +32,7 @@
 namespace WebKit {
 
 #if PLATFORM(IOS)
-void WKOptionItem::encode(IPC::ArgumentEncoder& encoder) const
+void OptionItem::encode(IPC::ArgumentEncoder& encoder) const
 {
     encoder << text;
     encoder << isGroup;
@@ -41,7 +41,7 @@ void WKOptionItem::encode(IPC::ArgumentEncoder& encoder) const
     encoder << parentGroupID;
 }
 
-bool WKOptionItem::decode(IPC::ArgumentDecoder& decoder, WKOptionItem& result)
+bool OptionItem::decode(IPC::ArgumentDecoder& decoder, OptionItem& result)
 {
     if (!decoder.decode(result.text))
         return false;
index 0b9219e..2377507 100644 (file)
 
 namespace WebKit {
 
-enum WKInputType {
-    WKTypeNone,
-    WKTypeContentEditable,
-    WKTypeText,
-    WKTypePassword,
-    WKTypeTextArea,
-    WKTypeSearch,
-    WKTypeEmail,
-    WKTypeURL,
-    WKTypePhone,
-    WKTypeNumber,
-    WKTypeNumberPad,
-    WKTypeDate,
-    WKTypeDateTime,
-    WKTypeDateTimeLocal,
-    WKTypeMonth,
-    WKTypeWeek,
-    WKTypeTime,
-    WKTypeSelect
+enum class InputType {
+    None,
+    ContentEditable,
+    Text,
+    Password,
+    TextArea,
+    Search,
+    Email,
+    URL,
+    Phone,
+    Number,
+    NumberPad,
+    Date,
+    DateTime,
+    DateTimeLocal,
+    Month,
+    Week,
+    Time,
+    Select
 };
 
 #if PLATFORM(IOS)
-struct WKOptionItem {
-    WKOptionItem()
+struct OptionItem {
+    OptionItem()
         : isGroup(false)
         , isSelected(false)
         , disabled(false)
@@ -64,7 +64,7 @@ struct WKOptionItem {
     {
     }
 
-    WKOptionItem(const WKOptionItem& item)
+    OptionItem(const OptionItem& item)
         : text(item.text)
         , isGroup(item.isGroup)
         , isSelected(item.isSelected)
@@ -73,7 +73,7 @@ struct WKOptionItem {
     {
     }
 
-    WKOptionItem(const String& text, bool isGroup, int parentID, bool selected, bool disabled)
+    OptionItem(const String& text, bool isGroup, int parentID, bool selected, bool disabled)
         : text(text)
         , isGroup(isGroup)
         , isSelected(selected)
@@ -88,7 +88,7 @@ struct WKOptionItem {
     int parentGroupID;
 
     void encode(IPC::ArgumentEncoder&) const;
-    static bool decode(IPC::ArgumentDecoder&, WKOptionItem&);
+    static bool decode(IPC::ArgumentDecoder&, OptionItem&);
 };
 
 struct AssistedNodeInformation {
@@ -103,7 +103,7 @@ struct AssistedNodeInformation {
         , isReadOnly(false)
         , allowsUserScaling(false)
         , autocapitalizeType(WebAutocapitalizeTypeDefault)
-        , elementType(WKTypeNone)
+        , elementType(InputType::None)
         , selectedIndex(-1)
         , valueAsNumber(0)
     {
@@ -121,9 +121,9 @@ struct AssistedNodeInformation {
     bool isReadOnly;
     bool allowsUserScaling;
     WebAutocapitalizeType autocapitalizeType;
-    WKInputType elementType;
+    InputType elementType;
     String formAction;
-    Vector<WKOptionItem> selectOptions;
+    Vector<OptionItem> selectOptions;
     int selectedIndex;
     String value;
     double valueAsNumber;
index f4b2487..0277252 100644 (file)
@@ -174,7 +174,7 @@ struct WKAutoCorrectionData {
 - (void)_showRunOpenPanel:(WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;
 - (void)accessoryDone;
 - (void)_didHandleKeyEvent:(WebIOSEvent *)event;
-- (Vector<WebKit::WKOptionItem>&) assistedNodeSelectOptions;
+- (Vector<WebKit::OptionItem>&) assistedNodeSelectOptions;
 - (void)_updateUnscaledView;
 @end
 
index a9b48a1..707bbc9 100644 (file)
@@ -533,14 +533,14 @@ static inline bool highlightedQuadsAreSmallerThanRect(const Vector<FloatQuad>& q
 {
     // FIXME: We should add the logic to handle keyboard visibility during focus redirects.
     switch (_assistedNodeInformation.elementType) {
-    case WebKit::WKTypeNone:
+    case InputType::None:
         return NO;
-    case WebKit::WKTypeSelect:
+    case InputType::Select:
         return !UICurrentUserInterfaceIdiomIsPad();
-    case WebKit::WKTypeDate:
-    case WebKit::WKTypeMonth:
-    case WebKit::WKTypeDateTimeLocal:
-    case WebKit::WKTypeTime:
+    case InputType::Date:
+    case InputType::Month:
+    case InputType::DateTimeLocal:
+    case InputType::Time:
         return !UICurrentUserInterfaceIdiomIsPad();
     default:
         return !_assistedNodeInformation.isReadOnly;
@@ -567,11 +567,11 @@ static inline bool highlightedQuadsAreSmallerThanRect(const Vector<FloatQuad>& q
 
 - (UIView *)inputView
 {
-    if (_assistedNodeInformation.elementType == WKTypeNone)
+    if (_assistedNodeInformation.elementType == InputType::None)
         return nil;
 
     if (!_inputPeripheral)
-        _inputPeripheral = adoptNS(_assistedNodeInformation.elementType == WKTypeSelect ? [WKFormSelectControl createPeripheralWithView:self] : [WKFormInputControl createPeripheralWithView:self]);
+        _inputPeripheral = adoptNS(_assistedNodeInformation.elementType == InputType::Select ? [WKFormSelectControl createPeripheralWithView:self] : [WKFormInputControl createPeripheralWithView:self]);
     else
         [self _displayFormNodeInputView];
 
@@ -959,27 +959,27 @@ static inline bool isSamePair(UIGestureRecognizer *a, UIGestureRecognizer *b, UI
 - (BOOL)requiresAccessoryView
 {
     switch (_assistedNodeInformation.elementType) {
-    case WKTypeNone:
+    case InputType::None:
         return NO;
-    case WKTypeText:
-    case WKTypePassword:
-    case WKTypeSearch:
-    case WKTypeEmail:
-    case WKTypeURL:
-    case WKTypePhone:
-    case WKTypeNumber:
-    case WKTypeNumberPad:
+    case InputType::Text:
+    case InputType::Password:
+    case InputType::Search:
+    case InputType::Email:
+    case InputType::URL:
+    case InputType::Phone:
+    case InputType::Number:
+    case InputType::NumberPad:
         return YES;
-    case WKTypeContentEditable:
-    case WKTypeTextArea:
+    case InputType::ContentEditable:
+    case InputType::TextArea:
         return YES;
-    case WKTypeSelect:
-    case WKTypeDate:
-    case WKTypeDateTime:
-    case WKTypeDateTimeLocal:
-    case WKTypeMonth:
-    case WKTypeWeek:
-    case WKTypeTime:
+    case InputType::Select:
+    case InputType::Date:
+    case InputType::DateTime:
+    case InputType::DateTimeLocal:
+    case InputType::Month:
+    case InputType::Week:
+    case InputType::Time:
         return !UICurrentUserInterfaceIdiomIsPad();
     }
 }
@@ -1668,10 +1668,10 @@ static void selectionChangedWithTouch(WKContentView *view, const WebCore::IntPoi
         [_formAccessoryView setClearVisible:NO];
     else {
         switch (_assistedNodeInformation.elementType) {
-        case WebKit::WKTypeDate:
-        case WebKit::WKTypeMonth:
-        case WebKit::WKTypeDateTimeLocal:
-        case WebKit::WKTypeTime:
+        case InputType::Date:
+        case InputType::Month:
+        case InputType::DateTimeLocal:
+        case InputType::Time:
             [_formAccessoryView setClearVisible:YES];
             break;
         default:
@@ -1912,13 +1912,13 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     if (!_traits)
         _traits = adoptNS([[UITextInputTraits alloc] init]);
 
-    [_traits setSecureTextEntry:_assistedNodeInformation.elementType == WKTypePassword];
-    [_traits setShortcutConversionType:_assistedNodeInformation.elementType == WKTypePassword ? UITextShortcutConversionTypeNo : UITextShortcutConversionTypeDefault];
+    [_traits setSecureTextEntry:_assistedNodeInformation.elementType == InputType::Password];
+    [_traits setShortcutConversionType:_assistedNodeInformation.elementType == InputType::Password ? UITextShortcutConversionTypeNo : UITextShortcutConversionTypeDefault];
 
     if (!_assistedNodeInformation.formAction.isEmpty())
-        [_traits setReturnKeyType:(_assistedNodeInformation.elementType == WebKit::WKTypeSearch) ? UIReturnKeySearch : UIReturnKeyGo];
+        [_traits setReturnKeyType:(_assistedNodeInformation.elementType == InputType::Search) ? UIReturnKeySearch : UIReturnKeyGo];
 
-    if (_assistedNodeInformation.elementType == WKTypePassword || _assistedNodeInformation.elementType == WKTypeEmail || _assistedNodeInformation.elementType == WKTypeURL || _assistedNodeInformation.formAction.contains("login")) {
+    if (_assistedNodeInformation.elementType == InputType::Password || _assistedNodeInformation.elementType == InputType::Email || _assistedNodeInformation.elementType == InputType::URL || _assistedNodeInformation.formAction.contains("login")) {
         [_traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
         [_traits setAutocorrectionType:UITextAutocorrectionTypeNo];
     } else {
@@ -1927,19 +1927,19 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     }
 
     switch (_assistedNodeInformation.elementType) {
-    case WebKit::WKTypePhone:
+    case InputType::Phone:
          [_traits setKeyboardType:UIKeyboardTypePhonePad];
          break;
-    case WebKit::WKTypeURL:
+    case InputType::URL:
          [_traits setKeyboardType:UIKeyboardTypeURL];
          break;
-    case WebKit::WKTypeEmail:
+    case InputType::Email:
          [_traits setKeyboardType:UIKeyboardTypeEmailAddress];
           break;
-    case WebKit::WKTypeNumber:
+    case InputType::Number:
          [_traits setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
          break;
-    case WebKit::WKTypeNumberPad:
+    case InputType::NumberPad:
          [_traits setKeyboardType:UIKeyboardTypeNumberPad];
          break;
     default:
@@ -2243,7 +2243,7 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     return _assistedNodeInformation;
 }
 
-- (Vector<WKOptionItem>&)assistedNodeSelectOptions
+- (Vector<OptionItem>&)assistedNodeSelectOptions
 {
     return _assistedNodeInformation.selectOptions;
 }
@@ -2274,15 +2274,15 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
         [self becomeFirstResponder];
 
     switch (information.elementType) {
-        case WKTypeSelect:
-        case WKTypeDateTimeLocal:
-        case WKTypeTime:
-        case WKTypeMonth:
-        case WKTypeDate:
-            break;
-        default:
-            [self _startAssistingKeyboard];
-            break;
+    case InputType::Select:
+    case InputType::DateTimeLocal:
+    case InputType::Time:
+    case InputType::Month:
+    case InputType::Date:
+        break;
+    default:
+        [self _startAssistingKeyboard];
+        break;
     }
     [self reloadInputViews];
     [self _displayFormNodeInputView];
@@ -2302,7 +2302,7 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     [_formInputSession invalidate];
     _formInputSession = nil;
     _isEditable = NO;
-    _assistedNodeInformation.elementType = WKTypeNone;
+    _assistedNodeInformation.elementType = InputType::None;
     _inputPeripheral = nil;
 
     [self _stopAssistingKeyboard];
index c8c3c51..ac00ce8 100644 (file)
@@ -90,17 +90,17 @@ static const NSTimeInterval kMillisecondsPerSecond = 1000;
     _shouldRemoveTimeZoneInformation = NO;
     _isTimeInput = NO;
     switch (view.assistedNodeInformation.elementType) {
-    case WebKit::WKTypeDate:
+    case InputType::Date:
         _formatString = kDateFormatString;
         break;
-    case WebKit::WKTypeMonth:
+    case InputType::Month:
         _formatString = kMonthFormatString;
         break;
-    case WebKit::WKTypeTime:
+    case InputType::Time:
         _formatString = kTimeFormatString;
         _isTimeInput = YES;
         break;
-    case WebKit::WKTypeDateTimeLocal:
+    case InputType::DateTimeLocal:
         _shouldRemoveTimeZoneInformation = YES;
         break;
     default:
@@ -236,25 +236,25 @@ static const NSTimeInterval kMillisecondsPerSecond = 1000;
     UIDatePickerMode mode;
 
     switch (view.assistedNodeInformation.elementType) {
-        case WebKit::WKTypeDate:
-            mode = UIDatePickerModeDate;
-            break;
+    case InputType::Date:
+        mode = UIDatePickerModeDate;
+        break;
 
-        case WebKit::WKTypeDateTimeLocal:
-            mode = UIDatePickerModeDateAndTime;
-            break;
+    case InputType::DateTimeLocal:
+        mode = UIDatePickerModeDateAndTime;
+        break;
 
-        case WebKit::WKTypeTime:
-            mode = UIDatePickerModeTime;
-            break;
+    case InputType::Time:
+        mode = UIDatePickerModeTime;
+        break;
 
-        case WebKit::WKTypeMonth:
-            mode = (UIDatePickerMode)UIDatePickerModeYearAndMonth;
-            break;
+    case InputType::Month:
+        mode = (UIDatePickerMode)UIDatePickerModeYearAndMonth;
+        break;
 
-        default:
-            [self release];
-            return nil;
+    default:
+        [self release];
+        return nil;
     }
 
     if (UICurrentUserInterfaceIdiomIsPad())
index 64f7f0f..e59bfc9 100644 (file)
@@ -31,7 +31,7 @@
 #import <UIKit/UIPickerView.h>
 #import <UIKit/UIPickerView_Private.h>
 
-CGFloat adjustedFontSize(CGFloat textWidth, UIFont *font, CGFloat initialFontSize, const Vector<WebKit::WKOptionItem>& items);
+CGFloat adjustedFontSize(CGFloat textWidth, UIFont *, CGFloat initialFontSize, const Vector<WebKit::OptionItem>& items);
 
 @class WKContentView;
 
index 42cc168..1132e2a 100644 (file)
@@ -46,11 +46,11 @@ using namespace WebKit;
 
 static const CGFloat minimumOptionFontSize = 12;
 
-CGFloat adjustedFontSize(CGFloat textWidth, UIFont *font, CGFloat initialFontSize, const Vector<WKOptionItem>& items)
+CGFloat adjustedFontSize(CGFloat textWidth, UIFont *font, CGFloat initialFontSize, const Vector<OptionItem>& items)
 {
     CGFloat adjustedSize = initialFontSize;
     for (size_t i = 0; i < items.size(); ++i) {
-        const WKOptionItem& item = items[i];
+        const OptionItem& item = items[i];
         if (item.text.isEmpty())
             continue;
 
index b99b278..a9ce052 100644 (file)
@@ -55,7 +55,7 @@ static const float DisabledOptionAlpha = 0.3;
 
 @property(nonatomic) BOOL disabled;
 
-- (instancetype)initWithOptionItem:(const WKOptionItem&)item;
+- (instancetype)initWithOptionItem:(const OptionItem&)item;
 
 @end
 
@@ -74,7 +74,7 @@ static const float DisabledOptionAlpha = 0.3;
     return self;
 }
 
-- (instancetype)initWithOptionItem:(const WKOptionItem&)item
+- (instancetype)initWithOptionItem:(const OptionItem&)item
 {
     if (!(self = [self init]))
         return nil;
@@ -95,12 +95,12 @@ static const float DisabledOptionAlpha = 0.3;
 
 
 @interface WKOptionGroupPickerCell : WKOptionPickerCell
-- (instancetype)initWithOptionItem:(const WKOptionItem&)item;
+- (instancetype)initWithOptionItem:(const OptionItem&)item;
 @end
 
 @implementation WKOptionGroupPickerCell
 
-- (instancetype)initWithOptionItem:(const WKOptionItem&)item
+- (instancetype)initWithOptionItem:(const OptionItem&)item
 {
     if (!(self = [self init]))
         return nil;
@@ -166,10 +166,10 @@ static const float DisabledOptionAlpha = 0.3;
     [self setSize:[UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]];
     [self reloadAllComponents];
 
-    const Vector<WKOptionItem>& selectOptions = [_view assistedNodeSelectOptions];
+    const Vector<OptionItem>& selectOptions = [_view assistedNodeSelectOptions];
     int currentIndex = 0;
     for (size_t i = 0; i < selectOptions.size(); ++i) {
-        const WKOptionItem& item = selectOptions[i];
+        const OptionItem& item = selectOptions[i];
         if (item.isGroup)
             continue;
 
@@ -222,7 +222,7 @@ static const float DisabledOptionAlpha = 0.3;
 
 - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)rowIndex forComponent:(NSInteger)columnIndex reusingView:(UIView *)view
 {
-    const WKOptionItem& item = [_view assistedNodeSelectOptions][rowIndex];
+    const OptionItem& item = [_view assistedNodeSelectOptions][rowIndex];
     UIPickerContentView* pickerItem = item.isGroup ? [[[WKOptionGroupPickerCell alloc] initWithOptionItem:item] autorelease] : [[[WKOptionPickerCell alloc] initWithOptionItem:item] autorelease];
 
     // The cell starts out with a null frame. We need to set its frame now so we can find the right font size.
@@ -275,10 +275,11 @@ static const float DisabledOptionAlpha = 0.3;
 
 - (void)pickerView:(UIPickerView *)pickerView row:(int)rowIndex column:(int)columnIndex checked:(BOOL)isChecked
 {
+
     if ((size_t)rowIndex >= [_view assistedNodeSelectOptions].size())
         return;
 
-    WKOptionItem& item = [_view assistedNodeSelectOptions][rowIndex];
+    OptionItem& item = [_view assistedNodeSelectOptions][rowIndex];
 
     if ([self allowsMultipleSelection]) {
         [_view page]->setAssistedNodeSelectedIndex([self findItemIndexAt:rowIndex], isChecked);
@@ -374,7 +375,7 @@ static const float DisabledOptionAlpha = 0.3;
     if (row < 0 || row >= (NSInteger)[_view assistedNodeSelectOptions].size())
         return nil;
 
-    const WKOptionItem& option = [_view assistedNodeSelectOptions][row];
+    const OptionItem& option = [_view assistedNodeSelectOptions][row];
     NSMutableString *trimmedText = [[option.text mutableCopy] autorelease];
     CFStringTrimWhitespace((CFMutableStringRef)trimmedText);
 
@@ -390,13 +391,13 @@ static const float DisabledOptionAlpha = 0.3;
     if (row < 0 || row >= (NSInteger)[_view assistedNodeSelectOptions].size())
         return;
 
-    const WKOptionItem& newSelectedOption = [_view assistedNodeSelectOptions][row];
+    const OptionItem& newSelectedOption = [_view assistedNodeSelectOptions][row];
     if (newSelectedOption.disabled) {
         NSInteger rowToSelect = NSNotFound;
 
         // Search backwards for the previous enabled option.
         for (NSInteger i = row - 1; i >= 0; --i) {
-            const WKOptionItem& earlierOption = [_view assistedNodeSelectOptions][i];
+            const OptionItem& earlierOption = [_view assistedNodeSelectOptions][i];
             if (!earlierOption.disabled) {
                 rowToSelect = i;
                 break;
@@ -406,7 +407,7 @@ static const float DisabledOptionAlpha = 0.3;
         // If nothing previous, search forwards for the next enabled option.
         if (rowToSelect == NSNotFound) {
             for (size_t i = row + 1; i < [_view assistedNodeSelectOptions].size(); ++i) {
-                const WKOptionItem& laterOption = [_view assistedNodeSelectOptions][i];
+                const OptionItem& laterOption = [_view assistedNodeSelectOptions][i];
                 if (!laterOption.disabled) {
                     rowToSelect = i;
                     break;
index c785d3a..67920cb 100644 (file)
@@ -109,7 +109,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
         return nil;
     
     _contentView = view;
-    Vector<WKOptionItem>& selectOptions = [_contentView assistedNodeSelectOptions];
+    Vector<OptionItem>& selectOptions = [_contentView assistedNodeSelectOptions];
     _allowsMultipleSelection = _contentView.assistedNodeInformation.isMultiSelect;
     
     // Even if the select is empty, there is at least one tableview section.
@@ -117,7 +117,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     _singleSelectionIndex = NSNotFound;
     NSInteger currentIndex = 0;
     for (size_t i = 0; i < selectOptions.size(); ++i) {
-        const WKOptionItem& item = selectOptions[i];
+        const OptionItem& item = selectOptions[i];
         if (item.isGroup) {
             _numberOfSections++;
             currentIndex = 0;
@@ -164,7 +164,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     
     int rowCount = 0;
     for (size_t i = 0; i < [_contentView assistedNodeSelectOptions].size(); ++i) {
-        const WKOptionItem& item = [_contentView assistedNodeSelectOptions][i];
+        const OptionItem& item = [_contentView assistedNodeSelectOptions][i];
         if (item.isGroup)
             continue;
         if (item.parentGroupID == section)
@@ -183,7 +183,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     
     int groupCount = 0;
     for (size_t i = 0; i < [_contentView assistedNodeSelectOptions].size(); ++i) {
-        const WKOptionItem& item = [_contentView assistedNodeSelectOptions][i];
+        const OptionItem& item = [_contentView assistedNodeSelectOptions][i];
         if (!item.isGroup)
             continue;
         groupCount++;
@@ -193,12 +193,12 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     return nil;
 }
 
-- (void)populateCell:(UITableViewCell *)cell withItem:(const WKOptionItem *)item
+- (void)populateCell:(UITableViewCell *)cell withItem:(const OptionItem&)item
 {
-    [cell.textLabel setText:item->text];
-    [cell.textLabel setEnabled:!item->disabled];
-    [cell setSelectionStyle:item->disabled ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleBlue];
-    [cell setAccessoryType:item->isSelected ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone];
+    [cell.textLabel setText:item.text];
+    [cell.textLabel setEnabled:!item.disabled];
+    [cell setSelectionStyle:item.disabled ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleBlue];
+    [cell setAccessoryType:item.isSelected ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone];
 }
 
 - (NSInteger)findItemIndexAt:(NSIndexPath *)indexPath
@@ -209,7 +209,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     int optionIndex = 0;
     int rowIndex = 0;
     for (size_t i = 0; i < [_contentView assistedNodeSelectOptions].size(); ++i) {
-        const WKOptionItem& item = [_contentView assistedNodeSelectOptions][i];
+        const OptionItem& item = [_contentView assistedNodeSelectOptions][i];
         if (item.isGroup) {
             rowIndex = 0;
             continue;
@@ -222,14 +222,14 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
     return NSNotFound;
 }
 
-- (WKOptionItem *)findItemAt:(NSIndexPath *)indexPath
+- (OptionItem *)findItemAt:(NSIndexPath *)indexPath
 {
     ASSERT(indexPath.row >= 0);
     ASSERT(indexPath.section <= _numberOfSections);
 
     int index = 0;
     for (size_t i = 0; i < [_contentView assistedNodeSelectOptions].size(); ++i) {
-        WKOptionItem& item = [_contentView assistedNodeSelectOptions][i];
+        OptionItem& item = [_contentView assistedNodeSelectOptions][i];
         if (item.isGroup || item.parentGroupID != indexPath.section)
             continue;
         if (index == indexPath.row)
@@ -267,10 +267,10 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
         _fontSize = adjustedFontSize(_maximumTextWidth, font, initialFontSize, _contentView.assistedNodeInformation.selectOptions);
     }
     
-    const WKOptionItem* item = [self findItemAt:indexPath];
+    const OptionItem* item = [self findItemAt:indexPath];
     ASSERT(item);
     
-    [self populateCell:cell withItem:item];
+    [self populateCell:cell withItem:*item];
     [cell.textLabel setFont:[font fontWithSize:_fontSize]];
     [cell.textLabel setLineBreakMode:NSLineBreakByWordWrapping];
     [cell.textLabel setNumberOfLines:2];
@@ -303,7 +303,7 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
         // changes do not trigger "change" events on such selects.
     
         [_contentView page]->setAssistedNodeSelectedIndex(itemIndex, true);
-        WKOptionItem& item = [_contentView assistedNodeSelectOptions][itemIndex];
+        OptionItem& item = [_contentView assistedNodeSelectOptions][itemIndex];
         item.isSelected = newStateIsSelected;
     } else {
         [tableView deselectRowAtIndexPath:indexPath animated:NO];
@@ -336,14 +336,13 @@ static NSString *stringWithWritingDirection(NSString *string, UITextWritingDirec
             _singleSelectionSection = indexPath.section;
  
             [_contentView page]->setAssistedNodeSelectedIndex(itemIndex);
-            WKOptionItem& newItem = [_contentView assistedNodeSelectOptions][itemIndex];
+            OptionItem& newItem = [_contentView assistedNodeSelectOptions][itemIndex];
             newItem.isSelected = true;
         }
         
         // Need to update the model even if there isn't a cell.
         if (oldIndexPath) {
-            WKOptionItem* oldItem = [self findItemAt:oldIndexPath];
-            if (oldItem)
+            if (OptionItem* oldItem = [self findItemAt:oldIndexPath])
                 oldItem->isSelected = false;
         }
         
index 7e222f1..4a22a1d 100644 (file)
@@ -1835,7 +1835,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
 
     if (isHTMLSelectElement(m_assistedNode.get())) {
         HTMLSelectElement* element = toHTMLSelectElement(m_assistedNode.get());
-        information.elementType = WKTypeSelect;
+        information.elementType = InputType::Select;
         size_t count = element->listItems().size();
         int parentGroupID = 0;
         // The parent group ID indicates the group the option belongs to and is 0 for group elements.
@@ -1845,11 +1845,11 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
             HTMLElement* item = element->listItems()[i];
             if (isHTMLOptionElement(item)) {
                 HTMLOptionElement* option = toHTMLOptionElement(item);
-                information.selectOptions.append(WKOptionItem(option->text(), false, parentGroupID, option->selected(), option->fastHasAttribute(WebCore::HTMLNames::disabledAttr)));
+                information.selectOptions.append(OptionItem(option->text(), false, parentGroupID, option->selected(), option->fastHasAttribute(WebCore::HTMLNames::disabledAttr)));
             } else if (isHTMLOptGroupElement(item)) {
                 HTMLOptGroupElement* group = toHTMLOptGroupElement(item);
                 parentGroupID++;
-                information.selectOptions.append(WKOptionItem(group->groupLabelText(), true, 0, false, group->fastHasAttribute(WebCore::HTMLNames::disabledAttr)));
+                information.selectOptions.append(OptionItem(group->groupLabelText(), true, 0, false, group->fastHasAttribute(WebCore::HTMLNames::disabledAttr)));
             }
         }
         information.selectedIndex = element->selectedIndex();
@@ -1858,7 +1858,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
         HTMLTextAreaElement* element = toHTMLTextAreaElement(m_assistedNode.get());
         information.autocapitalizeType = static_cast<WebAutocapitalizeType>(element->autocapitalizeType());
         information.isAutocorrect = element->autocorrect();
-        information.elementType = WKTypeTextArea;
+        information.elementType = InputType::TextArea;
         information.isReadOnly = element->isReadOnly();
         information.value = element->value();
     } else if (isHTMLInputElement(m_assistedNode.get())) {
@@ -1869,38 +1869,38 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
         information.autocapitalizeType = static_cast<WebAutocapitalizeType>(element->autocapitalizeType());
         information.isAutocorrect = element->autocorrect();
         if (element->isPasswordField())
-            information.elementType = WKTypePassword;
+            information.elementType = InputType::Password;
         else if (element->isSearchField())
-            information.elementType = WKTypeSearch;
+            information.elementType = InputType::Search;
         else if (element->isEmailField())
-            information.elementType = WKTypeEmail;
+            information.elementType = InputType::Email;
         else if (element->isTelephoneField())
-            information.elementType = WKTypePhone;
+            information.elementType = InputType::Phone;
         else if (element->isNumberField())
-            information.elementType = element->getAttribute("pattern") == "\\d*" || element->getAttribute("pattern") == "[0-9]*" ? WKTypeNumberPad : WKTypeNumber;
+            information.elementType = element->getAttribute("pattern") == "\\d*" || element->getAttribute("pattern") == "[0-9]*" ? InputType::NumberPad : InputType::Number;
         else if (element->isDateTimeLocalField())
-            information.elementType = WKTypeDateTimeLocal;
+            information.elementType = InputType::DateTimeLocal;
         else if (element->isDateField())
-            information.elementType = WKTypeDate;
+            information.elementType = InputType::Date;
         else if (element->isDateTimeField())
-            information.elementType = WKTypeDateTime;
+            information.elementType = InputType::DateTime;
         else if (element->isTimeField())
-            information.elementType = WKTypeTime;
+            information.elementType = InputType::Time;
         else if (element->isWeekField())
-            information.elementType = WKTypeWeek;
+            information.elementType = InputType::Week;
         else if (element->isMonthField())
-            information.elementType = WKTypeMonth;
+            information.elementType = InputType::Month;
         else if (element->isURLField())
-            information.elementType = WKTypeURL;
+            information.elementType = InputType::URL;
         else if (element->isText()) {
             const AtomicString& pattern = element->fastGetAttribute(HTMLNames::patternAttr);
             if (pattern == "\\d*" || pattern == "[0-9]*")
-                information.elementType = WKTypeNumberPad;
+                information.elementType = InputType::NumberPad;
             else {
-                information.elementType = WKTypeText;
+                information.elementType = InputType::Text;
                 if (!information.formAction.isEmpty()
                     && (element->getNameAttribute().contains("search") || element->getIdAttribute().contains("search") || element->fastGetAttribute(HTMLNames::titleAttr).contains("search")))
-                    information.elementType = WKTypeSearch;
+                    information.elementType = InputType::Search;
             }
         }
 
@@ -1909,7 +1909,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
         information.valueAsNumber = element->valueAsNumber();
         information.title = element->title();
     } else if (m_assistedNode->hasEditableStyle()) {
-        information.elementType = WKTypeContentEditable;
+        information.elementType = InputType::ContentEditable;
         information.isAutocorrect = true;   // FIXME: Should we look at the attribute?
         information.autocapitalizeType = WebAutocapitalizeTypeSentences; // FIXME: Should we look at the attribute?
         information.isReadOnly = false;