Bug 1069716 - Fix deficient CalcDifference of nsStyleList. r=heycam

This commit is contained in:
Xidorn Quan 2014-09-20 03:43:00 +02:00
parent ac25756b56
commit 3f468b77d0
5 changed files with 39 additions and 3 deletions

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<style type="text/css">
@counter-style triangle { symbols: b; }
@counter-style disc { system: extends triangle; }
</style>
</head>
<body>
<ul><li>&lt;---That should be a 'b' character.

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<script>
function go() {
var styleNode = document.createElement("style");
styleNode.textContent =
"@counter-style triangle { symbols: b; } \n" +
"@counter-style disc { system: extends triangle; } \n";
// NOTE: The bug goes away if you remove this trivial rule:
styleNode.textContent += "ul {}";
document.getElementsByTagName("head")[0].appendChild(styleNode);
}
</script>
</head>
<body onload="go()">
<ul><li>&lt;---That should be a 'b' character.

View File

@ -1834,3 +1834,4 @@ test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.htm
== 1059498-2.html 1059498-1-ref.html
== 1059498-3.html 1059498-1-ref.html
test-pref(dom.webcomponents.enabled,true) == 1066554-1.html 1066554-1-ref.html
== 1069716-1.html 1069716-1-ref.html

View File

@ -704,9 +704,12 @@ nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
if (mListStylePosition != aOther.mListStylePosition)
return NS_STYLE_HINT_FRAMECHANGE;
if (EqualImages(mListStyleImage, aOther.mListStyleImage) &&
mListStyleType == aOther.mListStyleType) {
if (mImageRegion.IsEqualInterior(aOther.mImageRegion))
mCounterStyle == aOther.mCounterStyle) {
if (mImageRegion.IsEqualInterior(aOther.mImageRegion)) {
if (mListStyleType != aOther.mListStyleType)
return nsChangeHint_NeutralChange;
return NS_STYLE_HINT_NONE;
}
if (mImageRegion.width == aOther.mImageRegion.width &&
mImageRegion.height == aOther.mImageRegion.height)
return NS_STYLE_HINT_VISUAL;

View File

@ -1154,7 +1154,8 @@ struct nsStyleList {
nsChangeHint CalcDifference(const nsStyleList& aOther) const;
static nsChangeHint MaxDifference() {
return NS_STYLE_HINT_FRAMECHANGE;
return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
nsChangeHint_NeutralChange);
}
static nsChangeHint MaxDifferenceNeverInherited() {
// CalcDifference never returns nsChangeHint_NeedReflow or