⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 201397 in webkit


Ignore:
Timestamp:
May 25, 2016, 12:41:34 PM (10 years ago)
Author:
Alan Bujtas
Message:

Swap search field's cancel and result button for RTL content.
https://bugs.webkit.org/show_bug.cgi?id=158007

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/forms/search-input-rtl.html

  • css/html.css:

(input[type="search"]::-webkit-textfield-decoration-container): Deleted.

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintSearchFieldCancelButton):
(WebCore::RenderThemeMac::paintSearchFieldResultsButton):

LayoutTests:

  • fast/forms/resources/common.js:

(searchCancelButtonPositionRTL):
(searchCancelButtonPosition):

  • fast/forms/search-input-rtl.html: Added.
  • fast/forms/search-rtl.html:
  • platform/ios-simulator-wk2/fast/forms/search-rtl-expected.txt:
  • platform/ios-simulator/fast/css/text-overflow-input-expected.txt:
  • platform/ios-simulator/fast/forms/search-input-rtl-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-input-expected.txt:
  • platform/mac/fast/forms/placeholder-position-expected.txt:
  • platform/mac/fast/forms/search-input-rtl-expected.png: Added.
  • platform/mac/fast/forms/search-input-rtl-expected.txt: Added.
  • platform/mac/fast/forms/search-rtl-expected.txt:
Location:
trunk
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201394 r201397  
     12016-05-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        Swap search field's cancel and result button for RTL content.
     4        https://bugs.webkit.org/show_bug.cgi?id=158007
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/forms/resources/common.js:
     9        (searchCancelButtonPositionRTL):
     10        (searchCancelButtonPosition):
     11        * fast/forms/search-input-rtl.html: Added.
     12        * fast/forms/search-rtl.html:
     13        * platform/ios-simulator-wk2/fast/forms/search-rtl-expected.txt:
     14        * platform/ios-simulator/fast/css/text-overflow-input-expected.txt:
     15        * platform/ios-simulator/fast/forms/search-input-rtl-expected.txt: Added.
     16        * platform/mac/fast/css/text-overflow-input-expected.txt:
     17        * platform/mac/fast/forms/placeholder-position-expected.txt:
     18        * platform/mac/fast/forms/search-input-rtl-expected.png: Added.
     19        * platform/mac/fast/forms/search-input-rtl-expected.txt: Added.
     20        * platform/mac/fast/forms/search-rtl-expected.txt:
     21
    1222016-05-25  Myles C. Maxfield  <mmaxfield@apple.com>
    223
  • trunk/LayoutTests/fast/forms/resources/common.js

    r130293 r201397  
    101101}
    102102
    103 function searchCancelButtonPosition(element) {
     103function searchCancelButtonPositionRTL(element) {
     104        return searchCancelButtonPosition(element, true);
     105}
     106
     107function searchCancelButtonPosition(element, isRTL = false) {
    104108    var pos = {};
    105     pos.x = element.offsetLeft + element.offsetWidth - 9;
     109    pos.x = element.offsetLeft + (isRTL ? 9 : (element.offsetWidth - 9));
    106110    pos.y = element.offsetTop + element.offsetHeight / 2;
    107111    return pos;
  • trunk/LayoutTests/fast/forms/search-rtl.html

    r90306 r201397  
    2323        if (window.eventSender) {
    2424            var target = $("target");
    25             var pos = searchCancelButtonPosition(target);
     25            var pos = searchCancelButtonPositionRTL(target);
    2626            eventSender.mouseMoveTo(pos.x, pos.y);
    2727            eventSender.mouseDown();
  • trunk/LayoutTests/platform/ios-simulator-wk2/fast/forms/search-rtl-expected.txt

    r177430 r201397  
    1919        RenderTextControl {INPUT} at (2,2) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    2020          RenderFlexibleBox {DIV} at (6,2) size 123x16
     21            RenderBlock {DIV} at (122,7) size 0x0
     22            RenderBlock {DIV} at (0,0) size 123x15
    2123            RenderBlock {DIV} at (0,7) size 0x0
    22             RenderBlock {DIV} at (0,0) size 123x15
    23             RenderBlock {DIV} at (122,7) size 0x0
    2424        RenderText {#text} at (139,0) size 5x19
    2525          text run at (139,0) width 5: " "
     
    2727        RenderTextControl {INPUT} at (2,27) size 197x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    2828          RenderFlexibleBox {DIV} at (6,2) size 185x16
     29            RenderBlock {DIV} at (183,7) size 0x0
     30            RenderBlock {DIV} at (0,0) size 184x15
    2931            RenderBlock {DIV} at (0,7) size 0x0
    30             RenderBlock {DIV} at (0,0) size 184x15
    31             RenderBlock {DIV} at (183,7) size 0x0
    3232        RenderText {#text} at (200,25) size 5x19
    3333          text run at (200,25) width 5: " "
     
    3535        RenderTextControl {INPUT} at (2,52) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    3636          RenderFlexibleBox {DIV} at (6,3) size 123x15
     37            RenderBlock {DIV} at (122,7) size 0x0
     38            RenderBlock {DIV} at (0,0) size 123x14
    3739            RenderBlock {DIV} at (0,7) size 0x0
    38             RenderBlock {DIV} at (0,0) size 123x14
    39             RenderBlock {DIV} at (122,7) size 0x0
    4040        RenderText {#text} at (0,0) size 0x0
    4141      RenderBlock {P} at (0,127) size 784x20
  • trunk/LayoutTests/platform/ios-simulator/fast/css/text-overflow-input-expected.txt

    r181242 r201397  
    3838        RenderTextControl {INPUT} at (145,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    3939          RenderFlexibleBox {DIV} at (6,3) size 123x15
    40             RenderBlock {DIV} at (0,7) size 0x0
    41             RenderBlock {DIV} at (0,0) size 123x14
    42             RenderBlock {DIV} at (122,7) size 0x0
     40            RenderBlock {DIV} at (122,7) size 0x0
     41            RenderBlock {DIV} at (0,0) size 123x14
     42            RenderBlock {DIV} at (0,7) size 0x0
    4343        RenderText {#text} at (282,46) size 5x19
    4444          text run at (282,46) width 5: " "
     
    4848        RenderTextControl {INPUT} at (432,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    4949          RenderFlexibleBox {DIV} at (6,3) size 123x15
    50             RenderBlock {DIV} at (0,7) size 0x0
    51             RenderBlock {DIV} at (0,0) size 123x14
    52             RenderBlock {DIV} at (122,7) size 0x0
     50            RenderBlock {DIV} at (122,7) size 0x0
     51            RenderBlock {DIV} at (0,0) size 123x14
     52            RenderBlock {DIV} at (0,7) size 0x0
    5353        RenderText {#text} at (569,46) size 5x19
    5454          text run at (569,46) width 5: " "
     
    8686        RenderTextControl {INPUT} at (145,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    8787          RenderFlexibleBox {DIV} at (6,3) size 123x15
    88             RenderBlock {DIV} at (0,7) size 0x0
    89             RenderBlock {DIV} at (0,0) size 123x14
    90             RenderBlock {DIV} at (122,7) size 0x0
     88            RenderBlock {DIV} at (122,7) size 0x0
     89            RenderBlock {DIV} at (0,0) size 123x14
     90            RenderBlock {DIV} at (0,7) size 0x0
    9191        RenderText {#text} at (282,46) size 5x19
    9292          text run at (282,46) width 5: " "
     
    9696        RenderTextControl {INPUT} at (432,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
    9797          RenderFlexibleBox {DIV} at (6,3) size 123x15
    98             RenderBlock {DIV} at (0,7) size 0x0
    99             RenderBlock {DIV} at (0,0) size 123x14
    100             RenderBlock {DIV} at (122,7) size 0x0
     98            RenderBlock {DIV} at (122,7) size 0x0
     99            RenderBlock {DIV} at (0,0) size 123x14
     100            RenderBlock {DIV} at (0,7) size 0x0
    101101        RenderText {#text} at (569,46) size 5x19
    102102          text run at (569,46) width 5: " "
  • trunk/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt

    r200915 r201397  
    4040        RenderTextControl {INPUT} at (146,43) size 164x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    4141          RenderFlexibleBox {DIV} at (3,0) size 158x19
    42             RenderBlock {DIV} at (0,0) size 8x19
    43             RenderBlock {DIV} at (8,3) size 131x13
    44             RenderBlock {DIV} at (138,0) size 20x19
     42            RenderBlock {DIV} at (149,0) size 9x19
     43            RenderBlock {DIV} at (19,3) size 131x13
     44            RenderBlock {DIV} at (0,0) size 19x19
    4545        RenderText {#text} at (311,43) size 5x18
    4646          text run at (311,43) width 5: " "
     
    5050        RenderTextControl {INPUT} at (462,43) size 164x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    5151          RenderFlexibleBox {DIV} at (3,0) size 158x19
    52             RenderBlock {DIV} at (0,0) size 8x19
    53             RenderBlock {DIV} at (8,3) size 131x13
    54             RenderBlock {DIV} at (138,0) size 20x19
     52            RenderBlock {DIV} at (149,0) size 9x19
     53            RenderBlock {DIV} at (19,3) size 131x13
     54            RenderBlock {DIV} at (0,0) size 19x19
    5555        RenderText {#text} at (627,43) size 5x18
    5656          text run at (627,43) width 5: " "
     
    9292        RenderTextControl {INPUT} at (146,43) size 164x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    9393          RenderFlexibleBox {DIV} at (3,0) size 158x19
    94             RenderBlock {DIV} at (0,0) size 8x19
    95             RenderBlock {DIV} at (8,3) size 131x13
    96             RenderBlock {DIV} at (138,0) size 20x19
     94            RenderBlock {DIV} at (149,0) size 9x19
     95            RenderBlock {DIV} at (19,3) size 131x13
     96            RenderBlock {DIV} at (0,0) size 19x19
    9797        RenderText {#text} at (311,43) size 5x18
    9898          text run at (311,43) width 5: " "
     
    102102        RenderTextControl {INPUT} at (462,43) size 164x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    103103          RenderFlexibleBox {DIV} at (3,0) size 158x19
    104             RenderBlock {DIV} at (0,0) size 8x19
    105             RenderBlock {DIV} at (8,3) size 131x13
    106             RenderBlock {DIV} at (138,0) size 20x19
     104            RenderBlock {DIV} at (149,0) size 9x19
     105            RenderBlock {DIV} at (19,3) size 131x13
     106            RenderBlock {DIV} at (0,0) size 19x19
    107107        RenderText {#text} at (627,43) size 5x18
    108108          text run at (627,43) width 5: " "
     
    163163layer at (13,96) size 130x13
    164164  RenderBlock {DIV} at (3,3) size 131x13
    165 layer at (165,96) size 130x13 scrollX 160 scrollWidth 291
    166   RenderBlock {DIV} at (11,3) size 131x13 [color=#A9A9A9]
    167     RenderText {#text} at (-160,0) size 292x13
    168       text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
    169 layer at (165,96) size 130x13
     165layer at (176,96) size 130x13 scrollX 160 scrollWidth 291
     166  RenderBlock {DIV} at (22,3) size 131x13 [color=#A9A9A9]
     167    RenderText {#text} at (-160,0) size 292x13
     168      text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
     169layer at (176,96) size 130x13
    170170  RenderBlock {DIV} at (0,0) size 131x13
    171171layer at (329,96) size 130x13 scrollX 160 scrollWidth 291
     
    173173    RenderText {#text} at (-160,0) size 292x13
    174174      text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
    175 layer at (481,96) size 130x13 scrollX 160 scrollWidth 291
     175layer at (492,96) size 130x13 scrollX 160 scrollWidth 291
    176176  RenderBlock {DIV} at (0,0) size 131x13
    177177    RenderText {#text} at (-160,0) size 292x13
     
    211211layer at (13,176) size 130x13
    212212  RenderBlock {DIV} at (3,3) size 131x13
    213 layer at (165,176) size 130x13 scrollX 160 scrollWidth 291
    214   RenderBlock {DIV} at (11,3) size 131x13 [color=#A9A9A9]
    215     RenderText {#text} at (-160,0) size 292x13
    216       text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
    217 layer at (165,176) size 130x13
     213layer at (176,176) size 130x13 scrollX 160 scrollWidth 291
     214  RenderBlock {DIV} at (22,3) size 131x13 [color=#A9A9A9]
     215    RenderText {#text} at (-160,0) size 292x13
     216      text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
     217layer at (176,176) size 130x13
    218218  RenderBlock {DIV} at (0,0) size 131x13
    219219layer at (329,176) size 130x13 scrollX 160 scrollWidth 291
     
    221221    RenderText {#text} at (-160,0) size 292x13
    222222      text run at (-160,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
    223 layer at (481,176) size 130x13 scrollX 160 scrollWidth 291
     223layer at (492,176) size 130x13 scrollX 160 scrollWidth 291
    224224  RenderBlock {DIV} at (0,0) size 131x13
    225225    RenderText {#text} at (-160,0) size 292x13
  • trunk/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt

    r198497 r201397  
    1414      RenderTextControl {INPUT} at (2,48) size 164x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    1515        RenderFlexibleBox {DIV} at (3,0) size 158x19
    16           RenderBlock {DIV} at (0,0) size 8x19
    17           RenderBlock {DIV} at (8,3) size 131x13
    18           RenderBlock {DIV} at (138,0) size 20x19
     16          RenderBlock {DIV} at (149,0) size 9x19
     17          RenderBlock {DIV} at (19,3) size 131x13
     18          RenderBlock {DIV} at (0,0) size 19x19
    1919      RenderBR {BR} at (167,62) size 1x0
    2020      RenderTextControl {INPUT} at (2,71) size 178x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
     
    6060layer at (13,36) size 130x13
    6161  RenderBlock {DIV} at (3,3) size 131x13
    62 layer at (21,59) size 130x13
    63   RenderBlock {DIV} at (11,3) size 131x13 [color=#A9A9A9]
     62layer at (32,59) size 130x13
     63  RenderBlock {DIV} at (22,3) size 131x13 [color=#A9A9A9]
    6464    RenderText {#text} at (68,0) size 63x13
    6565      text run at (68,0) width 63: "placeholder"
    66 layer at (21,59) size 130x13
     66layer at (32,59) size 130x13
    6767  RenderBlock {DIV} at (0,0) size 131x13
    6868layer at (35,82) size 130x13
  • trunk/LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt

    r198497 r201397  
    1919        RenderTextControl {INPUT} at (2,2) size 178x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    2020          RenderFlexibleBox {DIV} at (3,0) size 172x19
    21             RenderBlock {DIV} at (0,0) size 22x19
    22             RenderBlock {DIV} at (22,3) size 131x13
    23             RenderBlock {DIV} at (152,0) size 20x19
     21            RenderBlock {DIV} at (149,0) size 23x19
     22            RenderBlock {DIV} at (19,3) size 131x13
     23            RenderBlock {DIV} at (0,0) size 19x19
    2424        RenderText {#text} at (181,2) size 5x18
    2525          text run at (181,2) width 5: " "
     
    2727        RenderTextControl {INPUT} at (2,25) size 243x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    2828          RenderFlexibleBox {DIV} at (3,0) size 237x19
    29             RenderBlock {DIV} at (0,0) size 22x19
    30             RenderBlock {DIV} at (22,3) size 196x13
    31             RenderBlock {DIV} at (217,0) size 20x19
     29            RenderBlock {DIV} at (214,0) size 23x19
     30            RenderBlock {DIV} at (19,3) size 196x13
     31            RenderBlock {DIV} at (0,0) size 19x19
    3232        RenderText {#text} at (246,25) size 5x18
    3333          text run at (246,25) width 5: " "
     
    3535        RenderTextControl {INPUT} at (2,48) size 178x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
    3636          RenderFlexibleBox {DIV} at (3,0) size 172x19
    37             RenderBlock {DIV} at (0,0) size 22x19
    38             RenderBlock {DIV} at (22,3) size 131x13
    39             RenderBlock {DIV} at (152,0) size 20x19
     37            RenderBlock {DIV} at (149,0) size 23x19
     38            RenderBlock {DIV} at (19,3) size 131x13
     39            RenderBlock {DIV} at (0,0) size 19x19
    4040        RenderText {#text} at (0,0) size 0x0
    4141      RenderBlock {P} at (0,119) size 784x18
    4242        RenderText {#text} at (0,0) size 37x18
    4343          text run at (0,0) width 37: "PASS"
    44 layer at (35,47) size 130x13 scrollX 3 scrollWidth 134
     44layer at (32,47) size 130x13 scrollX 3 scrollWidth 134
    4545  RenderBlock {DIV} at (0,0) size 131x13
    4646    RenderText {#text} at (-3,0) size 135x13
     
    5050      text run at (80,0) width 14: "he"
    5151      text run at (93,0) width 38 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5D6}\x{5D4} "
    52 layer at (35,70) size 196x13
     52layer at (32,70) size 196x13
    5353  RenderBlock {DIV} at (0,0) size 196x13
    5454    RenderText {#text} at (61,0) size 135x13
     
    5858      text run at (145,0) width 14: "he"
    5959      text run at (158,0) width 38 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5D6}\x{5D4} "
    60 layer at (35,93) size 130x13
     60layer at (32,93) size 130x13
    6161  RenderBlock {DIV} at (0,0) size 131x13
    6262caret: position 0 of child 0 {DIV} of child 1 {DIV} of child 0 {DIV} of {#document-fragment} of child 9 {INPUT} of child 3 {P} of body
  • trunk/Source/WebCore/ChangeLog

    r201394 r201397  
     12016-05-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        Swap search field's cancel and result button for RTL content.
     4        https://bugs.webkit.org/show_bug.cgi?id=158007
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: fast/forms/search-input-rtl.html
     9
     10        * css/html.css:
     11        (input[type="search"]::-webkit-textfield-decoration-container): Deleted.
     12        * rendering/RenderThemeMac.mm:
     13        (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
     14        (WebCore::RenderThemeMac::paintSearchFieldResultsButton):
     15
    1162016-05-25  Myles C. Maxfield  <mmaxfield@apple.com>
    217
  • trunk/Source/WebCore/css/html.css

    r200075 r201397  
    412412}
    413413
    414 input[type="search"]::-webkit-textfield-decoration-container {
    415     direction: ltr;
    416 }
    417 
    418414input::-webkit-clear-button {
    419415    -webkit-appearance: searchfield-cancel-button;
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r200596 r201397  
    17401740
    17411741    FloatRect localBounds = adjustedCancelButtonRect([search cancelButtonRectForBounds:NSRect(snappedIntRect(inputBox.contentBoxRect()))]);
     1742    // Adjust position based on the content direction.
     1743    float adjustedXPosition;
     1744    if (box.style().direction() == RTL)
     1745        adjustedXPosition = inputBox.contentBoxRect().x();
     1746    else
     1747        adjustedXPosition = inputBox.contentBoxRect().maxX() - localBounds.size().width();
     1748   
     1749    localBounds.setX(adjustedXPosition);
    17421750    FloatPoint paintingPos = convertToPaintingPosition(inputBox, box, localBounds.location(), r.location());
    17431751
     
    18691877
    18701878    FloatRect localBounds = adjustedResultButtonRect([search searchButtonRectForBounds:NSRect(snappedIntRect(inputBox.contentBoxRect()))]);
     1879    // Adjust position based on the content direction.
     1880    float adjustedXPosition;
     1881    if (box.style().direction() == RTL)
     1882        adjustedXPosition = inputBox.contentBoxRect().maxX() - localBounds.size().width();
     1883    else
     1884        adjustedXPosition = inputBox.contentBoxRect().x();
     1885    localBounds.setX(adjustedXPosition);
    18711886    FloatPoint paintingPos = convertToPaintingPosition(inputBox, box, localBounds.location(), r.location());
    18721887   
Note: See TracChangeset for help on using the changeset viewer.