Changeset 64086 in webkit
- Timestamp:
- Jul 26, 2010 4:06:34 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64085 r64086 1 2010-07-26 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Anders Carlsson. 4 5 Patch for https://bugs.webkit.org/show_bug.cgi?id=43013 6 Part of <rdar://problem/8152434> 7 Add support for scrolling using the keyboard in WebKit2 8 9 Add a new export and make WindowsKeyboardCodes private. 10 11 * WebCore.exp.in: 12 * WebCore.xcodeproj/project.pbxproj: 13 1 14 2010-07-26 Darin Adler <darin@apple.com> 2 15 -
trunk/WebCore/WebCore.exp.in
r64070 r64086 216 216 __ZN7WebCore12EventHandler15sendScrollEventEv 217 217 __ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE 218 __ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE 218 219 __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb 219 220 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEj -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r64058 r64086 5096 5096 E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; }; 5097 5097 E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; }; 5098 E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */; };5098 E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5099 5099 E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */; }; 5100 5100 E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */; }; -
trunk/WebKit2/ChangeLog
r64079 r64086 1 2010-07-26 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Anders Carlsson. 4 5 Patch for https://bugs.webkit.org/show_bug.cgi?id=43013 6 Part of <rdar://problem/8152434> 7 Add support for scrolling using the keyboard in WebKit2 8 9 * WebProcess/WebPage/WebPage.cpp: 10 (WebKit::getScrollMapping): 11 (WebKit::WebPage::keyEvent): 12 Scroll the page in response to keyDown. 13 * WebProcess/WebPage/WebPage.h: 14 * WebProcess/WebPage/mac/WebPageMac.mm: 15 Use WindowsKeyboardCodes.h instead of redefining the constants. 16 1 17 2010-07-26 Ada Chan <adachan@apple.com> 2 18 -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r64063 r64086 58 58 #include <WebCore/ResourceRequest.h> 59 59 #include <WebCore/Settings.h> 60 #include <WebCore/WindowsKeyboardCodes.h> 60 61 #include <runtime/JSLock.h> 61 62 #include <runtime/JSValue.h> … … 344 345 } 345 346 347 static bool getScrollMapping(const WebKeyboardEvent& event, ScrollDirection& direction, ScrollGranularity& granularity) 348 { 349 if (event.type() != WebEvent::KeyDown && event.type() != WebEvent::RawKeyDown) 350 return false; 351 352 switch (event.windowsVirtualKeyCode()) { 353 case VK_LEFT: 354 granularity = ScrollByLine; 355 direction = ScrollLeft; 356 break; 357 case VK_RIGHT: 358 granularity = ScrollByLine; 359 direction = ScrollRight; 360 break; 361 case VK_UP: 362 granularity = ScrollByLine; 363 direction = ScrollUp; 364 break; 365 case VK_DOWN: 366 granularity = ScrollByLine; 367 direction = ScrollDown; 368 break; 369 case VK_HOME: 370 granularity = ScrollByDocument; 371 direction = ScrollUp; 372 break; 373 case VK_END: 374 granularity = ScrollByDocument; 375 direction = ScrollDown; 376 break; 377 case VK_PRIOR: 378 granularity = ScrollByPage; 379 direction = ScrollUp; 380 break; 381 case VK_NEXT: 382 granularity = ScrollByPage; 383 direction = ScrollDown; 384 break; 385 default: 386 return false; 387 } 388 389 return true; 390 } 391 346 392 void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) 347 393 { … … 354 400 355 401 PlatformKeyboardEvent platformKeyboardEvent = platform(keyboardEvent); 356 m_page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(platformKeyboardEvent); 402 403 Frame* frame = m_page->focusController()->focusedOrMainFrame(); 404 frame->eventHandler()->keyEvent(platformKeyboardEvent); 405 406 ScrollDirection direction; 407 ScrollGranularity granularity; 408 if (getScrollMapping(keyboardEvent, direction, granularity)) 409 frame->eventHandler()->scrollRecursively(direction, granularity); 357 410 } 358 411 -
trunk/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r57309 r64086 29 29 #include <WebCore/Page.h> 30 30 #include <WebCore/PlatformKeyboardEvent.h> 31 #include <WebCore/WindowsKeyboardCodes.h> 31 32 32 33 using namespace WebCore; … … 46 47 static const unsigned MetaKey = 1 << 3; 47 48 48 static const unsigned VKEY_BACK = 0x08;49 static const unsigned VKEY_TAB = 0x09;50 static const unsigned VKEY_RETURN = 0x0D;51 static const unsigned VKEY_ESCAPE = 0x1B;52 static const unsigned VKEY_PRIOR = 0x21;53 static const unsigned VKEY_NEXT = 0x22;54 static const unsigned VKEY_END = 0x23;55 static const unsigned VKEY_HOME = 0x24;56 static const unsigned VKEY_LEFT = 0x25;57 static const unsigned VKEY_UP = 0x26;58 static const unsigned VKEY_RIGHT = 0x27;59 static const unsigned VKEY_DOWN = 0x28;60 static const unsigned VKEY_INSERT = 0x2D;61 static const unsigned VKEY_DELETE = 0x2E;62 static const unsigned VKEY_OEM_PERIOD = 0xBE;63 64 49 // Keys with special meaning. These will be delegated to the editor using 65 50 // the execCommand() method … … 77 62 78 63 static const KeyDownEntry keyDownEntries[] = { 79 { VK EY_LEFT,0, "MoveLeft" },80 { VK EY_LEFT,ShiftKey, "MoveLeftAndModifySelection" },81 { VK EY_LEFT,AltKey, "MoveWordLeft" },82 { VK EY_LEFT,AltKey | ShiftKey, "MoveWordLeftAndModifySelection" },83 { VK EY_RIGHT,0, "MoveRight" },84 { VK EY_RIGHT,ShiftKey, "MoveRightAndModifySelection" },85 { VK EY_RIGHT,AltKey, "MoveWordRight" },86 { VK EY_RIGHT,AltKey | ShiftKey, "MoveWordRightAndModifySelection" },87 { VK EY_UP,0, "MoveUp" },88 { VK EY_UP,ShiftKey, "MoveUpAndModifySelection" },89 { VK EY_PRIOR,ShiftKey, "MovePageUpAndModifySelection" },90 { VK EY_DOWN,0, "MoveDown" },91 { VK EY_DOWN,ShiftKey, "MoveDownAndModifySelection" },92 { VK EY_NEXT,ShiftKey, "MovePageDownAndModifySelection" },93 { VK EY_PRIOR,0, "MovePageUp" },94 { VK EY_NEXT,0, "MovePageDown" },64 { VK_LEFT, 0, "MoveLeft" }, 65 { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" }, 66 { VK_LEFT, AltKey, "MoveWordLeft" }, 67 { VK_LEFT, AltKey | ShiftKey, "MoveWordLeftAndModifySelection" }, 68 { VK_RIGHT, 0, "MoveRight" }, 69 { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" }, 70 { VK_RIGHT, AltKey, "MoveWordRight" }, 71 { VK_RIGHT, AltKey | ShiftKey, "MoveWordRightAndModifySelection" }, 72 { VK_UP, 0, "MoveUp" }, 73 { VK_UP, ShiftKey, "MoveUpAndModifySelection" }, 74 { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" }, 75 { VK_DOWN, 0, "MoveDown" }, 76 { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" }, 77 { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" }, 78 { VK_PRIOR, 0, "MovePageUp" }, 79 { VK_NEXT, 0, "MovePageDown" }, 95 80 96 { VK EY_HOME,0, "MoveToBeginningOfLine" },97 { VK EY_HOME,ShiftKey, "MoveToBeginningOfLineAndModifySelection" },98 { VK EY_LEFT,MetaKey, "MoveToBeginningOfLine" },99 { VK EY_LEFT,MetaKey | ShiftKey, "MoveToBeginningOfLineAndModifySelection" },100 { VK EY_UP,MetaKey, "MoveToBeginningOfDocument" },101 { VK EY_UP,MetaKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" },81 { VK_HOME, 0, "MoveToBeginningOfLine" }, 82 { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, 83 { VK_LEFT, MetaKey, "MoveToBeginningOfLine" }, 84 { VK_LEFT, MetaKey | ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, 85 { VK_UP, MetaKey, "MoveToBeginningOfDocument" }, 86 { VK_UP, MetaKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" }, 102 87 103 { VK EY_END,0, "MoveToEndOfLine" },104 { VK EY_END,ShiftKey, "MoveToEndOfLineAndModifySelection" },105 { VK EY_DOWN,MetaKey, "MoveToEndOfDocument" },106 { VK EY_DOWN,MetaKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" },107 { VK EY_RIGHT,MetaKey, "MoveToEndOfLine" },108 { VK EY_RIGHT,MetaKey | ShiftKey, "MoveToEndOfLineAndModifySelection" },88 { VK_END, 0, "MoveToEndOfLine" }, 89 { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" }, 90 { VK_DOWN, MetaKey, "MoveToEndOfDocument" }, 91 { VK_DOWN, MetaKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" }, 92 { VK_RIGHT, MetaKey, "MoveToEndOfLine" }, 93 { VK_RIGHT, MetaKey | ShiftKey, "MoveToEndOfLineAndModifySelection" }, 109 94 110 { VK EY_BACK,0, "DeleteBackward" },111 { VK EY_BACK,ShiftKey, "DeleteBackward" },112 { VK EY_DELETE,0, "DeleteForward" },113 { VK EY_BACK,AltKey, "DeleteWordBackward" },114 { VK EY_DELETE,AltKey, "DeleteWordForward" },95 { VK_BACK, 0, "DeleteBackward" }, 96 { VK_BACK, ShiftKey, "DeleteBackward" }, 97 { VK_DELETE, 0, "DeleteForward" }, 98 { VK_BACK, AltKey, "DeleteWordBackward" }, 99 { VK_DELETE, AltKey, "DeleteWordForward" }, 115 100 116 101 { 'B', CtrlKey, "ToggleBold" }, 117 102 { 'I', CtrlKey, "ToggleItalic" }, 118 103 119 { VK EY_ESCAPE,0, "Cancel" },120 { VK EY_OEM_PERIOD, CtrlKey,"Cancel" },121 { VK EY_TAB,0, "InsertTab" },122 { VK EY_TAB,ShiftKey, "InsertBacktab" },123 { VK EY_RETURN,0, "InsertNewline" },124 { VK EY_RETURN,CtrlKey, "InsertNewline" },125 { VK EY_RETURN,AltKey, "InsertNewline" },126 { VK EY_RETURN,AltKey | ShiftKey, "InsertNewline" },127 { VK EY_RETURN,ShiftKey, "InsertLineBreak" },104 { VK_ESCAPE, 0, "Cancel" }, 105 { VK_OEM_PERIOD, CtrlKey, "Cancel" }, 106 { VK_TAB, 0, "InsertTab" }, 107 { VK_TAB, ShiftKey, "InsertBacktab" }, 108 { VK_RETURN, 0, "InsertNewline" }, 109 { VK_RETURN, CtrlKey, "InsertNewline" }, 110 { VK_RETURN, AltKey, "InsertNewline" }, 111 { VK_RETURN, AltKey | ShiftKey, "InsertNewline" }, 112 { VK_RETURN, ShiftKey, "InsertLineBreak" }, 128 113 129 114 { 'C', MetaKey, "Copy" }, … … 131 116 { 'X', MetaKey, "Cut" }, 132 117 { 'A', MetaKey, "SelectAll" }, 133 { VK EY_INSERT,CtrlKey, "Copy" },134 { VK EY_INSERT,ShiftKey, "Paste" },135 { VK EY_DELETE,ShiftKey, "Cut" },118 { VK_INSERT, CtrlKey, "Copy" }, 119 { VK_INSERT, ShiftKey, "Paste" }, 120 { VK_DELETE, ShiftKey, "Cut" }, 136 121 { 'Z', MetaKey, "Undo" }, 137 122 { 'Z', MetaKey | ShiftKey, "Redo" },
Note: See TracChangeset
for help on using the changeset viewer.