Title: [261836] trunk/Source
Revision
261836
Author
ddkil...@apple.com
Date
2020-05-18 15:50:41 -0700 (Mon, 18 May 2020)

Log Message

Use default initializers in TextIndicatorData
<https://webkit.org/b/212039>
<rdar://problem/63355619>

Reviewed by Alex Christensen.

Source/WebCore:

Tested by IPC::Decoder::decode() and IPC::Encoder::operator<<()
running on WebKit2 API and layout tests.

* page/TextIndicator.h:
(WebCore::TextIndicatorData):
- Add default initializers.
(WTF::EnumTraits<WebCore::TextIndicatorPresentationTransition>):
- Add EnumTraits so TextIndicatorPresentationTransition may be
  used by IPC::Decoder::decode() and IPC::Encoder::operator<<().

Source/WebKit:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextIndicatorData>::encode):
(IPC::ArgumentCoder<TextIndicatorData>::decode):
- Switch from decodeEnum() and encodeEnum() to modern
  equivalents that check for valid enum values.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261835 => 261836)


--- trunk/Source/WebCore/ChangeLog	2020-05-18 22:29:37 UTC (rev 261835)
+++ trunk/Source/WebCore/ChangeLog	2020-05-18 22:50:41 UTC (rev 261836)
@@ -1,3 +1,21 @@
+2020-05-18  David Kilzer  <ddkil...@apple.com>
+
+        Use default initializers in TextIndicatorData
+        <https://webkit.org/b/212039>
+        <rdar://problem/63355619>
+
+        Reviewed by Alex Christensen.
+
+        Tested by IPC::Decoder::decode() and IPC::Encoder::operator<<()
+        running on WebKit2 API and layout tests.
+
+        * page/TextIndicator.h:
+        (WebCore::TextIndicatorData):
+        - Add default initializers.
+        (WTF::EnumTraits<WebCore::TextIndicatorPresentationTransition>):
+        - Add EnumTraits so TextIndicatorPresentationTransition may be
+          used by IPC::Decoder::decode() and IPC::Encoder::operator<<().
+
 2020-05-18  Simon Fraser  <simon.fra...@apple.com>
 
         Fix operator== and hash() for ExtendedColor

Modified: trunk/Source/WebCore/page/TextIndicator.h (261835 => 261836)


--- trunk/Source/WebCore/page/TextIndicator.h	2020-05-18 22:29:37 UTC (rev 261835)
+++ trunk/Source/WebCore/page/TextIndicator.h	2020-05-18 22:50:41 UTC (rev 261836)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +27,7 @@
 
 #include "FloatRect.h"
 #include "Image.h"
+#include <wtf/EnumTraits.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
@@ -105,13 +106,13 @@
     FloatRect textBoundingRectInRootViewCoordinates;
     FloatRect contentImageWithoutSelectionRectInRootViewCoordinates;
     Vector<FloatRect> textRectsInBoundingRectCoordinates;
-    float contentImageScaleFactor;
+    float contentImageScaleFactor { 0 };
     RefPtr<Image> contentImageWithHighlight;
     RefPtr<Image> contentImageWithoutSelection;
     RefPtr<Image> contentImage;
     Color estimatedBackgroundColor;
-    TextIndicatorPresentationTransition presentationTransition;
-    TextIndicatorOptions options;
+    TextIndicatorPresentationTransition presentationTransition { TextIndicatorPresentationTransition::None };
+    TextIndicatorOptions options { TextIndicatorOptionDefault };
 };
 
 class TextIndicator : public RefCounted<TextIndicator> {
@@ -147,3 +148,17 @@
 };
 
 } // namespace WebKit
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::TextIndicatorPresentationTransition> {
+    using values = EnumValues<
+        WebCore::TextIndicatorPresentationTransition,
+        WebCore::TextIndicatorPresentationTransition::None,
+        WebCore::TextIndicatorPresentationTransition::Bounce,
+        WebCore::TextIndicatorPresentationTransition::BounceAndCrossfade,
+        WebCore::TextIndicatorPresentationTransition::FadeIn
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebKit/ChangeLog (261835 => 261836)


--- trunk/Source/WebKit/ChangeLog	2020-05-18 22:29:37 UTC (rev 261835)
+++ trunk/Source/WebKit/ChangeLog	2020-05-18 22:50:41 UTC (rev 261836)
@@ -1,3 +1,17 @@
+2020-05-18  David Kilzer  <ddkil...@apple.com>
+
+        Use default initializers in TextIndicatorData
+        <https://webkit.org/b/212039>
+        <rdar://problem/63355619>
+
+        Reviewed by Alex Christensen.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<TextIndicatorData>::encode):
+        (IPC::ArgumentCoder<TextIndicatorData>::decode):
+        - Switch from decodeEnum() and encodeEnum() to modern
+          equivalents that check for valid enum values.
+
 2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Replace uses of +self with +class

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (261835 => 261836)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2020-05-18 22:29:37 UTC (rev 261835)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2020-05-18 22:50:41 UTC (rev 261836)
@@ -2612,7 +2612,7 @@
     encoder << textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates;
     encoder << textIndicatorData.contentImageScaleFactor;
     encoder << textIndicatorData.estimatedBackgroundColor;
-    encoder.encodeEnum(textIndicatorData.presentationTransition);
+    encoder << textIndicatorData.presentationTransition;
     encoder << static_cast<uint64_t>(textIndicatorData.options);
 
     encodeOptionalImage(encoder, textIndicatorData.contentImage.get());
@@ -2641,7 +2641,7 @@
     if (!decoder.decode(textIndicatorData.estimatedBackgroundColor))
         return WTF::nullopt;
 
-    if (!decoder.decodeEnum(textIndicatorData.presentationTransition))
+    if (!decoder.decode(textIndicatorData.presentationTransition))
         return WTF::nullopt;
 
     uint64_t options;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to