Bug 840317 - Re-evaluate media queries in scoped style sheets. r=dbaron

This commit is contained in:
Cameron McCormack 2013-02-12 11:48:44 +11:00
parent 56fa4092eb
commit 85dbbf856b
5 changed files with 38 additions and 0 deletions

View File

@ -15,4 +15,5 @@ skip-if(B2G) == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml # bug 773482
skip-if(B2G) == mq_print_minheight_updown.xhtml mq_print-ref.xhtml # bug 773482
skip-if(B2G) == mq_print_minwidth_updown.xhtml mq_print-ref.xhtml # bug 773482
== scoped-mq-update.html scoped-mq-update-ref.html
== system-metrics-1.html system-metrics-1-ref.html

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<body>
<style>
body { width: 100%; height: 100%; background-color: red; }
</style>
<style scoped>
@media (max-width: 200px) {
body { background-color: green; }
}
</style>

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<iframe src="scoped-mq-update-helper.html" width="100" height="100" style="border: none"></iframe>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html class="reftest-wait">
<iframe src="scoped-mq-update-helper.html" width="300" height="100" style="border: none"></iframe>
<script>
function test() {
document.querySelector("iframe").width = "100";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", test, false);
</script>

View File

@ -125,8 +125,17 @@ nsStyleSet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
if (mRuleProcessors[i]) {
n += mRuleProcessors[i]->SizeOfIncludingThis(aMallocSizeOf);
}
n += mSheets[i].SizeOfExcludingThis(nullptr, aMallocSizeOf);
}
for (int i = 0; i < mScopedDocSheetRuleProcessors.Length(); i++) {
n += mScopedDocSheetRuleProcessors[i]->SizeOfIncludingThis(aMallocSizeOf);
}
n += mScopedDocSheetRuleProcessors.SizeOfExcludingThis(aMallocSizeOf);
n += mRoots.SizeOfExcludingThis(aMallocSizeOf);
n += mOldRuleTrees.SizeOfExcludingThis(aMallocSizeOf);
return n;
}
@ -1824,6 +1833,11 @@ nsStyleSet::MediumFeaturesChanged(nsPresContext* aPresContext)
bool thisChanged = processor->MediumFeaturesChanged(aPresContext);
stylesChanged = stylesChanged || thisChanged;
}
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); ++i) {
nsIStyleRuleProcessor *processor = mScopedDocSheetRuleProcessors[i];
bool thisChanged = processor->MediumFeaturesChanged(aPresContext);
stylesChanged = stylesChanged || thisChanged;
}
if (mBindingManager) {
bool thisChanged = false;