Closed Bug 486778 Opened 15 years ago Closed 15 years ago

Spell checker's wavy line is sometimes drawn through misspelled words

Categories

(Core :: Layout: Text and Fonts, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: u88484, Assigned: masayuki)

References

Details

(Keywords: polish)

Attachments

(10 files, 5 obsolete files)

26.42 KB, image/png
Details
12.35 KB, image/png
Details
195 bytes, text/html
Details
589 bytes, text/html
Details
5.28 KB, image/png
Details
17.83 KB, image/png
Details
10.92 KB, image/png
Details
16.28 KB, image/png
Details
9.64 KB, patch
roc
: review+
Details | Diff | Splinter Review
7.28 KB, image/jpeg
Details
Attached image Screenshot
The new wavy line for misspelled words is sometimes drawn through the text and makes it hard to read.  Please see attached screen shot that compares shows the comment input box for the description field when filing new bugs and the input box for an attachment description.  I also see the line through the text on gmail when composing a new email.

See attached screenshots.
Attached image Screenshot 2
STR:
Type asdf or any misspelled word in both inputs.  Notice the wavy line is drawn differently.
I don't think that the screenshot is unreadable. And I hope you should specify the font-family. input elements and textarea element's fonts depend on the locale of the webpage and system locale and system font settings.

Note that we have very tight space at input element. So, if you select the text and the selection rect's bottom edge is same as the wavy line bottom edge, we cannot draw the wavy line in it if we are painting the wavy line same as OOo.
Component: Spelling checker → Layout: Text
QA Contact: spelling-checker → layout.fonts-and-text
It isn't unreadable just a little harder to read and not polished since there is a difference in drawing the wavy line with <input> and <textarea>.  Within <textarea>, the wavy line touches all text, whereas in <input> the wavy line only only touches the text with letters like yjq.

Profile: New profile with layout.spellcheckDefault set to "2" so that spell checker checks one line input fields
Firefox Font Settings:
Default (Times New Roman size 16)
 Advanced font settings:
   Fonts for: "Western"
   Proportional: "Serif" Size "16"
   Serif: "Times New Roman"
   Sans-serif: "Arial"
   Monospace: "Courier New" Size "13"
Minimum font size: "None"
"Checked" Allow pages to choose their own fonts
Character Encoding: Western (ISO-8859-1)

Screen Resolution: 1440*900
DPI: 60 DPI
Attachment #370985 - Attachment description: Reduced test case → Reduced test case, set "layout.spellcheckDefault" to 2
the wave goest through the "y" but other letters aren't touched, at least not on XP
Sorry, I meant to add a comment in the last comment.  That attached test case has an <input> with a font size of 16, 22 and 23 pixels.  16px is the default.  23 pixels is when the wavy line is first drawn underneath the text and not through the bottom portion.
We can use only descent space to draw the underline. Because input element don't have more spaces. It means we cannot draw it outside the rect of selection.

