RESOLVED FIXED 72095
[chromium] Font::drawComplexText can not draw a segment of text run
https://bugs.webkit.org/show_bug.cgi?id=72095
Summary [chromium] Font::drawComplexText can not draw a segment of text run
Robin Cao
Reported 2011-11-11 00:27:35 PST
The implementation of Font::drawComplexText() in Chromium Linux does not respect the |from| and |to| arguments. It just draws the whole text run. This will result in text overlap.
Attachments
proposed patch with test case (12.39 KB, patch)
2011-11-11 01:04 PST, Robin Cao
no flags
patch-v2 (12.87 KB, patch)
2011-11-15 10:04 PST, Robin Cao
no flags
patch-v3 (12.41 KB, patch)
2011-11-17 18:15 PST, Robin Cao
no flags
Robin Cao
Comment 1 2011-11-11 01:04:21 PST
Created attachment 114642 [details] proposed patch with test case
Robin Cao
Comment 2 2011-11-11 19:47:13 PST
CC folks familiar with this part of the code
Kenichi Ishibashi
Comment 3 2011-11-14 02:01:39 PST
Comment on attachment 114642 [details] proposed patch with test case View in context: https://bugs.webkit.org/attachment.cgi?id=114642&action=review Thanks for the patch. It looks good to me. Some minor comments follows. > Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h:109 > + const unsigned charStartPos() const { return m_item.item.pos; } nit: WebKit doesn't prefer abbreviation. characterStartPosition() would be fine. > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:211 > + // No chars in this item to display. I think this comment is saying almost the same of above comment. Braces can be removed when this comment is no longer needed. > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:227 > + continue; How about having a function which takes |from| and |to| as arguments and handles these logic in ComplexTextController? The function would return false if there is no glyph to be displayed in the run. Otherwise, the function would return true and update values of length() and positions(). This way, we don't need to expose logclusters and beginning offset. > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:238 > + canvas->drawPosText(controller.glyphs() + fromGlyph, glyphCount << 1, controller.positions() + fromGlyph, strokePaint); If you agree with having a function that handle clipping in ComplexTextController, these changes might not be needed.
Robin Cao
Comment 4 2011-11-15 09:50:05 PST
Thanks for your comments. > > > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:211 > > + // No chars in this item to display. > > I think this comment is saying almost the same of above comment. Braces can be removed when this comment is no longer needed. Good point. > > > Source/WebCore/platform/graphics/chromium/FontLinux.cpp:227 > > + continue; > > How about having a function which takes |from| and |to| as arguments and handles these logic in ComplexTextController? The function would return false if there is no glyph to be displayed in the run. Otherwise, the function would return true and update values of length() and positions(). This way, we don't need to expose logclusters and beginning offset. I agree that we should add a function here, but personally, i don't like the idea of updating values of length() and positions() after calling nextScriptRun(). How about adding a function glyphsForRange() which will return the start index and length of glyphs that we need to draw?
Robin Cao
Comment 5 2011-11-15 10:04:58 PST
Created attachment 115186 [details] patch-v2
Robin Cao
Comment 6 2011-11-16 23:45:53 PST
ping : i have updated the patch, could you take a look at it?
Kenichi Ishibashi
Comment 7 2011-11-17 00:03:35 PST
(In reply to comment #6) > ping : i have updated the patch, could you take a look at it? Sorry for late response. Looks good to me. Please wait for official reviewers review.
Robin Cao
Comment 8 2011-11-17 00:08:46 PST
(In reply to comment #7) > > Sorry for late response. Looks good to me. Please wait for official reviewers review. Thank you very much.
Adam Barth
Comment 9 2011-11-17 17:20:23 PST
Comment on attachment 115186 [details] patch-v2 View in context: https://bugs.webkit.org/attachment.cgi?id=115186&action=review > Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp:548 > +void ComplexTextController::glyphsForRange(int from , int to, int& fromGlyph, int& glyphLength) nit: "from ," has an extra space. > LayoutTests/platform/chromium-linux/fast/text/international/draw-complex-text-from-to.html:11 > +<p>The text and ellipsis should not overlap.</p> Should this test be run on all ports?
Tony Chang
Comment 10 2011-11-17 17:21:19 PST
Comment on attachment 115186 [details] patch-v2 View in context: https://bugs.webkit.org/attachment.cgi?id=115186&action=review >> LayoutTests/platform/chromium-linux/fast/text/international/draw-complex-text-from-to.html:11 >> +<p>The text and ellipsis should not overlap.</p> > > Should this test be run on all ports? Can you add a call to layoutTestController.dumpAsText(true) to not have the render tree in the text output?
Robin Cao
Comment 11 2011-11-17 17:29:45 PST
(In reply to comment #9) > > Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp:548 > > +void ComplexTextController::glyphsForRange(int from , int to, int& fromGlyph, int& glyphLength) > > nit: "from ," has an extra space. > good catch! Will remove it.
Robin Cao
Comment 12 2011-11-17 17:35:00 PST
(In reply to comment #10) > (From update of attachment 115186 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=115186&action=review > > >> LayoutTests/platform/chromium-linux/fast/text/international/draw-complex-text-from-to.html:11 > >> +<p>The text and ellipsis should not overlap.</p> > > > > Should this test be run on all ports? > > Can you add a call to layoutTestController.dumpAsText(true) to not have the render tree in the text output? It makes sense to call layoutTestController.dumpAsText(true). If this test be run on all ports, should i generate all the expected PNGs on all platform in this patch?
Robin Cao
Comment 13 2011-11-17 18:15:36 PST
Created attachment 115720 [details] patch-v3
WebKit Review Bot
Comment 14 2011-11-17 21:25:17 PST
Comment on attachment 115720 [details] patch-v3 Clearing flags on attachment: 115720 Committed r100718: <http://trac.webkit.org/changeset/100718>
WebKit Review Bot
Comment 15 2011-11-17 21:25:22 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.