Open Bug 729075 Opened 12 years ago Updated 2 years ago

Have one canonical source for a document's language

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

ASSIGNED

People

(Reporter: jwatt, Assigned: jwatt)

Details

While fixing bug 416581, I noticed that nsStyleFont::nsStyleFont(nsPresContext*) constructs its mFont using the language-from-charset under the GetDefaultFont call, but then under Init() it prefers to set mLanguage to the content-language obtained from nsIDocument::GetContentLanguage. These could be different things.

Seems like we should have one canonical source for a document's language. A method GetLanguage() on nsIDocument would be good. We could then clean up the callers of the current two sources:
  
https://mxr.mozilla.org/mozilla-central/ident?i=GetLanguageFromCharset
https://mxr.mozilla.org/mozilla-central/ident?i=GetContentLanguage
We could also have nsIContent::GetLang fall back to returning nsIDocument::GetLanguage if none of the elements along the parent chain have an 'xml:lang' or 'lang' attribute. As long as nsIDocument::GetLanguage is consistent with the HTML5 rules:

http://www.w3.org/TR/html5/elements.html#the-lang-and-xml:lang-attributes
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.