Title: [261848] trunk/Source
Revision
261848
Author
ddkil...@apple.com
Date
2020-05-18 21:59:16 -0700 (Mon, 18 May 2020)

Log Message

Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
<https://webkit.org/b/212051>
<rdar://problem/63368556>

Reviewed by Simon Fraser.

Use OptionSet<TextIndicatorOption> everywhere
TextIndicatorOptions was previously used, plus:
- Make TextIndicatorOption an enum class.  Remove
  "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
  TextIndicatorOption::Bar.
- Remove TextIndicatorOptionDefault because OptionSet<>
  initializes to zero.
- Replace static variables (including two globals in WebCore)
  with constexpr variables.

Source/WebCore:

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
(WebCore::TextIndicator::createWithSelectionInFrame):
(WebCore::snapshotOptionsForTextIndicatorOptions):
(WebCore::takeSnapshots):
(WebCore::hasAnyIllegibleColors):
(WebCore::initializeIndicator):
* page/TextIndicator.h:
* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageForLink):
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForRange):
* testing/Internals.h:

Source/WebKit:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextIndicatorData>::encode):
(IPC::ArgumentCoder<TextIndicatorData>::decode):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::insertDroppedImagePlaceholders):
(WebKit::WebPage::computeAndSendEditDragSnapshot):
(WebKit::linkIndicatorPositionInformation):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(-[DOMNode getPreviewSnapshotImage:andRects:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _lookUpInDictionaryFromMenu:]):
* WebView/WebImmediateActionController.h:
* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _defaultAnimationController]):
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):
(+[WebImmediateActionController _dictionaryPopupInfoForRange:inFrame:withLookupOptions:indicatorOptions:transition:]):
(-[WebImmediateActionController _animationControllerForText]):
* WebView/WebView.mm:
(-[WebUITextIndicatorData initWithImage:textIndicatorData:scale:]):
(-[WebView _didConcludeEditDrag]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261847 => 261848)


--- trunk/Source/WebCore/ChangeLog	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/ChangeLog	2020-05-19 04:59:16 UTC (rev 261848)
@@ -1,3 +1,35 @@
+2020-05-18  David Kilzer  <ddkil...@apple.com>
+
+        Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
+        <https://webkit.org/b/212051>
+        <rdar://problem/63368556>
+
+        Reviewed by Simon Fraser.
+
+        Use OptionSet<TextIndicatorOption> everywhere
+        TextIndicatorOptions was previously used, plus:
+        - Make TextIndicatorOption an enum class.  Remove
+          "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
+          TextIndicatorOption::Bar.
+        - Remove TextIndicatorOptionDefault because OptionSet<>
+          initializes to zero.
+        - Replace static variables (including two globals in WebCore)
+          with constexpr variables.
+
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+        (WebCore::TextIndicator::createWithSelectionInFrame):
+        (WebCore::snapshotOptionsForTextIndicatorOptions):
+        (WebCore::takeSnapshots):
+        (WebCore::hasAnyIllegibleColors):
+        (WebCore::initializeIndicator):
+        * page/TextIndicator.h:
+        * platform/ios/DragImageIOS.mm:
+        (WebCore::createDragImageForLink):
+        (WebCore::createDragImageForSelection):
+        (WebCore::createDragImageForRange):
+        * testing/Internals.h:
+
 2020-05-18  Andy Estes  <aes...@apple.com>
 
         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (261847 => 261848)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2020-05-19 04:59:16 UTC (rev 261848)
@@ -66,7 +66,7 @@
     return adoptRef(*new TextIndicator(data));
 }
 
-RefPtr<TextIndicator> TextIndicator::createWithRange(const SimpleRange& range, TextIndicatorOptions options, TextIndicatorPresentationTransition presentationTransition, FloatSize margin)
+RefPtr<TextIndicator> TextIndicator::createWithRange(const SimpleRange& range, OptionSet<TextIndicatorOption> options, TextIndicatorPresentationTransition presentationTransition, FloatSize margin)
 {
     auto frame = makeRefPtr(range.startContainer().document().frame());
     if (!frame)
@@ -97,7 +97,7 @@
     return TextIndicator::create(data);
 }
 
-RefPtr<TextIndicator> TextIndicator::createWithSelectionInFrame(Frame& frame, TextIndicatorOptions options, TextIndicatorPresentationTransition presentationTransition, FloatSize margin)
+RefPtr<TextIndicator> TextIndicator::createWithSelectionInFrame(Frame& frame, OptionSet<TextIndicatorOption> options, TextIndicatorPresentationTransition presentationTransition, FloatSize margin)
 {
     auto range = frame.selection().selection().toNormalizedRange();
     if (!range)
@@ -124,17 +124,17 @@
     return false;
 }
 
