Home | History | Annotate | Download | only in editing

Lines Matching refs:Frame

43 #include "Frame.h"
70 bool (*execute)(Frame*, Event*, EditorCommandSource, const String&);
71 bool (*isSupportedFromDOM)(Frame*);
72 bool (*isEnabled)(Frame*, Event*, EditorCommandSource);
73 TriState (*state)(Frame*, Event*);
74 String (*value)(Frame*, Event*);
90 static Frame* targetFrame(Frame* frame, Event* event)
93 return frame;
96 return frame;
97 return node->document()->frame();
100 static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style)
105 frame->editor()->applyStyleToSelection(style, action);
109 frame->editor()->applyStyle(style);
116 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
120 return applyCommandToFrame(frame, source, action, style.get());
123 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue)
127 return applyCommandToFrame(frame, source, action, style.get());
133 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, CSSValue* value)
136 RefPtr<EditingStyle> selectionStyle = frame->editor()->selectionStartStyle();
155 return applyCommandToFrame(frame, source, action, newMutableStyle.get());
158 static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const char* offValue, const char* onValue)
165 if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
166 styleIsPresent = frame->editor()->selectionStartHasStyle(propertyID, onValue);
168 styleIsPresent = frame->editor()->selectionHasStyle(propertyID, onValue) == TrueTriState;
171 return applyCommandToFrame(frame, source, action, style->style());
174 static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
181 frame->editor()->applyParagraphStyleToSelection(style.get(), action);
185 frame->editor()->applyParagraphStyle(style.get());
192 static bool executeInsertFragment(Frame* frame, PassRefPtr<DocumentFragment> fragment)
194 applyCommand(ReplaceSelectionCommand::create(frame->document(), fragment, ReplaceSelectionCommand::PreventNesting, EditActionUnspecified));
198 static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content)
200 RefPtr<DocumentFragment> fragment = DocumentFragment::create(frame->document());
205 return executeInsertFragment(frame, fragment.release());
208 static bool expandSelectionToGranularity(Frame* frame, TextGranularity granularity)
210 VisibleSelection selection = frame->selection()->selection();
218 RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
219 EAffinity affinity = frame->selection()->affinity();
220 if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
222 frame->selection()->setSelectedRange(newRange.get(), affinity, true);
226 static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValue)
228 if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
229 return frame->editor()->selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
230 return frame->editor()->selectionHasStyle(propertyID, desiredValue);
233 static String valueStyle(Frame* frame, int propertyID)
237 return frame->editor()->selectionStartCSSPropertyValue(propertyID);
240 static TriState stateTextWritingDirection(Frame* frame, WritingDirection direction)
243 WritingDirection selectionDirection = frame->editor()->textDirectionForSelection(hasNestedOrMultipleEmbeddings);
247 static int verticalScrollDistance(Frame* frame)
249 Node* focusedNode = frame->document()->focusedNode();
261 frame->view()->visibleHeight());
278 static bool executeBackColor(Frame* frame, Event*, EditorCommandSource source, const String& value)
280 return executeApplyStyle(frame, source, EditActionSetBackgroundColor, CSSPropertyBackgroundColor, value);
283 static bool executeCopy(Frame* frame, Event*, EditorCommandSource, const String&)
285 frame->editor()->copy();
289 static bool executeCreateLink(Frame* frame, Event*, EditorCommandSource, const String& value)
294 applyCommand(CreateLinkCommand::create(frame->document(), value));
298 static bool executeCut(Frame* frame, Event*, EditorCommandSource source, const String&)
301 UserTypingGestureIndicator typingGestureIndicator(frame);
302 frame->editor()->cut();
304 frame->editor()->cut();
308 static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, const String&)
313 UserTypingGestureIndicator typingGestureIndicator(frame);
314 frame->editor()->performDelete();
321 TypingCommand::deleteKeyPressed(frame->document(), frame->selection()->granularity() == WordGranularity ? TypingCommand::SmartDelete : 0);
328 static bool executeDeleteBackward(Frame* frame, Event*, EditorCommandSource, const String&)
330 frame->editor()->deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
334 static bool executeDeleteBackwardByDecomposingPreviousCharacter(Frame* frame, Event*, EditorCommandSource, const String&)
337 frame->editor()->deleteWithDirection(DirectionBackward, CharacterGranularity, false, true);
341 static bool executeDeleteForward(Frame* frame, Event*, EditorCommandSource, const String&)
343 frame->editor()->deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
347 static bool executeDeleteToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
349 frame->editor()->deleteWithDirection(DirectionBackward, LineBoundary, true, false);
353 static bool executeDeleteToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
355 frame->editor()->deleteWithDirection(DirectionBackward, ParagraphBoundary, true, false);
359 static bool executeDeleteToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
363 frame->editor()->deleteWithDirection(DirectionForward, LineBoundary, true, false);
367 static bool executeDeleteToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
371 frame->editor()->deleteWithDirection(DirectionForward, ParagraphBoundary, true, false);
375 static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&)
377 RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
379 SelectionController* selection = frame->selection();
380 bool selected = selection->setSelectedRange(unionDOMRanges(mark.get(), frame->editor()->selectedRange().get()).get(), DOWNSTREAM, true);
385 frame->editor()->performDelete();
386 frame->editor()->setMark(frame->selection()->selection());
390 static bool executeDeleteWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
392 frame->editor()->deleteWithDirection(DirectionBackward, WordGranularity, true, false);
396 static bool executeDeleteWordForward(Frame* frame, Event*, EditorCommandSource, const String&)
398 frame->editor()->deleteWithDirection(DirectionForward, WordGranularity, true, false);
402 static bool executeFindString(Frame* frame, Event*, EditorCommandSource, const String& value)
404 return frame->editor()->findString(value, true, false, true, false);
407 static bool executeFontName(Frame* frame
409 return executeApplyStyle(frame, source, EditActionSetFont, CSSPropertyFontFamily, value);
412 static bool executeFontSize(Frame* frame, Event*, EditorCommandSource source, const String& value)
417 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontSize, size);
420 static bool executeFontSizeDelta(Frame* frame, Event*, EditorCommandSource source, const String& value)
422 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPropertyWebkitFontSizeDelta, value);
425 static bool executeForeColor(Frame* frame, Event*, EditorCommandSource source, const String& value)
427 return executeApplyStyle(frame, source, EditActionSetColor, CSSPropertyColor, value);
430 static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const String& value)
442 RefPtr<FormatBlockCommand> command = FormatBlockCommand::create(frame->document(), qualifiedTagName);
447 static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource source, const String&)
451 frame->editor()->deleteWithDirection(DirectionForward, CharacterGranularity, false, true);
458 TypingCommand::forwardDeleteKeyPressed(frame->document());
465 static bool executeIgnoreSpelling(Frame* frame, Event*, EditorCommandSource, const String&)
467 frame->editor()->ignoreSpelling();
471 static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const String&)
473 applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Indent));
477 static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource, const String&)
479 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, TextEventInputBackTab);
482 static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value)
484 RefPtr<HTMLHRElement> rule = HTMLHRElement::create(frame->document());
487 return executeInsertNode(frame, rule.release());
490 static bool executeInsertHTML(Frame* frame, Event*, EditorCommandSource, const String& value)
492 return executeInsertFragment(frame, createFragmentFromMarkup(frame->document(), value, ""));
495 static bool executeInsertImage(Frame* frame, Event*, EditorCommandSource, const String& value)
498 RefPtr<HTMLImageElement> image = HTMLImageElement::create(frame->document());
500 return executeInsertNode(frame, image.release());
503 static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSource source, const String&)
507 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, TextEventInputLineBreak);
513 TypingCommand::insertLineBreak(frame->document(), 0);
520 static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&)
522 Frame* targetFrame = WebCore::targetFrame(frame, event);
526 static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&)
528 TypingCommand::insertParagraphSeparatorInQuotedContent(frame->document());
532 static bool executeInsertOrderedList(Frame* frame, Event*, EditorCommandSource, const String&)
534 applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::OrderedList));
538 static bool executeInsertParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
540 TypingCommand::insertParagraphSeparator(frame->document(), 0);
544 static bool executeInsertTab(Frame* frame, Event* event, EditorCommandSource, const String&)
546 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event);
549 static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const String& value)
551 TypingCommand::insertText(frame->document(), value, 0);
555 static bool executeInsertUnorderedList(Frame* frame, Event*, EditorCommandSource, const String&)
557 applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::UnorderedList));
561 static bool executeJustifyCenter(Frame* frame, Event*, EditorCommandSource source, const String&)
563 return executeApplyParagraphStyle(frame, source, EditActionCenter, CSSPropertyTextAlign, "center");
566 static bool executeJustifyFull(Frame* frame, Event*, EditorCommandSource source, const String&)
568 return executeApplyParagraphStyle(frame, source, EditActionJustify, CSSPropertyTextAlign, "justify");
571 static bool executeJustifyLeft(Frame* frame, Event*, EditorCommandSource source, const String&)
573 return executeApplyParagraphStyle(frame, source, EditActionAlignLeft, CSSPropertyTextAlign, "left");
576 static bool executeJustifyRight(Frame* frame, Event*, EditorCommandSource source, const String&)
578 return executeApplyParagraphStyle(frame, source, EditActionAlignRight, CSSPropertyTextAlign, "right");
581 static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&)
586 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
590 static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&)
594 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
598 static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&)
603 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
607 static bool executeMoveBackward(Frame* frame, Event*, EditorCommandSource, const String&)
609 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, CharacterGranularity, true);
613 static bool executeMoveBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
615 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, CharacterGranularity, true);
619 static bool executeMoveDown(Frame* frame, Event*, EditorCommandSource, const String&)
621 return frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, LineGranularity, true);
624 static bool executeMoveDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
626 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, LineGranularity, true);
630 static bool executeMoveForward(Frame* frame, Event*, EditorCommandSource, const String&)
632 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, CharacterGranularity, true);
636 static bool executeMoveForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
638 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, CharacterGranularity, true);
642 static bool executeMoveLeft(Frame* frame, Event*, EditorCommandSource, const String&)
644 return frame->selection()->modify(SelectionController::AlterationMove, DirectionLeft, CharacterGranularity, true);
647 static bool executeMoveLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
649 frame->selection()->modify(SelectionController::AlterationExtend, DirectionLeft, CharacterGranularity, true);
653 static bool executeMovePageDown(Frame* frame, Event*, EditorCommandSource, const String&)
655 int distance = verticalScrollDistance(frame);
658 return frame->selection()->modify(SelectionController::AlterationMove, distance, true, SelectionController::AlignCursorOnScrollAlways);
661 static bool executeMovePageDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
663 int distance = verticalScrollDistance(frame);
666 return frame->selection()->modify(SelectionController::AlterationExtend, distance, true, SelectionController::AlignCursorOnScrollAlways);
669 static bool executeMovePageUp(Frame* frame, Event*, EditorCommandSource, const String&)
671 int distance = verticalScrollDistance(frame);
674 return frame->selection()->modify(SelectionController::AlterationMove, -distance, true, SelectionController::AlignCursorOnScrollAlways);
677 static bool executeMovePageUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
679 int distance = verticalScrollDistance(frame);
682 return frame->selection()->modify(SelectionController::AlterationExtend, -distance, true, SelectionController::AlignCursorOnScrollAlways);
685 static bool executeMoveRight(Frame* frame, Event*, EditorCommandSource, const String&)
687 return frame->selection()->modify(SelectionController::AlterationMove, DirectionRight, CharacterGranularity, true);
690 static bool executeMoveRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
692 frame->selection()->modify(SelectionController::AlterationExtend, DirectionRight, CharacterGranularity, true);
696 static bool executeMoveToBeginningOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
698 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, DocumentBoundary, true);
702 static bool executeMoveToBeginningOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
704 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, DocumentBoundary, true);
708 static bool executeMoveToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
710 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, LineBoundary, true);
714 static bool executeMoveToBeginningOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
716 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, LineBoundary, true);
720 static bool executeMoveToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
722 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, ParagraphBoundary, true);
726 static bool executeMoveToBeginningOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
728 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, ParagraphBoundary, true);
732 static bool executeMoveToBeginningOfSentence(Frame* frame, Event*, EditorCommandSource, const String&)
734 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, SentenceBoundary, true);
738 static bool executeMoveToBeginningOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
740 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, SentenceBoundary, true);
744 static bool executeMoveToEndOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
746 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, DocumentBoundary, true);
750 static bool executeMoveToEndOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
752 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, DocumentBoundary, true);
756 static bool executeMoveToEndOfSentence(Frame* frame, Event*, EditorCommandSource, const String&)
758 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, SentenceBoundary, true);
762 static bool executeMoveToEndOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
764 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, SentenceBoundary, true);
768 static bool executeMoveToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
770 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, LineBoundary, true);
774 static bool executeMoveToEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
776 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, LineBoundary, true);
780 static bool executeMoveToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
782 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, ParagraphBoundary, true);
786 static bool executeMoveToEndOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
788 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, ParagraphBoundary, true);
792 static bool executeMoveParagraphBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
794 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, ParagraphGranularity, true);
798 static bool executeMoveParagraphForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
800 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, ParagraphGranularity, true);
804 static bool executeMoveUp(Frame* frame, Event*, EditorCommandSource, const String&)
806 return frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, LineGranularity, true);
809 static bool executeMoveUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
811 frame
815 static bool executeMoveWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
817 frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, WordGranularity, true);
821 static bool executeMoveWordBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
823 frame->selection()->modify(SelectionController::AlterationExtend, DirectionBackward, WordGranularity, true);
827 static bool executeMoveWordForward(Frame* frame, Event*, EditorCommandSource, const String&)
829 frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, WordGranularity, true);
833 static bool executeMoveWordForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
835 frame->selection()->modify(SelectionController::AlterationExtend, DirectionForward, WordGranularity, true);
839 static bool executeMoveWordLeft(Frame* frame, Event*, EditorCommandSource, const String&)
841 frame->selection()->modify(SelectionController::AlterationMove, DirectionLeft, WordGranularity, true);
845 static bool executeMoveWordLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
847 frame->selection()->modify(SelectionController::AlterationExtend, DirectionLeft, WordGranularity, true);
851 static bool executeMoveWordRight(Frame* frame, Event*, EditorCommandSource, const String&)
853 frame->selection()->modify(SelectionController::AlterationMove, DirectionRight, WordGranularity, true);
857 static bool executeMoveWordRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
859 frame->selection()->modify(SelectionController::AlterationExtend, DirectionRight, WordGranularity, true);
863 static bool executeMoveToLeftEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
865 frame->selection()->modify(SelectionController::AlterationMove, DirectionLeft, LineBoundary, true);
869 static bool executeMoveToLeftEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
871 frame->selection()->modify(SelectionController::AlterationExtend, DirectionLeft, LineBoundary, true);
875 static bool executeMoveToRightEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
877 frame->selection()->modify(SelectionController::AlterationMove, DirectionRight, LineBoundary, true);
881 static bool executeMoveToRightEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
883 frame->selection()->modify(SelectionController::AlterationExtend, DirectionRight, LineBoundary, true);
887 static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const String&)
889 applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Outdent));
893 static bool executePaste(Frame* frame, Event*, EditorCommandSource source, const String&)
896 UserTypingGestureIndicator typingGestureIndicator(frame);
897 frame->editor()->paste();
899 frame->editor()->paste();
903 static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource source, const String&)
906 UserTypingGestureIndicator typingGestureIndicator(frame);
907 frame->editor()->pasteAsPlainText();
909 frame->editor()->pasteAsPlainText();
913 static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource source, const String&)
916 UserTypingGestureIndicator typingGestureIndicator(frame);
917 frame->editor()->pasteAsPlainText();
919 frame->editor()->pasteAsPlainText();
923 static bool executePrint(Frame* frame, Event*, EditorCommandSource, const String&)
925 Page* page = frame->page();
928 page->chrome()->print(frame);
932 static bool executeRedo(Frame* frame, Event*, EditorCommandSource, const String&)
934 frame->editor()->redo();
938 static bool executeRemoveFormat(Frame* frame, Event*, EditorCommandSource, const String&)
940 frame->editor()->removeFormattingAndStyle();
944 static bool executeScrollPageBackward(Frame* frame, Event*, EditorCommandSource, const String&)
946 return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByPage);
949 static bool executeScrollPageForward(Frame* frame, Event*, EditorCommandSource, const String&)
951 return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByPage);
954 static bool executeScrollToBeginningOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
956 return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByDocument);
959 static bool executeScrollToEndOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
961 return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByDocument);
964 static bool executeSelectAll(Frame* frame, Event*, EditorCommandSource, const String&)
966 frame->selection()->selectAll();
970 static bool executeSelectLine(Frame* frame, Event*, EditorCommandSource, const String&)
972 return expandSelectionToGranularity(frame, LineGranularity);
975 static bool executeSelectParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
977 return expandSelectionToGranularity(frame, ParagraphGranularity);
980 static bool executeSelectSentence(Frame* frame, Event*, EditorCommandSource, const String&)
982 return expandSelectionToGranularity(frame, SentenceGranularity);
985 static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&)
987 RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
988 RefPtr<Range> selection = frame->editor()->selectedRange();
993 frame->selection()->setSelectedRange(unionDOMRanges(mark.get(), selection.get()).get(), DOWNSTREAM, true);
997 static bool executeSelectWord(Frame* frame, Event*, EditorCommandSource, const String&)
999 return expandSelectionToGranularity(frame, WordGranularity);
1002 static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&)
1004 frame->editor()->setMark(frame->selection()->selection());
1008 static bool executeStrikethrough(Frame* frame, Event*, EditorCommandSource source, const String&)
1011 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, lineThrough.get());
1014 static bool executeStyleWithCSS(Frame* frame, Event*, EditorCommandSource, const String& value)
1019 frame->editor()->setShouldStyleWithCSS(value == "true" ? true : false);
1023 static bool executeSubscript(Frame* frame, Event*, EditorCommandSource source, const String&)
1025 return executeToggleStyle(frame, source, EditActionSubscript, CSSPropertyVerticalAlign, "baseline", "sub");
1028 static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source, const String&)
1030 return executeToggleStyle(frame, source, EditActionSuperscript, CSSPropertyVerticalAlign, "baseline", "super");
1033 static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
1035 const VisibleSelection& mark = frame->editor()->mark();
1036 const VisibleSelection& selection = frame->selection()->selection();
1041 frame->selection()->setSelection(mark);
1042 frame->editor()->setMark(selection);
1047 static bool executeTakeFindStringFromSelection(Frame* frame, Event*, EditorCommandSource, const String&)
1049 frame->editor()->takeFindStringFromSelection();
1054 static bool executeToggleBold(Frame* frame, Event*, EditorCommandSource source, const String&)
1056 return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontWeight, "normal", "bold");
1059 static bool executeToggleItalic(Frame* frame, Event*, EditorCommandSource source, const String&)
1061 return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontStyle, "normal", "italic");
1064 static bool executeTranspose(Frame* frame, Event*, EditorCommandSource, const String&)
1066 frame->editor()->transpose();
1070 static bool executeUnderline(Frame* frame, Event*, EditorCommandSource source, const String&)
1073 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, underline.get());
1076 static bool executeUndo(Frame* frame, Event*, EditorCommandSource, const String&)
1078 frame->editor()->undo();
1082 static bool executeUnlink(Frame* frame, Event*, EditorCommandSource, const String&)
1084 applyCommand(UnlinkCommand::create(frame->document()));
1088 static bool executeUnscript(Frame* frame, Event*, EditorCommandSource source, const String&)
1090 return executeApplyStyle(frame, source, EditActionUnscript, CSSPropertyVerticalAlign, "baseline");
1093 static bool executeUnselect(Frame* frame, Event*, EditorCommandSource, const String&)
1095 frame->selection()->clear();
1099 static bool executeYank(Frame* frame, Event*, EditorCommandSource, const String&)
1101 frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->killRing()->yank(), false, 0);
1102 frame->editor()->killRing()->setToYankedState();
1106 static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, const String&)
1108 frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->killRing()->yank(), true, 0);
1109 frame->editor()->killRing()->setToYankedState();
1115 static bool supported(Frame*)
1120 static bool supportedFromMenuOrKeyBinding(Frame*)
1125 static bool supportedCopyCut(Frame* frame)
1127 if (!frame)
1130 Settings* settings = frame->settings();
1133 EditorClient* client = frame->editor()->client();
1137 static bool supportedPaste(Frame* frame)
1139 if (!frame)
1142 Settings* settings = frame->settings();
1145 EditorClient* client = frame->editor()->client();
1151 static bool enabled(Frame*, Event*, EditorCommandSource)
1156 static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource)
1159 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1163 static bool caretBrowsingEnabled(Frame* frame)
1165 return frame->settings() && frame->settings()->caretBrowsingEnabled();
1170 static bool enabledVisibleSelectionOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource)
1173 return caretBrowsingEnabled(frame) || enabledVisibleSelection(frame, event, dummyEditorCommandSource);
1176 static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource)
1178 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1180 && frame->editor()->mark().isCaretOrRange();
1183 static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource)
1185 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1189 static bool enabledCopy(Frame* frame, Event*, EditorCommandSource)
1191 return frame->editor()->canDHTMLCopy() || frame->editor()->canCopy();
1194 static bool enabledCut(Frame* frame, Event*, EditorCommandSource)
1196 return frame->editor()->canDHTMLCut() || frame->editor()->canCut();
1199 static bool enabledInEditableText(Frame* frame, Event* event, EditorCommandSource)
1201 return frame->editor()->selectionForCommand(event).rootEditableElement();
1204 static bool enabledDelete(Frame* frame, Event* event, EditorCommandSource source)
1209 return enabledCut(frame, event, source);
1214 return enabledInEditableText(frame, event, source);
1220 static bool enabledInEditableTextOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource)
1223 return caretBrowsingEnabled(frame) || enabledInEditableText(frame, event, dummyEditorCommandSource);
1226 static bool enabledInRichlyEditableText(Frame* frame, Event*, EditorCommandSource)
1228 return frame->selection()->isCaretOrRange() && frame->selection()->isContentRichlyEditable() && frame->selection()->rootEditableElement();
1231 static bool enabledPaste(Frame* frame, Event*, EditorCommandSource)
1233 return frame->editor()->canPaste();
1236 static bool enabledRangeInEditableText(Frame* frame, Event*, EditorCommandSource)
1238 return frame->selection()->isRange() && frame->selection()->isContentEditable();
1241 static bool enabledRangeInRichlyEditableText(Frame* frame, Event*, EditorCommandSource)
1243 return frame->selection()->isRange() && frame->selection()->isContentRichlyEditable();
1246 static bool enabledRedo(Frame* frame, Event*, EditorCommandSource)
1248 return frame->editor()->canRedo();
1252 static bool enabledTakeFindStringFromSelection(Frame* frame, Event*, EditorCommandSource)
1254 return frame->editor()->canCopyExcludingStandaloneImages();
1258 static bool enabledUndo(Frame* frame, Event*, EditorCommandSource)
1260 return frame->editor()->canUndo();
1265 static TriState stateNone(Frame*, Event*)
1270 static TriState stateBold(Frame* frame, Event*)
1272 return stateStyle(frame, CSSPropertyFontWeight, "bold");
1275 static TriState stateItalic(Frame* frame, Event*)
1277 return stateStyle(frame, CSSPropertyFontStyle, "italic");
1280 static TriState stateOrderedList(Frame* frame, Event*)
1282 return frame->editor()->selectionOrderedListState();
1285 static TriState stateStrikethrough(Frame* frame, Event*)
1287 return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "line-through");
1290 static TriState stateStyleWithCSS(Frame* frame, Event*)
1292 return frame->editor()->shouldStyleWithCSS() ? TrueTriState : FalseTriState;
1295 static TriState stateSubscript(Frame* frame, Event*)
1297 return stateStyle(frame, CSSPropertyVerticalAlign, "sub");
1300 static TriState stateSuperscript(Frame* frame
1302 return stateStyle(frame, CSSPropertyVerticalAlign, "super");
1305 static TriState stateTextWritingDirectionLeftToRight(Frame* frame, Event*)
1307 return stateTextWritingDirection(frame, LeftToRightWritingDirection);
1310 static TriState stateTextWritingDirectionNatural(Frame* frame, Event*)
1312 return stateTextWritingDirection(frame, NaturalWritingDirection);
1315 static TriState stateTextWritingDirectionRightToLeft(Frame* frame, Event*)
1317 return stateTextWritingDirection(frame, RightToLeftWritingDirection);
1320 static TriState stateUnderline(Frame* frame, Event*)
1322 return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "underline");
1325 static TriState stateUnorderedList(Frame* frame, Event*)
1327 return frame->editor()->selectionUnorderedListState();
1330 static TriState stateJustifyCenter(Frame* frame, Event*)
1332 return stateStyle(frame, CSSPropertyTextAlign, "center");
1335 static TriState stateJustifyFull(Frame* frame, Event*)
1337 return stateStyle(frame, CSSPropertyTextAlign, "justify");
1340 static TriState stateJustifyLeft(Frame* frame, Event*)
1342 return stateStyle(frame, CSSPropertyTextAlign, "left");
1345 static TriState stateJustifyRight(Frame* frame, Event*)
1347 return stateStyle(frame, CSSPropertyTextAlign, "right");
1352 static String valueNull(Frame*, Event*)
1357 static String valueBackColor(Frame* frame, Event*)
1359 return valueStyle(frame, CSSPropertyBackgroundColor);
1362 static String valueFontName(Frame* frame, Event*)
1364 return valueStyle(frame, CSSPropertyFontFamily);
1367 static String valueFontSize(Frame* frame, Event*)
1369 return valueStyle(frame, CSSPropertyFontSize);
1372 static String valueFontSizeDelta(Frame* frame, Event*)
1374 return valueStyle(frame, CSSPropertyWebkitFontSizeDelta);
1377 static String valueForeColor(Frame* frame, Event*)
1379 return valueStyle(frame, CSSPropertyColor);
1382 static String valueFormatBlock(Frame* frame, Event*)
1384 const VisibleSelection& selection = frame->selection()->selection();
1624 Editor::Command::Command(const EditorInternalCommand* command, EditorCommandSource source, PassRefPtr<Frame> frame)
1627 , m_frame(command ? frame : 0)