RESOLVED FIXED Bug 187632
Dark Mode: document markers are difficult to see
https://bugs.webkit.org/show_bug.cgi?id=187632
Summary Dark Mode: document markers are difficult to see
Antoine Quint
Reported 2018-07-12 20:24:07 PDT
The contrast of the document markers, especially for auto-corrected words (blue), is quite bad. We should update these colours in this mode.
Attachments
Patch (27.50 KB, patch)
2018-07-12 20:34 PDT, Antoine Quint
no flags
Patch (27.37 KB, patch)
2018-07-13 12:59 PDT, Antoine Quint
simon.fraser: review+
Antoine Quint
Comment 1 2018-07-12 20:24:24 PDT
Antoine Quint
Comment 2 2018-07-12 20:34:05 PDT
Tim Horton
Comment 3 2018-07-12 21:42:07 PDT
Comment on attachment 344922 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344922&action=review > Source/WebCore/platform/graphics/GraphicsContext.h:112 > +enum class DocumentMarkerLineStyle { : uint8_t, didn’t you see Simon’s slides :) These aren’t stored much, but they are recorded in display lists!! > Source/WebCore/rendering/RenderThemeMac.mm:2784 > +static RetainPtr<CGColorRef> colorWithComponents(int r, int g, int b, int a) > +{ > + CGFloat components[4] = { CGFloat(r / 255.0), CGFloat(g / 255.0), CGFloat(b / 255.0), CGFloat(a / 100.0) }; > + return adoptCF(CGColorCreate(sRGBColorSpaceRef(), components)); > +} This is pretty goofy because A) it doesn’t use our platform color cache, and B) you’ve invented your own color format where alpha is 0-100. > Source/WebCore/rendering/RenderThemeMac.mm:2810 > + auto dotSize = CGSizeMake(patternHeight, patternHeight); What’s the point of dotSize? This is a weirdly roundabout way to propagate patternHeight to the two places it goes below :) > Source/WebCore/rendering/RenderThemeMac.mm:2828 > + for (int numberOfDots = 0; numberOfDots * patternWidth < width; ++numberOfDots) > + CGContextAddEllipseInRect(ctx, CGRectMake(offsetPoint.x() + numberOfDots * patternWidth, offsetPoint.y(), dotSize.width, dotSize.height)); I think I would make the iterator be the x position instead of numberOfDots and increment by the patternWidth and then this would be less repeaty, but it doesn’t really matter.
Antoine Quint
Comment 4 2018-07-13 09:34:11 PDT
(In reply to Tim Horton from comment #3) > Comment on attachment 344922 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=344922&action=review > > > Source/WebCore/platform/graphics/GraphicsContext.h:112 > > +enum class DocumentMarkerLineStyle { > > : uint8_t, didn’t you see Simon’s slides :) I don't know, did I? > These aren’t stored much, but they are recorded in display lists!! Changing the enum to uint8_t. > > Source/WebCore/rendering/RenderThemeMac.mm:2784 > > +static RetainPtr<CGColorRef> colorWithComponents(int r, int g, int b, int a) > > +{ > > + CGFloat components[4] = { CGFloat(r / 255.0), CGFloat(g / 255.0), CGFloat(b / 255.0), CGFloat(a / 100.0) }; > > + return adoptCF(CGColorCreate(sRGBColorSpaceRef(), components)); > > +} > > This is pretty goofy because A) it doesn’t use our platform color cache, and > B) you’ve invented your own color format where alpha is 0-100. What I think is goofy is to use a 0-255 range for alpha, but it's OK, I'll use makeRBA() and Color(). > > Source/WebCore/rendering/RenderThemeMac.mm:2810 > > + auto dotSize = CGSizeMake(patternHeight, patternHeight); > > What’s the point of dotSize? This is a weirdly roundabout way to propagate > patternHeight to the two places it goes below :) I'll remove it. > > Source/WebCore/rendering/RenderThemeMac.mm:2828 > > + for (int numberOfDots = 0; numberOfDots * patternWidth < width; ++numberOfDots) > > + CGContextAddEllipseInRect(ctx, CGRectMake(offsetPoint.x() + numberOfDots * patternWidth, offsetPoint.y(), dotSize.width, dotSize.height)); > > I think I would make the iterator be the x position instead of numberOfDots > and increment by the patternWidth and then this would be less repeaty, but > it doesn’t really matter. I will take this suggestion!
Antoine Quint
Comment 5 2018-07-13 12:59:12 PDT
Simon Fraser (smfr)
Comment 6 2018-07-13 13:06:30 PDT
Comment on attachment 344968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344968&action=review > Source/WebCore/rendering/RenderTheme.h:256 > + virtual void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint&, float, DocumentMarkerLineStyle); Please give names to the parameters whose roles are not obvious. > Source/WebCore/rendering/RenderThemeMac.h:171 > + void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint&, float, DocumentMarkerLineStyle) final; Likewise. > Source/WebCore/rendering/RenderThemeMac.mm:2803 > + auto patternWidth = cMisspellingLinePatternWidth; Why not just use cMisspellingLinePatternWidth below? > Source/WebCore/rendering/RenderThemeMac.mm:2804 > + auto patternHeight = cMisspellingLineThickness; Ditto. > Source/WebCore/rendering/RenderThemeMac.mm:2807 > + // Make sure to draw only complete dots allowing slightly more considering that the pattern ends with a transparent pixel. Not sure this comment still makes sense.
Antoine Quint
Comment 7 2018-07-13 13:34:32 PDT
Daniel Bates
Comment 8 2018-07-13 14:23:13 PDT
Comment on attachment 344968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344968&action=review > Source/WebCore/ChangeLog:16 > + No new test due to webkit.org/b/105616, webkit.org/b/187655 was raised to track the creation of new tests webkit.org/b/105616 is about spell checking not working in WebKit2. Spell checkers work in WebKitLegacy. We have existing tests for spelling dots that run without issue in DumpRenderTree. One such example is <https://trac.webkit.org/browser/trunk/LayoutTests/editing/spelling/spelling-marker-includes-hyphen.html?rev=223013>. Clearly with such support we can write a pixel test though it would be better to write tests using some other strategy as we do not run pixel tests on the bots. It may be non-trivial to write a ref test for this :/
Simon Fraser (smfr)
Comment 9 2018-07-13 14:39:41 PDT
A ref test should be easy. Just scale up 20x with a transform, and clip to show the interior of a couple of dots.
Antoine Quint
Comment 10 2018-07-16 09:10:27 PDT
(In reply to Simon Fraser (smfr) from comment #9) > A ref test should be easy. Just scale up 20x with a transform, and clip to > show the interior of a couple of dots. The problem has been getting the dots to draw _at all_ in DRT/WKTR.
Simon Fraser (smfr)
Comment 11 2018-07-16 10:31:48 PDT
Just add testing SPI to explicitly mark a range as having spelling dots.
Note You need to log in before you can comment on or make changes to this bug.