I think that we can improve only the first screenshot case. Looks like there is 1px below the wavy line. So, we can lower down the wavy line 1px.
(In reply to comment #8)
> We can use only descent space to draw the underline. Because input element
> don't have more spaces. It means we cannot draw it outside the rect of
> selection.
> 
> I think that we can improve only the first screenshot case. Looks like there is
> 1px below the wavy line. So, we can lower down the wavy line 1px.
I'm assuming the rect is what is blue when you highlight text?  The same height as the caret?  If that is the case then like you say, I don't think it could be fixed but moving the wavy line down one pixel would help a lot.

Just curious on why once the text is 23 pixels that there isn't a problem.  Wouldn't the rect be the same scale no matter the text size?

I don't think the spellchecker is used much for input fields so I don't think this is really a big deal though but the 1 pixel down would definitely look nicer.
(In reply to comment #9)
> (In reply to comment #8)
> > We can use only descent space to draw the underline. Because input element
> > don't have more spaces. It means we cannot draw it outside the rect of
> > selection.
> > 
> > I think that we can improve only the first screenshot case. Looks like there is
> > 1px below the wavy line. So, we can lower down the wavy line 1px.
> I'm assuming the rect is what is blue when you highlight text?

Yes.

> The same height as the caret?

I'm not sure what is used for deciding caret height.

> Just curious on why once the text is 23 pixels that there isn't a problem. 
> Wouldn't the rect be the same scale no matter the text size?

Currently, we honor the underline offset of font metrics. At wavy line case, my implementation lifts up the wavy line half of its height (it means the top most of the wavy line to the bottom most). I.e., the underline offset means middle of the wavy line on my implementation. Therefore, we can think that when it's 22px case and when it's 23px case, the font metrics have different underline offset.
OS -> All, since dupe was Windows 7 and I filed as Vista.  How does this look on Mac and Linux?
OS: Windows Vista → All
There is the same issue on Linux. The issue should be cross-platform as the underline is painted directly by Gecko.

By the way, I've added a comparison with Pango. I think the Pango way of drawing the wavy underline looks more readable. What about getting some inspiration from that?

The code that draws the wavy underline (called error underline in Pango naming) is in http://svn.gnome.org/viewvc/pango/trunk/pango/pango-renderer.c?revision=2814&view=markup#l897
(note that the part the computes the position of the underline, which is what matters most here, may be in another file like pango-layout.c or something).
Attached patch Patch v1.0 (obsolete) — Splinter Review
Slides down the wavy line if it's possible. I want the feedback for this patch. I'll post this patch to tryserver.
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
And I have an idea. The current selection underline is painted *over* the text, so, if we draw the selection underlines to *below* the text, it's better for the readability.
Attached patch Patch v2.0 (obsolete) — Splinter Review
This looks good for me.

This patch has previous patch and changing the painting stack.

This paints as:

Top
  - text-decoration: line-through;
  - IME selection underline
  - Text
  - Spellchecker underline
  - Selection background
  - text-decoration: underline overline;
Bottom

This changes the quirks mode's painting stack, but the result is same as standards mode. I'll post this patch to tryserver.
Attachment #371503 - Attachment is obsolete: true
You can check the behavior:

data:text/html,<!DOCTYPE html><textarea style="text-shadow: green 3px -3px; text-decoration: underline overline line-through;font-size:64px;">asdfqjpy</textarea>

and

data:text/html,<textarea style="text-shadow: green 3px -3px; text-decoration: underline overline line-through;font-size:64px;">asdfqjpy</textarea>
roc and dbaron:

I posted following comment to wrong bug, please recheck my post here.

>   -------  Comment #59 From  Masayuki Nakano (Mozilla Japan)   2009-04-08 04:36:42 PDT   (-) [reply] -------
> 
> roc or dbaron:
> 
> The reftests has testing the text-decoration stacking test in quirks mode. This
> patch makes UNEXPECTED-PASS error.
> 
>> REFTEST TEST-PASS | file:///e:/builds/moz2_slave/sendchange-win32-unittest/mozilla/layout/reftests/text-decoration/text-decoration-zorder-1-standards.html |
>> REFTEST TEST-UNEXPECTED-PASS | file:///e:/builds/moz2_slave/sendchange-win32-unittest/mozilla/layout/reftests/text-decoration/text-decoration-zorder-1-quirks.html |
>> REFTEST   IMAGE: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAPoCAYAAAAmy5qxAAAfg0lEQVR4nO3d227jOBZA0fr/n655GiCNVBxdqC2KWgvwS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bTOXG/Pc6xp9OA+6lqjQn7kvZ55HQAwr9dt39Xw96/rwazqdbHl+gDAml63zQsQ+E6AAACV123zAgS+EyAAQOV127wAge8ECABQed02L0DgOwECAFRet80LEPhOgAAAlddt8wIEvhMgAEDlddu8AIHvBAgAUHnVNv9pyLpq6DFQ8QQCBACovGab3xIfVww+BiqeQIAAABXbPHA7AQIA72GbBwAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgIwAAQAAMgIEAADICBAAACAjQAAAgMz/APfhpl7HzoZfAAAAAElFTkSuQmCC
> 
> Do you know why we are using different stacking between standards mode and
> quirks mode? I think that the stacking should not be different between both
> modes excepting the backward compatibility.
> 
> http://www.w3.org/TR/CSS21/zindex.html#painting-order
> CSS2.1 says that underline and overline should be drawn below the text.
>
We implement text-decoration completely differently in standards mode and quirks mode because what *used* to be specified in CSS2.1 was incompatible with the Web.  CSS 2.1 has now changed such that what it specifies is *probably* compatible with the Web, but we haven't had a chance to change our implementation to try it out.  See bug 403524 and many other bugs.
dbaron:

So, do you like the patch which changes the painting stacking of quirks mode to same as our standards mode?

Currently, we are painting by following stacking in quirks mode:

- <selection underlines>
- text-decoration: line-through;
- text-decoration: underline;
- text-decoration: overline;
- <text>
- <selection background color>
- <background>

but the patch changes to:

- text-decoration: line-through;
- <IME selection underlines>
- <text>
- <spellchecker underline>
- text-decoration: underline;
- text-decoration: overline;
- <selection background>
- <background>

So, spellchecker underline and text-decoration: underline overline; are moved to below the text. By this change, the spellchecker underline should not cause the unreadability. But it should be over the decoration lines of CSS for readability of the spellchecker underline. This stacking is same as CSS2.1's.
Attached patch Patch v2.1 (obsolete) — Splinter Review
I think that we should use same painting stacking between both modes and it should be same as CSS2.1 recommended.

This patch should improves the readability of the words which is misspelled words. The descent glyph is drawn over the spellchecker underlines which is drawn over the text-decoration's underline. And also, IME selection underlines should be kept to drawn *over* the text, because the decoration lines are important and should not be hidden by the *inputting* characters.

The patched builds are here:
https://build.mozilla.org/tryserver-builds/2009-04-12_19:21-masayuki@d-toybox.com-spellchecker-underline-z-order-2/
Attachment #371625 - Attachment is obsolete: true
Attachment #372366 - Flags: superreview?(dbaron)
Attachment #372366 - Flags: review?(roc)
Oops, I forgot to comment the changes in nsCSSRendering.cpp.

Our current implementation is lifting up half height of the decoration rect the selection underline if it is wavy line. Because I was thinking that it suppresses that we paint wavy line at too far position from baseline with some fonts. However, it helps to create this bug, therefore, I just removes the special code.
Looks a lot better!
Kurt:

Thank you for your testing. And I want to know your impressions of descent space using characters, e.g., 'y', 'g' and 'j'. They are painted *under* the spellchecker underline on current trunk. However, the patch paints them *over* the spellchecker underline. Do you feel better the new behavior?
I think that's an improvement. IMHO it would be even more readable if the underline didn't touch the baseline. For instance if there was always at least one pixel gap between the baseline and the top of the wavy line.
Yeah, if the font has enough descent space, the wavy line doesn't touch to baseline. But if not so (it's most cases), we need to lift up the wavy line for input element. We need to paint the selection line in smaller space than Office applications, unfortunately.
I think drawing the line over looks better.  With patch 2.1 it kind of looks like random pixels and with the trunk you can barely make out that it is all one wavy line.  Just my two cents.
Attachment #372366 - Flags: superreview?(dbaron)
Attachment #372366 - Flags: review?(roc)
Comment on attachment 372366 [details] [diff] [review]
Patch v2.1

Kurt:

OK, your opinion may be true for some other people. I'm restart to think the better way.
Attachment #370985 - Attachment is obsolete: true
Attached patch Patch v3.0 (obsolete) — Splinter Review
ok, this removes the changing of decoration line z-order. I think the way may be good way, but I'm not sure whether that is safe.

This patch gets down the underline if it's possible. This patch uses line-height value if that is larger than 1 or normal. If we can know that there is line gap below the descent space, this patch also uses there.
# But this patch doesn't check vertical-align value, but it can be problem on HTML editor in rare cases, probably. The lift up code is needed for input element, so, we should not have the tight space problem on HTML editor.

And this patch removes some special code from nsCSSRendering::GetTextDecorationRectInternal. Now, this patch makes simpler.
Attachment #372366 - Attachment is obsolete: true
(In reply to comment #34)
> new test builds:
> https://build.mozilla.org/tryserver-builds/2009-04-17_02:27-masayuki@d-toybox.com-attachment373285 [review]/
(In reply to comment #33)
> Created an attachment (id=373285) [details]
> Patch v3.0
> ok, this removes the changing of decoration line z-order. I think the way may
> be good way, but I'm not sure whether that is safe.
> This patch gets down the underline if it's possible. This patch uses
> line-height value if that is larger than 1 or normal. If we can know that there
> is line gap below the descent space, this patch also uses there.
> # But this patch doesn't check vertical-align value, but it can be problem on
> HTML editor in rare cases, probably. The lift up code is needed for input
> element, so, we should not have the tight space problem on HTML editor.
> And this patch removes some special code from
> nsCSSRendering::GetTextDecorationRectInternal. Now, this patch makes simpler.

I haven't test the latest tryserver build yet but will tonight but what exactly should I test for?  I don't understand the above comment
The latest patch just gets down the wavy line as far as possible. Current trunk build and Patch v2.0 and former only uses maxDescent space of the font, however, v3.0 also uses the gap between lines. This helps to render CJK fonts which don't have enough internal/external leading. I have written some special code for wavy line positioning for such CJK fonts. But this patch can remove them by using line-gap spaces.

I hope that some people use the test build on some sites. And please feed back the readability of the new patch.

If this patch cannot improve the readability, I don't have more ideas excepting the underline z-order changing.
What's the status on this bug?  I haven't had any issues anywhere and it looks a lot better then what it does on the trunk, although not perfect but it appears there is nothing more you can do to fix this.
I'm still waiting the feedbacks of the latest patch :-p
Do the tryserver builds disappear after a certain amount of time?  If so, I never got to test a build with patch 3.0.
Yes, currently, the builds are removed 14days later. I'll recreate the builds ASAP.
Attached patch Patch v3.1Splinter Review
Updated for latest trunk. The test builds are here:
https://build.mozilla.org/tryserver-builds/masayuki@d-toybox.com-better-spellchecker-underline/
Attachment #373285 - Attachment is obsolete: true
That is weird, after mistyping a few words and then pressing enter, the underlines seem to disappear, at least on this Bugzilla text field.
(In reply to comment #42)
> That is weird, after mistyping a few words and then pressing enter, the
> underlines seem to disappear, at least on this Bugzilla text field.

Is that a regression of my patch??
I assumed so. I could repeat it with default settings and in safe-mode, but not anymore now. Weird.
I tested 5 different forum text fields with default font settings and three of them were slightly better than before (one pixel lower) and the other two were not changed. So I think the overall result is better than before.
I have not seen the issue of comment 43 anymore; no idea why that happened.
(In reply to comment #42)
> That is weird, after mistyping a few words and then pressing enter, the
> underlines seem to disappear, at least on this Bugzilla text field.

This is what I did: first I ran the tryserver build with my default profile and there I saw this bug. To verify that it was not caused by an extension I copied the profile to my desktop and deleted prefs.js and the folder extensions. And weird, it happened again. The only remarkable thing in my set-up is a very large, nearly maximum size persdict.dat file (193 kB).
But I can't reproduce it anymore.
Patch 3.1 looks great and I haven't seen any regressions.  Great job!
Attachment #383714 - Flags: superreview?(roc)
Attachment #383714 - Flags: review?(roc)
Comment on attachment 383714 [details] [diff] [review]
Patch v3.1

ok, let's go to the review process.

This patch removes the special lifting up code for wavy line.

But this patch lifts up the wavy line when it overflows below the descent space. Then, the wavy line is lifted up to the bottom of its baseline even if the wavy line cannot be in the descent space.
+  return aFontMetrics.maxDescent + (lineHeight - aFontMetrics.maxHeight) / 2;

Why / 2?

Isn't this assuming that the text is going to be baseline-aligned? What about other values of 'vertical-align'?
(In reply to comment #50)
> +  return aFontMetrics.maxDescent + (lineHeight - aFontMetrics.maxHeight) / 2;
> 
> Why / 2?

The leading should be used at the upper of the line and the bottom. I.e., |(lineHeight - aFontMetrics.maxHeight) / 2| means the half leading.

> Isn't this assuming that the text is going to be baseline-aligned? What about
> other values of 'vertical-align'?

No, I don't assume that the other vertical-align values. I think that the checking of the limitation of the descent space is needed only when the textframe is in input element or textarea element. In other cases, i.e., when the textframe is in HTML editor and the textframe is in complex inline layout, there should be enough non-clipped space in most cases. Therefore, ComputeDescentLimitForSelectionUnderline returns non-problem values but they can be incorrect, maybe. How do you think?
Comment on attachment 383714 [details] [diff] [review]
Patch v3.1

I think you're right.
Attachment #383714 - Flags: superreview?(roc)
Attachment #383714 - Flags: superreview+
Attachment #383714 - Flags: review?(roc)
Attachment #383714 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/e3ec5794180b
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
(how) can we nominate this for 3.5.1?
(In reply to comment #54)
> (how) can we nominate this for 3.5.1?
Like so for now but I really, really doubt it will be checked in there.
Flags: wanted1.9.1.x?
bug 338209 is not fixed on gecko 1.9.1, so the patch isn't needed on 1.9.1 branch.
(In reply to comment #56)
> bug 338209 is not fixed on gecko 1.9.1, so the patch isn't needed on 1.9.1
> branch.

i forgot to look that bug. :)
Flags: wanted1.9.1.x?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: