RESOLVED FIXED 122716
Broken text rendering when input field has selection.
https://bugs.webkit.org/show_bug.cgi?id=122716
Summary Broken text rendering when input field has selection.
peavo
Reported 2013-10-12 23:46:09 PDT
In the last builds, I see broken text rendering in some places. It seems the text color is wrong.
Attachments
Patch (4.18 KB, patch)
2013-10-12 23:52 PDT, peavo
no flags
Image showing broken text rendering on WinCairo (31.06 KB, image/png)
2013-10-13 07:18 PDT, peavo
no flags
Testcase for broken text rendering (794 bytes, text/html)
2013-10-13 09:39 PDT, peavo
no flags
Patch (2.65 KB, patch)
2013-10-14 01:40 PDT, peavo
no flags
Patch (3.69 KB, patch)
2013-10-14 02:31 PDT, peavo
no flags
peavo
Comment 1 2013-10-12 23:52:32 PDT
Antti Koivisto
Comment 2 2013-10-13 02:04:25 PDT
Comment on attachment 214086 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214086&action=review This needs a test case. It should be easy to make one as a ref test. See tests with -expected.html under LayoutTests/fast/text/ for example. r- because lack of test case or even information how to reproduce the bug. > Source/WebCore/ChangeLog:3 > + Broken text rendering in some cases. What cases? The bug description doesn't say either. > Source/WebCore/rendering/InlineTextBox.cpp:551 > - TextPaintStyle selectionPaintStyle = computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow); > - > + TextPaintStyle selectionPaintStyle = computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, haveSelection, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow); Instead of adding an extra boolean parameter it would be better to just not call computeTextSelectionPaintStyle if haveSelection is false.
peavo
Comment 3 2013-10-13 06:04:33 PDT
(In reply to comment #2) > (From update of attachment 214086 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=214086&action=review > > This needs a test case. It should be easy to make one as a ref test. See tests with -expected.html under LayoutTests/fast/text/ for example. > > r- because lack of test case or even information how to reproduce the bug. > > > Source/WebCore/ChangeLog:3 > > + Broken text rendering in some cases. > > What cases? The bug description doesn't say either. > Sorry for the short description :) I added an url where it can be reproduced, at least when running WinCairo. > > Source/WebCore/rendering/InlineTextBox.cpp:551 > > - TextPaintStyle selectionPaintStyle = computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow); > > - > > + TextPaintStyle selectionPaintStyle = computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, haveSelection, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow); > > Instead of adding an extra boolean parameter it would be better to just not call computeTextSelectionPaintStyle if haveSelection is false. OK, but isn't there some initialization at the beginning of computeTextSelectionPaintStyle that needs to be done even if haveSelection is false?
Antti Koivisto
Comment 4 2013-10-13 06:54:20 PDT
(In reply to comment #3) > OK, but isn't there some initialization at the beginning of computeTextSelectionPaintStyle that needs to be done even if haveSelection is false? Maybe though it seems wrong that we actually use any of this stuff when haveSelection is false.
Antti Koivisto
Comment 5 2013-10-13 06:59:28 PDT
I don't see anything obviously wrong with the page on mac. Can you include a screenshot? It is possible that this is just exposing a WinCairo bug.
peavo
Comment 6 2013-10-13 07:13:35 PDT
(In reply to comment #5) > I don't see anything obviously wrong with the page on mac. Can you include a screenshot? > Yes, will do. I also see it when searching for changesets: e.g: http://trac.webkit.org/search?q=157000 > It is possible that this is just exposing a WinCairo bug. That could very well be. I also noticed that there used to be a check for haveSelection.
peavo
Comment 7 2013-10-13 07:18:03 PDT
Created attachment 214100 [details] Image showing broken text rendering on WinCairo
Antti Koivisto
Comment 8 2013-10-13 07:21:58 PDT
Mac rendering of that page looks fine.
peavo
Comment 9 2013-10-13 07:39:31 PDT
(In reply to comment #8) > Mac rendering of that page looks fine. Ok, will have a look at platform code :)
Antti Koivisto
Comment 10 2013-10-13 08:38:42 PDT
Does this fix it? --- Source/WebCore/rendering/InlineTextBox.cpp (revision 157368) +++ Source/WebCore/rendering/InlineTextBox.cpp (working copy) @@ -610,7 +610,7 @@ int sPos = 0; int ePos = 0; - if (paintSelectedTextOnly || paintSelectedTextSeparately) + if (haveSelection && (paintSelectedTextOnly || paintSelectedTextSeparately)) selectionStartEnd(sPos, ePos); if (m_truncation != cNoTruncation) {
peavo
Comment 11 2013-10-13 09:01:01 PDT
(In reply to comment #10) > Does this fix it? > > --- Source/WebCore/rendering/InlineTextBox.cpp (revision 157368) > +++ Source/WebCore/rendering/InlineTextBox.cpp (working copy) > @@ -610,7 +610,7 @@ > > int sPos = 0; > int ePos = 0; > - if (paintSelectedTextOnly || paintSelectedTextSeparately) > + if (haveSelection && (paintSelectedTextOnly || paintSelectedTextSeparately)) > selectionStartEnd(sPos, ePos); > > if (m_truncation != cNoTruncation) { Yes, that does the trick :) Commit?
Antti Koivisto
Comment 12 2013-10-13 09:06:34 PDT
If you could make a reduced test case that would be neat. Maybe I can figure out how to make the bug visible on mac too.
peavo
Comment 13 2013-10-13 09:39:37 PDT
Created attachment 214105 [details] Testcase for broken text rendering
peavo
Comment 14 2013-10-13 09:42:01 PDT
(In reply to comment #12) > If you could make a reduced test case that would be neat. Maybe I can figure out how to make the bug visible on mac too. I attached a somewhat reduced test case. Pretty weird though, seems there needs to be an input field with some content, which receives focus, for the bug to appear ...
peavo
Comment 15 2013-10-14 01:40:39 PDT
peavo
Comment 16 2013-10-14 01:41:39 PDT
(In reply to comment #10) > Does this fix it? > > --- Source/WebCore/rendering/InlineTextBox.cpp (revision 157368) > +++ Source/WebCore/rendering/InlineTextBox.cpp (working copy) > @@ -610,7 +610,7 @@ > > int sPos = 0; > int ePos = 0; > - if (paintSelectedTextOnly || paintSelectedTextSeparately) > + if (haveSelection && (paintSelectedTextOnly || paintSelectedTextSeparately)) > selectionStartEnd(sPos, ePos); > > if (m_truncation != cNoTruncation) { Updated the patch with your fix, and a testcase.
Antti Koivisto
Comment 17 2013-10-14 02:00:38 PDT
Comment on attachment 214133 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214133&action=review The test case is missing a file. It also doesn't work on mac (it might by setting some selection colours) but that's ok. At least it can be tested exercises the code paths (and can be tested manually on wincairo). > LayoutTests/ChangeLog:8 > + * fast/text/text-rendering-with-input-selection-expected.html: Added. Ref test should have two files: text-rendering-with-input-selection.html and text-rendering-with-input-selection-expected.html The test works by generating bitmap from both and comparing them. -expected should contain something that renders the same exact way as the test case but does so without hitting the bug.
peavo
Comment 18 2013-10-14 02:31:34 PDT
peavo
Comment 19 2013-10-14 02:33:07 PDT
(In reply to comment #17) > (From update of attachment 214133 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=214133&action=review > > The test case is missing a file. It also doesn't work on mac (it might by setting some selection colours) but that's ok. At least it can be tested exercises the code paths (and can be tested manually on wincairo). > > > LayoutTests/ChangeLog:8 > > + * fast/text/text-rendering-with-input-selection-expected.html: Added. > > Ref test should have two files: text-rendering-with-input-selection.html and text-rendering-with-input-selection-expected.html > > The test works by generating bitmap from both and comparing them. -expected should contain something that renders the same exact way as the test case but does so without hitting the bug. Thanks for clearifying, updated patch :)
Antti Koivisto
Comment 20 2013-10-14 03:08:24 PDT
Comment on attachment 214137 [details] Patch r=me
WebKit Commit Bot
Comment 21 2013-10-14 03:31:58 PDT
Comment on attachment 214137 [details] Patch Clearing flags on attachment: 214137 Committed r157392: <http://trac.webkit.org/changeset/157392>
WebKit Commit Bot
Comment 22 2013-10-14 03:32:01 PDT
All reviewed patches have been landed. Closing bug.
peavo
Comment 23 2013-10-15 03:44:25 PDT
(In reply to comment #20) > (From update of attachment 214137 [details]) > r=me Thanks :) On another note, I was just wondering if the function updateGraphicsContext when called with UseEmphasisMarkColor should set the fill color from the emphasisMarkColor, instead of the stroke color? I'm not sure though ...
Antti Koivisto
Comment 24 2013-10-15 03:57:02 PDT
> On another note, I was just wondering if the function updateGraphicsContext when called with UseEmphasisMarkColor should set the fill color from the emphasisMarkColor, instead of the stroke color? I'm not sure though ... You are right, looks like that has been switched around. Can you file a bug? Test case would be nice too :)
peavo
Comment 25 2013-10-15 04:07:21 PDT
(In reply to comment #24) > > On another note, I was just wondering if the function updateGraphicsContext when called with UseEmphasisMarkColor should set the fill color from the emphasisMarkColor, instead of the stroke color? I'm not sure though ... > > You are right, looks like that has been switched around. Can you file a bug? Test case would be nice too :) Yes, will file a bug, and see if I am able to come up with a testcase aswell ;)
Note You need to log in before you can comment on or make changes to this bug.