Home | History | Annotate | Download | only in editing

Lines Matching refs:Frame

43 #include "Frame.h"
66 bool (*execute)(Frame*, Event*, EditorCommandSource, const String&);
67 bool (*isSupported)(Frame*, EditorCommandSource);
68 bool (*isEnabled)(Frame*, Event*, EditorCommandSource);
69 TriState (*state)(Frame*, Event*);
70 String (*value)(Frame*, Event*);
86 static Frame* targetFrame(Frame* frame, Event* event)
89 return frame;
92 return frame;
93 return node->document()->frame();
96 static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style)
101 frame->editor()->applyStyleToSelection(style, action);
105 frame->editor()->applyStyle(style);
112 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
116 return applyCommandToFrame(frame, source, action, style.get());
119 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue)
123 return applyCommandToFrame(frame, source, action, style.get());
129 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, CSSValue* value)
133 RefPtr<CSSComputedStyleDeclaration> selectionStyle = frame->selectionComputedStyle(nodeToRemove);
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)
166 Settings* settings = frame->document()->settings();
169 styleIsPresent = frame->editor()->selectionStartHasStyle(style.get());
171 styleIsPresent = frame->editor()->selectionHasStyle(style.get()) == TrueTriState;
174 return applyCommandToFrame(frame, source, action, style.get());
177 static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
184 frame->editor()->applyParagraphStyleToSelection(style.get(), action);
188 frame->editor()->applyParagraphStyle(style.get());
195 static bool executeInsertFragment(Frame* frame, PassRefPtr<DocumentFragment> fragment)
197 applyCommand(ReplaceSelectionCommand::create(frame->document(), fragment,
202 static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content)
204 RefPtr<DocumentFragment> fragment = DocumentFragment::create(frame->document());
209 return executeInsertFragment(frame, fragment.release());
212 static bool expandSelectionToGranularity(Frame* frame, TextGranularity granularity)
214 VisibleSelection selection = frame->selection()->selection();
222 RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
223 EAffinity affinity = frame->selection()->affinity();
224 if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
226 frame->selection()->setSelectedRange(newRange.get(), affinity, true);
230 static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValue)
234 return frame->editor()->selectionHasStyle(style.get());
237 static String valueStyle(Frame* frame, int propertyID)
239 return frame->selectionStartStylePropertyValue(propertyID);
242 static TriState stateTextWritingDirection(Frame* frame, WritingDirection direction)
245 WritingDirection selectionDirection = frame->editor()->textDirectionForSelection(hasNestedOrMultipleEmbeddings);
249 static int verticalScrollDistance(Frame* frame)
251 Node* focusedNode = frame->document()->focusedNode();
279 static bool executeBackColor(Frame* frame, Event*, EditorCommandSource source, const String& value)
281 return executeApplyStyle(frame, source, EditActionSetBackgroundColor, CSSPropertyBackgroundColor, value);
284 static bool executeCopy(Frame* frame, Event*, EditorCommandSource, const String&)
286 frame->editor()->copy();
290 static bool executeCreateLink(Frame* frame, Event*, EditorCommandSource, const String& value)
295 applyCommand(CreateLinkCommand::create(frame->document(), value));
299 static bool executeCut(Frame* frame, Event*, EditorCommandSource, const String&)
301 frame->editor()->cut();
305 static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, const String&)
310 frame->editor()->performDelete();
316 TypingCommand::deleteKeyPressed(frame->document(), frame->selectionGranularity() == WordGranularity);
323 static bool executeDeleteBackward(Frame* frame, Event*, EditorCommandSource, const String&)
325 frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
329 static bool executeDeleteBackwardByDecomposingPreviousCharacter(Frame* frame, Event*, EditorCommandSource, const String&)
332 frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
336 static bool executeDeleteForward(Frame* frame, Event*, EditorCommandSource, const String&)
338 frame->editor()->deleteWithDirection(SelectionController::FORWARD, CharacterGranularity, false, true);
342 static bool executeDeleteToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
344 frame->editor()->deleteWithDirection(SelectionController::BACKWARD, LineBoundary, true, false);
348 static bool executeDeleteToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
350 frame->editor()->deleteWithDirection(SelectionController::BACKWARD, ParagraphBoundary, true, false);
354 static bool executeDeleteToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
358 frame->editor()->deleteWithDirection(SelectionController::FORWARD, LineBoundary, true, false);
362 static bool executeDeleteToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
366 frame->editor()->deleteWithDirection(SelectionController::FORWARD, ParagraphBoundary, true, false);
370 static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&)
372 RefPtr<Range> mark = frame->mark().toNormalizedRange();
374 SelectionController* selection = frame->selection();
375 bool selected = selection->setSelectedRange(unionDOMRanges(mark.get(), frame->editor()->selectedRange().get()).get(), DOWNSTREAM, true);
380 frame->editor()->performDelete();
381 frame->setMark(frame->selection()->selection());
385 static bool executeDeleteWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
387 frame->editor()->deleteWithDirection(SelectionController::BACKWARD, WordGranularity, true, false);
391 static bool executeDeleteWordForward(Frame* frame, Event*, EditorCommandSource, const String&)
393 frame->editor()->deleteWithDirection(SelectionController::FORWARD, WordGranularity, true, false);
397 static bool executeFindString(Frame* frame, Event*, EditorCommandSource, const String& value)
399 return frame->findString(value, true, false, true, false);
402 static bool executeFontName(Frame* frame, Event*, EditorCommandSource source, const String& value)
404 return executeApplyStyle(frame, source, EditActionSetFont, CSSPropertyFontFamily, value);
407 static bool executeFontSize(Frame* frame, Event*, EditorCommandSource source, const String& value)
412 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontSize, size);
415 static bool executeFontSizeDelta(Frame* frame, Event*, EditorCommandSource source, const String& value)
417 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPropertyWebkitFontSizeDelta, value);
420 static bool executeForeColor(Frame* frame, Event*, EditorCommandSource source, const String& value)
422 return executeApplyStyle(frame, source, EditActionSetColor, CSSPropertyColor, value);
425 static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const String& value)
432 applyCommand(FormatBlockCommand::create(frame->document(), tagName));
436 static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource source, const String&)
440 frame->editor()->deleteWithDirection(SelectionController::FORWARD, CharacterGranularity, false, true);
447 TypingCommand::forwardDeleteKeyPressed(frame->document());
454 static bool executeIgnoreSpelling(Frame* frame, Event*, EditorCommandSource, const String&)
456 frame->editor()->ignoreSpelling();
460 static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const String&)
462 applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Indent));
466 static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource, const String&)
468 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, true);
471 static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value)
473 RefPtr<HTMLHRElement> hr = new HTMLHRElement(hrTag, frame->document());
476 return executeInsertNode(frame, hr.release());
479 static bool executeInsertHTML(Frame* frame, Event*, EditorCommandSource, const String& value)
481 return executeInsertFragment(frame, createFragmentFromMarkup(frame->document(), value, ""));
484 static bool executeInsertImage(Frame* frame, Event*, EditorCommandSource, const String& value)
487 RefPtr<HTMLImageElement> image = new HTMLImageElement(imgTag, frame->document());
489 return executeInsertNode(frame, image.release());
492 static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSource source, const String&)
496 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, true);
502 TypingCommand::insertLineBreak(frame->document());
509 static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&)
511 Frame* targetFrame = WebCore::targetFrame(frame, event);
515 static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&)
517 TypingCommand::insertParagraphSeparatorInQuotedContent(frame->document());
521 static bool executeInsertOrderedList(Frame* frame, Event*, EditorCommandSource, const String&)
523 applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::OrderedList));
527 static bool executeInsertParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
529 TypingCommand::insertParagraphSeparator(frame->document());
533 static bool executeInsertTab(Frame* frame, Event* event, EditorCommandSource, const String&)
535 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, false);
538 static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const String& value)
540 TypingCommand::insertText(frame->document(), value);
544 static bool executeInsertUnorderedList(Frame* frame, Event*, EditorCommandSource, const String&)
546 applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::UnorderedList));
550 static bool executeJustifyCenter(Frame* frame, Event*, EditorCommandSource source, const String&)
552 return executeApplyParagraphStyle(frame, source, EditActionCenter, CSSPropertyTextAlign, "center");
555 static bool executeJustifyFull(Frame* frame, Event*, EditorCommandSource source, const String&)
557 return executeApplyParagraphStyle(frame, source, EditActionJustify, CSSPropertyTextAlign, "justify");
560 static bool executeJustifyLeft(Frame* frame, Event*, EditorCommandSource source, const String&)
562 return executeApplyParagraphStyle(frame, source, EditActionAlignLeft, CSSPropertyTextAlign, "left");
565 static bool executeJustifyRight(Frame* frame, Event*, EditorCommandSource source, const String&)
567 return executeApplyParagraphStyle(frame, source, EditActionAlignRight, CSSPropertyTextAlign, "right");
570 static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&)
575 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
579 static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&)
583 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
587 static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&)
592 frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
596 static bool executeMoveBackward(Frame* frame, Event*, EditorCommandSource, const String&)
598 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, CharacterGranularity, true);
602 static bool executeMoveBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
604 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, CharacterGranularity, true);
608 static bool executeMoveDown(Frame* frame, Event*, EditorCommandSource, const String&)
610 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, LineGranularity, true);
614 static bool executeMoveDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
616 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, LineGranularity, true);
620 static bool executeMoveForward(Frame* frame, Event*, EditorCommandSource, const String&)
622 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, CharacterGranularity, true);
626 static bool executeMoveForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
628 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, CharacterGranularity, true);
632 static bool executeMoveLeft(Frame* frame, Event*, EditorCommandSource, const String&)
634 frame->selection()->modify(SelectionController::MOVE, SelectionController::LEFT, CharacterGranularity, true);
638 static bool executeMoveLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
640 frame->selection()->modify(SelectionController::EXTEND, SelectionController::LEFT, CharacterGranularity, true);
644 static bool executeMovePageDown(Frame* frame, Event*, EditorCommandSource, const String&)
646 int distance = verticalScrollDistance(frame);
649 return frame->selection()->modify(SelectionController::MOVE, distance, true);
652 static bool executeMovePageDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
654 int distance = verticalScrollDistance(frame);
657 return frame->selection()->modify(SelectionController::EXTEND, distance, true);
660 static bool executeMovePageUp(Frame* frame, Event*, EditorCommandSource, const String&)
662 int distance = verticalScrollDistance(frame);
665 return frame->selection()->modify(SelectionController::MOVE, -distance, true);
668 static bool executeMovePageUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
670 int distance = verticalScrollDistance(frame);
673 return frame->selection()->modify(SelectionController::EXTEND, -distance, true);
676 static bool executeMoveRight(Frame* frame, Event*, EditorCommandSource, const String&)
678 frame->selection()->modify(SelectionController::MOVE, SelectionController::RIGHT, CharacterGranularity, true);
682 static bool executeMoveRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
684 frame->selection()->modify(SelectionController::EXTEND, SelectionController::RIGHT, CharacterGranularity, true);
688 static bool executeMoveToBeginningOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
690 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, DocumentBoundary, true);
694 static bool executeMoveToBeginningOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
696 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, DocumentBoundary, true);
700 static bool executeMoveToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
702 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, LineBoundary, true);
706 static bool executeMoveToBeginningOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
708 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, LineBoundary, true);
712 static bool executeMoveToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
714 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, ParagraphBoundary, true);
718 static bool executeMoveToBeginningOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
720 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, ParagraphBoundary, true);
724 static bool executeMoveToBeginningOfSentence(Frame* frame, Event*, EditorCommandSource, const String&)
726 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, SentenceBoundary, true);
730 static bool executeMoveToBeginningOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
732 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, SentenceBoundary, true);
736 static bool executeMoveToEndOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
738 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, DocumentBoundary, true);
742 static bool executeMoveToEndOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
744 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, DocumentBoundary, true);
748 static bool executeMoveToEndOfSentence(Frame* frame, Event*, EditorCommandSource, const String&)
750 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, SentenceBoundary, true);
754 static bool executeMoveToEndOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
756 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, SentenceBoundary, true);
760 static bool executeMoveToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
762 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, LineBoundary, true);
766 static bool executeMoveToEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
768 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, LineBoundary, true);
772 static bool executeMoveToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
774 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, ParagraphBoundary, true);
778 static bool executeMoveToEndOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
780 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, ParagraphBoundary, true);
784 static bool executeMoveParagraphBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
786 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, ParagraphGranularity, true);
790 static bool executeMoveParagraphForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
792 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, ParagraphGranularity, true);
796 static bool executeMoveUp(Frame* frame, Event*, EditorCommandSource, const String&)
798 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, LineGranularity, true);
802 static bool executeMoveUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
804 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, LineGranularity, true);
808 static bool executeMoveWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
810 frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, WordGranularity, true);
814 static bool executeMoveWordBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
816 frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, WordGranularity, true);
820 Frame* frame, Event*, EditorCommandSource, const String&)
822 frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, WordGranularity, true);
826 static bool executeMoveWordForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
828 frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, WordGranularity, true);
832 static bool executeMoveWordLeft(Frame* frame, Event*, EditorCommandSource, const String&)
834 frame->selection()->modify(SelectionController::MOVE, SelectionController::LEFT, WordGranularity, true);
838 static bool executeMoveWordLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
840 frame->selection()->modify(SelectionController::EXTEND, SelectionController::LEFT, WordGranularity, true);
844 static bool executeMoveWordRight(Frame* frame, Event*, EditorCommandSource, const String&)
846 frame->selection()->modify(SelectionController::MOVE, SelectionController::RIGHT, WordGranularity, true);
850 static bool executeMoveWordRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
852 frame->selection()->modify(SelectionController::EXTEND, SelectionController::RIGHT, WordGranularity, true);
856 static bool executeMoveToLeftEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
858 frame->selection()->modify(SelectionController::MOVE, SelectionController::LEFT, LineBoundary, true);
862 static bool executeMoveToLeftEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
864 frame->selection()->modify(SelectionController::EXTEND, SelectionController::LEFT, LineBoundary, true);
868 static bool executeMoveToRightEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
870 frame->selection()->modify(SelectionController::MOVE, SelectionController::RIGHT, LineBoundary, true);
874 static bool executeMoveToRightEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
876 frame->selection()->modify(SelectionController::EXTEND, SelectionController::RIGHT, LineBoundary, true);
880 static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const String&)
882 applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Outdent));
886 static bool executePaste(Frame* frame, Event*, EditorCommandSource, const String&)
888 frame->editor()->paste();
892 static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource, const String&)
894 frame->editor()->pasteAsPlainText();
898 static bool executePrint(Frame* frame, Event*, EditorCommandSource, const String&)
900 Page* page = frame->page();
903 page->chrome()->print(frame);
907 static bool executeRedo(Frame* frame, Event*, EditorCommandSource, const String&)
909 frame->editor()->redo();
913 static bool executeRemoveFormat(Frame* frame, Event*, EditorCommandSource, const String&)
915 frame->editor()->removeFormattingAndStyle();
919 static bool executeSelectAll(Frame* frame, Event*, EditorCommandSource, const String&)
921 frame->selection()->selectAll();
925 static bool executeSelectLine(Frame* frame, Event*, EditorCommandSource, const String&)
927 return expandSelectionToGranularity(frame, LineGranularity);
930 static bool executeSelectParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
932 return expandSelectionToGranularity(frame, ParagraphGranularity);
935 static bool executeSelectSentence(Frame* frame, Event*, EditorCommandSource, const String&)
937 return expandSelectionToGranularity(frame, SentenceGranularity);
940 static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&)
942 RefPtr<Range> mark = frame->mark().toNormalizedRange();
943 RefPtr<Range> selection = frame->editor()->selectedRange();
948 frame->selection()->setSelectedRange(unionDOMRanges(mark.get(), selection.get()).get(), DOWNSTREAM, true);
952 static bool executeSelectWord(Frame* frame, Event*, EditorCommandSource, const String&)
954 return expandSelectionToGranularity(frame, WordGranularity);
957 static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&)
959 frame->setMark(frame->selection()->selection());
963 static bool executeStrikethrough(Frame* frame, Event*, EditorCommandSource source, const String&)
966 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, lineThrough.get());
969 static bool executeStyleWithCSS(Frame* frame, Event*, EditorCommandSource, const String& value)
974 frame->editor()->setShouldStyleWithCSS(value == "true" ? true : false);
978 static bool executeSubscript(Frame* frame, Event*, EditorCommandSource source, const String&)
980 return executeToggleStyle(frame, source, EditActionSubscript, CSSPropertyVerticalAlign, "baseline", "sub");
983 static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source, const String&)
985 return executeToggleStyle(frame, source, EditActionSuperscript, CSSPropertyVerticalAlign, "baseline", "super");
988 static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
990 const VisibleSelection& mark = frame->mark();
991 const VisibleSelection& selection = frame->selection()->selection();
996 frame->selection()->setSelection(mark);
997 frame->setMark(selection);
1001 static bool executeToggleBold(Frame* frame, Event*, EditorCommandSource source, const String&)
1003 return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontWeight, "normal", "bold");
1006 static bool executeToggleItalic(Frame* frame, Event*, EditorCommandSource source, const String&)
1008 return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontStyle, "normal", "italic");
1011 static bool executeTranspose(Frame* frame, Event*, EditorCommandSource, const String&)
1013 frame->editor()->transpose();
1017 static bool executeUnderline(Frame* frame, Event*, EditorCommandSource source, const String&)
1020 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, underline.get());
1023 static bool executeUndo(Frame* frame, Event*, EditorCommandSource, const String&)
1025 frame->editor()->undo();
1029 static bool executeUnlink(Frame* frame, Event*, EditorCommandSource, const String&)
1031 applyCommand(UnlinkCommand::create(frame->document()));
1035 static bool executeUnscript(Frame* frame, Event*, EditorCommandSource source, const String&)
1037 return executeApplyStyle(frame, source, EditActionUnscript, CSSPropertyVerticalAlign, "baseline");
1040 static bool executeUnselect(Frame* frame, Event*, EditorCommandSource, const String&)
1042 frame->selection()->clear();
1046 static bool executeYank(Frame* frame, Event*, EditorCommandSource, const String&)
1048 frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->yankFromKillRing(), false, 0);
1049 frame->editor()->setKillRingToYankedState();
1053 static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, const String&)
1055 frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->yankFromKillRing(), true, 0);
1056 frame->editor()->setKillRingToYankedState();
1062 static bool supported(Frame*, EditorCommandSource)
1067 static bool supportedFromMenuOrKeyBinding(Frame*, EditorCommandSource source)
1072 static bool supportedPaste(Frame* frame, EditorCommandSource source)
1079 Settings* settings = frame ? frame->settings() : 0;
1089 static bool enabled(Frame*, Event*, EditorCommandSource)
1094 static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource)
1097 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1101 static bool caretBrowsingEnabled(Frame* frame)
1103 return frame->settings() && frame->settings()->caretBrowsingEnabled();
1108 static bool enabledVisibleSelectionOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource)
1111 return caretBrowsingEnabled(frame) || enabledVisibleSelection(frame, event, dummyEditorCommandSource);
1114 static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource)
1116 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1118 && frame->mark().isCaretOrRange();
1121 static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource)
1123 const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
1127 static bool enabledCopy(Frame* frame, Event*, EditorCommandSource)
1129 return frame->editor()->canDHTMLCopy() || frame->editor()->canCopy();
1132 static bool enabledCut(Frame* frame, Event*, EditorCommandSource)
1134 return frame->editor()->canDHTMLCut() || frame->editor()->canCut();
1137 static bool enabledDelete(Frame* frame, Event* event, EditorCommandSource source)
1142 return frame->editor()->canDHTMLCut() || frame->editor()->canCut();
1147 return frame->editor()->selectionForCommand(event).isContentEditable();
1153 static bool enabledInEditableText(Frame* frame, Event* event, EditorCommandSource)
1155 return frame->editor()->selectionForCommand(event).isContentEditable();
1158 static bool enabledInEditableTextOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource)
1161 return caretBrowsingEnabled(frame) || enabledInEditableText(frame, event, dummyEditorCommandSource);
1164 static bool enabledInRichlyEditableText(Frame* frame, Event*, EditorCommandSource)
1166 return frame->selection()->isCaretOrRange() && frame->selection()->isContentRichlyEditable();
1169 static bool enabledPaste(Frame* frame, Event*, EditorCommandSource)
1171 return frame->editor()->canPaste();
1174 static bool enabledRangeInEditableText(Frame* frame, Event*, EditorCommandSource)
1176 return frame->selection()->isRange() && frame->selection()->isContentEditable();
1179 static bool enabledRangeInRichlyEditableText(Frame* frame, Event*, EditorCommandSource)
1181 return frame->selection()->isRange() && frame->selection()->isContentRichlyEditable();
1184 static bool enabledRedo(Frame* frame, Event*, EditorCommandSource)
1186 return frame->editor()->canRedo();
1189 static bool enabledUndo(Frame* frame, Event*, EditorCommandSource)
1191 return frame->editor()->canUndo();
1196 static TriState stateNone(Frame*, Event*)
1201 static TriState stateBold(Frame* frame, Event*)
1203 return stateStyle(frame, CSSPropertyFontWeight, "bold");
1206 static TriState stateItalic(Frame* frame, Event*)
1208 return stateStyle(frame, CSSPropertyFontStyle, "italic");
1211 static TriState stateOrderedList(Frame* frame, Event*)
1213 return frame->editor()->selectionOrderedListState();
1216 static TriState stateStrikethrough(Frame* frame, Event*)
1218 return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "line-through");
1221 static TriState stateStyleWithCSS(Frame* frame, Event*)
1223 return frame->editor()->shouldStyleWithCSS() ? TrueTriState : FalseTriState;
1226 static TriState stateSubscript(Frame* frame, Event*)
1228 return stateStyle(frame, CSSPropertyVerticalAlign, "sub");
1231 static TriState stateSuperscript(Frame* frame, Event*)
1233 return stateStyle(frame, CSSPropertyVerticalAlign, "super");
1236 static TriState stateTextWritingDirectionLeftToRight(Frame* frame, Event*)
1238 return stateTextWritingDirection(frame, LeftToRightWritingDirection);
1241 static TriState stateTextWritingDirectionNatural(Frame* frame, Event*)
1243 return stateTextWritingDirection(frame, NaturalWritingDirection);
1246 static TriState stateTextWritingDirectionRightToLeft(Frame* frame, Event*)
1248 return stateTextWritingDirection(frame, RightToLeftWritingDirection);
1251 static TriState stateUnderline(Frame* frame, Event*)
1253 return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "underline");
1256 static TriState stateUnorderedList(Frame* frame, Event*)
1258 return frame->editor()->selectionUnorderedListState();
1263 static String valueNull(Frame*, Event*)
1268 static String valueBackColor(Frame* frame, Event*)
1270 return valueStyle(frame, CSSPropertyBackgroundColor);
1273 static String valueFontName(Frame* frame, Event*)
1275 return valueStyle(frame, CSSPropertyFontFamily);
1278 static String valueFontSize(Frame* frame, Event*)
1280 return valueStyle(frame, CSSPropertyFontSize);
1283 static String valueFontSizeDelta(Frame* frame, Event*)
1285 return valueStyle(frame, CSSPropertyWebkitFontSizeDelta);
1288 static String valueForeColor(Frame* frame, Event*)
1290 return valueStyle(frame, CSSPropertyColor);
1508 Editor::Command::Command(PassRefPtr<Frame> frame, const EditorInternalCommand* command, EditorCommandSource source)
1509 : m_frame(frame)