Changeset 260855 in webkit


Ignore:
Timestamp:
Apr 28, 2020 4:37:20 PM (4 years ago)
Author:
dbates@webkit.org
Message:

Modernize EndPointsAdjustmentMode enumeration and fix misspelled enumerator
https://bugs.webkit.org/show_bug.cgi?id=211141

Reviewed by Eric Carlson.

Fix the misspelled enumerator DoNotAdjsutEndpoints. While I am here, make
EndPointsAdjustmentMode an enum class sized as a bool and simplify the naming
of its enumerators now that they have to be qualified. I also re-ordered them
so that DoNotAdjust is the first enumerator (it will have value 0). This doesn't
really matter, but I like it because it makes it so that this enumeration behaves
more like an equivalent boolean should casts be involved.

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::setSelectionByMouseIfDifferent):

  • editing/FrameSelection.h:
  • page/EventHandler.cpp:

(WebCore::EventHandler::updateSelectionForMouseDrag):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r260854 r260855  
     12020-04-28  Daniel Bates  <dabates@apple.com>
     2
     3        Modernize EndPointsAdjustmentMode enumeration and fix misspelled enumerator
     4        https://bugs.webkit.org/show_bug.cgi?id=211141
     5
     6        Reviewed by Eric Carlson.
     7
     8        Fix the misspelled enumerator DoNotAdjsutEndpoints. While I am here, make
     9        EndPointsAdjustmentMode an enum class sized as a bool and simplify the naming
     10        of its enumerators now that they have to be qualified. I also re-ordered them
     11        so that DoNotAdjust is the first enumerator (it will have value 0). This doesn't
     12        really matter, but I like it because it makes it so that this enumeration behaves
     13        more like an equivalent boolean should casts be involved.
     14
     15        * editing/FrameSelection.cpp:
     16        (WebCore::FrameSelection::setSelectionByMouseIfDifferent):
     17        * editing/FrameSelection.h:
     18        * page/EventHandler.cpp:
     19        (WebCore::EventHandler::updateSelectionForMouseDrag):
     20
    1212020-04-28  Daniel Bates  <dabates@apple.com>
    222
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r260831 r260855  
    302302    VisiblePosition extent = newSelection.visibleExtent();
    303303    VisiblePosition newExtent = extent;
    304     if (endpointsAdjustmentMode == AdjustEndpointsAtBidiBoundary)
     304    if (endpointsAdjustmentMode == EndPointsAdjustmentMode::AdjustAtBidiBoundary)
    305305        adjustEndpointsAtBidiBoundary(newBase, newExtent);
    306306
  • trunk/Source/WebCore/editing/FrameSelection.h

    r260831 r260855  
    257257    bool shouldChangeSelection(const VisibleSelection&) const;
    258258    bool shouldDeleteSelection(const VisibleSelection&) const;
    259     enum EndPointsAdjustmentMode { AdjustEndpointsAtBidiBoundary, DoNotAdjsutEndpoints };
    260     void setSelectionByMouseIfDifferent(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
     259
     260    enum class EndPointsAdjustmentMode : bool { DoNotAdjust, AdjustAtBidiBoundary };
     261    void setSelectionByMouseIfDifferent(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = EndPointsAdjustmentMode::DoNotAdjust);
    261262
    262263    EditingStyle* typingStyle() const;
  • trunk/Source/WebCore/page/EventHandler.cpp

    r260753 r260855  
    10361036
    10371037    m_frame.selection().setSelectionByMouseIfDifferent(newSelection, m_frame.selection().granularity(),
    1038         FrameSelection::AdjustEndpointsAtBidiBoundary);
     1038        FrameSelection::EndPointsAdjustmentMode::AdjustAtBidiBoundary);
    10391039}
    10401040#endif // ENABLE(DRAG_SUPPORT)
Note: See TracChangeset for help on using the changeset viewer.