зеркало из https://github.com/mozilla/pjs.git
Bug 528038. Make sure to propagate inherited changes properly for cases where the change hint doesn't apply to all descendants. r=dbaron
This commit is contained in:
Родитель
744c274b36
Коммит
6075b392b6
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="position: relative"><div style="position: absolute; top: 200px">This text should be 200px from the top of the body</div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.body.style.top = "100px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="position: relative; top: inherit"><div style="position: absolute; top: inherit">This text should be 200px from the top of the body</div></div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.body.style.top = "100px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="position: relative; top: inherit"><div style="position: relative; top: inherit">This text should be 200px from the top of the body</div></div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.body.style.top = "200px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="position: relative; top: inherit">This text should be 200px from the top of the body</div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.getElementById("foo").style.top = "200px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="display: table" id="foo"><div style="position: relative; top: inherit">This text should be 200px from the top of the body</div></div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.getElementById("foo").style.top = "200px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="display: table-row" id="foo"><div style="position: relative; top: inherit">This text should be 200px from the top of the body</div></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.offsetWidth;
|
||||
document.getElementById("foo").style.top = "200px";
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body style="font-size: 0"><span id="foo"><span style="position: relative; top: inherit; display: block; font-size: medium">This text should be 200px from the top of the body</span></span></body>
|
||||
</html>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="position: relative"><table style="position: absolute; top: 200px"><tr><td>This text should be 200px from the top of the body</td></tr></table></body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.body.style.top = "100px";
|
||||
document.body.offsetWidth;
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body><div style="position: relative; top: inherit"><table style="position: absolute; top: inherit"><tr><td>This text should be 200px from the top of the body</td></tr></table></div></body>
|
||||
</html>
|
|
@ -1339,4 +1339,11 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
|
|||
== 523096-1.html 523096-1-ref.html
|
||||
== 523468-1.html 523468-1-ref.html
|
||||
== 524175-1.html 524175-1-ref.html
|
||||
== 528038-1a.html 528038-1-ref.html
|
||||
== 528038-1b.html 528038-1-ref.html
|
||||
== 528038-1c.html 528038-1-ref.html
|
||||
== 528038-1d.html 528038-1-ref.html
|
||||
== 528038-1e.html 528038-1-ref.html
|
||||
== 528038-1f.html 528038-1-ref.html
|
||||
== 528038-2.html 528038-2-ref.html
|
||||
== 527464-1.html 527464-ref.html
|
||||
|
|
|
@ -405,7 +405,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
|||
PeekStyleData(eStyleStruct_##struct_)); \
|
||||
if (this##struct_) { \
|
||||
const nsStyle##struct_* other##struct_ = aOther->GetStyle##struct_(); \
|
||||
if (compare && \
|
||||
if ((compare || nsStyle##struct_::ForceCompare()) && \
|
||||
!NS_IsHintSubset(maxHint, hint) && \
|
||||
this##struct_ != other##struct_) { \
|
||||
NS_ASSERTION(NS_IsHintSubset( \
|
||||
|
|
|
@ -92,6 +92,12 @@ class imgIContainer;
|
|||
|
||||
// The lifetime of these objects is managed by the presshell's arena.
|
||||
|
||||
// Each struct must implement a static ForceCompare() function returning a
|
||||
// boolean. Structs that can return a hint that doesn't guarantee that the
|
||||
// change will be applied to all descendants must return true from
|
||||
// ForceCompare(), so that we will make sure to compare those structs in
|
||||
// nsStyleContext::CalcStyleDifference.
|
||||
|
||||
struct nsStyleFont {
|
||||
nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext);
|
||||
nsStyleFont(const nsStyleFont& aStyleFont);
|
||||
|
@ -104,6 +110,7 @@ struct nsStyleFont {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
static nsChangeHint CalcFontDifference(const nsFont& aFont1, const nsFont& aFont2);
|
||||
|
||||
static nscoord ZoomText(nsPresContext* aPresContext, nscoord aSize);
|
||||
|
@ -306,6 +313,7 @@ struct nsStyleColor {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
|
@ -337,6 +345,7 @@ struct nsStyleBackground {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
struct Position;
|
||||
friend struct Position;
|
||||
|
@ -522,6 +531,7 @@ struct nsStyleMargin {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_TRUE; }
|
||||
|
||||
nsStyleSides mMargin; // [reset] coord, percent, auto
|
||||
|
||||
|
@ -555,6 +565,7 @@ struct nsStylePadding {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_TRUE; }
|
||||
|
||||
nsStyleSides mPadding; // [reset] coord, percent
|
||||
|
||||
|
@ -718,6 +729,7 @@ struct nsStyleBorder {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
PRBool ImageBorderDiffers() const;
|
||||
|
||||
nsStyleCorners mBorderRadius; // [reset] coord, percent
|
||||
|
@ -930,6 +942,7 @@ struct nsStyleOutline {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
nsStyleCorners mOutlineRadius; // [reset] coord, percent
|
||||
|
||||
|
@ -1015,6 +1028,7 @@ struct nsStyleList {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
|
||||
PRUint8 mListStylePosition; // [inherited]
|
||||
|
@ -1039,6 +1053,7 @@ struct nsStylePosition {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_TRUE; }
|
||||
|
||||
nsStyleSides mOffset; // [reset] coord, percent, auto
|
||||
nsStyleCoord mWidth; // [reset] coord, percent, auto, enum
|
||||
|
@ -1068,6 +1083,7 @@ struct nsStyleTextReset {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mUnicodeBidi; // [reset] see nsStyleConsts.h
|
||||
|
@ -1092,6 +1108,7 @@ struct nsStyleText {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mTextAlign; // [inherited] see nsStyleConsts.h
|
||||
PRUint8 mTextTransform; // [inherited] see nsStyleConsts.h
|
||||
|
@ -1147,6 +1164,7 @@ struct nsStyleVisibility {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
PRUint8 mVisible; // [inherited]
|
||||
|
@ -1256,6 +1274,7 @@ struct nsStyleDisplay {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_TRUE; }
|
||||
|
||||
// We guarantee that if mBinding is non-null, so are mBinding->mURI and
|
||||
// mBinding->mOriginPrincipal.
|
||||
|
@ -1366,6 +1385,7 @@ struct nsStyleTable {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
|
||||
PRUint8 mFrame; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_FRAME_*
|
||||
|
@ -1391,6 +1411,7 @@ struct nsStyleTableBorder {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
nscoord mBorderSpacingX;// [inherited]
|
||||
nscoord mBorderSpacingY;// [inherited]
|
||||
|
@ -1460,6 +1481,7 @@ struct nsStyleQuotes {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint32 QuotesCount(void) const { return mQuotesCount; } // [inherited]
|
||||
|
||||
|
@ -1530,6 +1552,7 @@ struct nsStyleContent {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint32 ContentCount(void) const { return mContentCount; } // [reset]
|
||||
|
||||
|
@ -1634,6 +1657,7 @@ struct nsStyleUIReset {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mUserSelect; // [reset] (selection-style)
|
||||
PRUint8 mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)
|
||||
|
@ -1666,6 +1690,7 @@ struct nsStyleUserInterface {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint8 mUserInput; // [inherited]
|
||||
PRUint8 mUserModify; // [inherited] (modify-content)
|
||||
|
@ -1701,6 +1726,7 @@ struct nsStyleXUL {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
float mBoxFlex; // [reset] see nsStyleConsts.h
|
||||
PRUint32 mBoxOrdinal; // [reset] see nsStyleConsts.h
|
||||
|
@ -1728,6 +1754,7 @@ struct nsStyleColumn {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
PRUint32 mColumnCount; // [reset] see nsStyleConsts.h
|
||||
nsStyleCoord mColumnWidth; // [reset] coord, auto
|
||||
|
@ -1796,6 +1823,7 @@ struct nsStyleSVG {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
nsStyleSVGPaint mFill; // [inherited]
|
||||
nsStyleSVGPaint mStroke; // [inherited]
|
||||
|
@ -1841,6 +1869,7 @@ struct nsStyleSVGReset {
|
|||
#ifdef DEBUG
|
||||
static nsChangeHint MaxDifference();
|
||||
#endif
|
||||
static PRBool ForceCompare() { return PR_FALSE; }
|
||||
|
||||
nsCOMPtr<nsIURI> mClipPath; // [reset]
|
||||
nsCOMPtr<nsIURI> mFilter; // [reset]
|
||||
|
|
Загрузка…
Ссылка в новой задаче