-static SnapshotOptions snapshotOptionsForTextIndicatorOptions(TextIndicatorOptions options)
+static SnapshotOptions snapshotOptionsForTextIndicatorOptions(OptionSet<TextIndicatorOption> options)
 {
     SnapshotOptions snapshotOptions = SnapshotOptionsPaintWithIntegralScaleFactor;
 
-    if (!(options & TextIndicatorOptionPaintAllContent)) {
-        if (options & TextIndicatorOptionPaintBackgrounds)
+    if (!options.contains(TextIndicatorOption::PaintAllContent)) {
+        if (options.contains(TextIndicatorOption::PaintBackgrounds))
             snapshotOptions |= SnapshotOptionsPaintSelectionAndBackgroundsOnly;
         else {
             snapshotOptions |= SnapshotOptionsPaintSelectionOnly;
 
-            if (!(options & TextIndicatorOptionRespectTextColor))
+            if (!options.contains(TextIndicatorOption::RespectTextColor))
                 snapshotOptions |= SnapshotOptionsForceBlackText;
         }
     } else
@@ -160,13 +160,13 @@
     if (!data.contentImage)
         return false;
 
-    if (data.options & TextIndicatorOptionIncludeSnapshotWithSelectionHighlight) {
+    if (data.options.contains(TextIndicatorOption::IncludeSnapshotWithSelectionHighlight)) {
         float snapshotScaleFactor;
         data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, SnapshotOptionsNone, snapshotScaleFactor, clipRectsInDocumentCoordinates);
         ASSERT(!data.contentImageWithHighlight || data.contentImageScaleFactor >= snapshotScaleFactor);
     }
 
-    if (data.options & TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection) {
+    if (data.options.contains(TextIndicatorOption::IncludeSnapshotOfAllVisibleContentWithoutSelection)) {
         float snapshotScaleFactor;
         auto snapshotRect = frame.view()->visibleContentRect();
         data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, SnapshotOptionsPaintEverythingExcludingSelection, snapshotScaleFactor, { });
@@ -256,17 +256,17 @@
 
 static bool hasAnyIllegibleColors(TextIndicatorData& data, const Color& backgroundColor, HashSet<Color>&& textColors)
 {
-    if (data.options & TextIndicatorOptionPaintAllContent)
+    if (data.options.contains(TextIndicatorOption::PaintAllContent))
         return false;
 
-    if (!(data.options & TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges))
+    if (!data.options.contains(TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges))
         return false;
 
-    if (!(data.options & TextIndicatorOptionComputeEstimatedBackgroundColor))
+    if (!data.options.contains(TextIndicatorOption::ComputeEstimatedBackgroundColor))
         return false;
 
     bool hasOnlyLegibleTextColors = true;
-    if (data.options & TextIndicatorOptionRespectTextColor) {
+    if (data.options.contains(TextIndicatorOption::RespectTextColor)) {
         for (auto& textColor : textColors) {
             hasOnlyLegibleTextColors = textColorIsLegibleAgainstBackgroundColor(textColor, backgroundColor);
             if (!hasOnlyLegibleTextColors)
@@ -293,7 +293,7 @@
         document->updateLayoutIgnorePendingStylesheets();
 
     bool treatRangeAsComplexDueToIllegibleTextColors = false;
-    if (data.options & TextIndicatorOptionComputeEstimatedBackgroundColor) {
+    if (data.options.contains(TextIndicatorOption::ComputeEstimatedBackgroundColor)) {
         data.estimatedBackgroundColor = estimatedBackgroundColorForRange(range, frame);
         treatRangeAsComplexDueToIllegibleTextColors = hasAnyIllegibleColors(data, data.estimatedBackgroundColor, estimatedTextColorsForRange(range));
     }
@@ -301,25 +301,25 @@
     // FIXME (138888): Ideally we wouldn't remove the margin in this case, but we need to
     // ensure that the indicator and indicator-with-highlight overlap precisely, and
     // we can't add a margin to the indicator-with-highlight.
-    if (indicatesCurrentSelection && !(data.options & TextIndicatorOptionIncludeMarginIfRangeMatchesSelection))
+    if (indicatesCurrentSelection && !data.options.contains(TextIndicatorOption::IncludeMarginIfRangeMatchesSelection))
         margin = FloatSize();
 
     Vector<FloatRect> textRects;
 
-    bool useBoundingRectAndPaintAllContentForComplexRanges = data.options & TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges;
+    bool useBoundingRectAndPaintAllContentForComplexRanges = data.options.contains(TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges);
     if (useBoundingRectAndPaintAllContentForComplexRanges && containsOnlyWhiteSpaceText(range)) {
         if (auto* containerRenderer = commonInclusiveAncestor(range.start.container, range.end.container)->renderer()) {
-            data.options |= TextIndicatorOptionPaintAllContent;
+            data.options.add(TextIndicatorOption::PaintAllContent);
             textRects.append(containerRenderer->absoluteBoundingBoxRect());
         }
     } else if (useBoundingRectAndPaintAllContentForComplexRanges && (treatRangeAsComplexDueToIllegibleTextColors || hasNonInlineOrReplacedElements(range)))
-        data.options |= TextIndicatorOptionPaintAllContent;
+        data.options.add(TextIndicatorOption::PaintAllContent);
 #if PLATFORM(IOS_FAMILY)
-    else if (data.options & TextIndicatorOptionUseSelectionRectForSizing)
+    else if (data.options.contains(TextIndicatorOption::UseSelectionRectForSizing))
         textRects = selectionRects(range);
 #endif
     else {
-        auto textRectHeight = (data.options & TextIndicatorOptionTightlyFitContent) ? FrameSelection::TextRectangleHeight::TextHeight : FrameSelection::TextRectangleHeight::SelectionHeight;
+        auto textRectHeight = data.options.contains(TextIndicatorOption::TightlyFitContent) ? FrameSelection::TextRectangleHeight::TextHeight : FrameSelection::TextRectangleHeight::SelectionHeight;
         Vector<IntRect> intRects;
         createLiveRange(range)->absoluteTextRects(intRects, textRectHeight == FrameSelection::TextRectangleHeight::SelectionHeight, Range::BoundingRectBehavior::RespectClipping);
         textRects.reserveInitialCapacity(intRects.size());
@@ -343,7 +343,7 @@
         contentsClipRect = frameView->visibleContentRect();
 #endif
 
-    if (data.options & TextIndicatorOptionExpandClipBeyondVisibleRect) {
+    if (data.options.contains(TextIndicatorOption::ExpandClipBeyondVisibleRect)) {
         contentsClipRect.inflateX(contentsClipRect.width() / 2);
         contentsClipRect.inflateY(contentsClipRect.height() / 2);
     }
@@ -354,7 +354,7 @@
     Vector<FloatRect> textRectsInRootViewCoordinates;
     for (const FloatRect& textRect : textRects) {
         FloatRect clippedTextRect;
-        if (data.options & TextIndicatorOptionDoNotClipToVisibleRect)
+        if (data.options.contains(TextIndicatorOption::DoNotClipToVisibleRect))
             clippedTextRect = textRect;
         else
             clippedTextRect = intersection(textRect, contentsClipRect);

Modified: trunk/Source/WebCore/page/TextIndicator.h (261847 => 261848)


--- trunk/Source/WebCore/page/TextIndicator.h	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/page/TextIndicator.h	2020-05-19 04:59:16 UTC (rev 261848)
@@ -28,6 +28,7 @@
 #include "FloatRect.h"
 #include "Image.h"
 #include <wtf/EnumTraits.h>
+#include <wtf/OptionSet.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
@@ -51,55 +52,52 @@
 };
 
 // Make sure to keep these in sync with the ones in Internals.idl.
-enum TextIndicatorOption : uint16_t {
-    TextIndicatorOptionDefault = 0,
-
+enum class TextIndicatorOption : uint16_t {
     // Use the styled text color instead of forcing black text (the default)
-    TextIndicatorOptionRespectTextColor = 1 << 0,
+    RespectTextColor = 1 << 0,
 
     // Paint backgrounds, even if they're not part of the Range
-    TextIndicatorOptionPaintBackgrounds = 1 << 1,
+    PaintBackgrounds = 1 << 1,
 
     // Don't restrict painting to the given Range
-    TextIndicatorOptionPaintAllContent = 1 << 2,
+    PaintAllContent = 1 << 2,
 
     // Take two snapshots:
     //    - one including the selection highlight and ignoring other painting-related options
     //    - one respecting the other painting-related options
-    TextIndicatorOptionIncludeSnapshotWithSelectionHighlight = 1 << 3,
+    IncludeSnapshotWithSelectionHighlight = 1 << 3,
 
     // Tightly fit the content instead of expanding to cover the bounds of the selection highlight
-    TextIndicatorOptionTightlyFitContent = 1 << 4,
+    TightlyFitContent = 1 << 4,
 
     // If there are any non-inline or replaced elements in the Range, indicate the bounding rect
     // of the range instead of the individual subrects, and don't restrict painting to the given Range
-    TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges = 1 << 5,
+    UseBoundingRectAndPaintAllContentForComplexRanges = 1 << 5,
 
     // By default, TextIndicator removes any margin if the given Range matches the
     // selection Range. If this option is set, maintain the margin in any case.
-    TextIndicatorOptionIncludeMarginIfRangeMatchesSelection = 1 << 6,
+    IncludeMarginIfRangeMatchesSelection = 1 << 6,
 
     // By default, TextIndicator clips the indicated rects to the visible content rect.
     // If this option is set, expand the clip rect outward so that slightly offscreen content will be included.
-    TextIndicatorOptionExpandClipBeyondVisibleRect = 1 << 7,
+    ExpandClipBeyondVisibleRect = 1 << 7,
 
     // By default, TextIndicator clips the indicated rects to the visible content rect.
     // If this option is set, do not clip to the visible rect.
-    TextIndicatorOptionDoNotClipToVisibleRect = 1 << 8,
+    DoNotClipToVisibleRect = 1 << 8,
 
     // Include an additional snapshot of everything in view, with the exception of nodes within the currently selected range.
-    TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection = 1 << 9,
+    IncludeSnapshotOfAllVisibleContentWithoutSelection = 1 << 9,
 
     // By default, TextIndicator uses text rects to size the snapshot. Enabling this flag causes it to use the bounds of the
     // selection rects that would enclose the given Range instead.
     // Currently, this is only supported on iOS.
-    TextIndicatorOptionUseSelectionRectForSizing = 1 << 10,
+    UseSelectionRectForSizing = 1 << 10,
 
     // Compute a background color to use when rendering a platter around the content image, falling back to a default if the
     // content's background is too complex to be captured by a single color.
-    TextIndicatorOptionComputeEstimatedBackgroundColor = 1 << 11,
+    ComputeEstimatedBackgroundColor = 1 << 11,
 };
-typedef uint16_t TextIndicatorOptions;
 
 struct TextIndicatorData {
     FloatRect selectionRectInRootViewCoordinates;
@@ -112,7 +110,7 @@
     RefPtr<Image> contentImage;
     Color estimatedBackgroundColor;
     TextIndicatorPresentationTransition presentationTransition { TextIndicatorPresentationTransition::None };
-    TextIndicatorOptions options { TextIndicatorOptionDefault };
+    OptionSet<TextIndicatorOption> options;
 };
 
 class TextIndicator : public RefCounted<TextIndicator> {
@@ -124,8 +122,8 @@
     constexpr static float defaultVerticalMargin { 1 };
 
     WEBCORE_EXPORT static Ref<TextIndicator> create(const TextIndicatorData&);
-    WEBCORE_EXPORT static RefPtr<TextIndicator> createWithSelectionInFrame(Frame&, TextIndicatorOptions, TextIndicatorPresentationTransition, FloatSize margin = FloatSize(defaultHorizontalMargin, defaultVerticalMargin));
-    WEBCORE_EXPORT static RefPtr<TextIndicator> createWithRange(const SimpleRange&, TextIndicatorOptions, TextIndicatorPresentationTransition, FloatSize margin = FloatSize(defaultHorizontalMargin, defaultVerticalMargin));
+    WEBCORE_EXPORT static RefPtr<TextIndicator> createWithSelectionInFrame(Frame&, OptionSet<TextIndicatorOption>, TextIndicatorPresentationTransition, FloatSize margin = FloatSize(defaultHorizontalMargin, defaultVerticalMargin));
+    WEBCORE_EXPORT static RefPtr<TextIndicator> createWithRange(const SimpleRange&, OptionSet<TextIndicatorOption>, TextIndicatorPresentationTransition, FloatSize margin = FloatSize(defaultHorizontalMargin, defaultVerticalMargin));
 
     WEBCORE_EXPORT ~TextIndicator();
 

Modified: trunk/Source/WebCore/platform/ios/DragImageIOS.mm (261847 => 261848)


--- trunk/Source/WebCore/platform/ios/DragImageIOS.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/platform/ios/DragImageIOS.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -106,8 +106,6 @@
 {
 }
 
-static const TextIndicatorOptions defaultLinkIndicatorOptions = TextIndicatorOptionTightlyFitContent | TextIndicatorOptionRespectTextColor | TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges | TextIndicatorOptionExpandClipBeyondVisibleRect | TextIndicatorOptionComputeEstimatedBackgroundColor;
-
 static FontCascade cascadeForSystemFont(CGFloat size)
 {
     UIFont *font = [PAL::getUIFontClass() systemFontOfSize:size];
@@ -147,6 +145,14 @@
             urlFontCascade.get().drawText(context, TextRun(truncatedBottomString), FloatPoint(dragImagePadding, 40 + dragImagePadding));
     }];
 
+    constexpr OptionSet<TextIndicatorOption> defaultLinkIndicatorOptions {
+        TextIndicatorOption::TightlyFitContent,
+        TextIndicatorOption::RespectTextColor,
+        TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges,
+        TextIndicatorOption::ExpandClipBeyondVisibleRect,
+        TextIndicatorOption::ComputeEstimatedBackgroundColor
+    };
+
     if (auto textIndicator = TextIndicator::createWithRange(makeRangeSelectingNodeContents(linkElement), defaultLinkIndicatorOptions, TextIndicatorPresentationTransition::None, FloatSize()))
         indicatorData = textIndicator->data();
 
@@ -165,7 +171,12 @@
     return image;
 }
 
-static TextIndicatorOptions defaultSelectionDragImageTextIndicatorOptions = TextIndicatorOptionExpandClipBeyondVisibleRect | TextIndicatorOptionPaintAllContent | TextIndicatorOptionUseSelectionRectForSizing | TextIndicatorOptionComputeEstimatedBackgroundColor;
+constexpr OptionSet<TextIndicatorOption> defaultSelectionDragImageTextIndicatorOptions {
+    TextIndicatorOption::ExpandClipBeyondVisibleRect,
+    TextIndicatorOption::PaintAllContent,
+    TextIndicatorOption::UseSelectionRectForSizing,
+    TextIndicatorOption::ComputeEstimatedBackgroundColor
+};
 
 DragImageRef createDragImageForSelection(Frame& frame, TextIndicatorData& indicatorData, bool forceBlackText)
 {
@@ -172,9 +183,9 @@
     if (auto document = frame.document())
         document->updateLayout();
 
-    TextIndicatorOptions options = defaultSelectionDragImageTextIndicatorOptions;
+    auto options = defaultSelectionDragImageTextIndicatorOptions;
     if (!forceBlackText)
-        options |= TextIndicatorOptionRespectTextColor;
+        options.add(TextIndicatorOption::RespectTextColor);
 
     auto textIndicator = TextIndicator::createWithSelectionInFrame(frame, options, TextIndicatorPresentationTransition::None, FloatSize());
     if (!textIndicator)
@@ -216,9 +227,9 @@
     if (range.collapsed())
         return nil;
 
-    TextIndicatorOptions options = defaultSelectionDragImageTextIndicatorOptions;
+    auto options = defaultSelectionDragImageTextIndicatorOptions;
     if (!forceBlackText)
-        options |= TextIndicatorOptionRespectTextColor;
+        options.add(TextIndicatorOption::RespectTextColor);
 
     auto textIndicator = TextIndicator::createWithRange(range, options, TextIndicatorPresentationTransition::None);
     if (!textIndicator || !textIndicator->contentImage())

Modified: trunk/Source/WebCore/testing/Internals.cpp (261847 => 261848)


--- trunk/Source/WebCore/testing/Internals.cpp	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/testing/Internals.cpp	2020-05-19 04:59:16 UTC (rev 261848)
@@ -5562,7 +5562,7 @@
 
 Internals::TextIndicatorInfo Internals::textIndicatorForRange(const Range& range, TextIndicatorOptions options)
 {
-    auto indicator = TextIndicator::createWithRange(range, options.core(), TextIndicatorPresentationTransition::None);
+    auto indicator = TextIndicator::createWithRange(range, options.coreOptions(), TextIndicatorPresentationTransition::None);
     return indicator->data();
 }
 

Modified: trunk/Source/WebCore/testing/Internals.h (261847 => 261848)


--- trunk/Source/WebCore/testing/Internals.h	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebCore/testing/Internals.h	2020-05-19 04:59:16 UTC (rev 261848)
@@ -962,16 +962,16 @@
         bool useBoundingRectAndPaintAllContentForComplexRanges { false };
         bool computeEstimatedBackgroundColor { false };
         bool respectTextColor { false };
-        
-        WebCore::TextIndicatorOptions core()
+
+        OptionSet<WebCore::TextIndicatorOption> coreOptions()
         {
-            WebCore::TextIndicatorOptions options = 0;
+            OptionSet<WebCore::TextIndicatorOption> options;
             if (useBoundingRectAndPaintAllContentForComplexRanges)
-                options = options | TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges;
+                options.add(TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges);
             if (computeEstimatedBackgroundColor)
-                options = options | TextIndicatorOptionComputeEstimatedBackgroundColor;
+                options.add(TextIndicatorOption::ComputeEstimatedBackgroundColor);
             if (respectTextColor)
-                options = options | TextIndicatorOptionRespectTextColor;
+                options.add(TextIndicatorOption::RespectTextColor);
             return options;
         }
     };

Modified: trunk/Source/WebKit/ChangeLog (261847 => 261848)


--- trunk/Source/WebKit/ChangeLog	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/ChangeLog	2020-05-19 04:59:16 UTC (rev 261848)
@@ -1,3 +1,36 @@
+2020-05-18  David Kilzer  <ddkil...@apple.com>
+
+        Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
+        <https://webkit.org/b/212051>
+        <rdar://problem/63368556>
+
+        Reviewed by Simon Fraser.
+
+        Use OptionSet<TextIndicatorOption> everywhere
+        TextIndicatorOptions was previously used, plus:
+        - Make TextIndicatorOption an enum class.  Remove
+          "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
+          TextIndicatorOption::Bar.
+        - Remove TextIndicatorOptionDefault because OptionSet<>
+          initializes to zero.
+        - Replace static variables (including two globals in WebCore)
+          with constexpr variables.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<TextIndicatorData>::encode):
+        (IPC::ArgumentCoder<TextIndicatorData>::decode):
+        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+        (WebKit::WebPage::dictionaryPopupInfoForRange):
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::updateFindIndicator):
+        * WebProcess/WebPage/ios/FindControllerIOS.mm:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::insertDroppedImagePlaceholders):
+        (WebKit::WebPage::computeAndSendEditDragSnapshot):
+        (WebKit::linkIndicatorPositionInformation):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performImmediateActionHitTestAtLocation):
+
 2020-05-18  Andy Estes  <aes...@apple.com>
 
         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (261847 => 261848)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2020-05-19 04:59:16 UTC (rev 261848)
@@ -2613,7 +2613,7 @@
     encoder << textIndicatorData.contentImageScaleFactor;
     encoder << textIndicatorData.estimatedBackgroundColor;
     encoder << textIndicatorData.presentationTransition;
-    encoder << static_cast<uint64_t>(textIndicatorData.options);
+    encoder << textIndicatorData.options;
 
     encodeOptionalImage(encoder, textIndicatorData.contentImage.get());
     encodeOptionalImage(encoder, textIndicatorData.contentImageWithHighlight.get());
@@ -2644,10 +2644,8 @@
     if (!decoder.decode(textIndicatorData.presentationTransition))
         return WTF::nullopt;
 
-    uint64_t options;
-    if (!decoder.decode(options))
+    if (!decoder.decode(textIndicatorData.options))
         return WTF::nullopt;
-    textIndicatorData.options = static_cast<TextIndicatorOptions>(options);
 
     if (!decodeOptionalImage(decoder, textIndicatorData.contentImage))
         return WTF::nullopt;

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (261847 => 261848)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -158,9 +158,9 @@
     }];
 #endif // PLATFORM(MAC)
 
-    TextIndicatorOptions indicatorOptions = TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges;
+    OptionSet<TextIndicatorOption> indicatorOptions { TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges };
     if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade)
-        indicatorOptions |= TextIndicatorOptionIncludeSnapshotWithSelectionHighlight;
+        indicatorOptions.add(TextIndicatorOption::IncludeSnapshotWithSelectionHighlight);
     
     auto textIndicator = TextIndicator::createWithRange(range, indicatorOptions, presentationTransition);
     if (!textIndicator) {

Modified: trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp (261847 => 261848)


--- trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp	2020-05-19 04:59:16 UTC (rev 261848)
@@ -378,7 +378,7 @@
 
 bool FindController::updateFindIndicator(Frame& selectedFrame, bool isShowingOverlay, bool shouldAnimate)
 {
-    auto indicator = TextIndicator::createWithSelectionInFrame(selectedFrame, TextIndicatorOptionIncludeMarginIfRangeMatchesSelection, shouldAnimate ? TextIndicatorPresentationTransition::Bounce : TextIndicatorPresentationTransition::None);
+    auto indicator = TextIndicator::createWithSelectionInFrame(selectedFrame, { TextIndicatorOption::IncludeMarginIfRangeMatchesSelection }, shouldAnimate ? TextIndicatorPresentationTransition::Bounce : TextIndicatorPresentationTransition::None);
     if (!indicator)
         return false;
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm (261847 => 261848)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -51,7 +51,7 @@
 const int totalHorizontalMargin = 1;
 const int totalVerticalMargin = 1;
 
-const TextIndicatorOptions findTextIndicatorOptions = TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionDoNotClipToVisibleRect;
+constexpr OptionSet<TextIndicatorOption> findTextIndicatorOptions { TextIndicatorOption::IncludeMarginIfRangeMatchesSelection, TextIndicatorOption::DoNotClipToVisibleRect };
 
 static Color highlightColor()
 {

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (261847 => 261848)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -951,14 +951,14 @@
     }
 
     Optional<TextIndicatorData> textIndicatorData;
-    OptionSet<TextIndicatorOption> textIndicatorOptions = {
-        TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection,
-        TextIndicatorOptionExpandClipBeyondVisibleRect,
-        TextIndicatorOptionPaintAllContent,
-        TextIndicatorOptionUseSelectionRectForSizing
+    constexpr OptionSet<TextIndicatorOption> textIndicatorOptions {
+        TextIndicatorOption::IncludeSnapshotOfAllVisibleContentWithoutSelection,
+        TextIndicatorOption::ExpandClipBeyondVisibleRect,
+        TextIndicatorOption::PaintAllContent,
+        TextIndicatorOption::UseSelectionRectForSizing
     };
 
-    if (auto textIndicator = TextIndicator::createWithRange(*imagePlaceholderRange, textIndicatorOptions.toRaw(), TextIndicatorPresentationTransition::None, { }))
+    if (auto textIndicator = TextIndicator::createWithRange(*imagePlaceholderRange, textIndicatorOptions, TextIndicatorPresentationTransition::None, { }))
         textIndicatorData = textIndicator->data();
 
     reply(WTFMove(placeholderRects), WTFMove(textIndicatorData));
@@ -1007,7 +1007,16 @@
 void WebPage::computeAndSendEditDragSnapshot()
 {
     Optional<TextIndicatorData> textIndicatorData;
-    static auto defaultTextIndicatorOptionsForEditDrag = TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection | TextIndicatorOptionExpandClipBeyondVisibleRect | TextIndicatorOptionPaintAllContent | TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionPaintBackgrounds | TextIndicatorOptionComputeEstimatedBackgroundColor | TextIndicatorOptionUseSelectionRectForSizing | TextIndicatorOptionIncludeSnapshotWithSelectionHighlight;
+    constexpr OptionSet<TextIndicatorOption> defaultTextIndicatorOptionsForEditDrag {
+        TextIndicatorOption::IncludeSnapshotOfAllVisibleContentWithoutSelection,
+        TextIndicatorOption::ExpandClipBeyondVisibleRect,
+        TextIndicatorOption::PaintAllContent,
+        TextIndicatorOption::IncludeMarginIfRangeMatchesSelection,
+        TextIndicatorOption::PaintBackgrounds,
+        TextIndicatorOption::ComputeEstimatedBackgroundColor,
+        TextIndicatorOption::UseSelectionRectForSizing,
+        TextIndicatorOption::IncludeSnapshotWithSelectionHighlight
+    };
     if (auto range = std::exchange(m_rangeForDropSnapshot, WTF::nullopt)) {
         if (auto textIndicator = TextIndicator::createWithRange(createLiveRange(*range), defaultTextIndicatorOptionsForEditDrag, TextIndicatorPresentationTransition::None, { }))
             textIndicatorData = textIndicator->data();
@@ -2603,11 +2612,16 @@
     float deviceScaleFactor = page.corePage()->deviceScaleFactor();
     const float marginInPoints = request.linkIndicatorShouldHaveLegacyMargins ? 4 : 0;
 
-    auto textIndicator = TextIndicator::createWithRange(linkRange.get(),
-        TextIndicatorOptionTightlyFitContent | TextIndicatorOptionRespectTextColor | TextIndicatorOptionPaintBackgrounds |
-        TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges | TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionComputeEstimatedBackgroundColor,
-        TextIndicatorPresentationTransition::None, FloatSize(marginInPoints * deviceScaleFactor, marginInPoints * deviceScaleFactor));
-        
+    constexpr OptionSet<TextIndicatorOption> textIndicatorOptions {
+        TextIndicatorOption::TightlyFitContent,
+        TextIndicatorOption::RespectTextColor,
+        TextIndicatorOption::PaintBackgrounds,
+        TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges,
+        TextIndicatorOption::IncludeMarginIfRangeMatchesSelection,
+        TextIndicatorOption::ComputeEstimatedBackgroundColor
+    };
+    auto textIndicator = TextIndicator::createWithRange(linkRange.get(), textIndicatorOptions, TextIndicatorPresentationTransition::None, FloatSize(marginInPoints * deviceScaleFactor, marginInPoints * deviceScaleFactor));
+
     if (textIndicator)
         info.linkIndicator = textIndicator->data();
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (261847 => 261848)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -852,7 +852,7 @@
     URL absoluteLinkURL = hitTestResult.absoluteLinkURL();
     Element* URLElement = hitTestResult.URLElement();
     if (!absoluteLinkURL.isEmpty() && URLElement)
-        immediateActionResult.linkTextIndicator = TextIndicator::createWithRange(makeRangeSelectingNodeContents(*URLElement), TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges, TextIndicatorPresentationTransition::FadeIn);
+        immediateActionResult.linkTextIndicator = TextIndicator::createWithRange(makeRangeSelectingNodeContents(*URLElement), { TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, TextIndicatorPresentationTransition::FadeIn);
 
     auto lookupResult = lookupTextAtLocation(locationInViewCoordinates);
     if (auto* lookupRange = std::get<RefPtr<Range>>(lookupResult).get()) {
@@ -883,7 +883,7 @@
         pageOverlayDidOverrideDataDetectors = true;
         immediateActionResult.detectedDataActionContext = actionContext;
         immediateActionResult.detectedDataBoundingBox = view->contentsToWindow(enclosingIntRect(unitedBoundingBoxes(RenderObject::absoluteTextQuads(*mainResultRange))));
-        immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges, TextIndicatorPresentationTransition::FadeIn);
+        immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, { TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, TextIndicatorPresentationTransition::FadeIn);
         immediateActionResult.detectedDataOriginatingPageOverlay = overlay->pageOverlayID();
         break;
     }
@@ -894,7 +894,7 @@
             immediateActionResult.detectedDataActionContext = WTFMove(result->actionContext);
             immediateActionResult.detectedDataBoundingBox = result->boundingBox;
             immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(result->range,
-                TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges, TextIndicatorPresentationTransition::FadeIn);
+                { TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, TextIndicatorPresentationTransition::FadeIn);
         }
     }
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-19 04:59:16 UTC (rev 261848)
@@ -1,3 +1,36 @@
+2020-05-18  David Kilzer  <ddkil...@apple.com>
+
+        Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
+        <https://webkit.org/b/212051>
+        <rdar://problem/63368556>
+
+        Reviewed by Simon Fraser.
+
+        Use OptionSet<TextIndicatorOption> everywhere
+        TextIndicatorOptions was previously used, plus:
+        - Make TextIndicatorOption an enum class.  Remove
+          "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
+          TextIndicatorOption::Bar.
+        - Remove TextIndicatorOptionDefault because OptionSet<>
+          initializes to zero.
+        - Replace static variables (including two globals in WebCore)
+          with constexpr variables.
+
+        * DOM/DOM.mm:
+        (-[DOMNode getPreviewSnapshotImage:andRects:]):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _lookUpInDictionaryFromMenu:]):
+        * WebView/WebImmediateActionController.h:
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _defaultAnimationController]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+        (+[WebImmediateActionController _dictionaryPopupInfoForRange:inFrame:withLookupOptions:indicatorOptions:transition:]):
+        (-[WebImmediateActionController _animationControllerForText]):
+        * WebView/WebView.mm:
+        (-[WebUITextIndicatorData initWithImage:textIndicatorData:scale:]):
+        (-[WebView _didConcludeEditDrag]):
+
 2020-05-18  Peng Liu  <peng.l...@apple.com>
 
         ASSERTION FAILED: media/modern-media-controls/media-controller/media-controller-resize.html crashes under stress tests

Modified: trunk/Source/WebKitLegacy/mac/DOM/DOM.mm (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/DOM/DOM.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOM.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -523,13 +523,15 @@
 
     auto& node = *core(self);
 
+    constexpr OptionSet<TextIndicatorOption> options {
+        TextIndicatorOption::TightlyFitContent,
+        TextIndicatorOption::RespectTextColor,
+        TextIndicatorOption::PaintBackgrounds,
+        TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges,
+        TextIndicatorOption::IncludeMarginIfRangeMatchesSelection
+    };
     const float margin = 4 / node.document().page()->pageScaleFactor();
-    auto textIndicator = TextIndicator::createWithRange(makeRangeSelectingNodeContents(node), TextIndicatorOptionTightlyFitContent |
-        TextIndicatorOptionRespectTextColor |
-        TextIndicatorOptionPaintBackgrounds |
-        TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges |
-        TextIndicatorOptionIncludeMarginIfRangeMatchesSelection,
-        TextIndicatorPresentationTransition::None, FloatSize(margin, margin));
+    auto textIndicator = TextIndicator::createWithRange(makeRangeSelectingNodeContents(node), options, TextIndicatorPresentationTransition::None, FloatSize(margin, margin));
 
     if (textIndicator) {
         if (Image* image = textIndicator->contentImage())

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -5905,7 +5905,7 @@
     if (!selectionRange)
         return;
 
-    [[self _webView] _showDictionaryLookupPopup:[WebImmediateActionController _dictionaryPopupInfoForRange:*selectionRange inFrame:coreFrame withLookupOptions:nil indicatorOptions:WebCore::TextIndicatorOptionIncludeSnapshotWithSelectionHighlight transition:WebCore::TextIndicatorPresentationTransition::BounceAndCrossfade]];
+    [[self _webView] _showDictionaryLookupPopup:[WebImmediateActionController _dictionaryPopupInfoForRange:*selectionRange inFrame:coreFrame withLookupOptions:nil indicatorOptions:{ WebCore::TextIndicatorOption::IncludeSnapshotWithSelectionHighlight } transition:WebCore::TextIndicatorPresentationTransition::BounceAndCrossfade]];
 }
 
 - (void)quickLookWithEvent:(NSEvent *)event

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.h (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.h	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.h	2020-05-19 04:59:16 UTC (rev 261848)
@@ -62,7 +62,7 @@
 
 - (NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
 
-+ (WebCore::DictionaryPopupInfo)_dictionaryPopupInfoForRange:(const WebCore::SimpleRange&)range inFrame:(WebCore::Frame*)frame withLookupOptions:(NSDictionary *)lookupOptions indicatorOptions:(WebCore::TextIndicatorOptions)indicatorOptions transition:(WebCore::TextIndicatorPresentationTransition)presentationTransition;
++ (WebCore::DictionaryPopupInfo)_dictionaryPopupInfoForRange:(const WebCore::SimpleRange&)range inFrame:(WebCore::Frame*)frame withLookupOptions:(NSDictionary *)lookupOptions indicatorOptions:(OptionSet<WebCore::TextIndicatorOption>)indicatorOptions transition:(WebCore::TextIndicatorPresentationTransition)presentationTransition;
 
 @end
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -271,7 +271,7 @@
             _type = WebImmediateActionLinkPreview;
 
             RefPtr<WebCore::Range> linkRange = rangeOfContents(*_hitTestResult.URLElement());
-            auto indicator = WebCore::TextIndicator::createWithRange(*linkRange, WebCore::TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges, WebCore::TextIndicatorPresentationTransition::FadeIn);
+            auto indicator = WebCore::TextIndicator::createWithRange(*linkRange, { WebCore::TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, WebCore::TextIndicatorPresentationTransition::FadeIn);
             if (indicator)
                 [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
 
@@ -439,7 +439,7 @@
     if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[detectedItem->actionContext mainResult] actionContext:detectedItem->actionContext.get()])
         return nil;
 
-    auto indicator = WebCore::TextIndicator::createWithRange(createLiveRange(detectedItem->range), WebCore::TextIndicatorOptionDefault, WebCore::TextIndicatorPresentationTransition::FadeIn);
+    auto indicator = WebCore::TextIndicator::createWithRange(createLiveRange(detectedItem->range), { }, WebCore::TextIndicatorPresentationTransition::FadeIn);
 
     _currentActionContext = [detectedItem->actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
@@ -474,7 +474,7 @@
     RefPtr<WebCore::Range> linkRange = rangeOfContents(*_hitTestResult.URLElement());
     if (!linkRange)
         return nullptr;
-    auto indicator = WebCore::TextIndicator::createWithRange(*linkRange, WebCore::TextIndicatorOptionDefault, WebCore::TextIndicatorPresentationTransition::FadeIn);
+    auto indicator = WebCore::TextIndicator::createWithRange(*linkRange, { }, WebCore::TextIndicatorPresentationTransition::FadeIn);
 
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
@@ -495,7 +495,7 @@
 
 #pragma mark Text action
 
-+ (WebCore::DictionaryPopupInfo)_dictionaryPopupInfoForRange:(const WebCore::SimpleRange&)range inFrame:(WebCore::Frame*)frame withLookupOptions:(NSDictionary *)lookupOptions indicatorOptions:(WebCore::TextIndicatorOptions)indicatorOptions transition:(WebCore::TextIndicatorPresentationTransition)presentationTransition
++ (WebCore::DictionaryPopupInfo)_dictionaryPopupInfoForRange:(const WebCore::SimpleRange&)range inFrame:(WebCore::Frame*)frame withLookupOptions:(NSDictionary *)lookupOptions indicatorOptions:(OptionSet<WebCore::TextIndicatorOption>)indicatorOptions transition:(WebCore::TextIndicatorPresentationTransition)presentationTransition
 {
     auto& editor = frame->editor();
     editor.setIsGettingDictionaryPopupInfo(true);
@@ -562,7 +562,7 @@
     if (!dictionaryRange)
         return nil;
 
-    auto dictionaryPopupInfo = [WebImmediateActionController _dictionaryPopupInfoForRange:*dictionaryRange inFrame:frame withLookupOptions:options indicatorOptions:WebCore::TextIndicatorOptionDefault transition: WebCore::TextIndicatorPresentationTransition::FadeIn];
+    auto dictionaryPopupInfo = [WebImmediateActionController _dictionaryPopupInfoForRange:*dictionaryRange inFrame:frame withLookupOptions:options indicatorOptions:{ } transition: WebCore::TextIndicatorPresentationTransition::FadeIn];
     if (!dictionaryPopupInfo.attributedString)
         return nil;
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (261847 => 261848)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-05-19 04:24:52 UTC (rev 261847)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-05-19 04:59:16 UTC (rev 261848)
@@ -712,7 +712,7 @@
         }
     }
 
-    if (indicatorData.options & WebCore::TextIndicatorOptionComputeEstimatedBackgroundColor)
+    if (indicatorData.options.contains(WebCore::TextIndicatorOption::ComputeEstimatedBackgroundColor))
         _estimatedBackgroundColor = [PAL::allocUIColorInstance() initWithCGColor:cachedCGColor(indicatorData.estimatedBackgroundColor)];
 
     return self;
@@ -1961,7 +1961,16 @@
     if (!page)
         return;
 
-    static auto defaultEditDragTextIndicatorOptions = WebCore::TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection | WebCore::TextIndicatorOptionExpandClipBeyondVisibleRect | WebCore::TextIndicatorOptionPaintAllContent | WebCore::TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | WebCore::TextIndicatorOptionPaintBackgrounds | WebCore::TextIndicatorOptionUseSelectionRectForSizing | WebCore::TextIndicatorOptionIncludeSnapshotWithSelectionHighlight | WebCore::TextIndicatorOptionRespectTextColor;
+    constexpr OptionSet<WebCore::TextIndicatorOption> defaultEditDragTextIndicatorOptions {
+        WebCore::TextIndicatorOption::IncludeSnapshotOfAllVisibleContentWithoutSelection,
+        WebCore::TextIndicatorOption::ExpandClipBeyondVisibleRect,
+        WebCore::TextIndicatorOption::PaintAllContent,
+        WebCore::TextIndicatorOption::IncludeMarginIfRangeMatchesSelection,
+        WebCore::TextIndicatorOption::PaintBackgrounds,
+        WebCore::TextIndicatorOption::UseSelectionRectForSizing,
+        WebCore::TextIndicatorOption::IncludeSnapshotWithSelectionHighlight,
+        WebCore::TextIndicatorOption::RespectTextColor
+    };
     auto& frame = page->focusController().focusedOrMainFrame();
     if (auto range = frame.selection().selection().toNormalizedRange()) {
         if (auto textIndicator = WebCore::TextIndicator::createWithRange(createLiveRange(*range), defaultEditDragTextIndicatorOptions, WebCore::TextIndicatorPresentationTransition::None, WebCore::FloatSize()))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to