Title: [200858] trunk/Source/WebKit2
Revision
200858
Author
[email protected]
Date
2016-05-13 09:06:03 -0700 (Fri, 13 May 2016)

Log Message

[iOS] <select> elements popover should render right-aligned when in RTL mode
https://bugs.webkit.org/show_bug.cgi?id=157672
<rdar://problem/26193442>

Patch by Antoine Quint <[email protected]> on 2016-05-13
Reviewed by Darin Adler.

Add a new isRTL field to the AssistedNodeInformation as specified by the assisted
node's render style and account for it when displaying the table view shown in the
popover attached to the assisted node using the UIView semanticContentAttribute
property.

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
(WebKit::AssistedNodeInformation::AssistedNodeInformation):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectTableViewController initWithView:hasGroups:]):
(-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (200857 => 200858)


--- trunk/Source/WebKit2/ChangeLog	2016-05-13 14:58:53 UTC (rev 200857)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-13 16:06:03 UTC (rev 200858)
@@ -1,3 +1,27 @@
+2016-05-13  Antoine Quint  <[email protected]>
+
+        [iOS] <select> elements popover should render right-aligned when in RTL mode
+        https://bugs.webkit.org/show_bug.cgi?id=157672
+        <rdar://problem/26193442>
+
+        Reviewed by Darin Adler.
+
+        Add a new isRTL field to the AssistedNodeInformation as specified by the assisted
+        node's render style and account for it when displaying the table view shown in the
+        popover attached to the assisted node using the UIView semanticContentAttribute
+        property.
+
+        * Shared/AssistedNodeInformation.cpp:
+        (WebKit::AssistedNodeInformation::encode):
+        (WebKit::AssistedNodeInformation::decode):
+        * Shared/AssistedNodeInformation.h:
+        (WebKit::AssistedNodeInformation::AssistedNodeInformation):
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectTableViewController initWithView:hasGroups:]):
+        (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation):
+
 2016-05-13  Tina Liu  <[email protected]>
 
         Revert r199691.

Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp (200857 => 200858)


--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp	2016-05-13 14:58:53 UTC (rev 200857)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp	2016-05-13 16:06:03 UTC (rev 200858)
@@ -71,6 +71,7 @@
     encoder << hasNextNode;
     encoder << hasPreviousNode;
     encoder << isAutocorrect;
+    encoder << isRTL;
     encoder.encodeEnum(autocapitalizeType);
     encoder.encodeEnum(elementType);
     encoder << formAction;
@@ -112,6 +113,9 @@
     if (!decoder.decode(result.isAutocorrect))
         return false;
 
+    if (!decoder.decode(result.isRTL))
+        return false;
+
     if (!decoder.decodeEnum(result.autocapitalizeType))
         return false;
 

Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.h (200857 => 200858)


--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.h	2016-05-13 14:58:53 UTC (rev 200857)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.h	2016-05-13 16:06:03 UTC (rev 200858)
@@ -100,6 +100,7 @@
         , hasNextNode(false)
         , hasPreviousNode(false)
         , isAutocorrect(false)
+        , isRTL(false)
         , isMultiSelect(false)
         , isReadOnly(false)
         , allowsUserScaling(false)
@@ -119,6 +120,7 @@
     bool hasNextNode;
     bool hasPreviousNode;
     bool isAutocorrect;
+    bool isRTL;
     bool isMultiSelect;
     bool isReadOnly;
     bool allowsUserScaling;

Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm (200857 => 200858)


--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm	2016-05-13 14:58:53 UTC (rev 200857)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm	2016-05-13 16:06:03 UTC (rev 200858)
@@ -122,11 +122,12 @@
         currentIndex++;
     }
     
-    UITextWritingDirection writingDirection = UITextWritingDirectionLeftToRight;
+    UITextWritingDirection writingDirection = _contentView.assistedNodeInformation.isRTL ? UITextWritingDirectionRightToLeft : UITextWritingDirectionLeftToRight;
     BOOL override = NO;
-    // FIXME: retrieve from WebProcess writing direction and override.
     _textAlignment = (writingDirection == UITextWritingDirectionLeftToRight) ? NSTextAlignmentLeft : NSTextAlignmentRight;
     
+    if (writingDirection == UITextWritingDirectionRightToLeft)
+        self.view.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
     [self setTitle:stringWithWritingDirection(_contentView.assistedNodeInformation.title, writingDirection, override)];
     
     return self;
@@ -244,6 +245,7 @@
     if (!cell)
         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:WKPopoverTableViewCellReuseIdentifier] autorelease];
     
+    cell.semanticContentAttribute = self.view.semanticContentAttribute;
     cell.textLabel.textAlignment = _textAlignment;
     
     if (_contentView.assistedNodeInformation.selectOptions.isEmpty()) {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (200857 => 200858)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-05-13 14:58:53 UTC (rev 200857)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-05-13 16:06:03 UTC (rev 200858)
@@ -2512,6 +2512,7 @@
         bool inFixed = false;
         renderer->localToContainerPoint(FloatPoint(), nullptr, UseTransforms, &inFixed);
         information.insideFixedPosition = inFixed;
+        information.isRTL = renderer->style().direction() == RTL;
         
         if (inFixed && elementFrame.isMainFrame()) {
             FrameView* frameView = elementFrame.view();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to