Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2020 04:59:16 +0000 (04:59 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2020 04:59:16 +0000 (04:59 +0000)
<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]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@261848 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/TextIndicator.cpp
Source/WebCore/page/TextIndicator.h
Source/WebCore/platform/ios/DragImageIOS.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
Source/WebKit/WebProcess/WebPage/FindController.cpp
Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOM.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Source/WebKitLegacy/mac/WebView/WebImmediateActionController.h
Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm
Source/WebKitLegacy/mac/WebView/WebView.mm

index 9d84a86..f453995 100644 (file)
@@ -1,3 +1,35 @@
+2020-05-18  David Kilzer  <ddkilzer@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  <aestes@apple.com>
 
         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds
index fa586f1..5b6ed5e 100644 (file)
@@ -66,7 +66,7 @@ Ref<TextIndicator> TextIndicator::create(const TextIndicatorData& data)
     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 @@ RefPtr<TextIndicator> TextIndicator::createWithRange(const SimpleRange& range, T
     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 @@ static bool hasNonInlineOrReplacedElements(const SimpleRange& range)
     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 @@ static bool takeSnapshots(TextIndicatorData& data, Frame& frame, IntRect snapsho
     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 Color estimatedBackgroundColorForRange(const SimpleRange& range, const Fr
 
 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 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Sim
         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 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Sim
     // 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 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Sim
         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 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Sim
     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);
index 99ed6f8..3199726 100644 (file)
@@ -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 @@ enum class TextIndicatorPresentationTransition : uint8_t {
 };
 
 // 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 @@ struct TextIndicatorData {
     RefPtr<Image> contentImage;
     Color estimatedBackgroundColor;
     TextIndicatorPresentationTransition presentationTransition { TextIndicatorPresentationTransition::None };
-    TextIndicatorOptions options { TextIndicatorOptionDefault };
+    OptionSet<TextIndicatorOption> options;
 };
 
 class TextIndicator : public RefCounted<TextIndicator> {
@@ -124,8 +122,8 @@ public:
     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();
 
index 21f6884..0ec5d58 100644 (file)
@@ -106,8 +106,6 @@ void deleteDragImage(DragImageRef)
 {
 }
 
-static const TextIndicatorOptions defaultLinkIndicatorOptions = TextIndicatorOptionTightlyFitContent | TextIndicatorOptionRespectTextColor | TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges | TextIndicatorOptionExpandClipBeyondVisibleRect | TextIndicatorOptionComputeEstimatedBackgroundColor;
-
 static FontCascade cascadeForSystemFont(CGFloat size)
 {
     UIFont *font = [PAL::getUIFontClass() systemFontOfSize:size];
@@ -147,6 +145,14 @@ DragImageRef createDragImageForLink(Element& linkElement, URL& url, const String
             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,16 +171,21 @@ DragImageRef platformAdjustDragImageForDeviceScaleFactor(DragImageRef image, flo
     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)
 {
     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 @@ DragImageRef createDragImageForRange(Frame& frame, Range& range, bool forceBlack
     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())
index 6ec7b48..3543378 100644 (file)
@@ -5562,7 +5562,7 @@ Internals::TextIndicatorInfo::~TextIndicatorInfo() = default;
 
 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();
 }
 
index 11971bd..337888c 100644 (file)
@@ -962,16 +962,16 @@ public:
         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;
         }
     };
index 4d7385e..3076fec 100644 (file)
@@ -1,3 +1,36 @@
+2020-05-18  David Kilzer  <ddkilzer@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  <aestes@apple.com>
 
         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds
index d8e3b21..d9ebb1b 100644 (file)
@@ -2613,7 +2613,7 @@ void ArgumentCoder<TextIndicatorData>::encode(Encoder& encoder, const TextIndica
     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 @@ Optional<TextIndicatorData> ArgumentCoder<TextIndicatorData>::decode(Decoder& de
     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;
index 6430fe5..a882cd7 100644 (file)
@@ -158,9 +158,9 @@ DictionaryPopupInfo WebPage::dictionaryPopupInfoForRange(Frame& frame, Range& ra
     }];
 #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) {
index d74498f..6de5090 100644 (file)
@@ -378,7 +378,7 @@ void FindController::hideFindUI()
 
 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;
 
index a95d5ca..41b4214 100644 (file)
@@ -51,7 +51,7 @@ const int cornerRadius = 3;
 const int totalHorizontalMargin = 1;
 const int totalVerticalMargin = 1;
 
-const TextIndicatorOptions findTextIndicatorOptions = TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionDoNotClipToVisibleRect;
+constexpr OptionSet<TextIndicatorOption> findTextIndicatorOptions { TextIndicatorOption::IncludeMarginIfRangeMatchesSelection, TextIndicatorOption::DoNotClipToVisibleRect };
 
 static Color highlightColor()
 {
index 819fbbf..3859922 100644 (file)
@@ -951,14 +951,14 @@ void WebPage::insertDroppedImagePlaceholders(const Vector<IntSize>& imageSizes,
     }
 
     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::didFinishLoadingImageForElement(WebCore::HTMLImageElement& element
 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 @@ static void linkIndicatorPositionInformation(WebPage& page, Element& linkElement
     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();
 }
index ae0a0ca..f6ac20f 100644 (file)
@@ -852,7 +852,7 @@ void WebPage::performImmediateActionHitTestAtLocation(WebCore::FloatPoint locati
     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 @@ void WebPage::performImmediateActionHitTestAtLocation(WebCore::FloatPoint locati
         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 @@ void WebPage::performImmediateActionHitTestAtLocation(WebCore::FloatPoint locati
             immediateActionResult.detectedDataActionContext = WTFMove(result->actionContext);
             immediateActionResult.detectedDataBoundingBox = result->boundingBox;
             immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(result->range,
-                TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges, TextIndicatorPresentationTransition::FadeIn);
+                { TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, TextIndicatorPresentationTransition::FadeIn);
         }
     }
 
index c83d733..aa0ade2 100644 (file)
@@ -1,3 +1,36 @@
+2020-05-18  David Kilzer  <ddkilzer@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.liu6@apple.com>
 
         ASSERTION FAILED: media/modern-media-controls/media-controller/media-controller-resize.html crashes under stress tests
index 5f060b0..7ae4558 100644 (file)
@@ -523,13 +523,15 @@ id <DOMEventTarget> kit(EventTarget* target)
 
     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())
index e0d8b54..aa8894d 100644 (file)
@@ -5905,7 +5905,7 @@ static BOOL writingDirectionKeyBindingsEnabled()
     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
index 91087b7..19335ab 100644 (file)
@@ -62,7 +62,7 @@ struct DictionaryPopupInfo;
 
 - (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
 
index ea11b73..96a61e8 100644 (file)
@@ -271,7 +271,7 @@ SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
             _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 @@ static WebCore::IntRect elementBoundingBoxInWindowCoordinatesFromNode(WebCore::N
     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 @@ static WebCore::IntRect elementBoundingBoxInWindowCoordinatesFromNode(WebCore::N
     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 @@ static WebCore::IntRect elementBoundingBoxInWindowCoordinatesFromNode(WebCore::N
 
 #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 @@ static WebCore::IntRect elementBoundingBoxInWindowCoordinatesFromNode(WebCore::N
     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;
 
index ad9bfdd..fdcba4e 100644 (file)
@@ -712,7 +712,7 @@ private:
         }
     }
 
-    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 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     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()))