Add more Editing logging
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 00:36:05 +0000 (00:36 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 00:36:05 +0000 (00:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161287

Reviewed by Darin Adler.

Add logging which tracks how key events get from the UI process to the
web process, and down to form fields.

* editing/Editor.cpp:
(WebCore::Editor::handleTextEvent):
(WebCore::Editor::appliedEditing):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::insertText):
(WebCore::TypingCommand::insertTextAndNotifyAccessibility):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
* page/EventHandler.cpp:
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::handleTextInputEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@205092 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/TypingCommand.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 3ab6221..f846399 100644 (file)
@@ -1,3 +1,25 @@
+2016-08-27  Simon Fraser  <simon.fraser@apple.com>
+
+        Add more Editing logging
+        https://bugs.webkit.org/show_bug.cgi?id=161287
+
+        Reviewed by Darin Adler.
+
+        Add logging which tracks how key events get from the UI process to the
+        web process, and down to form fields.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::handleTextEvent):
+        (WebCore::Editor::appliedEditing):
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::insertText):
+        (WebCore::TypingCommand::insertTextAndNotifyAccessibility):
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::keyEvent):
+        (WebCore::EventHandler::handleTextInputEvent):
+
 2016-08-27  Sam Weinig  <sam@webkit.org>
 
         Remove more custom JavaScript bindings
index 427eb29..c6ad412 100644 (file)
@@ -62,6 +62,7 @@
 #include "InsertListCommand.h"
 #include "KeyboardEvent.h"
 #include "KillRing.h"
+#include "Logging.h"
 #include "MainFrame.h"
 #include "ModifySelectionListLevel.h"
 #include "NodeList.h"
@@ -197,6 +198,8 @@ void Editor::handleInputMethodKeydown(KeyboardEvent* event)
 
 bool Editor::handleTextEvent(TextEvent* event)
 {
+    LOG(Editing, "Editor %p handleTextEvent (data %s)", this, event->data().utf8().data());
+
     // Default event handling for Drag and Drop will be handled by DragController
     // so we leave the event for it.
     if (event->isDrop())
@@ -1033,6 +1036,8 @@ static void dispatchEditableContentChangedEvents(PassRefPtr<Element> prpStartRoo
 
 void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
 {
+    LOG(Editing, "Editor %p appliedEditing", this);
+
     document().updateLayout();
 
     EditCommandComposition* composition = cmd->composition();
index f23eb0f..079aac4 100644 (file)
@@ -38,6 +38,7 @@
 #include "InsertLineBreakCommand.h"
 #include "InsertParagraphSeparatorCommand.h"
 #include "InsertTextCommand.h"
+#include "Logging.h"
 #include "MathMLElement.h"
 #include "RenderElement.h"
 #include "TextIterator.h"
@@ -167,6 +168,8 @@ void TypingCommand::insertText(Document& document, const String& text, const Vis
     RefPtr<Frame> frame = document.frame();
     ASSERT(frame);
 
+    LOG(Editing, "TypingCommand::insertText (text %s)", text.utf8().data());
+
     VisibleSelection currentSelection = frame->selection().selection();
 
     String newText = dispatchBeforeTextInsertedEvent(text, selectionForInsertion, compositionType == TextCompositionUpdate);
@@ -380,6 +383,8 @@ void TypingCommand::insertText(const String &text, bool selectInsertedText)
 
 void TypingCommand::insertTextAndNotifyAccessibility(const String &text, bool selectInsertedText)
 {
+    LOG(Editing, "TypingCommand %p insertTextAndNotifyAccessibility (text %s, selectInsertedText %d)", this, text.utf8().data(), selectInsertedText);
+
     AccessibilityReplacedText replacedText(frame().selection().selection());
     insertText(text, selectInsertedText);
     replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypeTyping, text, frame().selection().selection());
index dd59c95..55145fd 100644 (file)
@@ -38,6 +38,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
+#include "Logging.h"
 #include "NodeTraversal.h"
 #include "Page.h"
 #include "RenderBlockFlow.h"
@@ -109,6 +110,8 @@ void HTMLTextFormControlElement::didEditInnerTextValue()
     if (!isTextFormControl())
         return;
 
+    LOG(Editing, "HTMLTextFormControlElement %p didEditInnerTextValue", this);
+
     m_lastChangeWasUserEdit = true;
     subtreeHasChanged();
 }
index 490e06f..3dfe3ab 100644 (file)
@@ -63,6 +63,7 @@
 #include "Image.h"
 #include "InspectorInstrumentation.h"
 #include "KeyboardEvent.h"
+#include "Logging.h"
 #include "MainFrame.h"
 #include "MouseEvent.h"
 #include "MouseEventWithHitTestResults.h"
@@ -3013,6 +3014,8 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent)
 {
     RefPtr<FrameView> protector(m_frame.view());
 
+    LOG(Editing, "EventHandler %p keyEvent (text %s keyIdentifier %s)", this, initialKeyEvent.text().utf8().data(), initialKeyEvent.keyIdentifier().utf8().data());
+
 #if ENABLE(FULLSCREEN_API)
     if (m_frame.document()->webkitIsFullScreen() && !isKeyEventAllowedInFullScreen(initialKeyEvent))
         return false;
@@ -3536,6 +3539,8 @@ bool EventHandler::mouseMovementExceedsThreshold(const FloatPoint& viewportLocat
 
 bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, TextEventInputType inputType)
 {
+    LOG(Editing, "EventHandler %p handleTextInputEvent (text %s)", this, text.utf8().data());
+
     // Platforms should differentiate real commands like selectAll from text input in disguise (like insertNewline),
     // and avoid dispatching text input events from keydown default handlers.
     ASSERT(!is<KeyboardEvent>(underlyingEvent) || downcast<KeyboardEvent>(*underlyingEvent).type() == eventNames().keypressEvent);
index 3e51705..465ec20 100644 (file)
@@ -1958,8 +1958,10 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
     m_keyEventQueue.append(event);
 
     m_process->responsivenessTimer().start();
-    if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
+    if (m_keyEventQueue.size() == 1) { // Otherwise, sent from DidReceiveEvent message handler.
+        LOG(KeyHandling, " UI process: sent keyEvent from handleKeyboardEvent");
         m_process->send(Messages::WebPage::KeyEvent(event), m_pageID);
+    }
 }
 
 WebPreferencesStore WebPageProxy::preferencesStore() const
@@ -4857,16 +4859,17 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
     case WebEvent::KeyUp:
     case WebEvent::RawKeyDown:
     case WebEvent::Char: {
-        LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
+        LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s (queue empty %d)", webKeyboardEventTypeString(type), m_keyEventQueue.isEmpty());
 
         MESSAGE_CHECK(!m_keyEventQueue.isEmpty());
         NativeWebKeyboardEvent event = m_keyEventQueue.takeFirst();
 
         MESSAGE_CHECK(type == event.type());
 
-        if (!m_keyEventQueue.isEmpty())
+        if (!m_keyEventQueue.isEmpty()) {
+            LOG(KeyHandling, " UI process: sent keyEvent from didReceiveEvent");
             m_process->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
-        else {
+        else {
             if (auto* automationSession = process().processPool().automationSession())
                 automationSession->keyboardEventsFlushedForPage(*this);
         }