Clean up drawLineForDocumentMarker()
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Nov 2018 02:36:28 +0000 (02:36 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Nov 2018 02:36:28 +0000 (02:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191215

Reviewed by Zalan Bujtas.

In preparation for https://bugs.webkit.org/show_bug.cgi?id=190764, I need to do a little bit of refactoring.
This patch has no behavior change; it just does the following:

1. Renames drawLineForDocumentMarker() to drawDotsForDocumentMarker(), because 2 of the 3 implementations draw dots
2. Moves our implementation back into GraphicsContext, because it's simpler and  GraphicsContext is already platform-
       specific.
3. The signature used to accept a location and a width, but without a height, it's difficult to know what the bounding
       box is. In particular, knowing the bounding box must be possible without a GraphicsContext. So, I've modified
       the signature to accept a rectangle instead. The GraphicsContext draws only within this rectangle.

No new tests because there is no behavior change.

* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawDotsForDocumentMarker):
(WebCore::Cairo::drawLineForDocumentMarker): Deleted.
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawDotsForDocumentMarker):
(WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::drawDotsForDocumentMarker):
(WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker): Deleted.
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/cocoa/FontCascadeCocoa.mm:
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::colorForMarkerLineStyle):
(WebCore::GraphicsContext::drawDotsForDocumentMarker):
(WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::Item::sizeInBytes):
(WebCore::DisplayList::DrawDotsForDocumentMarker::apply const):
(WebCore::DisplayList::DrawDotsForDocumentMarker::localBounds const):
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::DrawLineForDocumentMarker::apply const): Deleted.
(WebCore::DisplayList::DrawLineForDocumentMarker::localBounds const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawDotsForDocumentMarker::create):
(WebCore::DisplayList::DrawDotsForDocumentMarker::rect const):
(WebCore::DisplayList::DrawDotsForDocumentMarker::DrawDotsForDocumentMarker):
(WebCore::DisplayList::DrawLineForDocumentMarker::create): Deleted.
(WebCore::DisplayList::DrawLineForDocumentMarker::point const): Deleted.
(WebCore::DisplayList::DrawLineForDocumentMarker::width const): Deleted.
(WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawDotsForDocumentMarker):
(WebCore::DisplayList::Recorder::drawLineForDocumentMarker): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::drawDotsForDocumentMarker):
(Nicosia::CairoOperationRecorder::drawLineForDocumentMarker): Deleted.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawDotsForDocumentMarker):
(WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::drawDotsForDocumentMarker):
(WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintPlatformDocumentMarker):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::drawLineForDocumentMarker): Deleted.
* rendering/RenderTheme.h:
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Deleted.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::colorForMarkerLineStyle): Deleted.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::colorForMarkerLineStyle): Deleted.

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

27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/GraphicsContextImpl.h
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/graphics/cairo/CairoOperations.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm
Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeCocoa.h
Source/WebCore/rendering/RenderThemeCocoa.mm
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm

index 1278d46..348c0a4 100644 (file)
@@ -1,3 +1,84 @@
+2018-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Clean up drawLineForDocumentMarker()
+        https://bugs.webkit.org/show_bug.cgi?id=191215
+
+        Reviewed by Zalan Bujtas.
+
+        In preparation for https://bugs.webkit.org/show_bug.cgi?id=190764, I need to do a little bit of refactoring.
+        This patch has no behavior change; it just does the following:
+
+        1. Renames drawLineForDocumentMarker() to drawDotsForDocumentMarker(), because 2 of the 3 implementations draw dots
+        2. Moves our implementation back into GraphicsContext, because it's simpler and  GraphicsContext is already platform-
+               specific.
+        3. The signature used to accept a location and a width, but without a height, it's difficult to know what the bounding
+               box is. In particular, knowing the bounding box must be possible without a GraphicsContext. So, I've modified
+               the signature to accept a rectangle instead. The GraphicsContext draws only within this rectangle.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/GraphicsContextImpl.h:
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::drawDotsForDocumentMarker):
+        (WebCore::Cairo::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/cairo/CairoOperations.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawDotsForDocumentMarker):
+        (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
+        (WebCore::GraphicsContextImplCairo::drawDotsForDocumentMarker):
+        (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/cairo/GraphicsContextImplCairo.h:
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        * platform/graphics/cocoa/GraphicsContextCocoa.mm:
+        (WebCore::colorForMarkerLineStyle):
+        (WebCore::GraphicsContext::drawDotsForDocumentMarker):
+        (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/displaylists/DisplayListItems.cpp:
+        (WebCore::DisplayList::Item::sizeInBytes):
+        (WebCore::DisplayList::DrawDotsForDocumentMarker::apply const):
+        (WebCore::DisplayList::DrawDotsForDocumentMarker::localBounds const):
+        (WebCore::DisplayList::operator<<):
+        (WebCore::DisplayList::DrawLineForDocumentMarker::apply const): Deleted.
+        (WebCore::DisplayList::DrawLineForDocumentMarker::localBounds const): Deleted.
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::DrawDotsForDocumentMarker::create):
+        (WebCore::DisplayList::DrawDotsForDocumentMarker::rect const):
+        (WebCore::DisplayList::DrawDotsForDocumentMarker::DrawDotsForDocumentMarker):
+        (WebCore::DisplayList::DrawLineForDocumentMarker::create): Deleted.
+        (WebCore::DisplayList::DrawLineForDocumentMarker::point const): Deleted.
+        (WebCore::DisplayList::DrawLineForDocumentMarker::width const): Deleted.
+        (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawDotsForDocumentMarker):
+        (WebCore::DisplayList::Recorder::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
+        (Nicosia::CairoOperationRecorder::drawDotsForDocumentMarker):
+        (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::GraphicsContext::drawDotsForDocumentMarker):
+        (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
+        * platform/graphics/win/GraphicsContextDirect2D.cpp:
+        (WebCore::GraphicsContext::drawDotsForDocumentMarker):
+        (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintPlatformDocumentMarker):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::drawLineForDocumentMarker): Deleted.
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeCocoa.h:
+        * rendering/RenderThemeCocoa.mm:
+        (WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Deleted.
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::colorForMarkerLineStyle): Deleted.
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::colorForMarkerLineStyle): Deleted.
+
 2018-11-02  Ali Juma  <ajuma@chromium.org>
 
         requestAnimationFrame causes bad location of position:fixed inside overflow:auto and iframe
index a3de86d..8619053 100644 (file)
@@ -73,10 +73,6 @@ class Font;
 class GlyphBuffer;
 #endif
 
-const int cMisspellingLineThickness = 3;
-const int cMisspellingLinePatternWidth = 4;
-const int cMisspellingLinePatternGapWidth = 1;
-
 class AffineTransform;
 class FloatRoundedRect;
 class Gradient;
@@ -109,12 +105,15 @@ enum StrokeStyle {
     WavyStroke,
 };
 
-enum class DocumentMarkerLineStyle : uint8_t {
-    TextCheckingDictationPhraseWithAlternatives,
-    Spelling,
-    Grammar,
-    AutocorrectionReplacement,
-    DictationAlternatives
+struct DocumentMarkerLineStyle {
+    enum class Mode : uint8_t {
+        TextCheckingDictationPhraseWithAlternatives,
+        Spelling,
+        Grammar,
+        AutocorrectionReplacement,
+        DictationAlternatives
+    } mode;
+    bool shouldUseDarkAppearance { false };
 };
 
 namespace DisplayList {
@@ -422,7 +421,7 @@ public:
     FloatRect computeUnderlineBoundsForText(const FloatPoint&, float width, bool printing);
     WEBCORE_EXPORT void drawLineForText(const FloatPoint&, float width, bool printing, bool doubleLines = false, StrokeStyle = SolidStroke);
     void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines = false, StrokeStyle = SolidStroke);
-    void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle);
+    void drawDotsForDocumentMarker(const FloatRect&, DocumentMarkerLineStyle);
 
     WEBCORE_EXPORT void beginTransparencyLayer(float opacity);
     WEBCORE_EXPORT void endTransparencyLayer();
index 47fb4a4..d48b924 100644 (file)
@@ -79,7 +79,7 @@ public:
     virtual void drawRect(const FloatRect&, float borderThickness) = 0;
     virtual void drawLine(const FloatPoint&, const FloatPoint&) = 0;
     virtual void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) = 0;
-    virtual void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle) = 0;
+    virtual void drawDotsForDocumentMarker(const FloatRect&, DocumentMarkerLineStyle) = 0;
     virtual void drawEllipse(const FloatRect&) = 0;
     virtual void drawPath(const Path&) = 0;
 
index 83c2b0a..f65ee25 100644 (file)
@@ -1049,21 +1049,21 @@ void drawLinesForText(PlatformContextCairo& platformContext, const FloatPoint& p
     cairo_restore(cr);
 }
 
-void drawLineForDocumentMarker(PlatformContextCairo& platformContext, const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
+void drawDotsForDocumentMarker(PlatformContextCairo& platformContext, const FloatRect& rect, DocumentMarkerLineStyle style)
 {
-    if (style != DocumentMarkerLineStyle::Spelling
-        && style != DocumentMarkerLineStyle::Grammar)
+    if (style.mode != DocumentMarkerLineStyle::Mode::Spelling
+        && style.mode != DocumentMarkerLineStyle::Mode::Grammar)
         return;
 
     cairo_t* cr = platformContext.cr();
     cairo_save(cr);
 
-    if (style == DocumentMarkerLineStyle::Spelling)
+    if (style.mode == DocumentMarkerLineStyle::Mode::Spelling)
         cairo_set_source_rgb(cr, 1, 0, 0);
-    else if (style == DocumentMarkerLineStyle::Grammar)
+    else if (style.mode == DocumentMarkerLineStyle::Mode::Grammar)
         cairo_set_source_rgb(cr, 0, 1, 0);
 
-    drawErrorUnderline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness);
+    drawErrorUnderline(cr, rect.x(), rect.y(), rect.width(), rect.height());
     cairo_restore(cr);
 }
 
index 39b52a7..cb78dfb 100644 (file)
@@ -145,7 +145,7 @@ WEBCORE_EXPORT void drawSurface(PlatformContextCairo&, cairo_surface_t*, const F
 void drawRect(PlatformContextCairo&, const FloatRect&, float, const Color&, StrokeStyle, const Color&);
 void drawLine(PlatformContextCairo&, const FloatPoint&, const FloatPoint&, StrokeStyle, const Color&, float, bool);
 void drawLinesForText(PlatformContextCairo&, const FloatPoint&, const DashArray&, bool, bool, const Color&, float);
-void drawLineForDocumentMarker(PlatformContextCairo&, const FloatPoint&, float, DocumentMarkerLineStyle);
+void drawDotsForDocumentMarker(PlatformContextCairo&, const FloatRect&, DocumentMarkerLineStyle);
 void drawEllipse(PlatformContextCairo&, const FloatRect&, const Color&, StrokeStyle, const Color&, float);
 
 void drawFocusRing(PlatformContextCairo&, const Path&, float, const Color&);
index 5f8570b..2f8b925 100644 (file)
@@ -337,18 +337,18 @@ void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray&
     Cairo::drawLinesForText(*platformContext(), point, widths, printing, doubleUnderlines, m_state.strokeColor, m_state.strokeThickness);
 }
 
-void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
+void GraphicsContext::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
 
     if (m_impl) {
-        m_impl->drawLineForDocumentMarker(origin, width, style);
+        m_impl->drawDotsForDocumentMarker(rect, style);
         return;
     }
 
     ASSERT(hasPlatformContext());
-    Cairo::drawLineForDocumentMarker(*platformContext(), origin, width, style);
+    Cairo::drawDotsForDocumentMarker(*platformContext(), rect, style);
 }
 
 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode)
index 7e9b9de..c77dfb7 100644 (file)
@@ -303,9 +303,9 @@ void GraphicsContextImplCairo::drawLinesForText(const FloatPoint& point, const D
     Cairo::drawLinesForText(m_platformContext, point, widths, printing, doubleUnderlines, state.strokeColor, state.strokeThickness);
 }
 
-void GraphicsContextImplCairo::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
+void GraphicsContextImplCairo::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
-    Cairo::drawLineForDocumentMarker(m_platformContext, origin, width, style);
+    Cairo::drawDotsForDocumentMarker(m_platformContext, rect, style);
 }
 
 void GraphicsContextImplCairo::drawEllipse(const FloatRect& rect)
index 30d3ec6..2d74285 100644 (file)
@@ -80,7 +80,7 @@ public:
     void drawRect(const FloatRect&, float) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;
     void drawLinesForText(const FloatPoint&, const DashArray&, bool, bool, float) override;
-    void drawLineForDocumentMarker(const FloatPoint&, float, DocumentMarkerLineStyle) override;
+    void drawDotsForDocumentMarker(const FloatRect&, DocumentMarkerLineStyle) override;
     void drawEllipse(const FloatRect&) override;
     void drawPath(const Path&) override;
 
index a0892dc..4da5ed5 100644 (file)
@@ -37,7 +37,7 @@
 #endif
 #import <wtf/MathExtras.h>
 
-#if ENABLE(LETTERPRESS)
+#if PLATFORM(IOS_FAMILY)
 #import <pal/spi/ios/CoreUISPI.h>
 #import <wtf/SoftLinking.h>
 
@@ -47,6 +47,7 @@ SOFT_LINK_CLASS(CoreUI, CUIStyleEffectConfiguration)
 
 SOFT_LINK_FRAMEWORK(UIKit)
 SOFT_LINK(UIKit, _UIKitGetTextEffectsCatalog, CUICatalog *, (void), ())
+SOFT_LINK_CLASS(UIKit, UIColor)
 #endif
 
 #ifdef __LP64__
index e63eeea..48b5b94 100644 (file)
@@ -32,6 +32,7 @@
 #import "IntRect.h"
 #import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/mac/NSGraphicsSPI.h>
+#import <wtf/SoftLinking.h>
 #import <wtf/StdLibExtras.h>
 
 #if USE(APPKIT)
@@ -41,6 +42,7 @@
 #if PLATFORM(IOS_FAMILY)
 #import "Color.h"
 #import "WKGraphics.h"
+#import <pal/spi/ios/UIKitSPI.h>
 #endif
 
 #if PLATFORM(MAC)
@@ -181,10 +183,66 @@ static inline void setPatternPhaseInUserSpace(CGContextRef context, CGPoint phas
     CGContextSetPatternPhase(context, CGSizeMake(phase.x, phase.y));
 }
 
-// FIXME: We need to keep this function since it is referenced by DrawLineForDocumentMarker::apply().
-void GraphicsContext::drawLineForDocumentMarker(const FloatPoint&, float, DocumentMarkerLineStyle)
+static CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle::Mode style, bool useDarkMode)
 {
-    // Cocoa platforms use RenderTheme::drawLineForDocumentMarker() to paint the platform document markers.
+#if PLATFORM(MAC)
+    switch (style) {
+    // Red
+    case DocumentMarkerLineStyle::Mode::Spelling:
+        return cachedCGColor(useDarkMode ? Color { 255, 140, 140, 217 } : Color { 255, 59, 48, 191 });
+    // Blue
+    case DocumentMarkerLineStyle::Mode::DictationAlternatives:
+    case DocumentMarkerLineStyle::Mode::TextCheckingDictationPhraseWithAlternatives:
+    case DocumentMarkerLineStyle::Mode::AutocorrectionReplacement:
+        return cachedCGColor(useDarkMode ? Color { 40, 145, 255, 217 } : Color { 0, 122, 255, 191 });
+    // Green
+    case DocumentMarkerLineStyle::Mode::Grammar:
+        return cachedCGColor(useDarkMode ? Color { 50, 215, 75, 217 } : Color { 25, 175, 50, 191 });
+    }
+#else
+    UNUSED_PARAM(useDarkMode);
+    switch (style) {
+    case DocumentMarkerLineStyle::Mode::Spelling:
+        return [getUIColorClass() systemRedColor].CGColor;
+    case DocumentMarkerLineStyle::Mode::DictationAlternatives:
+    case DocumentMarkerLineStyle::Mode::TextCheckingDictationPhraseWithAlternatives:
+    case DocumentMarkerLineStyle::Mode::AutocorrectionReplacement:
+        return [getUIColorClass() systemBlueColor].CGColor;
+    case DocumentMarkerLineStyle::Mode::Grammar:
+        return [getUIColorClass() systemGreenColor].CGColor;
+    }
+#endif
+}
+
+void GraphicsContext::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
+{
+    if (paintingDisabled())
+        return;
+
+    auto circleColor = colorForMarkerLineStyle(style.mode, style.shouldUseDarkAppearance);
+
+    auto lineThickness = rect.height();
+    auto patternGapWidth = lineThickness / 3;
+    auto patternWidth = lineThickness + patternGapWidth;
+
+    FloatPoint offsetPoint = rect.location();
+    auto width = rect.width();
+    float widthMod = fmodf(width, patternWidth);
+    if (patternWidth - widthMod > patternGapWidth) {
+        float gapIncludeWidth = 0;
+        if (width > patternWidth)
+            gapIncludeWidth = patternGapWidth;
+        offsetPoint.move(floor((widthMod + gapIncludeWidth) / 2), 0);
+        width -= widthMod;
+    }
+
+    CGContextRef platformContext = this->platformContext();
+    CGContextStateSaver stateSaver { platformContext };
+    CGContextSetFillColorWithColor(platformContext, circleColor);
+    for (int x = 0; x < width; x += patternWidth)
+        CGContextAddEllipseInRect(platformContext, CGRectMake(offsetPoint.x() + x, offsetPoint.y(), lineThickness, lineThickness));
+    CGContextSetCompositeOperation(platformContext, kCGCompositeSover);
+    CGContextFillPath(platformContext);
 }
 
 } // namespace WebCore
index 1fcee8b..7353d37 100644 (file)
@@ -99,8 +99,8 @@ size_t Item::sizeInBytes(const Item& item)
         return sizeof(downcast<DrawLine>(item));
     case ItemType::DrawLinesForText:
         return sizeof(downcast<DrawLinesForText>(item));
-    case ItemType::DrawLineForDocumentMarker:
-        return sizeof(downcast<DrawLineForDocumentMarker>(item));
+    case ItemType::DrawDotsForDocumentMarker:
+        return sizeof(downcast<DrawDotsForDocumentMarker>(item));
     case ItemType::DrawEllipse:
         return sizeof(downcast<DrawEllipse>(item));
     case ItemType::DrawPath:
@@ -621,25 +621,20 @@ static TextStream& operator<<(TextStream& ts, const DrawLinesForText& item)
     return ts;
 }
 
-void DrawLineForDocumentMarker::apply(GraphicsContext& context) const
+void DrawDotsForDocumentMarker::apply(GraphicsContext& context) const
 {
-    context.drawLineForDocumentMarker(m_point, m_width, m_style);
+    context.drawDotsForDocumentMarker(m_rect, m_style);
 }
 
-std::optional<FloatRect> DrawLineForDocumentMarker::localBounds(const GraphicsContext&) const
+std::optional<FloatRect> DrawDotsForDocumentMarker::localBounds(const GraphicsContext&) const
 {
-    // This function needs to return a value equal to or enclosing what GraphicsContext::drawLineForDocumentMarker() returns.
-
-    FloatRect result(m_point, FloatSize(m_width, cMisspellingLineThickness));
-    result.inflate(cMisspellingLineThickness); // Account for "misspelling dot" snapping.
-    return result;
+    return m_rect;
 }
 
-static TextStream& operator<<(TextStream& ts, const DrawLineForDocumentMarker& item)
+static TextStream& operator<<(TextStream& ts, const DrawDotsForDocumentMarker& item)
 {
     ts << static_cast<const DrawingItem&>(item);
-    ts.dumpProperty("point", item.point());
-    ts.dumpProperty("width", item.width());
+    ts.dumpProperty("rect", item.rect());
     return ts;
 }
 
@@ -965,7 +960,7 @@ static TextStream& operator<<(TextStream& ts, const ItemType& type)
     case ItemType::DrawRect: ts << "draw-rect"; break;
     case ItemType::DrawLine: ts << "draw-line"; break;
     case ItemType::DrawLinesForText: ts << "draw-lines-for-text"; break;
-    case ItemType::DrawLineForDocumentMarker: ts << "draw-lines-for-document-marker"; break;
+    case ItemType::DrawDotsForDocumentMarker: ts << "draw-dots-for-document-marker"; break;
     case ItemType::DrawEllipse: ts << "draw-ellipse"; break;
     case ItemType::DrawPath: ts << "draw-path"; break;
     case ItemType::DrawFocusRingPath: ts << "draw-focus-ring-path"; break;
@@ -1072,8 +1067,8 @@ TextStream& operator<<(TextStream& ts, const Item& item)
     case ItemType::DrawLinesForText:
         ts << downcast<DrawLinesForText>(item);
         break;
-    case ItemType::DrawLineForDocumentMarker:
-        ts << downcast<DrawLineForDocumentMarker>(item);
+    case ItemType::DrawDotsForDocumentMarker:
+        ts << downcast<DrawDotsForDocumentMarker>(item);
         break;
     case ItemType::DrawEllipse:
         ts << downcast<DrawEllipse>(item);
index 872e30d..7c7eb6d 100644 (file)
@@ -77,7 +77,7 @@ enum class ItemType {
     DrawRect,
     DrawLine,
     DrawLinesForText,
-    DrawLineForDocumentMarker,
+    DrawDotsForDocumentMarker,
     DrawEllipse,
     DrawPath,
     DrawFocusRingPath,
@@ -828,21 +828,19 @@ private:
     bool m_doubleLines;
 };
 
-class DrawLineForDocumentMarker : public DrawingItem {
+class DrawDotsForDocumentMarker : public DrawingItem {
 public:
-    static Ref<DrawLineForDocumentMarker> create(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
+    static Ref<DrawDotsForDocumentMarker> create(const FloatRect& rect, DocumentMarkerLineStyle style)
     {
-        return adoptRef(*new DrawLineForDocumentMarker(point, width, style));
+        return adoptRef(*new DrawDotsForDocumentMarker(rect, style));
     }
 
-    FloatPoint point() const { return m_point; }
-    float width() const { return m_width; }
+    FloatRect rect() const { return m_rect; }
 
 private:
-    DrawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
-        : DrawingItem(ItemType::DrawLineForDocumentMarker)
-        , m_point(point)
-        , m_width(width)
+    DrawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
+        : DrawingItem(ItemType::DrawDotsForDocumentMarker)
+        , m_rect(rect)
         , m_style(style)
     {
     }
@@ -851,8 +849,7 @@ private:
 
     std::optional<FloatRect> localBounds(const GraphicsContext&) const override;
 
-    FloatPoint m_point;
-    float m_width;
+    FloatRect m_rect;
     DocumentMarkerLineStyle m_style;
 };
 
@@ -1360,7 +1357,7 @@ SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawPattern)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawRect)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLine)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLinesForText)
-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLineForDocumentMarker)
+SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawDotsForDocumentMarker)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawEllipse)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawPath)
 SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawFocusRingPath)
index ea27326..5307f02 100644 (file)
@@ -236,9 +236,9 @@ void Recorder::drawLinesForText(const FloatPoint& point, const DashArray& widths
     updateItemExtent(newItem);
 }
 
-void Recorder::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
+void Recorder::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
-    DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawLineForDocumentMarker::create(point, width, style)));
+    DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawDotsForDocumentMarker::create(rect, style)));
     updateItemExtent(newItem);
 }
 
index 5c1c066..1b79437 100644 (file)
@@ -98,7 +98,7 @@ private:
     void drawRect(const FloatRect&, float borderThickness) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;
     void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) override;
-    void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle) override;
+    void drawDotsForDocumentMarker(const FloatRect&, DocumentMarkerLineStyle) override;
     void drawEllipse(const FloatRect&) override;
     void drawPath(const Path&) override;
 
index 85d3ec3..578495f 100644 (file)
@@ -652,23 +652,23 @@ void CairoOperationRecorder::drawLinesForText(const FloatPoint& point, const Das
     append(createCommand<DrawLinesForText>(point, widths, printing, doubleUnderlines, state.strokeColor, state.strokeThickness));
 }
 
-void CairoOperationRecorder::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
+void CairoOperationRecorder::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
-    struct DrawLineForDocumentMarker final : PaintingOperation, OperationData<FloatPoint, float, DocumentMarkerLineStyle> {
-        virtual ~DrawLineForDocumentMarker() = default;
+    struct DrawDotsForDocumentMarker final : PaintingOperation, OperationData<FloatRect, DocumentMarkerLineStyle> {
+        virtual ~DrawDotsForDocumentMarker() = default;
 
         void execute(PaintingOperationReplay& replayer) override
         {
-            Cairo::drawLineForDocumentMarker(contextForReplay(replayer), arg<0>(), arg<1>(), arg<2>());
+            Cairo::drawDotsForDocumentMarker(contextForReplay(replayer), arg<0>(), arg<1>());
         }
 
         void dump(TextStream& ts) override
         {
-            ts << indent << "DrawLineForDocumentMarker<>\n";
+            ts << indent << "DrawDotsForDocumentMarker<>\n";
         }
     };
 
-    append(createCommand<DrawLineForDocumentMarker>(origin, width, style));
+    append(createCommand<DrawDotsForDocumentMarker>(rect, style));
 }
 
 void CairoOperationRecorder::drawEllipse(const FloatRect& rect)
index 009eb22..6d6fac3 100644 (file)
@@ -73,7 +73,7 @@ private:
     void drawRect(const WebCore::FloatRect&, float) override;
     void drawLine(const WebCore::FloatPoint&, const WebCore::FloatPoint&) override;
     void drawLinesForText(const WebCore::FloatPoint&, const DashArray&, bool, bool, float) override;
-    void drawLineForDocumentMarker(const WebCore::FloatPoint&, float, WebCore::DocumentMarkerLineStyle) override;
+    void drawDotsForDocumentMarker(const WebCore::FloatRect&, WebCore::DocumentMarkerLineStyle) override;
     void drawEllipse(const WebCore::FloatRect&) override;
     void drawPath(const WebCore::Path&) override;
 
index 120638b..e0e2380 100644 (file)
@@ -185,19 +185,19 @@ static const Color& grammarPatternColor() {
     return grammarColor;
 }
 
-void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
+void GraphicsContext::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
     if (paintingDisabled())
         return;
 
-    if (style != DocumentMarkerLineStyle::Spelling && style != DocumentMarkerLineStyle::Grammar)
+    if (style.mode != DocumentMarkerLineStyle::Mode::Spelling && style.mode != DocumentMarkerLineStyle::Mode::Grammar)
         return;
 
-    // These are the same for misspelling or bad grammar
-    const int patternHeight = 3; // 3 rows
-    ASSERT(cMisspellingLineThickness == patternHeight);
-    const int patternWidth = 4; // 4 pixels
-    ASSERT(patternWidth == cMisspellingLinePatternWidth);
+    auto point = rect.location();
+    auto width = rect.width();
+    auto lineThickness = rect.height();
+    auto patternGapWidth = lineThickness / 3;
+    auto patternWidth = lineThickness + patternGapWidth;
 
     // Make sure to draw only complete dots.
     // NOTE: Code here used to shift the underline to the left and increase the width
@@ -206,23 +206,23 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w
     // space between adjacent misspelled words was underlined.
     // allow slightly more considering that the pattern ends with a transparent pixel
     float widthMod = fmodf(width, patternWidth);
-    if (patternWidth - widthMod > cMisspellingLinePatternGapWidth)
+    if (patternWidth - widthMod > patternGapWidth)
         width -= widthMod;
-      
+
     // Draw the underline
     CGContextRef context = platformContext();
     CGContextSaveGState(context);
 
-    const Color& patternColor = style == DocumentMarkerLineStyle::Grammar ? grammarPatternColor() : spellingPatternColor();
+    const Color& patternColor = style.mode == DocumentMarkerLineStyle::Mode::Grammar ? grammarPatternColor() : spellingPatternColor();
     setCGStrokeColor(context, patternColor);
 
     wkSetPatternPhaseInUserSpace(context, point);
     CGContextSetBlendMode(context, kCGBlendModeNormal);
     
     // 3 rows, each offset by half a pixel for blending purposes
-    const CGPoint upperPoints [] = {{point.x(), point.y() + patternHeight - 2.5 }, {point.x() + width, point.y() + patternHeight - 2.5}};
-    const CGPoint middlePoints [] = {{point.x(), point.y() + patternHeight - 1.5 }, {point.x() + width, point.y() + patternHeight - 1.5}};
-    const CGPoint lowerPoints [] = {{point.x(), point.y() + patternHeight - 0.5 }, {point.x() + width, point.y() + patternHeight - 0.5 }};
+    const CGPoint upperPoints[] = {{ point.x(), point.y() + lineThickness - 2.5 }, {point.x() + width, point.y() + lineThickness - 2.5 }};
+    const CGPoint middlePoints[] = {{ point.x(), point.y() + lineThickness - 1.5 }, {point.x() + width, point.y() + lineThickness - 1.5 }};
+    const CGPoint lowerPoints[] = {{ point.x(), point.y() + lineThickness - 0.5 }, {point.x() + width, point.y() + lineThickness - 0.5 }};
     
     // Dash lengths for the top and bottom of the error underline are the same.
     // These are magic.
index 23c7db1..ba150c6 100644 (file)
@@ -319,7 +319,7 @@ void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width,
 {
 }
 
-void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
+void GraphicsContext::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
 }
 
index be7f8d4..7cbc078 100644 (file)
@@ -698,24 +698,25 @@ void InlineTextBox::paintPlatformDocumentMarker(GraphicsContext& context, const
         width = markerRect.width();
     }
 
-    auto lineStyleForMarkedTextType = [] (MarkedText::Type type) {
+    auto lineStyleForMarkedTextType = [&] (MarkedText::Type type) -> DocumentMarkerLineStyle {
+        bool shouldUseDarkAppearance = renderer().document().useDarkAppearance();
         switch (type) {
         case MarkedText::SpellingError:
-            return DocumentMarkerLineStyle::Spelling;
+            return { DocumentMarkerLineStyle::Mode::Spelling, shouldUseDarkAppearance };
         case MarkedText::GrammarError:
-            return DocumentMarkerLineStyle::Grammar;
+            return { DocumentMarkerLineStyle::Mode::Grammar, shouldUseDarkAppearance };
         case MarkedText::Correction:
-            return DocumentMarkerLineStyle::AutocorrectionReplacement;
+            return { DocumentMarkerLineStyle::Mode::AutocorrectionReplacement, shouldUseDarkAppearance };
         case MarkedText::DictationAlternatives:
-            return DocumentMarkerLineStyle::DictationAlternatives;
+            return { DocumentMarkerLineStyle::Mode::DictationAlternatives, shouldUseDarkAppearance };
 #if PLATFORM(IOS_FAMILY)
         case MarkedText::DictationPhraseWithAlternatives:
             // FIXME: Rename DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives and remove the PLATFORM(IOS_FAMILY)-guard.
-            return DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives;
+            return { DocumentMarkerLineStyle::Mode::TextCheckingDictationPhraseWithAlternatives, shouldUseDarkAppearance };
 #endif
         default:
             ASSERT_NOT_REACHED();
-            return DocumentMarkerLineStyle::Spelling;
+            return { DocumentMarkerLineStyle::Mode::Spelling, shouldUseDarkAppearance };
         }
     };
 
@@ -725,7 +726,7 @@ void InlineTextBox::paintPlatformDocumentMarker(GraphicsContext& context, const
     // or decrease the underline thickness.  The overlap is actually the most useful, and matches what AppKit does.
     // So, we generally place the underline at the bottom of the text, but in larger fonts that's not so good so
     // we pin to two pixels under the baseline.
-    int lineThickness = cMisspellingLineThickness;
+    int lineThickness = 3;
     int baseline = lineStyle().fontMetrics().ascent();
     int descent = logicalHeight() - baseline;
     int underlineOffset;
@@ -737,11 +738,7 @@ void InlineTextBox::paintPlatformDocumentMarker(GraphicsContext& context, const
         underlineOffset = baseline + 2;
     }
 
-#if PLATFORM(COCOA)
-    RenderTheme::singleton().drawLineForDocumentMarker(renderer(), context, FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkedTextType(markedText.type));
-#else
-    context.drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkedTextType(markedText.type));
-#endif
+    context.drawDotsForDocumentMarker(FloatRect(boxOrigin.x() + start, boxOrigin.y() + underlineOffset, width, lineThickness), lineStyleForMarkedTextType(markedText.type));
 }
 
 auto InlineTextBox::computeStyleForUnmarkedMarkedText(const PaintInfo& paintInfo) const -> MarkedTextStyle
index 0f64305..abf7600 100644 (file)
@@ -1474,8 +1474,4 @@ Color RenderTheme::platformTapHighlightColor() const
 
 #endif
 
-void RenderTheme::drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint&, float, DocumentMarkerLineStyle)
-{
-}
-
 } // namespace WebCore
index 6d52498..092fef8 100644 (file)
@@ -261,8 +261,6 @@ public:
     virtual void paintSystemPreviewBadge(Image&, const PaintInfo&, const FloatRect&);
 #endif
 
-    virtual void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint& origin, float width, DocumentMarkerLineStyle);
-
     virtual bool usingDarkAppearance(const RenderObject&) const { return false; }
 
 protected:
index 16de965..a464c10 100644 (file)
@@ -36,15 +36,12 @@ namespace WebCore {
 
 class RenderThemeCocoa : public RenderTheme {
 private:
-    void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint& origin, float width, DocumentMarkerLineStyle) final;
-
 #if ENABLE(APPLE_PAY)
     void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
 #endif
-protected:
-    virtual CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) = 0;
 
