Bug 115406 - [GTK] Use drawErrorUnderline() instead of Pango API for highlighting misspelled words
Summary: [GTK] Use drawErrorUnderline() instead of Pango API for highlighting misspell...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-30 01:26 PDT by Eduardo Lima Mitev
Modified: 2013-06-03 13:52 PDT (History)
3 users (show)

See Also:


Attachments
patch (3.35 KB, patch)
2013-04-30 01:43 PDT, Eduardo Lima Mitev
no flags Details | Formatted Diff | Diff
updated patch including new baseline PNGs (134.04 KB, patch)
2013-06-03 02:53 PDT, Eduardo Lima Mitev
no flags Details | Formatted Diff | Diff
last patch removing the cairo_new_path(), which was not required (133.75 KB, patch)
2013-06-03 09:38 PDT, Eduardo Lima Mitev
no flags Details | Formatted Diff | Diff
last patch with changelog corrected (133.72 KB, patch)
2013-06-03 09:42 PDT, Eduardo Lima Mitev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Lima Mitev 2013-04-30 01:26:54 PDT
GraphicsContextCairo currently uses Pango only to draw the underline error hint on misspelled words when platform is GTK. However, the drawErrorUnderline() method that is used by the Win platform, uses Cairo directly and works well for GTK.

This bug is about using drawErrorUnderline() instead of pango's API and completely remove Pango from GraphicsContextCairo.
Comment 1 Eduardo Lima Mitev 2013-04-30 01:43:39 PDT
Created attachment 200091 [details]
patch
Comment 2 Eduardo Lima Mitev 2013-04-30 01:44:11 PDT
Adding mrobinson to CC
Comment 3 Martin Robinson 2013-04-30 08:54:24 PDT
Does this change any test output?
Comment 4 Eduardo Lima Mitev 2013-04-30 09:33:14 PDT
All spelling related tests render similar outputs with and without this patch:

Tools/Scripts/run-webkit-tests --gtk LayoutTests/editing/spelling/*
Comment 5 Eduardo Lima Mitev 2013-04-30 09:34:03 PDT
I meant identical, not similar :)
Comment 6 Martin Robinson 2013-04-30 09:35:17 PDT
(In reply to comment #5)
> I meant identical, not similar :)

You'll need to run with -p.
Comment 7 Eduardo Lima Mitev 2013-06-03 02:53:14 PDT
Created attachment 203567 [details]
updated patch including new baseline PNGs

This patch adds 3 new baseline PNG images for spell checking tests that were not passing pixel hash comparison.

It also wraps drawErrorUnderline() logic with new filled cairo path.
Comment 8 Martin Robinson 2013-06-03 04:21:25 PDT
(In reply to comment #7)

> It also wraps drawErrorUnderline() logic with new filled cairo path.

Was there a test failing because a path was remaining on the context?
Comment 9 Eduardo Lima Mitev 2013-06-03 04:46:44 PDT
(In reply to comment #8)
> 
> Was there a test failing because a path was remaining on the context?

Without the calls to new_path() and fill(), the drawings are never committed so the underline is never visible. Implementation of drawErrorUnderline() expected the path to be opened and closed outside, but I don't think the Win port was doing that, as far as I could research.

pango_cairo_show_error_underline() calls new_path() and fill() at the beginning and ending (respectively) of the draw_error_underline() method <https://git.gnome.org/browse/pango/tree/pango/pangocairo-render.c#n614>, conditionally. After the replacement by the custom drawErrorUnderline(), I had to make these calls explicit. First I though adding them in GraphicsContext::drawLineForDocumentMarker(), but I then decided to put them in drawErrorUnderline() itself for better encapsulation, and also because I think the Win port needs that as well.
Comment 10 Martin Robinson 2013-06-03 04:54:50 PDT
If it's required, it seems that some other code (whatever used GraphicsContext before this call) is leaving a stale path on the context. It might be better to ensure that the other code doesn't leave the path hanging around, rather than having to manually clear the path in every method called afterward. I'm worried about this bug causing us to add cairo_new_path to a lot of places over time when the real fix is to prevent the situation.
Comment 11 Eduardo Lima Mitev 2013-06-03 09:38:13 PDT
Created attachment 203603 [details]
last patch removing the cairo_new_path(), which was not required

After discussing a bit with mrobinson, I learned that it should not be required to cairo_new_path() at the beginning of drawErrorUnderline(). These routines should assume and respect a clean path.

This new patch just removes the call to cairo_new_path() in drawErrorUnderline(), and just add the cairo_fill() at the end.

Tests are passing and all looks ok to me.
Comment 12 Eduardo Lima Mitev 2013-06-03 09:42:04 PDT
Created attachment 203606 [details]
last patch with changelog corrected

Last patch had an error in a ChangeLog, please ignore.

Sorry for the noise.
Comment 13 Martin Robinson 2013-06-03 13:30:37 PDT
Comment on attachment 203606 [details]
last patch with changelog corrected

Great!
Comment 14 WebKit Commit Bot 2013-06-03 13:52:29 PDT
Comment on attachment 203606 [details]
last patch with changelog corrected

Clearing flags on attachment: 203606

Committed r151125: <http://trac.webkit.org/changeset/151125>
Comment 15 WebKit Commit Bot 2013-06-03 13:52:32 PDT
All reviewed patches have been landed.  Closing bug.