Closed Bug 1088071 Opened 10 years ago Closed 10 years ago

Move the final variant of nsRenderingContext::DrawString to nsLayoutUtils

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(2 files)

      No description provided.
Blocks: 1087958
I've exposed some nsRenderingContext methods for this, but those methods will be moved themselves shortly.
Comment on attachment 8510347 [details] [diff] [review]
part 1 - Wrap the callers of the final nsRenderingContext::DrawString method up in an nsLayoutUtils method

Review of attachment 8510347 [details] [diff] [review]:
-----------------------------------------------------------------

How about something like DrawUnidirectionalString or DrawSingleDirectionString instead of DrawStringWithoutBidi?
Someone else can choose the name. I have no strong opinions there.
Comment on attachment 8510348 [details] [diff] [review]
part 2 - Move the nsRenderingContext::DrawString code to nsLayoutUtils::DrawStringWithoutBidi

Review of attachment 8510348 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/base/nsLayoutUtils.h
@@ +1325,5 @@
>                           nsStyleContext*       aStyleContext = nullptr);
>  
> +  /**
> +   * Supports only LTR or RTL. Bidi (mixed direction) is not supported.
> +   */

So it looks like the only two callers of this method are nsImageFrame::DisplayAltText (though if the text includes RTL characters, or the presContext has BidiEnabled, it'll go via nsBidiPresUtils::RenderText instead), and nsDisplayMathMLError::Paint, which just uses it to draw a hard-coded ASCII error string.

Given this, I wonder if we need any kind of RTL support at all in this method? Can we strip it down and make it just DrawLTRString?
Don't forget the nsLayoutUtils::DrawString caller.

I'm not adverse to stripping it down, but I'd rather do that as a follow-up.
Comment on attachment 8510347 [details] [diff] [review]
part 1 - Wrap the callers of the final nsRenderingContext::DrawString method up in an nsLayoutUtils method

Review of attachment 8510347 [details] [diff] [review]:
-----------------------------------------------------------------

OK, but let's go with one of Simon's naming suggestions to replace DrawStringWithoutBidi. I guess I'd lean towards DrawUnidirectionalString, though all of the options are rather long... DrawUniDirString, anyone?
Attachment #8510347 - Flags: review?(jfkthame) → review+
Comment on attachment 8510348 [details] [diff] [review]
part 2 - Move the nsRenderingContext::DrawString code to nsLayoutUtils::DrawStringWithoutBidi

Review of attachment 8510348 [details] [diff] [review]:
-----------------------------------------------------------------

Fair enough. I still suspect we don't need RTL support here at all, though, and could simplify it accordingly; could you file a followup for us to check on that, please?
Attachment #8510348 - Flags: review?(jfkthame) → review+
Surely to reflect "Bidi" it should be "Unidi". ;)

(DrawUniDirString seems fine to me.)
Comment on attachment 8510347 [details] [diff] [review]
part 1 - Wrap the callers of the final nsRenderingContext::DrawString method up in an nsLayoutUtils method

https://hg.mozilla.org/integration/mozilla-inbound/rev/449a78f0febc
Attachment #8510347 - Flags: checkin+
Comment on attachment 8510348 [details] [diff] [review]
part 2 - Move the nsRenderingContext::DrawString code to nsLayoutUtils::DrawStringWithoutBidi

https://hg.mozilla.org/integration/mozilla-inbound/rev/90cd5968c9ce
Attachment #8510348 - Flags: checkin+
(In reply to Jonathan Kew (:jfkthame) from comment #9)
> could you file a followup for us to check
> on that, please?

Bug 1088596.
https://hg.mozilla.org/mozilla-central/rev/449a78f0febc
https://hg.mozilla.org/mozilla-central/rev/90cd5968c9ce
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: