Implement KeyboardEvent constructor
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 00:56:32 +0000 (00:56 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 00:56:32 +0000 (00:56 +0000)
commit4f55ec0b738884ad825c6f374b3b06e9b98d7811
tree8773c017c188f3dff980a896f512b0cf9a97c6e4
parentb99610dd55ecab38d786d89fa9d4a502d19f5dba
Implement KeyboardEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=108320

Reviewed by Adam Barth.

Source/WebCore:

This patch implements KeyboardEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

This significantly simplifies a code to construct a KeyboardEvent.

Before:
  e = document.createEvent("KeyboardEvent");
  e.initKeyboardEvent("keypress", true, true, null, false, false, false, false, 0, 0);

After:
  e = new KeyboardEvent("keypress");

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

- 'char' and 'code' are not yet supported due to lack of WebCore implementation.

- 'altGraphKey' is not supported because it's an extended attribute in WebKit
and is not speced.

- Renamed keyboard event constant variables to avoid style errors.

Test: fast/events/constructors/keyboard-event-constructor.html

* dom/KeyboardEvent.cpp:
(WebCore::keyLocationCode):
(WebCore::KeyboardEventInit::KeyboardEventInit):
(WebCore):
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
(WebCore):
(WebCore::KeypressCommand::KeypressCommand):
(KeypressCommand):
(KeyboardEventInit):
(KeyboardEvent):
(WebCore::KeyboardEvent::create):
(WebCore::KeyboardEvent::keyIdentifier):
(WebCore::KeyboardEvent::keyLocation):
(WebCore::KeyboardEvent::altGraphKey):
(WebCore::KeyboardEvent::keyEvent):
(WebCore::KeyboardEvent::keypressCommands):
* dom/KeyboardEvent.idl:

Source/WebKit/chromium:

Renamed keyboard event constant variables to avoid style errors.

* src/WebInputEventConversion.cpp:
(WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder):
* tests/WebInputEventConversionTest.cpp:
* tests/WebInputEventFactoryTestGtk.cpp:

LayoutTests:

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

This patch implements KeyboardEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/dom-constructors-expected.txt:
* fast/dom/dom-constructors.html:
* fast/events/constructors/keyboard-event-constructor-expected.txt: Added.
* fast/events/constructors/keyboard-event-constructor.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
LayoutTests/fast/dom/dom-constructors-expected.txt
LayoutTests/fast/dom/dom-constructors.html
LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/constructors/keyboard-event-constructor.html [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/dom/KeyboardEvent.cpp
Source/WebCore/dom/KeyboardEvent.h
Source/WebCore/dom/KeyboardEvent.idl
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebInputEventConversion.cpp
Source/WebKit/chromium/tests/WebInputEventConversionTest.cpp
Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp