Changeset 39114 in webkit


Ignore:
Timestamp:
Dec 8, 2008 4:15:34 PM (15 years ago)
Author:
Darin Adler
Message:

WebCore:

2008-12-03 Darin Adler <Darin Adler>

Reviewed by John Sullivan.

Tests: editing/execCommand/enabling-and-selection-2.html

editing/execCommand/enabling-and-selection.html

  • editing/EditorCommand.cpp: Updated table to use these functions by their new names. (WebCore::enabledVisibleSelection): Renamed this to reflect its new algorithm. An invisible selection with a position that selects no characters doesn't count as a visible selection. (WebCore::enabledVisibleSelectionAndMark): Ditto.

WebKitTools:

2008-12-08 Darin Adler <Darin Adler>

Reviewed by John Sullivan.

  • DumpRenderTree/LayoutTestController.cpp: (isCommandEnabledCallback): Added. (LayoutTestController::staticFunctions): Added "isCommandEnabled".
  • DumpRenderTree/LayoutTestController.h: Ditto.
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::isCommandEnabled): Ditto.
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (-[CommandValidationTarget initWithAction:]): Added. Used to get the command validation system to tell us if a comment is enabled. (-[CommandValidationTarget action]): Ditto. (-[CommandValidationTarget tag]): Ditto. (LayoutTestController::isCommandEnabled): Ditto.
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::isCommandEnabled): Ditto.

LayoutTests:

2008-12-08 Darin Adler <Darin Adler>

Reviewed by John Sullivan.

  • editing/execCommand/enabling-and-selection-2-expected.txt: Added.
  • editing/execCommand/enabling-and-selection-2.html: Added.
  • editing/execCommand/enabling-and-selection-expected.txt: Added.
  • editing/execCommand/enabling-and-selection.html: Added.
  • editing/execCommand/resources: Added.
  • editing/execCommand/resources/TEMPLATE.html: Copied from LayoutTests/fast/js/resources/TEMPLATE.html.
  • editing/execCommand/resources/enabling-and-selection-2.js: Added.
  • editing/execCommand/resources/enabling-and-selection.js: Added.
  • fast/canvas/canvas-setTransform.html: Let make-js-test-wrappers update this.
  • fast/canvas/canvas-strokeRect.html: Ditto.
  • platform/qt/Skipped: Added enabling-and-selection-2 to the skipped list.
  • platform/win/Skipped: Ditto.
