Bug 1511570 - Make content-language invalidate style data. r=jfkthame

This is needed because content-language can affect the default
computed values for a given document.

Differential Revision: https://phabricator.services.mozilla.com/D13636

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-12-04 18:44:40 +00:00
parent ef8f9622b4
commit df6ab0194b
6 changed files with 16 additions and 0 deletions

View File

@ -3579,6 +3579,9 @@ void nsIDocument::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) {
if (aHeaderField == nsGkAtoms::headerContentLanguage) {
CopyUTF16toUTF8(aData, mContentLanguage);
if (auto* presContext = GetPresContext()) {
presContext->ContentLanguageChanged();
}
}
if (aHeaderField == nsGkAtoms::headerDefaultStyle) {

View File

@ -1720,6 +1720,11 @@ void nsPresContext::CacheAllLangs() {
mFontGroupCacheDirty = false;
}
void nsPresContext::ContentLanguageChanged() {
mFontGroupCacheDirty = true;
PostRebuildAllStyleDataEvent(nsChangeHint(0), eRestyle_ForceDescendants);
}
void nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint) {
if (!mShell) {

View File

@ -273,6 +273,8 @@ class nsPresContext : public nsISupports,
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void ContentLanguageChanged();
/**
* Handle changes in the values of media features (used in media
* queries).

View File

@ -0,0 +1,3 @@
<!doctype html>
<meta http-equiv="Content-Language" content="zh-CN">
<p style="font-family: sans-serif">Some test in the default font for zh-CN.

View File

@ -0,0 +1,2 @@
<!doctype html>
<p lang="zh-CN" style="font-family: sans-serif">Some test in the default font for zh-CN.

View File

@ -2094,3 +2094,4 @@ test-pref(layout.css.visited_links_enabled,false) == 1488155.html 1488155-ref.ht
== 1492660-1.html 1492660-1-ref.html
pref(layout.css.supports-selector.enabled,true) == 1499386.html 1499386-ref.html
pref(layout.css.supports-selector.enabled,false) != 1499386.html 1499386-ref.html
== 1511570.html 1511570-ref.html