Title: [225651] trunk/Source/WebKit
Revision
225651
Author
simon.fra...@apple.com
Date
2017-12-07 16:15:29 -0800 (Thu, 07 Dec 2017)

Log Message

Add logging for EditorState in RemoteLayerTree transactions
https://bugs.webkit.org/show_bug.cgi?id=180515

Reviewed by Wenson Hsieh.

Make EditorState TextStream-able, and dump it in layer tree transactions.

* Shared/EditorState.cpp:
(WebKit::operator<<):
* Shared/EditorState.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::description const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (225650 => 225651)


--- trunk/Source/WebKit/ChangeLog	2017-12-07 23:58:39 UTC (rev 225650)
+++ trunk/Source/WebKit/ChangeLog	2017-12-08 00:15:29 UTC (rev 225651)
@@ -1,3 +1,18 @@
+2017-12-07  Simon Fraser  <simon.fra...@apple.com>
+
+        Add logging for EditorState in RemoteLayerTree transactions
+        https://bugs.webkit.org/show_bug.cgi?id=180515
+
+        Reviewed by Wenson Hsieh.
+       
+        Make EditorState TextStream-able, and dump it in layer tree transactions.
+
+        * Shared/EditorState.cpp:
+        (WebKit::operator<<):
+        * Shared/EditorState.h:
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::description const):
+
 2017-12-07  Youenn Fablet  <you...@apple.com>
 
         CacheStorage Cache should not remove any disk entry when clearing its memory representation

Modified: trunk/Source/WebKit/Shared/EditorState.cpp (225650 => 225651)


--- trunk/Source/WebKit/Shared/EditorState.cpp	2017-12-07 23:58:39 UTC (rev 225650)
+++ trunk/Source/WebKit/Shared/EditorState.cpp	2017-12-08 00:15:29 UTC (rev 225651)
@@ -27,7 +27,10 @@
 #include "EditorState.h"
 
 #include "WebCoreArgumentCoders.h"
+#include <wtf/text/TextStream.h>
 
+using namespace WebCore;
+
 namespace WebKit {
 
 void EditorState::encode(IPC::Encoder& encoder) const
@@ -202,4 +205,100 @@
     return true;
 }
 
