Changeset 218976 in webkit


Ignore:
Timestamp:
Jun 29, 2017 5:55:34 PM (7 years ago)
Author:
Megan Gardner
Message:

Add TextStream operators for Range, VisiblePosition, VisibleSelection, and ScrollAlignment
https://bugs.webkit.org/show_bug.cgi?id=173997

Reviewed by Simon Fraser.

Adding logging that can be used with TextStream-based LOG_WITH_STREAM.

  • dom/Range.cpp:

(WebCore::operator<<):

  • dom/Range.h:
  • editing/VisiblePosition.h:
  • editing/VisibleSelection.cpp:

(WebCore::operator<<):

  • editing/VisibleSelection.h:
  • rendering/ScrollAlignment.cpp:

(WebCore::operator<<):

  • rendering/ScrollAlignment.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r218973 r218976  
     12017-06-29  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Add TextStream operators for Range, VisiblePosition, VisibleSelection, and ScrollAlignment
     4        https://bugs.webkit.org/show_bug.cgi?id=173997
     5
     6        Reviewed by Simon Fraser.
     7
     8        Adding logging that can be used with TextStream-based LOG_WITH_STREAM.
     9
     10        * dom/Range.cpp:
     11        (WebCore::operator<<):
     12        * dom/Range.h:
     13        * editing/VisiblePosition.h:
     14        * editing/VisibleSelection.cpp:
     15        (WebCore::operator<<):
     16        * editing/VisibleSelection.h:
     17        * rendering/ScrollAlignment.cpp:
     18        (WebCore::operator<<):
     19        * rendering/ScrollAlignment.h:
     20
    1212017-06-29  Matt Lewis  <jlewis3@apple.com>
    222
  • trunk/Source/WebCore/dom/Range.cpp

    r218879 r218976  
    18291829    return boundingRect(CoordinateSpace::Absolute);
    18301830}
     1831   
     1832TextStream& operator<<(TextStream& ts, const RangeBoundaryPoint& r)
     1833{
     1834    return ts << r.toPosition();
     1835}
     1836   
     1837TextStream& operator<<(TextStream& ts, const Range& r)
     1838{
     1839    return ts << "Range: " << "start: " << r.startPosition() << " end: " << r.endPosition();
     1840}
    18311841
    18321842} // namespace WebCore
  • trunk/Source/WebCore/dom/Range.h

    r218593 r218976  
    180180    return Range::compareBoundaryPoints(const_cast<Node*>(a), 0, const_cast<Node*>(b), 0).releaseReturnValue() < 0;
    181181}
     182   
     183TextStream& operator<<(TextStream&, const RangeBoundaryPoint&);
     184TextStream& operator<<(TextStream&, const Range&);
    182185
    183186} // namespace
  • trunk/Source/WebCore/editing/VisiblePosition.h

    r218748 r218976  
    164164
    165165TextStream& operator<<(TextStream&, EAffinity);
    166 TextStream& operator<<(TextStream&, const VisiblePosition&);
     166WEBCORE_EXPORT TextStream& operator<<(TextStream&, const VisiblePosition&);
    167167
    168168} // namespace WebCore
  • trunk/Source/WebCore/editing/VisibleSelection.cpp

    r218879 r218976  
    3232#include "HTMLInputElement.h"
    3333#include "TextIterator.h"
     34#include "TextStream.h"
    3435#include "VisibleUnits.h"
    3536#include <stdio.h>
     
    720721    }
    721722}
     723   
     724TextStream& operator<<(TextStream& stream, const VisibleSelection& v)
     725{
     726    TextStream::GroupScope scope(stream);
     727    stream << "VisibleSelection " << &v;
     728   
     729    stream.dumpProperty("base", v.base());
     730    stream.dumpProperty("extent", v.extent());
     731    stream.dumpProperty("start", v.start());
     732    stream.dumpProperty("end", v.end());
     733   
     734    return stream;
     735}
    722736
    723737#endif
  • trunk/Source/WebCore/editing/VisibleSelection.h

    r217041 r218976  
    153153    return !(a == b);
    154154}
     155   
     156WEBCORE_EXPORT TextStream& operator<<(TextStream&, const VisibleSelection&);
    155157
    156158} // namespace WebCore
  • trunk/Source/WebCore/rendering/ScrollAlignment.cpp

    r205551 r218976  
    4545#include "ScrollAlignment.h"
    4646
     47#include "Logging.h"
     48#include "TextStream.h"
     49
    4750namespace WebCore {
    4851
     
    5659const ScrollAlignment ScrollAlignment::alignLeftAlways = { Behavior::AlignLeft, Behavior::AlignLeft, Behavior::AlignLeft };
    5760const ScrollAlignment ScrollAlignment::alignBottomAlways = { Behavior::AlignBottom, Behavior::AlignBottom, Behavior::AlignBottom };
     61   
     62TextStream& operator<<(TextStream& ts, ScrollAlignment::Behavior b)
     63{
     64    switch (b) {
     65    case ScrollAlignment::Behavior::NoScroll:
     66        return ts << "NoScroll";
     67    case ScrollAlignment::Behavior::AlignCenter:
     68        return ts << "AlignCenter";
     69    case ScrollAlignment::Behavior::AlignTop:
     70        return ts << "AlignTop";
     71    case ScrollAlignment::Behavior::AlignBottom:
     72        return ts << "AlignBottom";
     73    case ScrollAlignment::Behavior::AlignLeft:
     74        return ts << "AlignLeft";
     75    case ScrollAlignment::Behavior::AlignRight:
     76        return ts << "AlignRight";
     77    case ScrollAlignment::Behavior::AlignToClosestEdge:
     78        return ts << "AlignToClosestEdge";
     79    }
     80}
     81   
     82TextStream& operator<<(TextStream& ts, const ScrollAlignment& s)
     83{
     84    return ts << "ScrollAlignment: visible: " << s.m_rectVisible << " hidden: " << s.m_rectHidden << " partial: " << s.m_rectPartial;
     85}
    5886
    5987}; // namespace WebCore
  • trunk/Source/WebCore/rendering/ScrollAlignment.h

    r205551 r218976  
    4545
    4646namespace WebCore {
     47   
     48class TextStream;
    4749
    4850struct ScrollAlignment {
     
    7678    Behavior m_rectPartial;
    7779};
     80   
     81WEBCORE_EXPORT TextStream& operator<<(TextStream&, ScrollAlignment::Behavior);
     82WEBCORE_EXPORT TextStream& operator<<(TextStream&, const ScrollAlignment&);
    7883
    7984}; // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.