Changeset 68904 in webkit


Ignore:
Timestamp:
Oct 1, 2010 11:25:59 AM (14 years ago)
Author:
rniwa@webkit.org
Message:

2010-09-30 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

Implement queryCommandState('justifyFull')
https://bugs.webkit.org/show_bug.cgi?id=46954

Implemented queryCommandState('justifyFull').
New tests are added to editing/style/inline-style-container.html

  • editing/ApplyStyleCommand.cpp: (WebCore::getTextAlignment): Added support for CSSValueJustify.
  • editing/EditorCommand.cpp: (WebCore::stateJustifyFull): Added. (WebCore::createCommandMap): Added stateJustifyFull.

2010-09-30 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

Implement queryCommandState('justifyFull')
https://bugs.webkit.org/show_bug.cgi?id=46954

Added tests for queryCommandState('justifyFull') to editing/execCommand/query-text-alignment.html

  • editing/execCommand/query-text-alignment-expected.txt:
  • editing/execCommand/script-tests/query-text-alignment.js: (queryTextAlignment): (runRangeTests):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68897 r68904  
     12010-09-30  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement queryCommandState('justifyFull')
     6        https://bugs.webkit.org/show_bug.cgi?id=46954
     7
     8        Added tests for queryCommandState('justifyFull') to editing/execCommand/query-text-alignment.html
     9
     10        * editing/execCommand/query-text-alignment-expected.txt:
     11        * editing/execCommand/script-tests/query-text-alignment.js:
     12        (queryTextAlignment):
     13        (runRangeTests):
     14
    1152010-10-01  David Hyatt  <hyatt@apple.com>
    216
  • trunk/LayoutTests/editing/execCommand/query-text-alignment-expected.txt

    r68465 r68904  
    1 Tests queryCommandState('justifyCenter'), queryCommandState('justifyLeft'), queryCommandState('justifyRight')
     1Tests queryCommandState('justifyCenter'), queryCommandState('justifyFull'), queryCommandState('justifyLeft'), and queryCommandState('justifyRight')
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    99PASS queryCommand('format') returns "" when selecting first position of "<p>hello</p>"
    1010PASS queryCommand('format') returns "center" when selecting first position of "<p align="center">hello</p>"
     11PASS queryCommand('format') returns "full" when selecting first position of "<p align="justify">hello</p>"
    1112PASS queryCommand('format') returns "left" when selecting first position of "<p align="left">hello</p>"
    1213PASS queryCommand('format') returns "right" when selecting first position of "<p align="right">hello</p>"
    1314PASS queryCommand('format') returns "center" when selecting first position of "<p style="text-align: center;">hello</p>"
     15PASS queryCommand('format') returns "full" when selecting first position of "<p style="text-align: justify;">hello</p>"
    1416PASS queryCommand('format') returns "left" when selecting first position of "<p style="text-align: left;">hello</p>"
    1517PASS queryCommand('format') returns "right" when selecting first position of "<p style="text-align: right;">hello</p>"
     18PASS queryCommand('format') returns "full" when selecting first position of "<p align="center" style="text-align: justify;">hello</p>"
    1619PASS queryCommand('format') returns "left" when selecting first position of "<p align="right" style="text-align: left;">hello</p>"
    1720PASS queryCommand('format') returns "right" when selecting first position of "<p align="center" style="text-align: right;">hello</p>"
     
    2225PASS queryCommand('format') returns "" when selecting first position of "<h1>hello</h1>"
    2326PASS queryCommand('format') returns "center" when selecting first position of "<h1 align="center">hello</h1>"
     27PASS queryCommand('format') returns "full" when selecting first position of "<h1 align="justify">hello</h1>"
    2428PASS queryCommand('format') returns "left" when selecting first position of "<h2 align="left">hello</h2>"
    2529PASS queryCommand('format') returns "right" when selecting first position of "<h3 align="right">hello</h3>"
     
    2731PASS queryCommand('format') returns "left" when selecting first position of "<h5 align="left">hello</h5>"
    2832PASS queryCommand('format') returns "right" when selecting first position of "<h6 align="right">hello</h6>"
     33PASS queryCommand('format') returns "full" when selecting first position of "<div align="justify">hello</div>"
    2934PASS queryCommand('format') returns "center" when selecting first position of "<div align="center">hello</div>"
    3035PASS queryCommand('format') returns "left" when selecting first position of "<div align="left">hello</div>"
     
    3742PASS queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p align="right">world</p>"
    3843PASS queryCommand('format') returns "center" when selecting middle of "<p align="center">hello</p><p align="center">world</p>"
     44PASS queryCommand('format') returns "full" when selecting middle of "<p align="justify">hello</p><p align="justify">world</p>"
    3945PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p align="left">world</p>"
    4046PASS queryCommand('format') returns "right" when selecting middle of "<p align="right">hello</p><p align="right">world</p>"
    4147PASS queryCommand('format') returns "" when selecting middle of "<div align="right">hello<p align="left">world</p></div>"
    4248PASS queryCommand('format') returns "" when selecting middle of "<div align="left"><p align="center">world</p>hello</div>"
    43 FAIL queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>" but expected "[object Object]"
     49PASS queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>"
     50PASS queryCommand('format') returns "" when selecting middle of "<p align="justify">hello</p><p>w</p><p align="center">orld</p>"
    4451
    4552Tests for mac
     
    4956PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p align="right">world</p>"
    5057PASS queryCommand('format') returns "center" when selecting middle of "<p align="center">hello</p><p align="center">world</p>"
     58PASS queryCommand('format') returns "full" when selecting middle of "<p align="justify">hello</p><p align="justify">world</p>"
    5159PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p align="left">world</p>"
    5260PASS queryCommand('format') returns "right" when selecting middle of "<p align="right">hello</p><p align="right">world</p>"
    5361PASS queryCommand('format') returns "right" when selecting middle of "<div align="right">hello<p align="left">world</p></div>"
    5462PASS queryCommand('format') returns "center" when selecting middle of "<div align="left"><p align="center">world</p>hello</div>"
    55 FAIL queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>" but expected "[object Object]"
     63PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>"
     64PASS queryCommand('format') returns "full" when selecting middle of "<p align="justify">hello</p><p>w</p><p align="center">orld</p>"
    5665PASS successfullyParsed is true
    5766
  • trunk/LayoutTests/editing/execCommand/script-tests/query-text-alignment.js

    r68465 r68904  
    1 description("Tests queryCommandState('justifyCenter'), queryCommandState('justifyLeft'), queryCommandState('justifyRight')")
     1description("Tests queryCommandState('justifyCenter'), queryCommandState('justifyFull'), queryCommandState('justifyLeft'), and queryCommandState('justifyRight')")
    22
    33var testContainer = document.createElement("div");
     
    1010    var selected = selector(testContainer);
    1111    var center = document.queryCommandState('justifyCenter');
     12    var full = document.queryCommandState('justifyFull');
    1213    var left = document.queryCommandState('justifyLeft');
    1314    var right = document.queryCommandState('justifyRight');
    14     if ((center && left) || (left && right) || (right && center))
    15         testFailed('Inconsistent state when selecting ' + selected + ' of "' + content + '".  More than one of justifyCenter, justifyRight, and justifyLeft returned true.')
     15    if ((center && full) || (full && left) || (left && right) || (right && center))
     16        testFailed('Inconsistent state when selecting ' + selected + ' of "' + content + '".  More than one of justifyCenter, justifyFull, justifyRight, and justifyLeft returned true.')
    1617
    17     var actual = center ? 'center' : left ? 'left' : right ? 'right' : '';
     18    var actual = center ? 'center' : full ? 'full' : left ? 'left' : right ? 'right' : '';
    1819    var action = "queryCommand('format') returns \"" + actual + '" when selecting ' + selected + ' of "' + content + '"';
    1920    if (actual == expected)
     
    4647queryTextAlignment(selectFirstPosition, '<p>hello</p>', '');
    4748queryTextAlignment(selectFirstPosition, '<p align="center">hello</p>', 'center');
     49queryTextAlignment(selectFirstPosition, '<p align="justify">hello</p>', 'full');
    4850queryTextAlignment(selectFirstPosition, '<p align="left">hello</p>', 'left');
    4951queryTextAlignment(selectFirstPosition, '<p align="right">hello</p>', 'right');
    5052queryTextAlignment(selectFirstPosition, '<p style="text-align: center;">hello</p>', 'center');
     53queryTextAlignment(selectFirstPosition, '<p style="text-align: justify;">hello</p>', 'full');
    5154queryTextAlignment(selectFirstPosition, '<p style="text-align: left;">hello</p>', 'left');
    5255queryTextAlignment(selectFirstPosition, '<p style="text-align: right;">hello</p>', 'right');
     56queryTextAlignment(selectFirstPosition, '<p align="center" style="text-align: justify;">hello</p>', 'full');
    5357queryTextAlignment(selectFirstPosition, '<p align="right" style="text-align: left;">hello</p>', 'left');
    5458queryTextAlignment(selectFirstPosition, '<p align="center" style="text-align: right;">hello</p>', 'right');
     
    5963queryTextAlignment(selectFirstPosition, '<h1>hello</h1>', '');
    6064queryTextAlignment(selectFirstPosition, '<h1 align="center">hello</h1>', 'center');
     65queryTextAlignment(selectFirstPosition, '<h1 align="justify">hello</h1>', 'full');
    6166queryTextAlignment(selectFirstPosition, '<h2 align="left">hello</h2>', 'left');
    6267queryTextAlignment(selectFirstPosition, '<h3 align="right">hello</h3>', 'right');
     
    6469queryTextAlignment(selectFirstPosition, '<h5 align="left">hello</h5>', 'left');
    6570queryTextAlignment(selectFirstPosition, '<h6 align="right">hello</h6>', 'right');
     71queryTextAlignment(selectFirstPosition, '<div align="justify">hello</div>', 'full');
    6672queryTextAlignment(selectFirstPosition, '<div align="center">hello</div>', 'center');
    6773queryTextAlignment(selectFirstPosition, '<div align="left">hello</div>', 'left');
     
    7985    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p align="right">world</p>', {'mac': 'left', 'win': ''}[editingBehavior]);
    8086    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="center">hello</p><p align="center">world</p>', 'center');
     87    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="justify">hello</p><p align="justify">world</p>', 'full');
    8188    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p align="left">world</p>', 'left');
    8289    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="right">hello</p><p align="right">world</p>', 'right');
    8390    queryTextAlignment(selectMiddleOfHelloWorld, '<div align="right">hello<p align="left">world</p></div>', {'mac': 'right', 'win': ''}[editingBehavior]);
    8491    queryTextAlignment(selectMiddleOfHelloWorld, '<div align="left"><p align="center">world</p>hello</div>', {'mac': 'center', 'win': ''}[editingBehavior]);
    85     queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p>w</p><p align="left">orld</p>', {'mac': 'left', 'win': ''});
     92    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p>w</p><p align="left">orld</p>', {'mac': 'left', 'win': ''}[editingBehavior]);
     93    queryTextAlignment(selectMiddleOfHelloWorld, '<p align="justify">hello</p><p>w</p><p align="center">orld</p>', {'mac': 'full', 'win': ''}[editingBehavior]);
    8694}
    8795
  • trunk/WebCore/ChangeLog

    r68902 r68904  
     12010-09-30  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement queryCommandState('justifyFull')
     6        https://bugs.webkit.org/show_bug.cgi?id=46954
     7
     8        Implemented queryCommandState('justifyFull').
     9        New tests are added to editing/style/inline-style-container.html
     10
     11        * editing/ApplyStyleCommand.cpp:
     12        (WebCore::getTextAlignment): Added support for CSSValueJustify.
     13        * editing/EditorCommand.cpp:
     14        (WebCore::stateJustifyFull): Added.
     15        (WebCore::createCommandMap): Added stateJustifyFull.
     16
    1172010-10-01  Jia Pu  <jpu@apple.com>
    218
  • trunk/WebCore/editing/ApplyStyleCommand.cpp

    r68830 r68904  
    396396    case CSSValueWebkitCenter:
    397397        return CSSValueCenter;
     398    case CSSValueJustify:
     399        return CSSValueJustify;
    398400    case CSSValueLeft:
    399401    case CSSValueWebkitLeft:
  • trunk/WebCore/editing/EditorCommand.cpp

    r68670 r68904  
    13031303{
    13041304    return stateStyle(frame, CSSPropertyTextAlign, "center");
     1305}
     1306
     1307static TriState stateJustifyFull(Frame* frame, Event*)
     1308{
     1309    return stateStyle(frame, CSSPropertyTextAlign, "justify");
    13051310}
    13061311
     
    14101415        { "Italic", { executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14111416        { "JustifyCenter", { executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1412         { "JustifyFull", { executeJustifyFull, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1417        { "JustifyFull", { executeJustifyFull, supported, enabledInRichlyEditableText, stateJustifyFull, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14131418        { "JustifyLeft", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    14141419        { "JustifyNone", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
Note: See TracChangeset for help on using the changeset viewer.