editorcommand.cpp

来自「linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自Web」· C++ 代码 · 共 1,341 行 · 第 1/5 页

CPP
1,341
字号
static bool executeJustifyRight(Frame* frame, Event*, EditorCommandSource source, const String&){    return executeApplyParagraphStyle(frame, source, EditActionAlignRight, CSSPropertyTextAlign, "right");}static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&){    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();    style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);    style->setProperty(CSSPropertyDirection, CSSValueLtr);    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);    return true;}static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&){    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();    style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);    return true;}static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&){    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();    style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);    style->setProperty(CSSPropertyDirection, CSSValueRtl);    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);    return true;}static bool executeMoveBackward(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, CharacterGranularity, true);    return true;}static bool executeMoveBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, CharacterGranularity, true);    return true;}static bool executeMoveDown(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, LineGranularity, true);    return true;}static bool executeMoveDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, LineGranularity, true);    return true;}static bool executeMoveForward(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, CharacterGranularity, true);    return true;}static bool executeMoveForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, CharacterGranularity, true);    return true;}static bool executeMoveLeft(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::LEFT, CharacterGranularity, true);    return true;}static bool executeMoveLeftAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::LEFT, CharacterGranularity, true);    return true;}static bool executeMovePageDown(Frame* frame, Event*, EditorCommandSource, const String&){    int distance = verticalScrollDistance(frame);    if (!distance)        return false;    return frame->selection()->modify(SelectionController::MOVE, distance, true);}static bool executeMovePageDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    int distance = verticalScrollDistance(frame);    if (!distance)        return false;    return frame->selection()->modify(SelectionController::EXTEND, distance, true);}static bool executeMovePageUp(Frame* frame, Event*, EditorCommandSource, const String&){    int distance = verticalScrollDistance(frame);    if (!distance)        return false;    return frame->selection()->modify(SelectionController::MOVE, -distance, true);}static bool executeMovePageUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    int distance = verticalScrollDistance(frame);    if (!distance)        return false;    return frame->selection()->modify(SelectionController::EXTEND, -distance, true);}static bool executeMoveRight(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::RIGHT, CharacterGranularity, true);    return true;}static bool executeMoveRightAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::RIGHT, CharacterGranularity, true);    return true;}static bool executeMoveToBeginningOfDocument(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, DocumentBoundary, true);    return true;}static bool executeMoveToBeginningOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, DocumentBoundary, true);    return true;}static bool executeMoveToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, LineBoundary, true);    return true;}static bool executeMoveToBeginningOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, LineBoundary, true);    return true;}static bool executeMoveToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, ParagraphBoundary, true);    return true;}static bool executeMoveToBeginningOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, ParagraphBoundary, true);    return true;}static bool executeMoveToBeginningOfSentence(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, SentenceBoundary, true);    return true;}static bool executeMoveToBeginningOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, SentenceBoundary, true);    return true;}static bool executeMoveToEndOfDocument(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, DocumentBoundary, true);    return true;}static bool executeMoveToEndOfDocumentAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, DocumentBoundary, true);    return true;}static bool executeMoveToEndOfSentence(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, SentenceBoundary, true);    return true;}static bool executeMoveToEndOfSentenceAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, SentenceBoundary, true);    return true;}static bool executeMoveToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, LineBoundary, true);    return true;}static bool executeMoveToEndOfLineAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, LineBoundary, true);    return true;}static bool executeMoveToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, ParagraphBoundary, true);    return true;}static bool executeMoveToEndOfParagraphAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, ParagraphBoundary, true);    return true;}static bool executeMoveParagraphBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, ParagraphGranularity, true);    return true;}static bool executeMoveParagraphForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, ParagraphGranularity, true);    return true;}static bool executeMoveUp(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, LineGranularity, true);    return true;}static bool executeMoveUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, LineGranularity, true);    return true;}static bool executeMoveWordBackward(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::BACKWARD, WordGranularity, true);    return true;}static bool executeMoveWordBackwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::BACKWARD, WordGranularity, true);    return true;}static bool executeMoveWordForward(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::MOVE, SelectionController::FORWARD, WordGranularity, true);    return true;}static bool executeMoveWordForwardAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&){    frame->selection()->modify(SelectionController::EXTEND, SelectionController::FORWARD, WordGranularity, true);    return true;}static bool executeMoveWordLeft(Frame* frame, Event*, EditorCommandSource, const String&){

⌨️ 快捷键说明

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