Title: [260855] trunk/Source/WebCore
Revision
260855
Author
[email protected]
Date
2020-04-28 16:37:20 -0700 (Tue, 28 Apr 2020)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260854 => 260855)


--- trunk/Source/WebCore/ChangeLog	2020-04-28 23:35:05 UTC (rev 260854)
+++ trunk/Source/WebCore/ChangeLog	2020-04-28 23:37:20 UTC (rev 260855)
@@ -1,5 +1,25 @@
 2020-04-28  Daniel Bates  <[email protected]>
 
+        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):
+
+2020-04-28  Daniel Bates  <[email protected]>
+
         [WebKitLegacy] Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
         https://bugs.webkit.org/show_bug.cgi?id=211139
 

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (260854 => 260855)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2020-04-28 23:35:05 UTC (rev 260854)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2020-04-28 23:37:20 UTC (rev 260855)
@@ -301,7 +301,7 @@
     VisiblePosition newBase = base;
     VisiblePosition extent = newSelection.visibleExtent();
     VisiblePosition newExtent = extent;
-    if (endpointsAdjustmentMode == AdjustEndpointsAtBidiBoundary)
+    if (endpointsAdjustmentMode == EndPointsAdjustmentMode::AdjustAtBidiBoundary)
         adjustEndpointsAtBidiBoundary(newBase, newExtent);
 
     if (newBase != base || newExtent != extent) {

Modified: trunk/Source/WebCore/editing/FrameSelection.h (260854 => 260855)


--- trunk/Source/WebCore/editing/FrameSelection.h	2020-04-28 23:35:05 UTC (rev 260854)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2020-04-28 23:37:20 UTC (rev 260855)
@@ -256,9 +256,10 @@
 
     bool shouldChangeSelection(const VisibleSelection&) const;
     bool shouldDeleteSelection(const VisibleSelection&) const;
-    enum EndPointsAdjustmentMode { AdjustEndpointsAtBidiBoundary, DoNotAdjsutEndpoints };
-    void setSelectionByMouseIfDifferent(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
 
+    enum class EndPointsAdjustmentMode : bool { DoNotAdjust, AdjustAtBidiBoundary };
+    void setSelectionByMouseIfDifferent(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = EndPointsAdjustmentMode::DoNotAdjust);
+
     EditingStyle* typingStyle() const;
     WEBCORE_EXPORT RefPtr<MutableStyleProperties> copyTypingStyle() const;
     void setTypingStyle(RefPtr<EditingStyle>&& style) { m_typingStyle = WTFMove(style); }

Modified: trunk/Source/WebCore/page/EventHandler.cpp (260854 => 260855)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-04-28 23:35:05 UTC (rev 260854)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-04-28 23:37:20 UTC (rev 260855)
@@ -1035,7 +1035,7 @@
         newSelection.expandUsingGranularity(m_frame.selection().granularity());
 
     m_frame.selection().setSelectionByMouseIfDifferent(newSelection, m_frame.selection().granularity(),
-        FrameSelection::AdjustEndpointsAtBidiBoundary);
+        FrameSelection::EndPointsAdjustmentMode::AdjustAtBidiBoundary);
 }
 #endif // ENABLE(DRAG_SUPPORT)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to