After preventing a beforeinput event, an input event is fired when formatting rich...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Dec 2016 04:36:55 +0000 (04:36 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Dec 2016 04:36:55 +0000 (04:36 +0000)
commit8206fe06f33e8239c32f0b630b8f95e9032fdaa7
tree416b2ac1f3892c3bda11571045491c48618a69fe
parent7373adbe3410fbd2b5fa53b5471f17ab41faeb40
After preventing a beforeinput event, an input event is fired when formatting rich text
https://bugs.webkit.org/show_bug.cgi?id=165435
<rdar://problem/29522314>

Reviewed by Ryosuke Niwa.

Source/WebCore:

This regressed after I refactored some input event event dispatch logic when formatting text in r208461.
I moved the logic for dispatching input events when applying styles into Editor::applyStyle, but left out an
early return after firing the beforeinput event if the default behavior was prevented, which caused us to
continue on and dispatch an input event. The fix is to bail from applyStyle if default was prevented.

Augmented an existing layout test to cover this case.

* editing/Editor.cpp:
(WebCore::Editor::applyStyle):
(WebCore::Editor::applyParagraphStyle):

LayoutTests:

Augmented a layout test to verify that when preventing beforeinput events, a corresponding input event is not
fired in addition to the style not being applied to the text.

* fast/events/before-input-prevent-biu.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/before-input-prevent-biu.html
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp