WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Prototype (tests in progress)
bug-163021-20161006095449.patch (text/plain), 24.85 KB, created by
Wenson Hsieh
on 2016-10-06 09:58:03 PDT
(
hide
)
Description:
Prototype (tests in progress)
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2016-10-06 09:58:03 PDT
Size:
24.85 KB
patch
obsolete
>Subversion Revision: 206866 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e9820b5e0f2fcaeec86ae2351928088553af8113..fae8a0dc3c7bcecbbed31c2625886b56445d97d7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,62 @@ >+2016-10-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Support onbeforeinput event handling for the new InputEvent spec >+ https://bugs.webkit.org/show_bug.cgi?id=163021 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Work in progress patch. Adds support for parsing the onbeforeinput attribute, and sends default-preventable >+ 'beforeinput' InputEvents to the page. >+ >+ Tests to come soon. >+ >+ * dom/Document.idl: >+ * dom/Element.idl: >+ * dom/EventNames.h: >+ * dom/Node.cpp: >+ (WebCore::Node::dispatchBeforeInputEvent): >+ (WebCore::Node::defaultEventHandler): >+ * dom/Node.h: >+ * editing/CompositeEditCommand.cpp: >+ (WebCore::EditCommandComposition::unapply): >+ (WebCore::EditCommandComposition::reapply): >+ (WebCore::CompositeEditCommand::willApplyCommand): >+ (WebCore::CompositeEditCommand::apply): >+ (WebCore::CompositeEditCommand::didApplyCommand): >+ * editing/CompositeEditCommand.h: >+ * editing/Editor.cpp: >+ (WebCore::dispatchBeforeInputEvents): >+ (WebCore::dispatchInputEvents): >+ (WebCore::Editor::willApplyEditing): >+ (WebCore::Editor::appliedEditing): >+ (WebCore::Editor::willUnapplyEditing): >+ (WebCore::Editor::unappliedEditing): >+ (WebCore::Editor::willReapplyEditing): >+ (WebCore::Editor::reappliedEditing): >+ (WebCore::Editor::computeAndSetTypingStyle): >+ (WebCore::Editor::handleAcceptedCandidate): >+ (WebCore::dispatchEditableContentChangedEvents): Deleted. >+ * editing/Editor.h: >+ * editing/TypingCommand.cpp: >+ (WebCore::TypingCommand::willApplyCommand): >+ (WebCore::TypingCommand::didApplyCommand): >+ (WebCore::TypingCommand::willAddTypingToOpenCommand): >+ (WebCore::TypingCommand::insertTextRunWithoutNewlines): >+ (WebCore::TypingCommand::insertLineBreak): >+ (WebCore::TypingCommand::insertParagraphSeparator): >+ (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): >+ (WebCore::TypingCommand::deleteKeyPressed): >+ (WebCore::TypingCommand::forwardDeleteKeyPressed): >+ (WebCore::TypingCommand::deleteSelection): >+ * editing/TypingCommand.h: >+ (WebCore::TypingCommand::preservesTypingStyle): Deleted. >+ (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator): Deleted. >+ (WebCore::TypingCommand::setShouldRetainAutocorrectionIndicator): Deleted. >+ (WebCore::TypingCommand::shouldStopCaretBlinking): Deleted. >+ * html/HTMLAttributeNames.in: >+ * html/HTMLElement.cpp: >+ (WebCore::HTMLElement::createEventHandlerNameMap): >+ > 2016-10-05 Philippe Normand <pnormand@igalia.com> > > [GStreamer][OWR] GL rendering support >diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl >index cda4e6bb7e1010f2ceab4238d5f41ac9d7c53b4f..85949748ad5c5526b65fc052bf05c4654b9fa876 100644 >--- a/Source/WebCore/dom/Document.idl >+++ b/Source/WebCore/dom/Document.idl >@@ -192,6 +192,7 @@ > // FIXME: Should these be exposed on Window as well (and therefore moved to GlobalEventHandlers.idl)? > [NotEnumerable] attribute EventHandler onbeforecopy; > [NotEnumerable] attribute EventHandler onbeforecut; >+ [NotEnumerable] attribute EventHandler onbeforeinput; > [NotEnumerable] attribute EventHandler onbeforepaste; > [NotEnumerable] attribute EventHandler oncopy; > [NotEnumerable] attribute EventHandler oncut; >diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl >index bcf353b64fe8a742da986a11a1bb5342ec072287..4e7cf1c25447219623083707eb99383eea5592c7 100644 >--- a/Source/WebCore/dom/Element.idl >+++ b/Source/WebCore/dom/Element.idl >@@ -145,6 +145,7 @@ > // FIXME: Should these be exposed on Window as well (and therefore moved to GlobalEventHandlers.idl)? > [NotEnumerable] attribute EventHandler onbeforecopy; > [NotEnumerable] attribute EventHandler onbeforecut; >+ [NotEnumerable] attribute EventHandler onbeforeinput; > [NotEnumerable] attribute EventHandler onbeforepaste; > [NotEnumerable] attribute EventHandler oncopy; > [NotEnumerable] attribute EventHandler oncut; >diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h >index da6df40491fb40009a4f3cadeeb52ba7167b158d..cb2d2c2de8daa734087722363a30693f1230bdb9 100644 >--- a/Source/WebCore/dom/EventNames.h >+++ b/Source/WebCore/dom/EventNames.h >@@ -60,6 +60,7 @@ namespace WebCore { > macro(autocompleteerror) \ > macro(beforecopy) \ > macro(beforecut) \ >+ macro(beforeinput) \ > macro(beforeload) \ > macro(beforepaste) \ > macro(beforeunload) \ >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index c3e74008f54a7f1295547a4e69e008c35677ccd0..b996b11c8f4037afe327e9786a36f740d63192f1 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -2202,6 +2202,17 @@ bool Node::dispatchBeforeLoadEvent(const String& sourceURL) > return !beforeLoadEvent->defaultPrevented(); > } > >+bool Node::dispatchBeforeInputEvent(const AtomicString& inputType) >+{ >+ if (!document().settings()->inputEventsEnabled()) >+ return true; >+ >+ auto beforeInputEvent = InputEvent::create(eventNames().beforeinputEvent, inputType, true, true, document().defaultView(), 0); >+ dispatchScopedEvent(beforeInputEvent); >+ >+ return !beforeInputEvent->defaultPrevented(); >+} >+ > void Node::dispatchInputEvent(const AtomicString& inputType) > { > if (document().settings()->inputEventsEnabled()) >@@ -2272,8 +2283,6 @@ void Node::defaultEventHandler(Event& event) > frame->eventHandler().defaultTouchEventHandler(renderer->node(), &downcast<TouchEvent>(event)); > } > #endif >- } else if (event.type() == eventNames().webkitEditableContentChangedEvent) { >- dispatchInputEvent(emptyString()); > } > } > >diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h >index 9664df77152b3a0ac9558deec166e9c877616ec7..54a802f26126c92d777614240f928401fea1eccc 100644 >--- a/Source/WebCore/dom/Node.h >+++ b/Source/WebCore/dom/Node.h >@@ -525,6 +525,7 @@ public: > > bool dispatchBeforeLoadEvent(const String& sourceURL); > >+ virtual bool dispatchBeforeInputEvent(const AtomicString& inputType); > virtual void dispatchInputEvent(const AtomicString& inputType); > > // Perform the default action for an event. >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index 7db87bd7048e9c0e6553c5410043861f31530432..61fa1f6d9ae853059b680763ed9875b85a82aad8 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -231,6 +231,9 @@ void EditCommandComposition::unapply() > frame->editor().cancelComposition(); > #endif > >+ if (!frame->editor().willUnapplyEditing(*this)) >+ return; >+ > size_t size = m_commands.size(); > for (size_t i = size; i; --i) > m_commands[i - 1]->doUnapply(); >@@ -255,6 +258,9 @@ void EditCommandComposition::reapply() > // if one is necessary (like for the creation of VisiblePositions). > m_document->updateLayoutIgnorePendingStylesheets(); > >+ if (!frame->editor().willReapplyEditing(*this)) >+ return; >+ > for (auto& command : m_commands) > command->doReapply(); > >@@ -311,6 +317,11 @@ CompositeEditCommand::~CompositeEditCommand() > ASSERT(isTopLevelCommand() || !m_composition); > } > >+bool CompositeEditCommand::willApplyCommand() >+{ >+ return frame().editor().willApplyEditing(*this); >+} >+ > void CompositeEditCommand::apply() > { > if (!endingSelection().isContentRichlyEditable()) { >@@ -337,18 +348,23 @@ void CompositeEditCommand::apply() > // if one is necessary (like for the creation of VisiblePositions). > document().updateLayoutIgnorePendingStylesheets(); > >+ if (!willApplyCommand()) >+ return; >+ > { > EventQueueScope eventQueueScope; > doApply(); > } > >- // Only need to call appliedEditing for top-level commands, >- // and TypingCommands do it on their own (see TypingCommand::typingAddedToOpenCommand). >- if (!isTypingCommand()) >- frame().editor().appliedEditing(this); >+ didApplyCommand(); > setShouldRetainAutocorrectionIndicator(false); > } > >+void CompositeEditCommand::didApplyCommand() >+{ >+ frame().editor().appliedEditing(this); >+} >+ > EditCommandComposition* CompositeEditCommand::ensureComposition() > { > CompositeEditCommand* command = this; >diff --git a/Source/WebCore/editing/CompositeEditCommand.h b/Source/WebCore/editing/CompositeEditCommand.h >index 08d243dd3022d15b804cf5b07bc1b445581df72d..e726de9048a536b65ae7581fc439eff0e8da08ee 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.h >+++ b/Source/WebCore/editing/CompositeEditCommand.h >@@ -117,6 +117,9 @@ public: > protected: > explicit CompositeEditCommand(Document&, EditAction = EditActionUnspecified); > >+ virtual bool willApplyCommand(); >+ virtual void didApplyCommand(); >+ > // > // sugary-sweet convenience functions to help create and apply edit commands in composite commands > // >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index 608f745c69ae2d72d584204daa2b9062d02962c6..80c5fe5ba567fa4b1477f1738ef312bdc26e3439 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -60,6 +60,7 @@ > #include "HitTestResult.h" > #include "IndentOutdentCommand.h" > #include "InsertListCommand.h" >+#include "InsertTextCommand.h" > #include "KeyboardEvent.h" > #include "KillRing.h" > #include "Logging.h" >@@ -1025,14 +1026,35 @@ static void notifyTextFromControls(Element* startRoot, Element* endRoot) > endingTextControl->didEditInnerTextValue(); > } > >-static void dispatchEditableContentChangedEvents(PassRefPtr<Element> prpStartRoot, PassRefPtr<Element> prpEndRoot) >+static bool dispatchBeforeInputEvents(RefPtr<Element> startRoot, RefPtr<Element> endRoot, const AtomicString& inputTypeName) >+{ >+ bool continueWithDefaultBehavior = true; >+ if (startRoot) >+ continueWithDefaultBehavior &= startRoot->dispatchBeforeInputEvent(inputTypeName); >+ >+ if (endRoot && endRoot != startRoot) >+ continueWithDefaultBehavior &= endRoot->dispatchBeforeInputEvent(inputTypeName); >+ >+ return continueWithDefaultBehavior; >+} >+ >+static void dispatchInputEvents(PassRefPtr<Element> prpStartRoot, PassRefPtr<Element> prpEndRoot, const AtomicString& inputTypeName) > { > RefPtr<Element> startRoot = prpStartRoot; > RefPtr<Element> endRoot = prpEndRoot; > if (startRoot) >- startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false)); >+ startRoot->dispatchInputEvent(inputTypeName); > if (endRoot && endRoot != startRoot) >- endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false)); >+ endRoot->dispatchInputEvent(inputTypeName); >+} >+ >+bool Editor::willApplyEditing(CompositeEditCommand& command) const >+{ >+ auto* composition = command.composition(); >+ if (!composition) >+ return true; >+ >+ return dispatchBeforeInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), emptyString()); > } > > void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) >@@ -1051,7 +1073,7 @@ void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) > FrameSelection::SetSelectionOptions options = cmd->isDictationCommand() ? FrameSelection::DictationTriggered : 0; > > changeSelectionAfterCommand(newSelection, options); >- dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement()); >+ dispatchInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), emptyString()); > > updateEditorUINowIfScheduled(); > >@@ -1074,6 +1096,11 @@ void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) > respondToChangedContents(newSelection); > } > >+bool Editor::willUnapplyEditing(const EditCommandComposition& composition) const >+{ >+ return dispatchBeforeInputEvents(composition.startingRootEditableElement(), composition.endingRootEditableElement(), emptyString()); >+} >+ > void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd) > { > document().updateLayout(); >@@ -1082,7 +1109,7 @@ void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd) > > VisibleSelection newSelection(cmd->startingSelection()); > changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions()); >- dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement()); >+ dispatchInputEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), emptyString()); > > updateEditorUINowIfScheduled(); > >@@ -1094,6 +1121,11 @@ void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd) > respondToChangedContents(newSelection); > } > >+bool Editor::willReapplyEditing(const EditCommandComposition& composition) const >+{ >+ return dispatchBeforeInputEvents(composition.startingRootEditableElement(), composition.endingRootEditableElement(), emptyString()); >+} >+ > void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd) > { > document().updateLayout(); >@@ -1102,7 +1134,7 @@ void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd) > > VisibleSelection newSelection(cmd->endingSelection()); > changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions()); >- dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement()); >+ dispatchInputEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), emptyString()); > > updateEditorUINowIfScheduled(); > >@@ -3052,6 +3084,10 @@ void Editor::computeAndSetTypingStyle(EditingStyle& style, EditAction editingAct > return; > } > >+ auto* element = m_frame.selection().selection().rootEditableElement(); >+ if (element && !element->dispatchBeforeInputEvent(emptyString())) >+ return; >+ > // Calculate the current typing style. > RefPtr<EditingStyle> typingStyle; > if (auto existingTypingStyle = m_frame.selection().typingStyle()) >@@ -3065,6 +3101,9 @@ void Editor::computeAndSetTypingStyle(EditingStyle& style, EditAction editingAct > if (!blockStyle->isEmpty()) > applyCommand(ApplyStyleCommand::create(document(), blockStyle.get(), editingAction)); > >+ if (element) >+ element->dispatchInputEvent(emptyString()); >+ > // Set the remaining style as the typing style. > m_frame.selection().setTypingStyle(typingStyle); > } >@@ -3625,12 +3664,10 @@ void Editor::handleAcceptedCandidate(TextCheckingResult acceptedCandidate) > m_isHandlingAcceptedCandidate = true; > > if (auto range = rangeForTextCheckingResult(acceptedCandidate)) { >- if (shouldInsertText(acceptedCandidate.replacement, range.get(), EditorInsertActionTyped)) { >- Ref<ReplaceRangeWithTextCommand> replaceCommand = ReplaceRangeWithTextCommand::create(range.get(), acceptedCandidate.replacement); >- applyCommand(replaceCommand.ptr()); >- } >+ if (shouldInsertText(acceptedCandidate.replacement, range.get(), EditorInsertActionTyped)) >+ applyCommand(ReplaceRangeWithTextCommand::create(range.get(), acceptedCandidate.replacement)); > } else >- insertText(acceptedCandidate.replacement, nullptr); >+ applyCommand(InsertTextCommand::create(document(), acceptedCandidate.replacement)); > > RefPtr<Range> insertedCandidateRange = rangeExpandedByCharactersInDirectionAtWordBoundary(selection.visibleStart(), acceptedCandidate.replacement.length(), DirectionBackward); > if (insertedCandidateRange) >diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h >index 738e8f6c4e195eb066b95d0bd104e3ee270cbd5a..46abc179a176fe69beb2f2bff496c3b8418bbf3d 100644 >--- a/Source/WebCore/editing/Editor.h >+++ b/Source/WebCore/editing/Editor.h >@@ -198,6 +198,11 @@ public: > WEBCORE_EXPORT void applyStyleToSelection(Ref<EditingStyle>&&, EditAction); > void applyParagraphStyleToSelection(StyleProperties*, EditAction); > >+ // Returns whether or not we should proceed with editing. >+ bool willApplyEditing(CompositeEditCommand&) const; >+ bool willUnapplyEditing(const EditCommandComposition&) const; >+ bool willReapplyEditing(const EditCommandComposition&) const; >+ > void appliedEditing(PassRefPtr<CompositeEditCommand>); > void unappliedEditing(PassRefPtr<EditCommandComposition>); > void reappliedEditing(PassRefPtr<EditCommandComposition>); >diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp >index 079aac4e4414cb6d6761aaf68fa6aa54c4005c51..1407a4ee4066dc64cf2ef96cd8d14c58b4485d99 100644 >--- a/Source/WebCore/editing/TypingCommand.cpp >+++ b/Source/WebCore/editing/TypingCommand.cpp >@@ -262,6 +262,16 @@ void TypingCommand::postTextStateChangeNotificationForDeletion(const VisibleSele > composition()->setRangeDeletedByUnapply(range); > } > >+bool TypingCommand::willApplyCommand() >+{ >+ if (m_isHandlingInitialTypingCommand) >+ return CompositeEditCommand::willApplyCommand(); >+ >+ // If this is not the initial typing command, then the TypingCommand will handle the willApplyCommand logic separately >+ // in TypingCommand::willAddTypingToOpenCommand >+ return true; >+} >+ > void TypingCommand::doApply() > { > if (endingSelection().isNoneOrOrphaned()) >@@ -298,6 +308,12 @@ void TypingCommand::doApply() > ASSERT_NOT_REACHED(); > } > >+void TypingCommand::didApplyCommand() >+{ >+ // TypingCommands handle applied editing separately (see TypingCommand::typingAddedToOpenCommand). >+ m_isHandlingInitialTypingCommand = false; >+} >+ > void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) > { > Frame& frame = this->frame(); >@@ -352,6 +368,16 @@ void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) > } > } > >+bool TypingCommand::willAddTypingToOpenCommand(ETypingCommand, TextGranularity) >+{ >+ if (m_isHandlingInitialTypingCommand) >+ return true; >+ >+ // TODO: Use the newly added typing command and granularity to ensure that an InputEvent with the >+ // correct inputType is dispatched. >+ return frame().editor().willApplyEditing(*this); >+} >+ > void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedTyping) > { > Frame& frame = this->frame(); >@@ -393,6 +419,9 @@ void TypingCommand::insertTextAndNotifyAccessibility(const String &text, bool se > > void TypingCommand::insertTextRunWithoutNewlines(const String &text, bool selectInsertedText) > { >+ if (!willAddTypingToOpenCommand(InsertText, CharacterGranularity)) >+ return; >+ > RefPtr<InsertTextCommand> command = InsertTextCommand::create(document(), text, selectInsertedText, > m_compositionType == TextCompositionNone ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces : InsertTextCommand::RebalanceAllWhitespaces, EditActionTyping); > >@@ -406,6 +435,9 @@ void TypingCommand::insertLineBreak() > if (!canAppendNewLineFeedToSelection(endingSelection())) > return; > >+ if (!willAddTypingToOpenCommand(InsertLineBreak, LineGranularity)) >+ return; >+ > applyCommandToComposite(InsertLineBreakCommand::create(document())); > typingAddedToOpenCommand(InsertLineBreak); > } >@@ -423,6 +455,9 @@ void TypingCommand::insertParagraphSeparator() > if (!canAppendNewLineFeedToSelection(endingSelection())) > return; > >+ if (!willAddTypingToOpenCommand(InsertParagraphSeparator, ParagraphGranularity)) >+ return; >+ > applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), false, false, EditActionTyping)); > typingAddedToOpenCommand(InsertParagraphSeparator); > } >@@ -437,6 +472,9 @@ void TypingCommand::insertParagraphSeparatorAndNotifyAccessibility() > > void TypingCommand::insertParagraphSeparatorInQuotedContent() > { >+ if (!willAddTypingToOpenCommand(InsertParagraphSeparatorInQuotedContent, ParagraphGranularity)) >+ return; >+ > // If the selection starts inside a table, just insert the paragraph separator normally > // Breaking the blockquote would also break apart the table, which is unecessary when inserting a newline > if (enclosingNodeOfType(endingSelection().start(), &isTableStructureNode)) { >@@ -479,6 +517,9 @@ bool TypingCommand::makeEditableRootEmpty() > > void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool shouldAddToKillRing) > { >+ if (!willAddTypingToOpenCommand(DeleteKey, granularity)) >+ return; >+ > Frame& frame = this->frame(); > > frame.editor().updateMarkersForWordsAffectedByEditing(false); >@@ -592,6 +633,9 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool shouldAdd > > void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool shouldAddToKillRing) > { >+ if (!willAddTypingToOpenCommand(ForwardDeleteKey, granularity)) >+ return; >+ > Frame& frame = this->frame(); > > frame.editor().updateMarkersForWordsAffectedByEditing(false); >@@ -690,6 +734,9 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool sh > > void TypingCommand::deleteSelection(bool smartDelete) > { >+ if (!willAddTypingToOpenCommand(DeleteSelection, CharacterGranularity)) >+ return; >+ > CompositeEditCommand::deleteSelection(smartDelete); > typingAddedToOpenCommand(DeleteSelection); > } >diff --git a/Source/WebCore/editing/TypingCommand.h b/Source/WebCore/editing/TypingCommand.h >index 9d15d3b6978c59bf138a9dd352df49a37f777b33..b4f0c363c495f65d9d5b1f6b7ac1f2dbfeb6ef24 100644 >--- a/Source/WebCore/editing/TypingCommand.h >+++ b/Source/WebCore/editing/TypingCommand.h >@@ -84,6 +84,10 @@ public: > void setEndingSelectionOnLastInsertCommand(const VisibleSelection& selection); > #endif > >+protected: >+ bool willApplyCommand() override; >+ void didApplyCommand() override; >+ > private: > static Ref<TypingCommand> create(Document& document, ETypingCommand command, const String& text = emptyString(), Options options = 0, TextGranularity granularity = CharacterGranularity) > { >@@ -104,21 +108,22 @@ private: > > static RefPtr<TypingCommand> lastTypingCommandIfStillOpenForTyping(Frame&); > >- virtual void doApply(); >- virtual bool isTypingCommand() const; >- virtual bool preservesTypingStyle() const { return m_preservesTypingStyle; } >- virtual bool shouldRetainAutocorrectionIndicator() const >+ void doApply() override; >+ bool isTypingCommand() const override; >+ bool preservesTypingStyle() const override { return m_preservesTypingStyle; } >+ bool shouldRetainAutocorrectionIndicator() const override > { > ASSERT(isTopLevelCommand()); > return m_shouldRetainAutocorrectionIndicator; > } >- virtual void setShouldRetainAutocorrectionIndicator(bool retain) { m_shouldRetainAutocorrectionIndicator = retain; } >- virtual bool shouldStopCaretBlinking() const { return true; } >+ void setShouldRetainAutocorrectionIndicator(bool retain) override { m_shouldRetainAutocorrectionIndicator = retain; } >+ bool shouldStopCaretBlinking() const override { return true; } > void setShouldPreventSpellChecking(bool prevent) { m_shouldPreventSpellChecking = prevent; } > > static void updateSelectionIfDifferentFromCurrentSelection(TypingCommand*, Frame*); > > void updatePreservesTypingStyle(ETypingCommand); >+ bool willAddTypingToOpenCommand(ETypingCommand, TextGranularity); > void markMisspellingsAfterTyping(ETypingCommand); > void typingAddedToOpenCommand(ETypingCommand); > bool makeEditableRootEmpty(); >@@ -134,6 +139,7 @@ private: > bool m_openForMoreTyping; > bool m_selectInsertedText; > bool m_smartDelete; >+ bool m_isHandlingInitialTypingCommand { true }; > TextGranularity m_granularity; > TextCompositionType m_compositionType; > bool m_shouldAddToKillRing; >diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in >index 02d86d0d79d99ec758856f3d1318a105b7653d12..2ea1af84a3c0d1377fd1ed947fbf763d7c86b52a 100644 >--- a/Source/WebCore/html/HTMLAttributeNames.in >+++ b/Source/WebCore/html/HTMLAttributeNames.in >@@ -188,6 +188,7 @@ onautocomplete > onautocompleteerror > onbeforecopy > onbeforecut >+onbeforeinput > onbeforeload > onbeforepaste > onbeforeunload >diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp >index 85df6089c1dca6d9993c2720c1dbdbc433dc922f..f1ff252f79be5cc10ffa314b1f7fa2c8ed98be8b 100644 >--- a/Source/WebCore/html/HTMLElement.cpp >+++ b/Source/WebCore/html/HTMLElement.cpp >@@ -231,6 +231,7 @@ HTMLElement::EventHandlerNameMap HTMLElement::createEventHandlerNameMap() > &onautocompleteerrorAttr, > &onbeforecopyAttr, > &onbeforecutAttr, >+ &onbeforeinputAttr, > &onbeforeloadAttr, > &onbeforepasteAttr, > &onblurAttr,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 163021
:
290826
|
290833
|
290835
|
290836
|
290838
|
290858
|
290983