+protected:
 #if ENABLE(VIDEO)
     String mediaControlsFormattedStringForDuration(double) override;
 #endif
index 835a695..feacfc5 100644 (file)
@@ -51,33 +51,6 @@ SOFT_LINK_MAY_FAIL(PassKit, PKDrawApplePayButton, void, (CGContextRef context, C
 
 namespace WebCore {
 
-void RenderThemeCocoa::drawLineForDocumentMarker(const RenderText& renderer, GraphicsContext& context, const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
-{
-    if (context.paintingDisabled())
-        return;
-
-    auto circleColor = colorForMarkerLineStyle(style, renderer.document().useDarkAppearance());
-
-    // Center the underline and ensure we only draw entire dots.
-    FloatPoint offsetPoint = origin;
-    float widthMod = fmodf(width, cMisspellingLinePatternWidth);
-    if (cMisspellingLinePatternWidth - widthMod > cMisspellingLinePatternGapWidth) {
-        float gapIncludeWidth = 0;
-        if (width > cMisspellingLinePatternWidth)
-            gapIncludeWidth = cMisspellingLinePatternGapWidth;
-        offsetPoint.move(floor((widthMod + gapIncludeWidth) / 2), 0);
-        width -= widthMod;
-    }
-
-    CGContextRef platformContext = context.platformContext();
-    CGContextStateSaver stateSaver { platformContext };
-    CGContextSetFillColorWithColor(platformContext, circleColor);
-    for (int x = 0; x < width; x += cMisspellingLinePatternWidth)
-        CGContextAddEllipseInRect(platformContext, CGRectMake(offsetPoint.x() + x, offsetPoint.y(), cMisspellingLineThickness, cMisspellingLineThickness));
-    CGContextSetCompositeOperation(platformContext, kCGCompositeSover);
-    CGContextFillPath(platformContext);
-}
-
 #if ENABLE(APPLE_PAY)
 
 static const auto applePayButtonMinimumWidth = 140;
index 8e09dfd..d4d6ef9 100644 (file)
@@ -158,8 +158,6 @@ private:
 
     Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override;
 
-    CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
-
     String m_legacyMediaControlsScript;
     String m_mediaControlsScript;
     String m_legacyMediaControlsStyleSheet;
index 2e9180f..a6c9103 100644 (file)
@@ -1417,20 +1417,6 @@ String RenderThemeIOS::mediaControlsBase64StringForIconNameAndType(const String&
 
 #endif // ENABLE(VIDEO)
 
-CGColorRef RenderThemeIOS::colorForMarkerLineStyle(DocumentMarkerLineStyle style, bool)
-{
-    switch (style) {
-    case DocumentMarkerLineStyle::Spelling:
-        return [getUIColorClass() systemRedColor].CGColor;
-    case DocumentMarkerLineStyle::DictationAlternatives:
-    case DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives:
-    case DocumentMarkerLineStyle::AutocorrectionReplacement:
-        return [getUIColorClass() systemBlueColor].CGColor;
-    case DocumentMarkerLineStyle::Grammar:
-        return [getUIColorClass() systemGreenColor].CGColor;
-    }
-}
-
 Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
 {
     const bool forVisitedLink = options.contains(StyleColor::Options::ForVisitedLink);
index df4d951..d85761a 100644 (file)
@@ -181,8 +181,6 @@ private:
 
     Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const final;
 
-    CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
-
     ColorCache& colorCache(OptionSet<StyleColor::Options>) const final;
 
     void purgeCaches() final;
index 40a8ae0..3fbd60d 100644 (file)
@@ -2999,23 +2999,6 @@ bool RenderThemeMac::usingDarkAppearance(const RenderObject& o) const
     return o.document().useDarkAppearance();
 }
 
-CGColorRef RenderThemeMac::colorForMarkerLineStyle(DocumentMarkerLineStyle style, bool useDarkMode)
-{
-    switch (style) {
-    // Red
-    case DocumentMarkerLineStyle::Spelling:
-        return cachedCGColor(useDarkMode ? Color { 255, 140, 140, 217 } : Color { 255, 59, 48, 191 });
-    // Blue
-    case DocumentMarkerLineStyle::DictationAlternatives:
-    case DocumentMarkerLineStyle::TextCheckingDictationPhraseWithAlternatives:
-    case DocumentMarkerLineStyle::AutocorrectionReplacement:
-        return cachedCGColor(useDarkMode ? Color { 40, 145, 255, 217 } : Color { 0, 122, 255, 191 });
-    // Green
-    case DocumentMarkerLineStyle::Grammar:
-        return cachedCGColor(useDarkMode ? Color { 50, 215, 75, 217 } : Color { 25, 175, 50, 191 });
-    }
-}
-
 } // namespace WebCore
 
 #endif // PLATFORM(MAC)