Bug 148220

Summary: [Harfbuzz] Fix incorrect font rendering when selecting texts in pages which specifies text-rendering: optimizeLegibility
Product: WebKit Reporter: Joonghun Park <jh718.park>
Component: WebCore Misc.Assignee: Joonghun Park <jh718.park>
Status: RESOLVED FIXED    
Severity: Normal CC: bouanto, bugs-noreply, cgarcia, commit-queue, guillaume.webkit, gyuyoung.kim, mcatanzaro, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
mmaxfield: review-
Screenshot of the problem
none
Patch mcatanzaro: review+

Joonghun Park
Reported 2015-08-20 06:38:08 PDT
Fix incorrect font rendering when selecting texts in pages which specifies text-rendering: optimizeLegibility CSS property and corresponding value. For example, this issue can be reproducible in https://www.wordpress.com by selecting texts in there in which it specifies the css style mentioned.
Attachments
Patch (2.79 KB, patch)
2015-08-20 06:43 PDT, Joonghun Park
no flags
Patch (2.80 KB, patch)
2015-08-20 06:46 PDT, Joonghun Park
mmaxfield: review-
Screenshot of the problem (21.53 KB, image/png)
2017-02-17 06:41 PST, Guilaume Ayoub
no flags
Patch (8.58 KB, patch)
2017-09-14 03:48 PDT, Carlos Garcia Campos
mcatanzaro: review+
Joonghun Park
Comment 1 2015-08-20 06:43:01 PDT
Joonghun Park
Comment 2 2015-08-20 06:46:14 PDT
Gyuyoung Kim
Comment 3 2016-04-12 00:15:06 PDT
Comment on attachment 259466 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259466&action=review Please upload a test as well. > Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:69 > + glyphBuffer.reverse(0, glyphBuffer.size()); Why can't we do this behavior in previous condition ? if (run.rtl()) { float finalRoundingWidth = it.m_finalRoundingWidth; it.advance(run.length(), &localGlyphBuffer); initialAdvance = finalRoundingWidth + it.m_runWidthSoFar - afterWidth; glyphBuffer.reverse(0, glyphBuffer.size()); } else
Guilaume Ayoub
Comment 4 2016-05-09 08:18:18 PDT
I have this bug and find it very annoying too (and thank you for trying to solve it!), but unfortunately I'm not fully satisfied with this patch. It's removing kerning and ligatures everywhere, even with optimizeLegibility set and even when no text is selected. This makes optimizeLegibility almost useless and breaks pages when kerning is needed (for Arabic I suppose, but also for websites based on Material Design Lite as they need kerning for icons, see https://getmdl.io/components/index.html#buttons-section).
Michael Catanzaro
Comment 5 2017-02-17 06:30:09 PST
What is the incorrect rendering...?
Guilaume Ayoub
Comment 6 2017-02-17 06:40:42 PST
(In reply to comment #5) > What is the incorrect rendering...? When you select some text in a paragraph, the text of that's not selected in the paragraph gets the color of the selected text.
Guilaume Ayoub
Comment 7 2017-02-17 06:41:15 PST
Created attachment 301922 [details] Screenshot of the problem
Michael Catanzaro
Comment 8 2017-02-17 08:01:32 PST
Ah yeah, this has been annoying me for a long time.
Michael Catanzaro
Comment 9 2017-02-18 08:11:42 PST
Hey Myles, could you review this patch please? We know it's not correct, but I'm curious to hear your comments on it. See comment #6 and comment #7 for description of the problem and screenshot.
Myles C. Maxfield
Comment 10 2017-02-27 14:03:18 PST
Comment on attachment 259466 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259466&action=review > Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:48 > + WidthIterator it(this, run, 0, false, forTextEmphasis); WidthIterator only is used for the simple text codepath. It doesn't work with complex text (which is what this function is supposed to be for).
Michael Catanzaro
Comment 11 2017-06-24 05:32:46 PDT
*** Bug 173809 has been marked as a duplicate of this bug. ***
Carlos Garcia Campos
Comment 12 2017-09-14 03:48:09 PDT
Michael Catanzaro
Comment 13 2017-09-14 08:20:08 PDT
Comment on attachment 320756 [details] Patch Myles, do you want to review this? Thanks Carlos. If you don't get a review from Myles soon, then ping me for the r+.
Michael Catanzaro
Comment 14 2017-09-15 06:38:48 PDT
Comment on attachment 320756 [details] Patch I changed my mind, let's land this now. Myles can let us know if he sees something broken. :)
Carlos Garcia Campos
Comment 15 2017-09-15 06:42:43 PDT
Radar WebKit Bug Importer
Comment 16 2017-09-27 12:52:38 PDT
Note You need to log in before you can comment on or make changes to this bug.