Changeset 19463 in webkit


Ignore:
Timestamp:
Feb 6, 2007 11:40:59 PM (17 years ago)
Author:
aliceli1
Message:

Reviewed by Maciej.

Added editing command functions for scrolling by page and moving the caret

  • editing/Editor.cpp: (WebCore::execMoveUpByPageAndModifyCaret): (WebCore::execMoveDownByPageAndModifyCaret): (WebCore::CommandEntry::):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19452 r19463  
     12007-02-06  Alice Liu  <alice.liu@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        Added editing command functions for scrolling by page and moving the caret
     6
     7        * editing/Editor.cpp:
     8        (WebCore::execMoveUpByPageAndModifyCaret):
     9        (WebCore::execMoveDownByPageAndModifyCaret):
     10        (WebCore::CommandEntry::):
     11
    1122007-02-06  Justin Garcia  <justin.garcia@apple.com>
    213
  • trunk/WebCore/editing/Editor.cpp

    r19417 r19463  
    797797}
    798798
     799static bool execMoveUpByPageAndModifyCaret(Frame* frame)
     800{
     801    RenderObject* renderer = frame->document()->focusedNode()->renderer();
     802    if (renderer->style()->overflowY() == OSCROLL
     803        || renderer->style()->overflowY() == OAUTO
     804        || renderer->isTextArea()) {
     805        int height = -(frame->document()->focusedNode()->renderer()->clientHeight()-PAGE_KEEP);
     806        bool handledScroll = renderer->scroll(ScrollUp, ScrollByPage);
     807        bool handledCaretMove = frame->selectionController()->modify(SelectionController::MOVE, height);
     808        return handledScroll || handledCaretMove;
     809    }
     810    return false;
     811}
     812
    799813static bool execMoveDown(Frame* frame)
    800814{
     
    819833    frame->selectionController()->modify(SelectionController::EXTEND, SelectionController::FORWARD, CharacterGranularity, true);
    820834    return true;
     835}
     836
     837static bool execMoveDownByPageAndModifyCaret(Frame* frame)
     838{
     839    RenderObject* renderer = frame->document()->focusedNode()->renderer();
     840    if (renderer->style()->overflowY() == OSCROLL
     841        || renderer->style()->overflowY() == OAUTO
     842        || renderer->isTextArea()) {
     843        int height = frame->document()->focusedNode()->renderer()->clientHeight()-PAGE_KEEP;
     844        bool handledScroll = renderer->scroll(ScrollDown, ScrollByPage);
     845        bool handledCaretMove = frame->selectionController()->modify(SelectionController::MOVE, height);
     846        return handledScroll || handledCaretMove;
     847    }
     848    return false;
    821849}
    822850
     
    11221150        { "MoveBackward", { hasEditableSelection, execMoveBackward } },
    11231151        { "MoveBackwardAndModifySelection", { hasEditableSelection, execMoveBackwardAndModifySelection } },
     1152        { "MoveUpByPageAndModifyCaret", { hasEditableSelection, execMoveUpByPageAndModifyCaret } },
    11241153        { "MoveDown", { hasEditableSelection, execMoveDown } },
    11251154        { "MoveDownAndModifySelection", { hasEditableSelection, execMoveDownAndModifySelection } },
    11261155        { "MoveForward", { hasEditableSelection, execMoveForward } },
    11271156        { "MoveForwardAndModifySelection", { hasEditableSelection, execMoveForwardAndModifySelection } },
     1157        { "MoveDownByPageAndModifyCaret", { hasEditableSelection, execMoveDownByPageAndModifyCaret } },
    11281158        { "MoveLeft", { hasEditableSelection, execMoveLeft } },
    11291159        { "MoveLeftAndModifySelection", { hasEditableSelection, execMoveLeftAndModifySelection } },
Note: See TracChangeset for help on using the changeset viewer.