Title: [237765] trunk/Source/WebCore
Revision
237765
Author
mmaxfi...@apple.com
Date
2018-11-02 19:36:28 -0700 (Fri, 02 Nov 2018)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237764 => 237765)


--- trunk/Source/WebCore/ChangeLog	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/ChangeLog	2018-11-03 02:36:28 UTC (rev 237765)
@@ -1,3 +1,84 @@
+2018-11-02  Myles C. Maxfield  <mmaxfi...@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  <aj...@chromium.org>
 
         requestAnimationFrame causes bad location of position:fixed inside overflow:auto and iframe

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -73,10 +73,6 @@
 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 @@
     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 @@
     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();

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -79,7 +79,7 @@
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -1049,21 +1049,21 @@
     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);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -145,7 +145,7 @@
 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&);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -337,18 +337,18 @@
     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)

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -303,9 +303,9 @@
     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)

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -80,7 +80,7 @@
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2018-11-03 02:36:28 UTC (rev 237765)
@@ -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_FRAMEWORK(UIKit)
 SOFT_LINK(UIKit, _UIKitGetTextEffectsCatalog, CUICatalog *, (void), ())
+SOFT_LINK_CLASS(UIKit, UIColor)
 #endif
 
 #ifdef __LP64__

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2018-11-03 02:36:28 UTC (rev 237765)
@@ -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 @@
     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

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -99,8 +99,8 @@
         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 @@
     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 @@
     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 @@
     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);

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -77,7 +77,7 @@
     DrawRect,
     DrawLine,
     DrawLinesForText,
-    DrawLineForDocumentMarker,
+    DrawDotsForDocumentMarker,
     DrawEllipse,
     DrawPath,
     DrawFocusRingPath,
@@ -828,21 +828,19 @@
     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 @@
 
     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(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)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -236,9 +236,9 @@
     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);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -98,7 +98,7 @@
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -652,23 +652,23 @@
     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)

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -73,7 +73,7 @@
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -185,19 +185,19 @@
     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,14 +206,14 @@
     // 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);
@@ -220,9 +220,9 @@
     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.

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (237764 => 237765)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -319,7 +319,7 @@
 {
 }
 
-void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
+void GraphicsContext::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (237764 => 237765)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -698,24 +698,25 @@
         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 @@
     // 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 @@
         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

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2018-11-03 02:36:28 UTC (rev 237765)
@@ -1474,8 +1474,4 @@
 
 #endif
 
-void RenderTheme::drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint&, float, DocumentMarkerLineStyle)
-{
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -261,8 +261,6 @@
     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:

Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.h (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeCocoa.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -36,15 +36,12 @@
 
 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;
-
 #if ENABLE(VIDEO)
     String mediaControlsFormattedStringForDuration(double) override;
 #endif

Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.mm (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeCocoa.mm	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.mm	2018-11-03 02:36:28 UTC (rev 237765)
@@ -51,33 +51,6 @@
 
 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;

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -158,8 +158,6 @@
 
     Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override;
 
-    CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
-
     String m_legacyMediaControlsScript;
     String m_mediaControlsScript;
     String m_legacyMediaControlsStyleSheet;

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2018-11-03 02:36:28 UTC (rev 237765)
@@ -1417,20 +1417,6 @@
 
 #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);

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2018-11-03 02:36:28 UTC (rev 237765)
@@ -181,8 +181,6 @@
 
     Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const final;
 
-    CGColorRef colorForMarkerLineStyle(DocumentMarkerLineStyle, bool useDarkMode) override;
-
     ColorCache& colorCache(OptionSet<StyleColor::Options>) const final;
 
     void purgeCaches() final;

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (237764 => 237765)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-11-03 01:52:35 UTC (rev 237764)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-11-03 02:36:28 UTC (rev 237765)
@@ -2999,23 +2999,6 @@
     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)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to