Title: [175266] trunk/Source/WebKit2
Revision
175266
Author
[email protected]
Date
2014-10-28 12:05:32 -0700 (Tue, 28 Oct 2014)

Log Message

[iOS] iPhone should not allow selecting <optgroup> in <select multiple>
https://bugs.webkit.org/show_bug.cgi?id=137991

Reviewed by Darin Adler.

We seem to be getting the delegate when we are not supposed to.
Workaround the issue as best we can by reseting the styles
for the group's content view and not changing selections.

* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker pickerView:row:column:checked:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (175265 => 175266)


--- trunk/Source/WebKit2/ChangeLog	2014-10-28 18:46:23 UTC (rev 175265)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-28 19:05:32 UTC (rev 175266)
@@ -1,3 +1,17 @@
+2014-10-28  Joseph Pecoraro  <[email protected]>
+
+        [iOS] iPhone should not allow selecting <optgroup> in <select multiple>
+        https://bugs.webkit.org/show_bug.cgi?id=137991
+
+        Reviewed by Darin Adler.
+
+        We seem to be getting the delegate when we are not supposed to.
+        Workaround the issue as best we can by reseting the styles
+        for the group's content view and not changing selections.
+
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
+
 2014-10-28  Tim Horton  <[email protected]>
 
         Remove an inaccurate comment in WKActionMenuController

Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm (175265 => 175266)


--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm	2014-10-28 18:46:23 UTC (rev 175265)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm	2014-10-28 19:05:32 UTC (rev 175266)
@@ -42,6 +42,7 @@
 using namespace WebKit;
 
 static const float DisabledOptionAlpha = 0.3;
+static const float GroupOptionTextColorAlpha = 0.5;
 
 @interface UIPickerView (UIPickerViewInternal)
 - (BOOL)allowsMultipleSelection;
@@ -110,7 +111,7 @@
 
     [[self titleLabel] setText:trimmedText];
     [self setChecked:NO];
-    [[self titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:0.5]];
+    [[self titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:GroupOptionTextColorAlpha]];
     [self setDisabled:YES];
 
     return self;
@@ -279,6 +280,17 @@
 
     OptionItem& item = [_view assistedNodeSelectOptions][rowIndex];
 
+    // FIXME: Remove this workaround once <rdar://problem/18745253> is fixed.
+    // Group rows should not be checkable, but we are getting this delegate for
+    // those rows. As a workaround, if we get this delegate for a group row, reset
+    // the styles for the content view so it still appears unselected.
+    if (item.isGroup) {
+        UIPickerContentView *view = (UIPickerContentView *)[self viewForRow:rowIndex forComponent:columnIndex];
+        [view setChecked:NO];
+        [[view titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:GroupOptionTextColorAlpha]];
+        return;
+    }
+
     if ([self allowsMultipleSelection]) {
         [_view page]->setAssistedNodeSelectedIndex([self findItemIndexAt:rowIndex], true);
         item.isSelected = isChecked;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to