Bug 495798. Drop native theming for controls styled with transparent backgrounds, even if the user said to not use the page colors. r+sr=dbaron, a=ss
git-svn-id: svn://10.0.0.236/trunk@257515 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1502,7 +1502,7 @@ nsPresContext::IsChrome() const
|
||||
nsPresContext::HasAuthorSpecifiedRules(nsIFrame *aFrame, PRUint32 ruleTypeMask) const
|
||||
{
|
||||
return
|
||||
UseDocumentColors() &&
|
||||
nsRuleNode::HasAuthorSpecifiedRules(aFrame->GetStyleContext(),
|
||||
ruleTypeMask);
|
||||
ruleTypeMask,
|
||||
UseDocumentColors());
|
||||
}
|
||||
|
||||
@@ -232,10 +232,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
|
||||
if (iProp == eCSSProperty_background_color) {
|
||||
// Force non-'transparent' background
|
||||
// colors to the user's default.
|
||||
nsCSSUnit u = target->GetUnit();
|
||||
if (u != eCSSUnit_Enumerated &&
|
||||
u != eCSSUnit_Inherit &&
|
||||
u != eCSSUnit_Initial) {
|
||||
if (target->IsNonTransparentColor()) {
|
||||
target->SetColorValue(aRuleData->
|
||||
mPresContext->
|
||||
DefaultBackgroundColor());
|
||||
|
||||
@@ -394,6 +394,13 @@ void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSValue::IsNonTransparentColor() const
|
||||
{
|
||||
nsCSSUnit u = GetUnit();
|
||||
return u != eCSSUnit_Enumerated && u != eCSSUnit_Initial &&
|
||||
u != eCSSUnit_Initial;
|
||||
}
|
||||
|
||||
// static
|
||||
nsStringBuffer*
|
||||
nsCSSValue::BufferFromString(const nsString& aValue)
|
||||
|
||||
@@ -216,6 +216,8 @@ public:
|
||||
return mValue.mColor;
|
||||
}
|
||||
|
||||
PRBool IsNonTransparentColor() const;
|
||||
|
||||
Array* GetArrayValue() const
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Array <= mUnit && mUnit <= eCSSUnit_Counters,
|
||||
|
||||
@@ -5171,7 +5171,8 @@ nsRuleNode::Sweep()
|
||||
|
||||
/* static */ PRBool
|
||||
nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
|
||||
PRUint32 ruleTypeMask)
|
||||
PRUint32 ruleTypeMask,
|
||||
PRBool aAuthorColorsAllowed)
|
||||
{
|
||||
nsRuleDataColor colorData;
|
||||
nsRuleDataMargin marginData;
|
||||
@@ -5262,10 +5263,22 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
|
||||
} else {
|
||||
// If any of the values we care about was set by the above rule,
|
||||
// we have author style.
|
||||
for (PRUint32 i = 0; i < nValues; ++i)
|
||||
for (PRUint32 i = 0; i < nValues; ++i) {
|
||||
if (values[i]->GetUnit() != eCSSUnit_Null &&
|
||||
values[i]->GetUnit() != eCSSUnit_Dummy) // see above
|
||||
return PR_TRUE;
|
||||
values[i]->GetUnit() != eCSSUnit_Dummy) { // see above
|
||||
// If author colors are not allowed, only claim to have
|
||||
// author-specified rules if we're looking at the background
|
||||
// color and it's set to transparent. Anything else should get
|
||||
// set to a dummy value instead.
|
||||
if (aAuthorColorsAllowed ||
|
||||
(values[i] == &colorData.mBackColor &&
|
||||
!values[i]->IsNonTransparentColor())) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
values[i]->SetDummyValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +722,9 @@ public:
|
||||
NS_HIDDEN_(PRBool) Sweep();
|
||||
|
||||
static PRBool
|
||||
HasAuthorSpecifiedRules(nsStyleContext* aStyleContext, PRUint32 ruleTypeMask);
|
||||
HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
|
||||
PRUint32 ruleTypeMask,
|
||||
PRBool aAuthorColorsAllowed);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user