Changeset 225651 in webkit


Ignore:
Timestamp:
Dec 7, 2017 4:15:29 PM (6 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r225646 r225651  
     12017-12-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add logging for EditorState in RemoteLayerTree transactions
     4        https://bugs.webkit.org/show_bug.cgi?id=180515
     5
     6        Reviewed by Wenson Hsieh.
     7       
     8        Make EditorState TextStream-able, and dump it in layer tree transactions.
     9
     10        * Shared/EditorState.cpp:
     11        (WebKit::operator<<):
     12        * Shared/EditorState.h:
     13        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
     14        (WebKit::RemoteLayerTreeTransaction::description const):
     15
    1162017-12-07  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WebKit/Shared/EditorState.cpp

    r224945 r225651  
    2828
    2929#include "WebCoreArgumentCoders.h"
     30#include <wtf/text/TextStream.h>
     31
     32using namespace WebCore;
    3033
    3134namespace WebKit {
     
    203206}
    204207
    205 }
     208TextStream& operator<<(TextStream& ts, const EditorState& editorState)
     209{
     210#if PLATFORM(IOS)
     211    if (editorState.firstMarkedRect != IntRect())
     212        ts.dumpProperty("firstMarkedRect", editorState.firstMarkedRect);
     213    if (editorState.lastMarkedRect != IntRect())
     214        ts.dumpProperty("lastMarkedRect", editorState.lastMarkedRect);
     215    if (editorState.markedText.length())
     216        ts.dumpProperty("markedText", editorState.markedText);
     217#endif
     218
     219    if (editorState.shouldIgnoreSelectionChanges)
     220        ts.dumpProperty("shouldIgnoreSelectionChanges", editorState.shouldIgnoreSelectionChanges);
     221    if (!editorState.selectionIsNone)
     222        ts.dumpProperty("selectionIsNone", editorState.selectionIsNone);
     223    if (editorState.selectionIsRange)
     224        ts.dumpProperty("selectionIsRange", editorState.selectionIsRange);
     225    if (editorState.isContentEditable)
     226        ts.dumpProperty("isContentEditable", editorState.isContentEditable);
     227    if (editorState.isContentRichlyEditable)
     228        ts.dumpProperty("isContentRichlyEditable", editorState.isContentRichlyEditable);
     229    if (editorState.isInPasswordField)
     230        ts.dumpProperty("isInPasswordField", editorState.isInPasswordField);
     231    if (editorState.isInPlugin)
     232        ts.dumpProperty("isInPlugin", editorState.isInPlugin);
     233    if (editorState.hasComposition)
     234        ts.dumpProperty("hasComposition", editorState.hasComposition);
     235    if (editorState.isMissingPostLayoutData)
     236        ts.dumpProperty("isMissingPostLayoutData", editorState.isMissingPostLayoutData);
     237
     238    if (editorState.isMissingPostLayoutData)
     239        return ts;
     240
     241    TextStream::GroupScope scope(ts);
     242    ts << "postLayoutData";
     243    if (editorState.postLayoutData().typingAttributes != AttributeNone)
     244        ts.dumpProperty("typingAttributes", editorState.postLayoutData().typingAttributes);
     245#if PLATFORM(IOS) || PLATFORM(GTK)
     246    if (editorState.postLayoutData().caretRectAtStart != IntRect())
     247        ts.dumpProperty("caretRectAtStart", editorState.postLayoutData().caretRectAtStart);
     248#endif
     249#if PLATFORM(IOS) || PLATFORM(MAC)
     250    if (editorState.postLayoutData().selectionClipRect != IntRect())
     251        ts.dumpProperty("selectionClipRect", editorState.postLayoutData().selectionClipRect);
     252    if (editorState.postLayoutData().selectedTextLength)
     253        ts.dumpProperty("selectedTextLength", editorState.postLayoutData().selectedTextLength);
     254    if (editorState.postLayoutData().textAlignment != NoAlignment)
     255        ts.dumpProperty("textAlignment", editorState.postLayoutData().textAlignment);
     256    if (editorState.postLayoutData().textColor.isValid())
     257        ts.dumpProperty("textColor", editorState.postLayoutData().textColor);
     258    if (editorState.postLayoutData().enclosingListType != NoList)
     259        ts.dumpProperty("enclosingListType", editorState.postLayoutData().enclosingListType);
     260#endif
     261#if PLATFORM(IOS)
     262    if (editorState.postLayoutData().caretRectAtEnd != IntRect())
     263        ts.dumpProperty("caretRectAtEnd", editorState.postLayoutData().caretRectAtEnd);
     264    if (editorState.postLayoutData().selectionRects.size())
     265        ts.dumpProperty("selectionRects", editorState.postLayoutData().selectionRects);
     266    if (editorState.postLayoutData().wordAtSelection.length())
     267        ts.dumpProperty("wordAtSelection", editorState.postLayoutData().wordAtSelection);
     268    if (editorState.postLayoutData().characterAfterSelection)
     269        ts.dumpProperty("characterAfterSelection", editorState.postLayoutData().characterAfterSelection);
     270    if (editorState.postLayoutData().characterBeforeSelection)
     271        ts.dumpProperty("characterBeforeSelection", editorState.postLayoutData().characterBeforeSelection);
     272    if (editorState.postLayoutData().twoCharacterBeforeSelection)
     273        ts.dumpProperty("twoCharacterBeforeSelection", editorState.postLayoutData().twoCharacterBeforeSelection);
     274
     275    if (editorState.postLayoutData().isReplaceAllowed)
     276        ts.dumpProperty("isReplaceAllowed", editorState.postLayoutData().isReplaceAllowed);
     277    if (editorState.postLayoutData().hasContent)
     278        ts.dumpProperty("hasContent", editorState.postLayoutData().hasContent);
     279    ts.dumpProperty("isStableStateUpdate", editorState.postLayoutData().isStableStateUpdate);
     280    if (editorState.postLayoutData().insideFixedPosition)
     281        ts.dumpProperty("insideFixedPosition", editorState.postLayoutData().insideFixedPosition);
     282    if (editorState.postLayoutData().caretColor.isValid())
     283        ts.dumpProperty("caretColor", editorState.postLayoutData().caretColor);
     284#endif
     285#if PLATFORM(MAC)
     286    if (editorState.postLayoutData().candidateRequestStartPosition)
     287        ts.dumpProperty("candidateRequestStartPosition", editorState.postLayoutData().candidateRequestStartPosition);
     288    if (editorState.postLayoutData().paragraphContextForCandidateRequest.length())
     289        ts.dumpProperty("paragraphContextForCandidateRequest", editorState.postLayoutData().paragraphContextForCandidateRequest);
     290    if (editorState.postLayoutData().stringForCandidateRequest.length())
     291        ts.dumpProperty("stringForCandidateRequest", editorState.postLayoutData().stringForCandidateRequest);
     292#endif
     293
     294    if (editorState.postLayoutData().canCut)
     295        ts.dumpProperty("canCut", editorState.postLayoutData().canCut);
     296    if (editorState.postLayoutData().canCopy)
     297        ts.dumpProperty("canCopy", editorState.postLayoutData().canCopy);
     298    if (editorState.postLayoutData().canPaste)
     299        ts.dumpProperty("canPaste", editorState.postLayoutData().canPaste);
     300
     301    return ts;
     302}
     303
     304} // namespace WebKit
  • trunk/Source/WebKit/Shared/EditorState.h

    r224945 r225651  
    2424 */
    2525
    26 #ifndef EditorState_h
    27 #define EditorState_h
     26#pragma once
    2827
    2928#include "ArgumentCoders.h"
     
    3534#include <WebCore/SelectionRect.h>
    3635#endif
     36
     37namespace WTF {
     38class TextStream;
     39};
    3740
    3841namespace WebKit {
     
    140143}
    141144
    142 }
     145WTF::TextStream& operator<<(WTF::TextStream&, const EditorState&);
    143146
    144 #endif // EditorState_h
     147} // namespace WebKit
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm

    r223149 r225651  
    906906    ts.dumpProperty("isInStableState", m_isInStableState);
    907907    ts.dumpProperty("renderTreeSize", m_renderTreeSize);
    908 
    909     ts << "root-layer " << m_rootLayerID << ")";
     908    ts.dumpProperty("root-layer", m_rootLayerID);
    910909
    911910    if (!m_createdLayers.isEmpty()) {
     
    936935        ts.dumpProperty<Vector<GraphicsLayer::PlatformLayerID>>("destroyed-layers", m_destroyedLayerIDs);
    937936
     937    if (m_editorState) {
     938        TextStream::GroupScope scope(ts);
     939        ts << "EditorState";
     940        ts << *m_editorState;
     941    }
     942
    938943    ts.endGroup();
    939944
Note: See TracChangeset for help on using the changeset viewer.