Location:
trunk
Files:
7 added
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r39110 r39114  
     12008-12-08  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - tests for https://bugs.webkit.org/show_bug.cgi?id=22409
     6          REGRESSION: cmd-shift-left/right don't switch tabs, instead select text
     7
     8        * editing/execCommand/enabling-and-selection-2-expected.txt: Added.
     9        * editing/execCommand/enabling-and-selection-2.html: Added.
     10        * editing/execCommand/enabling-and-selection-expected.txt: Added.
     11        * editing/execCommand/enabling-and-selection.html: Added.
     12        * editing/execCommand/resources: Added.
     13        * editing/execCommand/resources/TEMPLATE.html: Copied from LayoutTests/fast/js/resources/TEMPLATE.html.
     14        * editing/execCommand/resources/enabling-and-selection-2.js: Added.
     15        * editing/execCommand/resources/enabling-and-selection.js: Added.
     16
     17        * fast/canvas/canvas-setTransform.html: Let make-js-test-wrappers update this.
     18        * fast/canvas/canvas-strokeRect.html: Ditto.
     19
     20        * platform/qt/Skipped: Added enabling-and-selection-2 to the skipped list.
     21        * platform/win/Skipped: Ditto.
     22
    1232008-12-08  Pamela Greene  <pam@chromium.org>
    224
  • trunk/LayoutTests/editing/execCommand/resources/TEMPLATE.html

    r39099 r39114  
    22<html>
    33<head>
    4 <link rel="stylesheet" href="resources/js-test-style.css">
    5 <script src="resources/js-test-pre.js"></script>
     4<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
     5<script src="../../fast/js/resources/js-test-pre.js"></script>
    66</head>
    77<body>
     
    99<div id="console"></div>
    1010<script src="YOUR_JS_FILE_HERE"></script>
    11 <script src="resources/js-test-post.js"></script>
     11<script src="../../fast/js/resources/js-test-post.js"></script>
    1212</body>
    1313</html>
  • trunk/LayoutTests/fast/canvas/canvas-setTransform.html

    r39079 r39114  
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     2<html>
     3<head>
    14<link rel="stylesheet" href="../js/resources/js-test-style.css">
    25<script src="../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
    38<p id="description"></p>
    49<div id="console"></div>
    510<script src="resources/canvas-setTransform.js"></script>
    611<script src="../js/resources/js-test-post.js"></script>
     12</body>
     13</html>
  • trunk/LayoutTests/fast/canvas/canvas-strokeRect.html

    r39080 r39114  
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     2<html>
     3<head>
    14<link rel="stylesheet" href="../js/resources/js-test-style.css">
    25<script src="../js/resources/js-test-pre.js"></script>
     6</head>
     7<body>
    38<p id="description"></p>
    49<div id="console"></div>
    510<script src="resources/canvas-strokeRect.js"></script>
    611<script src="../js/resources/js-test-post.js"></script>
     12</body>
     13</html>
  • trunk/LayoutTests/platform/qt/Skipped

    r38884 r39114  
    1313# ------- failing editing tests
    1414editing/deleting/delete-to-end-of-paragraph.html
     15editing/execCommand/enabling-and-selection-2.html
    1516editing/execCommand/italicizeByCharacter.html
    1617editing/execCommand/nsresponder-indent.html
  • trunk/LayoutTests/platform/win/Skipped

    r38957 r39114  
    354354editing/pasteboard/undoable-fragment-removes.html
    355355
     356# Command enabling
     357editing/execCommand/enabling-and-selection-2.html
     358
    356359################################################################################
    357360######################### All of above may be related ##########################
  • trunk/WebCore/ChangeLog

    r39112 r39114  
     12008-12-03  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - fix https://bugs.webkit.org/show_bug.cgi?id=22409
     6          REGRESSION: cmd-shift-left/right don't switch tabs, instead select text
     7
     8        Tests: editing/execCommand/enabling-and-selection-2.html
     9               editing/execCommand/enabling-and-selection.html
     10
     11        * editing/EditorCommand.cpp: Updated table to use these functions by their new names.
     12        (WebCore::enabledVisibleSelection): Renamed this to reflect its new algorithm.
     13        An invisible selection with a position that selects no characters doesn't count
     14        as a visible selection.
     15        (WebCore::enabledVisibleSelectionAndMark): Ditto.
     16
    1172008-12-08  David Kilzer  <ddkilzer@apple.com>
    218
  • trunk/WebCore/editing/EditorCommand.cpp

    r38629 r39114  
    10311031}
    10321032
    1033 static bool enabledAnySelection(Frame* frame, Event*, EditorCommandSource)
    1034 {
    1035     return frame->selection()->isCaretOrRange();
    1036 }
    1037 
    1038 static bool enabledAnySelectionAndMark(Frame* frame, Event*, EditorCommandSource)
    1039 {
    1040     return frame->selection()->isCaretOrRange() && frame->mark().isCaretOrRange();
     1033static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource)
     1034{
     1035    // The term "visible" here includes a caret in editable text or a range in any text.
     1036    const Selection& selection = frame->editor()->selectionForCommand(event);
     1037    return (selection.isCaret() && selection.isContentEditable()) || selection.isRange();
     1038}
     1039
     1040static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource)
     1041{
     1042    const Selection& selection = frame->editor()->selectionForCommand(event);
     1043    return ((selection.isCaret() && selection.isContentEditable()) || selection.isRange())
     1044        && frame->mark().isCaretOrRange();
    10411045}
    10421046
     
    12621266        { "MakeTextWritingDirectionRightToLeft", { executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12631267        { "MoveBackward", { executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1264         { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1268        { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12651269        { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1266         { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1270        { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12671271        { "MoveForward", { executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1268         { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1272        { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12691273        { "MoveLeft", { executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1270         { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1274        { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12711275        { "MovePageDown", { executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1272         { "MovePageDownAndModifySelection", { executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1276        { "MovePageDownAndModifySelection", { executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12731277        { "MovePageUp", { executeMovePageUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1274         { "MovePageUpAndModifySelection", { executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1275         { "MoveParagraphBackwardAndModifySelection", { executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1276         { "MoveParagraphForwardAndModifySelection", { executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1278        { "MovePageUpAndModifySelection", { executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1279        { "MoveParagraphBackwardAndModifySelection", { executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1280        { "MoveParagraphForwardAndModifySelection", { executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12771281        { "MoveRight", { executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1278         { "MoveRightAndModifySelection", { executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1282        { "MoveRightAndModifySelection", { executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12791283        { "MoveToBeginningOfDocument", { executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1280         { "MoveToBeginningOfDocumentAndModifySelection", { executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1284        { "MoveToBeginningOfDocumentAndModifySelection", { executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12811285        { "MoveToBeginningOfLine", { executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1282         { "MoveToBeginningOfLineAndModifySelection", { executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1286        { "MoveToBeginningOfLineAndModifySelection", { executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12831287        { "MoveToBeginningOfParagraph", { executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1284         { "MoveToBeginningOfParagraphAndModifySelection", { executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1288        { "MoveToBeginningOfParagraphAndModifySelection", { executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12851289        { "MoveToBeginningOfSentence", { executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1286         { "MoveToBeginningOfSentenceAndModifySelection", { executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1290        { "MoveToBeginningOfSentenceAndModifySelection", { executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12871291        { "MoveToEndOfDocument", { executeMoveToEndOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1288         { "MoveToEndOfDocumentAndModifySelection", { executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1292        { "MoveToEndOfDocumentAndModifySelection", { executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12891293        { "MoveToEndOfLine", { executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1290         { "MoveToEndOfLineAndModifySelection", { executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1294        { "MoveToEndOfLineAndModifySelection", { executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12911295        { "MoveToEndOfParagraph", { executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1292         { "MoveToEndOfParagraphAndModifySelection", { executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1296        { "MoveToEndOfParagraphAndModifySelection", { executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12931297        { "MoveToEndOfSentence", { executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1294         { "MoveToEndOfSentenceAndModifySelection", { executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1298        { "MoveToEndOfSentenceAndModifySelection", { executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12951299        { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1296         { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1300        { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12971301        { "MoveWordBackward", { executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1298         { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1302        { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    12991303        { "MoveWordForward", { executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1300         { "MoveWordForwardAndModifySelection", { executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1304        { "MoveWordForwardAndModifySelection", { executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13011305        { "MoveWordLeft", { executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1302         { "MoveWordLeftAndModifySelection", { executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1306        { "MoveWordLeftAndModifySelection", { executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13031307        { "MoveWordRight", { executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1304         { "MoveWordRightAndModifySelection", { executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1308        { "MoveWordRightAndModifySelection", { executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13051309        { "Outdent", { executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13061310        { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
     
    13101314        { "RemoveFormat", { executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13111315        { "SelectAll", { executeSelectAll, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1312         { "SelectLine", { executeSelectLine, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1313         { "SelectParagraph", { executeSelectParagraph, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1314         { "SelectSentence", { executeSelectSentence, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1315         { "SelectToMark", { executeSelectToMark, supportedFromMenuOrKeyBinding, enabledAnySelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1316         { "SelectWord", { executeSelectWord, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1317         { "SetMark", { executeSetMark, supportedFromMenuOrKeyBinding, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1316        { "SelectLine", { executeSelectLine, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1317        { "SelectParagraph", { executeSelectParagraph, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1318        { "SelectSentence", { executeSelectSentence, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1319        { "SelectToMark", { executeSelectToMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1320        { "SelectWord", { executeSelectWord, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1321        { "SetMark", { executeSetMark, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13181322        { "Strikethrough", { executeStrikethrough, supported, enabledInRichlyEditableText, stateStrikethrough, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13191323        { "Subscript", { executeSubscript, supported, enabledInRichlyEditableText, stateSubscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13201324        { "Superscript", { executeSuperscript, supported, enabledInRichlyEditableText, stateSuperscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1321         { "SwapWithMark", { executeSwapWithMark, supportedFromMenuOrKeyBinding, enabledAnySelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1325        { "SwapWithMark", { executeSwapWithMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13221326        { "ToggleBold", { executeToggleBold, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13231327        { "ToggleItalic", { executeToggleItalic, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     
    13281332        { "Unlink", { executeUnlink, supported, enabledRangeInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13291333        { "Unscript", { executeUnscript, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1330         { "Unselect", { executeUnselect, supported, enabledAnySelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     1334        { "Unselect", { executeUnselect, supported, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13311335        { "Yank", { executeYank, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    13321336        { "YankAndSelect", { executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
  • trunk/WebKitTools/ChangeLog

    r39109 r39114  
     12008-12-08  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - test machinery for https://bugs.webkit.org/show_bug.cgi?id=22409
     6          REGRESSION: cmd-shift-left/right don't switch tabs, instead select text
     7
     8        * DumpRenderTree/LayoutTestController.cpp:
     9        (isCommandEnabledCallback): Added.
     10        (LayoutTestController::staticFunctions): Added "isCommandEnabled".
     11        * DumpRenderTree/LayoutTestController.h: Ditto.
     12        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     13        (LayoutTestController::isCommandEnabled): Ditto.
     14        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     15        (-[CommandValidationTarget initWithAction:]): Added. Used to get the
     16        command validation system to tell us if a comment is enabled.
     17        (-[CommandValidationTarget action]): Ditto.
     18        (-[CommandValidationTarget tag]): Ditto.
     19        (LayoutTestController::isCommandEnabled): Ditto.
     20        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     21        (LayoutTestController::isCommandEnabled): Ditto.
     22
    1232008-12-08  David Kilzer  <ddkilzer@apple.com>
    224
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r38735 r39114  
    334334}
    335335
     336static JSValueRef isCommandEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     337{
     338    // Has Mac implementation.
     339
     340    if (argumentCount < 1)
     341        return JSValueMakeUndefined(context);
     342
     343    JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception));
     344    ASSERT(!*exception);
     345
     346    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     347
     348    return JSValueMakeBoolean(context, controller->isCommandEnabled(name.get()));
     349}
     350
    336351static JSValueRef keepWebHistoryCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    337352{
     
    781796        { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    782797        { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     798        { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    783799        { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    784800        { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r38735 r39114  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4949    void execCommand(JSStringRef name, JSStringRef value);
    5050    void display();
     51    bool isCommandEnabled(JSStringRef name);
    5152    void keepWebHistory();
    5253    void notifyDone();
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r38739 r39114  
    255255}
    256256
     257bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
     258{
     259    // FIXME: implement
     260    return false;
     261}
     262
    257263void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
    258264{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r38735 r39114  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5656#import <wtf/RetainPtr.h>
    5757
     58@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
     59{
     60    SEL _action;
     61}
     62- (id)initWithAction:(SEL)action;
     63@end
     64
     65@implementation CommandValidationTarget
     66
     67- (id)initWithAction:(SEL)action
     68{
     69    self = [super init];
     70    if (!self)
     71        return nil;
     72
     73    _action = action;
     74    return self;
     75}
     76
     77- (SEL)action
     78{
     79    return _action;
     80}
     81
     82- (NSInteger)tag
     83{
     84    return 0;
     85}
     86
     87@end
     88
    5889LayoutTestController::~LayoutTestController()
    5990{
     
    318349}
    319350
     351bool LayoutTestController::isCommandEnabled(JSStringRef name)
     352{
     353    RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
     354    NSString *nameNS = reinterpret_cast<const NSString *>(nameCF.get());
     355
     356    // Accept command strings with capital letters for first letter without trailing colon.
     357    if (![nameNS hasSuffix:@":"] && [nameNS length]) {
     358        nameNS = [[[[nameNS substringToIndex:1] lowercaseString]
     359            stringByAppendingString:[nameNS substringFromIndex:1]]
     360            stringByAppendingString:@":"];
     361    }
     362
     363    SEL selector = NSSelectorFromString(nameNS);
     364    RetainPtr<CommandValidationTarget> target(AdoptNS, [[CommandValidationTarget alloc] initWithAction:selector]);
     365    id validator = [NSApp targetForAction:selector to:[mainFrame webView] from:target.get()];
     366    if (!validator)
     367        return false;
     368    if (![validator respondsToSelector:selector])
     369        return false;
     370    if (![validator respondsToSelector:@selector(validateUserInterfaceItem:)])
     371        return true;
     372    return [validator validateUserInterfaceItem:target.get()];
     373}
     374
    320375bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
    321376{
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r38735 r39114  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    633633}
    634634
     635bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
     636{
     637    printf("ERROR: LayoutTestController::isCommandEnabled() not implemented\n");
     638    return false;
     639}
     640
    635641void LayoutTestController::clearAllDatabases()
    636642{
Note: See TracChangeset for help on using the changeset viewer.