This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FreeType] Simple and complex paths are not applied consistently
https://bugs.webkit.org/show_bug.cgi?id=177601 Reviewed by Michael Catanzaro. Due to bug #100050, when rendering text, the complex path is forced in case kerning or shaping is enabled and only part of the run is going to be rendered. This happens in the GTK+ port when selecting text (except when selecting the whole run, of course). The text is initially rendered using the simple path as returned by FontCascade::codePath() and then the selection is rendered using the complex path, overriding what FontCascade::codePath() returned in that case. This doesn't happen in mac, because the selection is rendered differently, so FontCascade::drawText always renders the full run (simple path) when selecting text. Selecting text is the most noticeable inconsistency, but it's not the only one. Similar exceptions are applied when calculating the text width, or getting the offset of a given position. The rendered text is the simple one, but the calculations are performed using the complex path, so depending on the kerning and ligatures we might end up with wrong results. If the text has been rendered using the simple path, the selections and all other calculations should be performed with the simple path too. This patch moves the condition to force complex text to FontCascade::codePath(), and only for non Freetype ports. This ensures that all callers to FontCascade::codePath() will get a consistent result. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawText const): Use the mode returned by codePath(). (WebCore::FontCascade::drawEmphasisMarks const): Ditto. (WebCore::FontCascade::adjustSelectionRectForText const): Use the mode returned by codePath(). (WebCore::FontCascade::offsetForPosition const): Ditto. (WebCore::FontCascade::codePath const): Force complex text for partial runs for ports not enabling advance text rendering mode by default. * platform/graphics/FontCascade.h: Add to and from optional parameters to codePath(). Canonical link: https://commits.webkit.org/195180@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224223 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing 3 changed files with 45 additions and 25 deletions.