haikuwebkit/LayoutTests/fast/text-indicator/text-indicator-with-low-con...

41 lines
917 B
Plaintext
Raw Permalink Normal View History

Daring Fireball long press highlights are unnecessarily inflated due to false illegibility https://bugs.webkit.org/show_bug.cgi?id=200064 Reviewed by Geoff Garen. Source/WebCore: If we consider text illegible on the given estimated background color, we bail from doing a tightly fitted selection-only TextIndicator and instead just paint the page without modification into the indicator, causing ugly overlap and an excessively inflated indicator. Change the mechanism we use to determine illegibility to be based on a standard, instead of a constant chosen by hand 13 years ago. Test: fast/text-indicator/text-indicator-with-low-contrast-text.html * platform/graphics/ColorUtilities.cpp: (WebCore::luminance): Fix a typo. (WebCore::contrastRatio): Add a function that computes the contrast ratio given two colors using the formula from WCAG. * platform/graphics/ColorUtilities.h: * rendering/TextPaintStyle.cpp: (WebCore::textColorIsLegibleAgainstBackgroundColor): Make use of WCAG's minimum legible contrast ratio instead of an arbitrary color difference cutoff for determining whether we consider text legible. It seems sensible and also considers the text on DF readable (which it seems to be to me!). * testing/Internals.cpp: (WebCore::Internals::TextIndicatorInfo::TextIndicatorInfo): * testing/Internals.h: * testing/Internals.idl: Expose all of the text rects to Internals, not just the bounding rect. Expose some more TextIndicator options to Internals so that we can turn on the legibility mechanism. LayoutTests: * fast/text-indicator/text-indicator-with-low-contrast-text-expected.txt: Added. * fast/text-indicator/text-indicator-with-low-contrast-text.html: Added. Canonical link: https://commits.webkit.org/213922@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247792 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-07-24 22:36:13 +00:00
whiteTextWhiteBackground: NOT legible
0 0 68 66
whiteTextGrayBackground: NOT legible
0 0 68 66
whiteTextBlackBackground: legible
0 0 68 18
0 48 36 18
grayTextWhiteBackground: NOT legible
0 0 68 66
grayTextGrayBackground: NOT legible
0 0 68 66
grayTextBlackBackground: legible
0 0 68 18
0 48 36 18
lightGrayTextWhiteBackground: NOT legible
0 0 68 66
lightGrayTextGrayBackground: NOT legible
0 0 68 66
lightGrayTextBlackBackground: legible
0 0 68 18
0 48 36 18
darkGrayTextWhiteBackground: legible
0 0 68 18
0 48 36 18
darkGrayTextGrayBackground: NOT legible
0 0 68 66
darkGrayTextBlackBackground: NOT legible
0 0 68 66
blackTextWhiteBackground: legible
0 0 68 18
0 48 36 18
blackTextGrayBackground: legible
0 0 68 18
0 48 36 18
blackTextBlackBackground: NOT legible
0 0 68 66
dfTextDfBackground: legible
0 0 68 18
0 48 36 18