+TextStream& operator<<(TextStream& ts, const EditorState& editorState)
+{
+#if PLATFORM(IOS)
+    if (editorState.firstMarkedRect != IntRect())
+        ts.dumpProperty("firstMarkedRect", editorState.firstMarkedRect);
+    if (editorState.lastMarkedRect != IntRect())
+        ts.dumpProperty("lastMarkedRect", editorState.lastMarkedRect);
+    if (editorState.markedText.length())
+        ts.dumpProperty("markedText", editorState.markedText);
+#endif
+
+    if (editorState.shouldIgnoreSelectionChanges)
+        ts.dumpProperty("shouldIgnoreSelectionChanges", editorState.shouldIgnoreSelectionChanges);
+    if (!editorState.selectionIsNone)
+        ts.dumpProperty("selectionIsNone", editorState.selectionIsNone);
+    if (editorState.selectionIsRange)
+        ts.dumpProperty("selectionIsRange", editorState.selectionIsRange);
+    if (editorState.isContentEditable)
+        ts.dumpProperty("isContentEditable", editorState.isContentEditable);
+    if (editorState.isContentRichlyEditable)
+        ts.dumpProperty("isContentRichlyEditable", editorState.isContentRichlyEditable);
+    if (editorState.isInPasswordField)
+        ts.dumpProperty("isInPasswordField", editorState.isInPasswordField);
+    if (editorState.isInPlugin)
+        ts.dumpProperty("isInPlugin", editorState.isInPlugin);
+    if (editorState.hasComposition)
+        ts.dumpProperty("hasComposition", editorState.hasComposition);
+    if (editorState.isMissingPostLayoutData)
+        ts.dumpProperty("isMissingPostLayoutData", editorState.isMissingPostLayoutData);
+
+    if (editorState.isMissingPostLayoutData)
+        return ts;
+
+    TextStream::GroupScope scope(ts);
+    ts << "postLayoutData";
+    if (editorState.postLayoutData().typingAttributes != AttributeNone)
+        ts.dumpProperty("typingAttributes", editorState.postLayoutData().typingAttributes);
+#if PLATFORM(IOS) || PLATFORM(GTK)
+    if (editorState.postLayoutData().caretRectAtStart != IntRect())
+        ts.dumpProperty("caretRectAtStart", editorState.postLayoutData().caretRectAtStart);
+#endif
+#if PLATFORM(IOS) || PLATFORM(MAC)
+    if (editorState.postLayoutData().selectionClipRect != IntRect())
+        ts.dumpProperty("selectionClipRect", editorState.postLayoutData().selectionClipRect);
+    if (editorState.postLayoutData().selectedTextLength)
+        ts.dumpProperty("selectedTextLength", editorState.postLayoutData().selectedTextLength);
+    if (editorState.postLayoutData().textAlignment != NoAlignment)
+        ts.dumpProperty("textAlignment", editorState.postLayoutData().textAlignment);
+    if (editorState.postLayoutData().textColor.isValid())
+        ts.dumpProperty("textColor", editorState.postLayoutData().textColor);
+    if (editorState.postLayoutData().enclosingListType != NoList)
+        ts.dumpProperty("enclosingListType", editorState.postLayoutData().enclosingListType);
+#endif
+#if PLATFORM(IOS)
+    if (editorState.postLayoutData().caretRectAtEnd != IntRect())
+        ts.dumpProperty("caretRectAtEnd", editorState.postLayoutData().caretRectAtEnd);
+    if (editorState.postLayoutData().selectionRects.size())
+        ts.dumpProperty("selectionRects", editorState.postLayoutData().selectionRects);
+    if (editorState.postLayoutData().wordAtSelection.length())
+        ts.dumpProperty("wordAtSelection", editorState.postLayoutData().wordAtSelection);
+    if (editorState.postLayoutData().characterAfterSelection)
+        ts.dumpProperty("characterAfterSelection", editorState.postLayoutData().characterAfterSelection);
+    if (editorState.postLayoutData().characterBeforeSelection)
+        ts.dumpProperty("characterBeforeSelection", editorState.postLayoutData().characterBeforeSelection);
+    if (editorState.postLayoutData().twoCharacterBeforeSelection)
+        ts.dumpProperty("twoCharacterBeforeSelection", editorState.postLayoutData().twoCharacterBeforeSelection);
+
+    if (editorState.postLayoutData().isReplaceAllowed)
+        ts.dumpProperty("isReplaceAllowed", editorState.postLayoutData().isReplaceAllowed);
+    if (editorState.postLayoutData().hasContent)
+        ts.dumpProperty("hasContent", editorState.postLayoutData().hasContent);
+    ts.dumpProperty("isStableStateUpdate", editorState.postLayoutData().isStableStateUpdate);
+    if (editorState.postLayoutData().insideFixedPosition)
+        ts.dumpProperty("insideFixedPosition", editorState.postLayoutData().insideFixedPosition);
+    if (editorState.postLayoutData().caretColor.isValid())
+        ts.dumpProperty("caretColor", editorState.postLayoutData().caretColor);
+#endif
+#if PLATFORM(MAC)
+    if (editorState.postLayoutData().candidateRequestStartPosition)
+        ts.dumpProperty("candidateRequestStartPosition", editorState.postLayoutData().candidateRequestStartPosition);
+    if (editorState.postLayoutData().paragraphContextForCandidateRequest.length())
+        ts.dumpProperty("paragraphContextForCandidateRequest", editorState.postLayoutData().paragraphContextForCandidateRequest);
+    if (editorState.postLayoutData().stringForCandidateRequest.length())
+        ts.dumpProperty("stringForCandidateRequest", editorState.postLayoutData().stringForCandidateRequest);
+#endif
+
+    if (editorState.postLayoutData().canCut)
+        ts.dumpProperty("canCut", editorState.postLayoutData().canCut);
+    if (editorState.postLayoutData().canCopy)
+        ts.dumpProperty("canCopy", editorState.postLayoutData().canCopy);
+    if (editorState.postLayoutData().canPaste)
+        ts.dumpProperty("canPaste", editorState.postLayoutData().canPaste);
+
+    return ts;
 }
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/Shared/EditorState.h (225650 => 225651)


--- trunk/Source/WebKit/Shared/EditorState.h	2017-12-07 23:58:39 UTC (rev 225650)
+++ trunk/Source/WebKit/Shared/EditorState.h	2017-12-08 00:15:29 UTC (rev 225651)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef EditorState_h
-#define EditorState_h
+#pragma once
 
 #include "ArgumentCoders.h"
 #include <WebCore/Color.h>
@@ -35,6 +34,10 @@
 #include <WebCore/SelectionRect.h>
 #endif
 
+namespace WTF {
+class TextStream;
+};
+
 namespace WebKit {
 
 enum TypingAttributes {
@@ -139,6 +142,6 @@
     return m_postLayoutData;
 }
 
-}
+WTF::TextStream& operator<<(WTF::TextStream&, const EditorState&);
 
-#endif // EditorState_h
+} // namespace WebKit

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm (225650 => 225651)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2017-12-07 23:58:39 UTC (rev 225650)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2017-12-08 00:15:29 UTC (rev 225651)
@@ -905,9 +905,8 @@
     ts.dumpProperty("avoidsUnsafeArea", m_avoidsUnsafeArea);
     ts.dumpProperty("isInStableState", m_isInStableState);
     ts.dumpProperty("renderTreeSize", m_renderTreeSize);
+    ts.dumpProperty("root-layer", m_rootLayerID);
 
-    ts << "root-layer " << m_rootLayerID << ")";
-
     if (!m_createdLayers.isEmpty()) {
         TextStream::GroupScope group(ts);
         ts << "created-layers";
@@ -935,6 +934,12 @@
     if (!m_destroyedLayerIDs.isEmpty())
         ts.dumpProperty<Vector<GraphicsLayer::PlatformLayerID>>("destroyed-layers", m_destroyedLayerIDs);
 
+    if (m_editorState) {
+        TextStream::GroupScope scope(ts);
+        ts << "EditorState";
+        ts << *m_editorState;
+    }
+
     ts.endGroup();
 
     return ts.release().utf8();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to