⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editorcommand.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    frame->selection()->modify(SelectionController::MOVE, SelectionController::LEFT, WordGranularity, true);    return true;}static bool executeMoveWordLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::LEFT, WordGranularity, true);    return true;}static bool executeMoveWordRight(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::RIGHT, WordGranularity, true);    return true;}static bool executeMoveWordRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::RIGHT, WordGranularity, true);    return true;}static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const String&){    applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Outdent));    return true;}static bool executePaste(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->paste();    return true;}static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->pasteAsPlainText();    return true;}static bool executePrint(Frame* frame, Event*, EditorCommandSource, const String&){    Page* page = frame->page();    if (!page)        return false;    page->chrome()->print(frame);    return true;}static bool executeRedo(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->redo();    return true;}static bool executeRemoveFormat(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->removeFormattingAndStyle();    return true;}static bool executeSelectAll(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->selectAll();    return true;}static bool executeSelectLine(Frame* frame, Event*, EditorCommandSource, const String&){    return expandSelectionToGranularity(frame, LineGranularity);}static bool executeSelectParagraph(Frame* frame, Event*, EditorCommandSource, const String&){    return expandSelectionToGranularity(frame, ParagraphGranularity);}static bool executeSelectSentence(Frame* frame, Event*, EditorCommandSource, const String&){    return expandSelectionToGranularity(frame, SentenceGranularity);}static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&){    RefPtr<Range> mark = frame->mark().toNormalizedRange();    RefPtr<Range> selection = frame->editor()->selectedRange();    if (!mark || !selection) {        systemBeep();        return false;    }    frame->selection()->setSelectedRange(unionDOMRanges(mark.get(), selection.get()).get(), DOWNSTREAM, true);    return true;}static bool executeSelectWord(Frame* frame, Event*, EditorCommandSource, const String&){    return expandSelectionToGranularity(frame, WordGranularity);}static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&){    frame->setMark(frame->selection()->selection());    return true;}static bool executeStrikethrough(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyWebkitTextDecorationsInEffect, "none", "line-through");}static bool executeStyleWithCSS(Frame* frame, Event*, EditorCommandSource, const String& value){    if (value != "false" && value != "true")        return false;        frame->editor()->setShouldStyleWithCSS(value == "true" ? true : false);    return true;}static bool executeSubscript(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeToggleStyle(frame, source, EditActionSubscript, CSSPropertyVerticalAlign, "baseline", "sub");}static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeToggleStyle(frame, source, EditActionSuperscript, CSSPropertyVerticalAlign, "baseline", "super");}static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&){    const VisibleSelection& mark = frame->mark();    const VisibleSelection& selection = frame->selection()->selection();    if (mark.isNone() || selection.isNone()) {        systemBeep();        return false;    }    frame->selection()->setSelection(mark);    frame->setMark(selection);    return true;}static bool executeToggleBold(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontWeight, "normal", "bold");}static bool executeToggleItalic(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeToggleStyle(frame, source, EditActionChangeAttributes, CSSPropertyFontStyle, "normal", "italic");}static bool executeTranspose(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->transpose();    return true;}static bool executeUnderline(Frame* frame, Event*, EditorCommandSource source, const String&){    // FIXME: This currently clears overline, line-through, and blink as an unwanted side effect.    return executeToggleStyle(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, "none", "underline");}static bool executeUndo(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->undo();    return true;}static bool executeUnlink(Frame* frame, Event*, EditorCommandSource, const String&){    applyCommand(UnlinkCommand::create(frame->document()));    return true;}static bool executeUnscript(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeApplyStyle(frame, source, EditActionUnscript, CSSPropertyVerticalAlign, "baseline");}static bool executeUnselect(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->clear();    return true;}static bool executeYank(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->yankFromKillRing(), false, 0);    frame->editor()->setKillRingToYankedState();    return true;}static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, const String&){    frame->editor()->insertTextWithoutSendingTextEvent(frame->editor()->yankFromKillRing(), true, 0);    frame->editor()->setKillRingToYankedState();    return true;}// Supported functionsstatic bool supported(Frame*, EditorCommandSource){    return true;}static bool supportedFromMenuOrKeyBinding(Frame*, EditorCommandSource source){    return source == CommandFromMenuOrKeyBinding;}static bool supportedPaste(Frame* frame, EditorCommandSource source){    switch (source) {        case CommandFromMenuOrKeyBinding:            return true;        case CommandFromDOM:        case CommandFromDOMWithUserInterface: {            Settings* settings = frame ? frame->settings() : 0;            return settings && settings->isDOMPasteAllowed();        }    }    ASSERT_NOT_REACHED();    return false;}// Enabled functionsstatic bool enabled(Frame*, Event*, EditorCommandSource){    return true;}static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource){    // The term "visible" here includes a caret in editable text or a range in any text.    const VisibleSelection& selection = frame->editor()->selectionForCommand(event);    return (selection.isCaret() && selection.isContentEditable()) || selection.isRange();}static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource){    const VisibleSelection& selection = frame->editor()->selectionForCommand(event);    return ((selection.isCaret() && selection.isContentEditable()) || selection.isRange())        && frame->mark().isCaretOrRange();}static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource){    const VisibleSelection& selection = frame->editor()->selectionForCommand(event);    return selection.isCaret() && selection.isContentEditable();}static bool enabledCopy(Frame* frame, Event*, EditorCommandSource){    return frame->editor()->canDHTMLCopy() || frame->editor()->canCopy();}static bool enabledCut(Frame* frame, Event*, EditorCommandSource){    return frame->editor()->canDHTMLCut() || frame->editor()->canCut();}static bool enabledDelete(Frame* frame, Event* event, EditorCommandSource source){    switch (source) {        case CommandFromMenuOrKeyBinding:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -